Esempio n. 1
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   short time = Schedule.today(this).nextTimeIndex();
   switch (item.getItemId()) {
     case R.id.menu_location_calculation:
       new CalculationSettingsDialog(this).show();
       break;
     case R.id.menu_previous:
       time--;
       if (time < CONSTANT.FAJR) {
         time = CONSTANT.ISHAA;
       }
       if (CONSTANT.SUNRISE == time && mPreferences.dontNotifySunrise()) {
         time = CONSTANT.FAJR;
       }
       NotificationService.notify(
           this, time, Schedule.today(this).getTimes()[time].getTimeInMillis());
       break;
     case R.id.menu_next:
       if (CONSTANT.SUNRISE == time && mPreferences.dontNotifySunrise()) {
         time = CONSTANT.DHUHR;
       }
       NotificationService.notify(
           this, time, Schedule.today(this).getTimes()[time].getTimeInMillis());
       break;
     case R.id.menu_stop:
       NotificationService.cancelAll(this);
       break;
     case R.id.menu_settings:
       startActivity(new Intent(this, SettingsActivity.class));
       break;
   }
   return super.onOptionsItemSelected(item);
 }
Esempio n. 2
0
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.file_path);
    setTitle(R.string.file_path_example);

    final Preferences preferences = Preferences.getInstance(getContext());

    mFilePathText = (EditText) findViewById(R.id.file_path);
    mFilePathText.setText(preferences.getCustomFilePath(mTimeIndex));

    ((Button) findViewById(R.id.save_settings))
        .setOnClickListener(
            new Button.OnClickListener() {
              public void onClick(View v) {
                preferences.setCustomFilePath(mFilePathText.getText().toString());
                dismiss();
              }
            });

    ((Button) findViewById(R.id.reset_settings))
        .setOnClickListener(
            new Button.OnClickListener() {
              public void onClick(View v) {
                mFilePathText.setText("");
              }
            });
  }
Esempio n. 3
0
  @Override
  public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
      if (Utils.isRestartNeeded) {
        restartSelf();
        return;
      }

      if (mPreferences.isLocationSet()) {
        TextView notes = (TextView) findViewById(R.id.notes);
        assert notes != null;
        notes.setText(null);
      }
    }
  }
Esempio n. 4
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mPreferences = Preferences.getInstance(this);
    LocaleManager.getInstance(this, true);

    setContentView(R.layout.activity_muazzin);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    assert toolbar != null;
    toolbar.setTitle(R.string.app_name);
    setSupportActionBar(toolbar);

    // Set up the ViewPager, attaching the adapter
    MuazzinAdapter muazzinAdapter =
        new MuazzinAdapter(getApplicationContext(), getSupportFragmentManager());
    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    assert pager != null;
    pager.setAdapter(muazzinAdapter);
    final SlidingTabLayout indicator = (SlidingTabLayout) findViewById(R.id.indicator);
    assert indicator != null;
    indicator.setViewPager(pager);
  }