Esempio n. 1
0
  @Override
  public void init() {
    if (!pluginEnabled) {
      /* here should be your specific initialization code */

      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
      frequency = prefs.getInt(EditActivity.PREF_FREQUENCY, 50);
      pluginId = prefs.getInt(EditActivity.KEY_PLUGIN_ID, -1);
      ignoreThreshold = EditActivity.getRate(frequency);

      prefs.registerOnSharedPreferenceChangeListener(this);

      // make sure not to call it twice
      sm = (SensorManager) getSystemService(SENSOR_SERVICE);
      List<Sensor> sensors = sm.getSensorList(Sensor.TYPE_ORIENTATION);
      if (sensors != null && sensors.size() > 0) {
        orientationSensor = sensors.get(0);
        sm.registerListener(this, orientationSensor, SensorManager.SENSOR_DELAY_UI);
        pluginEnabled = true;
      } else {
        Toast.makeText(
                this, "Accelerometer sensor is not available on this device!", Toast.LENGTH_SHORT)
            .show();
      }
    }
  }
Esempio n. 2
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
   super.onActivityResult(requestCode, resultCode, intent);
   if (resultCode == RESULT_OK && requestCode == CALCULATOR_REQUEST && intent != null) {
     try {
       AmountEditText input =
           (AmountEditText)
               findViewById(intent.getIntExtra(CalculatorInput.EXTRA_KEY_INPUT_ID, 0));
       input.setAmount(new BigDecimal(intent.getStringExtra(KEY_AMOUNT)));
       input.setError(null);
     } catch (Exception e) {
       AcraHelper.report(e);
     }
   }
 }
Esempio n. 3
0
 @Override
 public void setContentView(int layoutResID) {
   super.setContentView(layoutResID);
   mAmountLabel = (TextView) findViewById(R.id.AmountLabel);
   mAmountText = (AmountEditText) findViewById(R.id.AmountRow).findViewById(R.id.Amount);
 }
Esempio n. 4
0
 @Override
 protected void onRestoreInstanceState(Bundle savedInstanceState) {
   super.onRestoreInstanceState(savedInstanceState);
   mType = savedInstanceState.getBoolean("type");
   configureType();
 }
Esempio n. 5
0
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putBoolean("type", mType);
 }
Esempio n. 6
0
 @Override
 public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
   if (EditActivity.PREF_FREQUENCY.equals(key)) {
     ignoreThreshold = EditActivity.getRate(prefs.getInt(key, 50));
   }
 }
Esempio n. 7
0
 @Override
 public void onGesture(int gesture) {
   mEditActivity.getQuSystemUIHider().show();
 }