Ejemplo n.º 1
0
  @Override
  public void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    boolean alwaysDownload =
        preferences.getBoolean(getString(R.string.preference_auto_download_key), true);

    if (alwaysDownload) {
      DownloadTickCheckTask task = new DownloadTickCheckTask(this, this);
      task.execute();
    } else {
      initialize();
    }
  }
Ejemplo n.º 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    init = false;

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

    setBehindContentView(R.layout.menu_frame);
    getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.menu_frame, new MenuFragment())
        .commit();

    // customize the SlidingMenu
    SlidingMenu sm = getSlidingMenu();
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.shadow);
    sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setFadeDegree(0.35f);
    sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

    setContentView(R.layout.activity_main);

    downloadView = findViewById(R.id.DownloadView);
    progressBar = (ProgressBar) findViewById(R.id.ProgressBar);
    progressMessageTextView = (TextView) findViewById(R.id.ProgressTextView);

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    boolean alwaysTurnOnScreen =
        preferences.getBoolean(getString(R.string.preference_always_turn_on_key), true);
    if (alwaysTurnOnScreen) {
      getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    } else {
      getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
  }