Example usage for android.widget ScrollView getResources

List of usage examples for android.widget ScrollView getResources

Introduction

In this page you can find the example usage for android.widget ScrollView getResources.

Prototype

public Resources getResources() 

Source Link

Document

Returns the resources associated with this view.

Usage

From source file:com.wmstein.transektcount.CountOptionsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_count_options);

    transektCount = (TransektCountApplication) getApplication();
    prefs = com.wmstein.transektcount.TransektCountApplication.getPrefs();
    prefs.registerOnSharedPreferenceChangeListener(this);
    boolean brightPref = prefs.getBoolean("pref_bright", true);

    // Set full brightness of screen
    if (brightPref) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        WindowManager.LayoutParams params = getWindow().getAttributes();
        params.screenBrightness = 1.0f;/*from w ww. ja v a  2s . co m*/
        getWindow().setAttributes(params);
    }

    ScrollView counting_screen = (ScrollView) findViewById(R.id.count_options);
    bMap = transektCount.decodeBitmap(R.drawable.kbackground, transektCount.width, transektCount.height);
    bg = new BitmapDrawable(counting_screen.getResources(), bMap);
    counting_screen.setBackground(bg);

    static_widget_area = (LinearLayout) findViewById(R.id.static_widget_area);
    dynamic_widget_area = (LinearLayout) findViewById(R.id.dynamic_widget_area);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        count_id = extras.getInt("count_id");
        section_id = extras.getInt("section_id");
    }

    savedAlerts = new ArrayList<>();
    if (savedInstanceState != null) {
        if (savedInstanceState.getSerializable("savedAlerts") != null) {
            savedAlerts = (ArrayList<AlertCreateWidget>) savedInstanceState.getSerializable("savedAlerts");
        }
    }
}

From source file:com.wmstein.transektcount.CountOptionsActivity.java

public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
    ScrollView counting_screen = (ScrollView) findViewById(R.id.count_options);
    counting_screen.setBackground(null);
    bMap = transektCount.decodeBitmap(R.drawable.kbackground, transektCount.width, transektCount.height);
    bg = new BitmapDrawable(counting_screen.getResources(), bMap);
    counting_screen.setBackground(bg);/*from   w w  w .j av  a  2 s .c  om*/
}

From source file:com.wmstein.transektcount.EditSectionActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_edit_section);

    countNames = new ArrayList<>();
    countCodes = new ArrayList<>();
    countIds = new ArrayList<>();
    savedCounts = new ArrayList<>();

    notes_area = (LinearLayout) findViewById(R.id.editingNotesLayout);
    counts_area = (LinearLayout) findViewById(R.id.editingCountsLayout);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        section_id = extras.getInt("section_id");
    }/*w w  w.  ja  va  2 s  .c o m*/

    /*
     * Restore any edit widgets the user has added previously
     */
    if (savedInstanceState != null) {
        if (savedInstanceState.getSerializable("savedCounts") != null) {
            savedCounts = (ArrayList<CountEditWidget>) savedInstanceState.getSerializable("savedCounts");
        }
    }

    // Load preferences
    transektCount = (TransektCountApplication) getApplication();
    prefs = TransektCountApplication.getPrefs();
    prefs.registerOnSharedPreferenceChangeListener(this);

    boolean brightPref = prefs.getBoolean("pref_bright", true);
    dupPref = prefs.getBoolean("pref_duplicate", true);

    // Set full brightness of screen
    if (brightPref) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        WindowManager.LayoutParams params = getWindow().getAttributes();
        params.screenBrightness = 1.0f;
        getWindow().setAttributes(params);
    }

    ScrollView counting_screen = (ScrollView) findViewById(R.id.editingScreen);
    bMap = transektCount.decodeBitmap(R.drawable.kbackground, transektCount.width, transektCount.height);
    bg = new BitmapDrawable(counting_screen.getResources(), bMap);
    counting_screen.setBackground(bg);
}

From source file:com.wmstein.transektcount.EditSectionActivity.java

public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
    ScrollView counting_screen = (ScrollView) findViewById(R.id.editingScreen);
    counting_screen.setBackground(null);
    bMap = transektCount.decodeBitmap(R.drawable.kbackground, transektCount.width, transektCount.height);
    bg = new BitmapDrawable(counting_screen.getResources(), bMap);
    counting_screen.setBackground(bg);//from  w  w w .  j av a 2 s .  c o m

    //added for duplicates check
    dupPref = prefs.getBoolean("duplicate_counts", true);
}