Example usage for android.widget ScrollView setBackground

List of usage examples for android.widget ScrollView setBackground

Introduction

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

Prototype

public void setBackground(Drawable background) 

Source Link

Document

Set the background to a given Drawable, or remove the background.

Usage

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  ww w . ja  v a2 s .com
}

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);//  w  w w. j a  v a 2  s  . co  m

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

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;/*  www  . j ava 2 s  .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.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");
    }// www.ja  v  a  2  s .  c  om

    /*
     * 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);
}