@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);
  }
Exemplo n.º 3
0
  @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());
  }
Exemplo n.º 4
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   beforeBuildPrefs();
   addPreferencesFromResource(getXmlPreferences());
   afterBuildPrefs();
 }
Exemplo n.º 5
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);
    }
  }
Exemplo n.º 6
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();
  }
Exemplo n.º 7
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));
  }
  @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();
  }
Exemplo n.º 9
0
  @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();
    }
  }
  @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
    /*
    }*/
  }
Exemplo n.º 11
0
  @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);
  }
Exemplo n.º 12
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));
  }
Exemplo n.º 13
0
  @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);
  }
Exemplo n.º 14
0
  @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(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);
    }
  }
Exemplo n.º 16
0
  @SuppressWarnings("deprecation")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    addPreferencesFromResource(R.xml.quicksettings);

    String bgcolor =
        getSharedPreferences("EvoPrefsFile", MODE_PRIVATE).getString("toggleColor", "#ff161616");

    ((ColorPickerPreference) findPreference("toggleColor")).setDefaultValue(bgcolor);
    ((ColorPickerPreference) findPreference("toggleColor")).setSummary(bgcolor);

    ((ColorPickerPreference) findPreference("toggleColor"))
        .setOnPreferenceChangeListener(
            new OnPreferenceChangeListener() {

              @Override
              public boolean onPreferenceChange(Preference preference, Object newValue) {
                color =
                    (ColorPickerPreference.convertToARGB(
                        Integer.valueOf(String.valueOf(newValue))));
                ;
                preference.setSummary(color);
                SharedPreferences sharedPreferences =
                    getSharedPreferences("EvoPrefsFile", MODE_PRIVATE);
                SharedPreferences.Editor editor = sharedPreferences.edit(); // opens the editor
                editor.putString("toggleColor", color); // true or false
                editor.commit();
                Intent intent = new Intent();
                intent.setAction("com.b16h22.statusbar.CHANGE_TOGGLE_BACKGROUND");
                intent.putExtra("shortcutBackgroundColor", color.toString());
                sendBroadcast(intent);
                return false;
              }
            });

    String textcolor =
        getSharedPreferences("EvoPrefsFile", MODE_PRIVATE)
            .getString("toggleTextColor", "#ffffffff");

    ((ColorPickerPreference) findPreference("textColor")).setDefaultValue(textcolor);
    ((ColorPickerPreference) findPreference("textColor")).setSummary(textcolor);

    ((ColorPickerPreference) findPreference("textColor"))
        .setOnPreferenceChangeListener(
            new OnPreferenceChangeListener() {

              @Override
              public boolean onPreferenceChange(Preference preference, Object newValue) {
                colorText =
                    (ColorPickerPreference.convertToARGB(
                        Integer.valueOf(String.valueOf(newValue))));
                ;
                preference.setSummary(colorText);
                SharedPreferences sharedPreferences =
                    getSharedPreferences("EvoPrefsFile", MODE_PRIVATE);
                SharedPreferences.Editor editor = sharedPreferences.edit(); // opens the editor
                editor.putString("toggleTextColor", colorText); // true or false
                editor.commit();
                Intent intent = new Intent();
                intent.setAction("com.b16h22.statusbar.CHANGE_TOGGLETEXT_COLOR");
                intent.putExtra("toggleTextColor", colorText.toString());
                sendBroadcast(intent);
                return false;
              }
            });
  }
Exemplo n.º 17
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.proxydroid_preference);

    // Create the adView
    adView = new AdView(this, AdSize.SMART_BANNER, "a14db2c016cb9b6");
    // Lookup your LinearLayout assuming it’s been given
    // the attribute android:id="@+id/mainLayout"
    ViewParent parent = getListView().getParent();
    LinearLayout layout = getLayout(parent);

    // disable adds
    /*
    if (layout != null) {
      // Add the adView to it
      layout.addView(adView, 0);
      // Initiate a generic request to load it with an ad
      AdRequest aq = new AdRequest();
      adView.loadAd(aq);
    }
    */

    hostText = (EditTextPreference) findPreference("host");
    portText = (EditTextPreference) findPreference("port");
    userText = (EditTextPreference) findPreference("user");
    passwordText = (EditTextPreference) findPreference("password");
    domainText = (EditTextPreference) findPreference("domain");
    certificateText = (EditTextPreference) findPreference("certificate");
    bypassAddrs = findPreference("bypassAddrs");
    ssidList = (ListPreferenceMultiSelect) findPreference("ssid");
    proxyTypeList = (ListPreference) findPreference("proxyType");
    proxyedApps = findPreference("proxyedApps");
    profileList = (ListPreference) findPreference("profile");

    isRunningCheck = (Preference) findPreference("isRunning");
    isAutoSetProxyCheck = (CheckBoxPreference) findPreference("isAutoSetProxy");
    isAuthCheck = (CheckBoxPreference) findPreference("isAuth");
    isNTLMCheck = (CheckBoxPreference) findPreference("isNTLM");
    isDNSProxyCheck = (CheckBoxPreference) findPreference("isDNSProxy");
    isPACCheck = (CheckBoxPreference) findPreference("isPAC");
    isAutoConnectCheck = (CheckBoxPreference) findPreference("isAutoConnect");
    isBypassAppsCheck = (CheckBoxPreference) findPreference("isBypassApps");

    final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);

    String profileValuesString = settings.getString("profileValues", "");

    if (profileValuesString.equals("")) {
      Editor ed = settings.edit();
      profile = "1";
      ed.putString("profileValues", "1|0");
      ed.putString(
          "profileEntries",
          getString(R.string.profile_default) + "|" + getString(R.string.profile_new));
      ed.putString("profile", "1");
      ed.commit();

      profileList.setDefaultValue("1");
    }

    registerReceiver(
        ssidReceiver, new IntentFilter(android.net.ConnectivityManager.CONNECTIVITY_ACTION));

    loadProfileList();

    loadNetworkList();

    new Thread() {
      @Override
      public void run() {

        try {
          // Try not to block activity
          Thread.sleep(2000);
        } catch (InterruptedException ignore) {
          // Nothing
        }

        if (!Utils.isRoot()) {
          handler.sendEmptyMessage(MSG_NO_ROOT);
        }

        String versionName;
        try {
          versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
        } catch (NameNotFoundException e) {
          versionName = "NONE";
        }

        if (!settings.getBoolean(versionName, false)) {

          String version;
          try {
            version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
          } catch (NameNotFoundException e) {
            version = "NONE";
          }

          reset();

          Editor edit = settings.edit();
          edit.putBoolean(version, true);
          edit.commit();

          handler.sendEmptyMessage(MSG_UPDATE_FINISHED);
        }
      }
    }.start();
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   FlurryAgent.onPageView();
 }
Exemplo n.º 19
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   getSupportActionBar().setHomeButtonEnabled(true);
 }
Exemplo n.º 20
0
 @SuppressWarnings("deprecation")
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   addPreferencesFromResource(R.xml.preference);
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setup();
 }