Android Open Source - saldo Settings Activity






From Project

Back to project page saldo.

License

The source code is released under:

GNU General Public License

If you think the Android project saldo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.adrup.saldo;
//from w  w  w.j a  v a2 s  .c  om
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.Spinner;

public class SettingsActivity extends Activity {
  private static final String TAG = "SettingsActivity";
  
  private Spinner mSpinner;
  private CheckBox mNotifyCheckBox;
  private CheckBox mSoundCheckBox;
  private SharedPreferences mPrefs;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate()");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.settings);
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);

    mSpinner = (Spinner) findViewById(R.id.settings_autoupdate_spinner);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.update_interval_array,
        android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mSpinner.setAdapter(adapter);
    
    mNotifyCheckBox = (CheckBox) findViewById(R.id.settings_notifications_enable_checkbox);
    mSoundCheckBox = (CheckBox) findViewById(R.id.settings_notifications_sound_checkbox);
  }


  @Override
  protected void onResume() {
    Log.d(TAG, "onResume()");
    super.onResume();
    mSpinner.setSelection(mPrefs.getInt(Constants.PREF_UPDATE_INTERVAL, 0));
    mNotifyCheckBox.setChecked(mPrefs.getBoolean(Constants.PREF_NOTIFY, true));
    mSoundCheckBox.setChecked(mPrefs.getBoolean(Constants.PREF_SOUND, true));
  }

  @Override
  protected void onPause() {
    Log.d(TAG, "onPause()");
    super.onPause();
    int interval = mSpinner.getSelectedItemPosition();
    int prevInterval = mPrefs.getInt(Constants.PREF_UPDATE_INTERVAL, 0);
    if (interval != prevInterval) {
      mPrefs.edit().putInt(Constants.PREF_UPDATE_INTERVAL, interval).commit();
      AutoUpdateReceiver.setAlarm(this);
    }
    mPrefs.edit().putBoolean(Constants.PREF_NOTIFY, mNotifyCheckBox.isChecked()).commit();
    mPrefs.edit().putBoolean(Constants.PREF_SOUND, mSoundCheckBox.isChecked()).commit();
  }

}




Java Source Code List

com.adrup.http.EasySSLSocketFactory.java
com.adrup.http.EasyX509TrustManager.java
com.adrup.http.HttpException.java
com.adrup.http.HttpHelper.java
com.adrup.saldo.AccountsViewBinder.java
com.adrup.saldo.AutoUpdateReceiver.java
com.adrup.saldo.AutoUpdateService.java
com.adrup.saldo.BankListActivity.java
com.adrup.saldo.BankLoginEditActivity.java
com.adrup.saldo.Constants.java
com.adrup.saldo.DatabaseAdapter.java
com.adrup.saldo.SaldoHttpClient.java
com.adrup.saldo.Saldo.java
com.adrup.saldo.SettingsActivity.java
com.adrup.saldo.Util.java
com.adrup.saldo.bank.AccountHashKey.java
com.adrup.saldo.bank.Account.java
com.adrup.saldo.bank.AuthenticationException.java
com.adrup.saldo.bank.BankException.java
com.adrup.saldo.bank.BankLogin.java
com.adrup.saldo.bank.BankManagerFactory.java
com.adrup.saldo.bank.BankManager.java
com.adrup.saldo.bank.RemoteAccount.java
com.adrup.saldo.bank.coop.CoopException.java
com.adrup.saldo.bank.coop.CoopManager.java
com.adrup.saldo.bank.firstcard.FirstcardException.java
com.adrup.saldo.bank.firstcard.FirstcardManager.java
com.adrup.saldo.bank.ica.IcaException.java
com.adrup.saldo.bank.ica.IcaManager.java
com.adrup.saldo.bank.icabanken.IcabankenException.java
com.adrup.saldo.bank.icabanken.IcabankenManager.java
com.adrup.saldo.bank.lf.LfBankException.java
com.adrup.saldo.bank.lf.LfBankManager.java
com.adrup.saldo.bank.nordea.NordeaException.java
com.adrup.saldo.bank.nordea.NordeaManager.java
com.adrup.saldo.bank.preem.PreemException.java
com.adrup.saldo.bank.preem.PreemManager.java
com.adrup.saldo.bank.statoil.StatoilException.java
com.adrup.saldo.bank.statoil.StatoilManager.java
com.adrup.saldo.bank.swedbank.SwedbankException.java
com.adrup.saldo.bank.swedbank.SwedbankManager.java
com.adrup.saldo.widget.SaldoWidgetProvider.java
com.adrup.saldo.widget.WidgetConfigurationActivity.java
com.adrup.saldo.widget.WidgetService.java
com.adrup.util.HashCodeUtil.java
com.adrup.util.NumberUtil.java
com.adrup.util.SectionedAdapter.java