Example #1
0
  @Override
  protected void onPause() {
    super.onPause();

    // Unregister the listener whenever a key changes
    getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
  }
  @SuppressWarnings("deprecation")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    // Just load the system-related preferences from XML
    addPreferencesFromResource(R.xml.pref_system);

    // Handle outgoing links and preference changes
    if (SystemSettings.enableUpdateChecker(this)) {
      findPreference("system_checkupdates").setOnPreferenceClickListener(onCheckUpdatesClick);
    } else {
      getPreferenceScreen().removePreference(findPreference("system_checkupdates"));
    }
    findPreference("system_sendlog").setOnPreferenceClickListener(onSendLogClick);
    findPreference("system_installhelp").setOnPreferenceClickListener(onInstallHelpClick);
    findPreference("system_changelog").setOnPreferenceClickListener(onChangeLogClick);
    findPreference("system_clearsearch").setOnPreferenceClickListener(onClearSearchClick);
    findPreference("system_importsettings").setOnPreferenceClickListener(onImportSettingsClick);
    findPreference("system_exportsettings").setOnPreferenceClickListener(onExportSettingsClick);
    findPreference("system_about")
        .setTitle(getString(R.string.pref_about, getString(R.string.app_name)));
    findPreference("system_about").setOnPreferenceClickListener(onAboutClick);
  }
  // Soo... we can use SherlockPreferenceActivity to display the
  // action bar, but we can't use a PreferenceFragment?
  @SuppressWarnings("deprecation")
  public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    super.onCreate(savedInstanceState);
    UIHelp.setupActionBar(getSupportActionBar());
    setSupportProgressBarIndeterminate(true);

    addPreferencesFromResource(R.xml.preferences);

    regionPref = findPreference(getString(R.string.preference_key_region));
    regionPref.setOnPreferenceClickListener(this);

    customApiUrlPref = findPreference(getString(R.string.preference_key_oba_api_url));
    customApiUrlPref.setOnPreferenceChangeListener(this);

    analyticsPref = findPreference(getString(R.string.preferences_key_analytics));
    analyticsPref.setOnPreferenceChangeListener(this);

    donatePref = findPreference(getString(R.string.preferences_key_donate));
    donatePref.setOnPreferenceClickListener(this);

    SharedPreferences settings = Application.getPrefs();
    autoSelectInitialValue =
        settings.getBoolean(getString(R.string.preference_key_auto_select_region), true);

    preferredUnits =
        (ListPreference) findPreference(getString(R.string.preference_key_preferred_units));

    settings.registerOnSharedPreferenceChangeListener(this);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrefStore.setLocale(this);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    PreferenceManager prefMgr = getPreferenceManager();
    prefMgr.setSharedPreferencesName(PrefStore.getCurrentProfile(this));

    Bundle b = getIntent().getExtras();
    int pref = 0;
    if (b != null) pref = b.getInt("pref");
    switch (pref) {
      case 1:
        addPreferencesFromResource(R.xml.properties_ssh);
        break;
      case 2:
        addPreferencesFromResource(R.xml.properties_vnc);
        break;
      case 3:
        addPreferencesFromResource(R.xml.properties_xserver);
        break;
      case 4:
        addPreferencesFromResource(R.xml.properties_framebuffer);
        break;
      default:
        addPreferencesFromResource(R.xml.properties);
    }

    initSummaries(getPreferenceScreen());
  }
Example #5
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   beforeBuildPrefs();
   addPreferencesFromResource(getXmlPreferences());
   afterBuildPrefs();
 }
  @Override
  protected void onDestroy() {
    super.onDestroy();

    if (progressDialog != null) progressDialog.dismiss();

    if (completeReceiver != null) unregisterReceiver(completeReceiver);
  }
Example #7
0
  @Override
  protected void onResume() {
    super.onResume();
    getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);

    lunchRingPref.setOnPreferenceChangeListener(this);
    dayRingPref.setOnPreferenceChangeListener(this);
  }
Example #8
0
  /*
   * @see android.preference.PreferenceActivity#onBuildHeaders(java.util.List)
   */
  @Override
  public void onBuildHeaders(List<Header> lstHeaders) {

    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
      loadHeadersFromResource(R.xml.headers, lstHeaders);
    }

    super.onBuildHeaders(lstHeaders);
  }
Example #9
0
  /** Called when the activity is closed. */
  @Override
  public void onDestroy() {

    if (adView != null) adView.destroy();

    if (ssidReceiver != null) unregisterReceiver(ssidReceiver);

    super.onDestroy();
  }
Example #10
0
  /*
   * @see android.preference.PreferenceFragment#onCreate(android.os.Bundle)
   */
  @Override
  public void onCreate(Bundle bndState) {

    super.onCreate(bndState);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
      addPreferencesFromResource(R.xml.preferences);
    }
  }
 @Override
 protected void onPause() {
   mIsPaused = true;
   if (mIsArabic != mInitiallyIsArabic) {
     Intent i = new Intent(this, com.quran.labs.androidquran.ui.QuranActivity.class);
     i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
     startActivity(i);
   }
   super.onPause();
 }
Example #12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.main_prefs);

    Account mainAccount = PhotupApplication.getApplication(this).getMainAccount();
    if (null != mainAccount) {
      mainAccount.getAlbums(getApplicationContext(), this, false);
    }

    populateFiltersPref();
  }
  @Override
  public void onResume() {
    super.onResume();

    String titleMsg =
        getString(R.string.title_activity_properties)
            + ": "
            + PrefStore.getCurrentProfileTitle(getApplicationContext());
    setTitle(titleMsg);

    getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
  }
  @Override
  protected void onResume() {
    Log.d("PrefEditor", "onResume");
    super.onResume();

    CheckBoxPreference iconspref =
        (CheckBoxPreference) getPreferenceScreen().findPreference(KEY_PREFICONS);
    AdvancedPrefDatabase db = new AdvancedPrefDatabase(this);
    API current = db.getCurrentAPI();

    iconspref.setChecked(current.showicon);
    Log.d("PrefEditor", "onResume done");
  }
Example #15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.Theme_Sherlock);
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);

    lunchRingPref = (RingtonePreference) findPreference(LUNCH_RINGTON_KEY);
    dayRingPref = (RingtonePreference) findPreference(DAY_RINGTON_KEY);
    updateRingtoneSummary(lunchRingPref);
    updateRingtoneSummary(dayRingPref);
    updateNotificationSummury(new KeyMeneger(KeyMeneger.LUNCH_MODE));
    updateNotificationSummury(new KeyMeneger(KeyMeneger.DAY_MODE));
  }
Example #16
0
 @Override
 public void handleMessage(Message msg) {
   switch (msg.what) {
     case MSG_UPDATE_FINISHED:
       Toast.makeText(
               ProxyDroid.this, getString(R.string.update_finished), Toast.LENGTH_LONG)
           .show();
       break;
     case MSG_NO_ROOT:
       showAToast(getString(R.string.require_root_alert));
       break;
   }
   super.handleMessage(msg);
 }
  @Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    addPreferencesFromResource(R.xml.preferences);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle(R.string.ApplicationPreferencesActivity_redphone_settings);

    if (Release.DEBUG) {
      addPreferencesFromResource(R.xml.debug);
    }

    initializeIntentFilters();
    initializePreferenceDisplay();
    initializeListeners();
  }
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Action bar Sherlock
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setTitle("Preferences");

    try {
      getClass().getMethod("getFragmentManager");
      AddResourceApi11AndGreater();
    } catch (NoSuchMethodException e) { // Api < 11
      AddResourceApiLessThan11();
    }
  }
  @Override
  protected void onDestroy() {
    SharedPreferences settings = Application.getPrefs();
    boolean currentValue =
        settings.getBoolean(getString(R.string.preference_key_auto_select_region), true);

    // If the use has selected to auto-select region, and the previous state of the setting was
    // false,
    // then run the auto-select by going to HomeActivity
    if (currentValue && !autoSelectInitialValue) {
      if (BuildConfig.DEBUG) {
        Log.d(TAG, "User re-enabled auto-select regions pref, auto-selecting via Home Activity...");
      }
      NavHelp.goHome(this);
    }
    super.onDestroy();
  }
  @SuppressWarnings("deprecation")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    /*
    int currentApiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentApiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
    	// Do preference activity with fragments
    } else {
    	// Do preference activity with deprecated methods.
    	*/
    addPreferencesFromResource(R.xml.preferencias);

    // update service
    /*
    }*/
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.menu_settings);
    addPreferencesFromResource(R.xml.preferences);
    // Get the custom preference
    /*
     * Preference customPref = (Preference) findPreference("customPref");
     * customPref .setOnPreferenceClickListener(new
     * OnPreferenceClickListener() {
     *
     * public boolean onPreferenceClick(Preference preference) {
     * Toast.makeText(getBaseContext(),
     * "The custom preference has been clicked", Toast.LENGTH_LONG).show();
     * SharedPreferences customSharedPreference = getSharedPreferences(
     * "myCustomSharedPrefs", Activity.MODE_PRIVATE);
     * SharedPreferences.Editor editor = customSharedPreference .edit();
     * editor.putString("myCustomPref", "The preference has been clicked");
     * editor.commit(); return true; }
     *
     * });
     */
    notifyPref = (Preference) findPreference(PREF_NOTIFY);
    notifyPref.setOnPreferenceChangeListener(this);

    vibratePref = (Preference) findPreference(PREF_VIBRATE);
    vibratePref.setOnPreferenceChangeListener(this);

    delayPref = (Preference) findPreference(PREF_DELAY);
    delayPref.setOnPreferenceChangeListener(this);

    ledPref = (Preference) findPreference(PREF_LED);
    ledPref.setOnPreferenceChangeListener(this);

    upcomingPref = (Preference) findPreference(PREF_UPCOMING);
    upcomingPref.setOnPreferenceChangeListener(this);

    SharedPreferences sharedPreferences = getSharedPreferences(Main.PREFS, Activity.MODE_PRIVATE);
    vibratePref.setEnabled(sharedPreferences.getBoolean(PREF_NOTIFY, true));

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  }
Example #22
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);

    mHideOfflineContacts =
        (CheckBoxPreference) findPreference(getString(R.string.pref_hide_offline_contacts));
    mOtrMode = (ListPreference) findPreference(getString(R.string.pref_security_otr_mode));
    mEnableNotification =
        (CheckBoxPreference) findPreference(getString(R.string.pref_enable_notification));
    mNotificationVibrate =
        (CheckBoxPreference) findPreference(getString(R.string.pref_notification_vibrate));
    mNotificationSound =
        (CheckBoxPreference) findPreference(getString(R.string.pref_notification_sound));
    // TODO re-enable Ringtone preference
    // mNotificationRingtone = (CheckBoxPreference)
    // findPreference(getString(R.string.pref_notification_ringtone));
    mForegroundService =
        (CheckBoxPreference) findPreference(getString(R.string.pref_foreground_service));
    mHeartbeatInterval =
        (EditTextPreference) findPreference(getString(R.string.pref_heartbeat_interval));
  }
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    application = (WalletApplication) getApplication();
    addPreferencesFromResource(R.xml.preferences);

    trustedPeerPreference = findPreference(Constants.PREFS_KEY_TRUSTED_PEER);
    trustedPeerPreference.setOnPreferenceChangeListener(this);

    trustedPeerOnlyPreference = findPreference(Constants.PREFS_KEY_TRUSTED_PEER_ONLY);
    trustedPeerOnlyPreference.setOnPreferenceChangeListener(this);

    final Preference dataUsagePreference = findPreference(PREFS_KEY_DATA_USAGE);
    dataUsagePreference.setEnabled(getPackageManager().resolveActivity(dataUsageIntent, 0) != null);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
    final String trustedPeer = prefs.getString(Constants.PREFS_KEY_TRUSTED_PEER, "").trim();
    updateTrustedPeer(trustedPeer);
  }
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    Log.d("PrefEditor", "onCreate");
    Preferences prefs = new Preferences(this);
    if (prefs.lightThemeEnabled()) {
      setTheme(R.style.Theme_Sherlock_Light);
    }

    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.preferences);
    r = getResources();
    KEY_MAPBG = r.getString(R.string.config_backgroundLayer_key);
    KEY_MAPOL = r.getString(R.string.config_overlayLayer_key);
    KEY_MAPPROFILE = r.getString(R.string.config_mapProfile_key);
    KEY_PREFICONS = r.getString(R.string.config_iconbutton_key);
    KEY_ADVPREFS = r.getString(R.string.config_advancedprefs_key);
    KEY_LICENSE = r.getString(R.string.config_licensebutton_key);
    fixUpPrefs();

    ActionBar actionbar = getSupportActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);
  }
Example #25
0
  /*
   * @see android.app.Fragment#onResume()
   */
  @TargetApi(9)
  @Override
  public void onResume() {

    super.onResume();

    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) return;

    getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    SharedPreferences spePreferences =
        PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());

    EditTextPreference etpUsername =
        (EditTextPreference) getPreferenceScreen().findPreference("torrentleech_username");
    if (!spePreferences.getString("torrentleech_username", "").isEmpty())
      etpUsername.setSummary(spePreferences.getString("torrentleech_username", ""));

    EditTextPreference etpPassword =
        (EditTextPreference) getPreferenceScreen().findPreference("torrentleech_password");
    if (!spePreferences.getString("torrentleech_password", "").isEmpty())
      etpPassword.setSummary(
          spePreferences.getString("torrentleech_password", "").replaceAll("(?s).", "*"));
  }
Example #26
0
 @Override
 protected void onPause() {
   super.onPause();
   getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
 }
Example #27
0
 @Override
 protected void onResume() {
   super.onResume();
   getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
   updateDescriptions();
 }
Example #28
0
 @Override
 protected void onStop() {
   super.onStop();
   PhotupApplication.getApplication(this).checkInstantUploadReceiverState();
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.Theme_Sherlock);
    super.onCreate(savedInstanceState);

    // add preferences
    addPreferencesFromResource(R.xml.quran_preferences);

    // special handling for the arabic checkbox
    CheckBoxPreference arabicPreference =
        (CheckBoxPreference) findPreference(Constants.PREF_USE_ARABIC_NAMES);
    mInitiallyIsArabic = arabicPreference.isChecked();
    mIsArabic = mInitiallyIsArabic;
    arabicPreference.setOnPreferenceChangeListener(
        new OnPreferenceChangeListener() {
          @Override
          public boolean onPreferenceChange(Preference preference, Object newValue) {
            boolean isArabic = (Boolean) newValue;
            mIsArabic = isArabic;

            Locale lang = (isArabic ? new Locale("ar") : getResources().getConfiguration().locale);
            Locale.setDefault(lang);
            Configuration config = new Configuration();
            config.locale = lang;
            getResources().updateConfiguration(config, getResources().getDisplayMetrics());

            return true;
          }
        });

    // remove the tablet mode preference if it doesn't exist
    if (!QuranScreenInfo.getOrMakeInstance(this).isTablet(this)) {
      Preference tabletModePreference = findPreference(Constants.PREF_TABLET_ENABLED);
      PreferenceCategory category =
          (PreferenceCategory) findPreference(Constants.PREF_DISPLAY_CATEGORY);
      category.removePreference(tabletModePreference);
    }

    Preference advancedPrefs = findPreference(getString(R.string.prefs_advanced_settings));
    advancedPrefs.setOnPreferenceClickListener(
        new Preference.OnPreferenceClickListener() {
          @Override
          public boolean onPreferenceClick(Preference preference) {
            mLoadStorageOptionsTask = new LoadStorageOptionsTask();
            mLoadStorageOptionsTask.execute();
            return false;
          }
        });

    /*
    // can enable this to get logs from users until we move it to
    // a setting. needs READ_LOGS permissions below jellybean. this
    // is a work around until we properly use the Logger framework
    // to roll our own log files.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
      mReadLogsTask = new ReadLogsTask();
      mReadLogsTask.execute();
    }
    */

    mListStorageOptions = (ListPreference) findPreference(getString(R.string.prefs_app_location));

    mStorageList = StorageUtils.getAllStorageLocations(getApplicationContext());

    // Hide Advanced Preferences Screen if there is no storage option
    // except for the normal Environment.getExternalStorageDirectory
    if (mStorageList.size() <= 1) {
      Log.d(TAG, "removing advanced settings from preferences");
      getPreferenceScreen().removePreference(advancedPrefs);
    }
  }
 @Override
 public void onBackPressed() {
   // disable back press while task in progress
   if (mMoveFilesTask == null) super.onBackPressed();
 }