Esempio n. 1
0
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    setClickable(true);
    for (int i = 0, len = getChildCount(); i < len; i++) {
      getChildAt(i).setDuplicateParentStateEnabled(false);
    }

    bBible = V.get(this, R.id.bBible);
    bDevotion = V.get(this, R.id.bDevotion);
    bReadingPlan = V.get(this, R.id.bReadingPlan);
    bSongs = V.get(this, R.id.bSongs);
    bSettings = V.get(this, R.id.bSettings);
    bHelp = V.get(this, R.id.bHelp);

    final int selectedTextColor = getResources().getColor(R.color.accent);
    if (this instanceof Text) bBible.setTextColor(selectedTextColor);
    if (this instanceof Devotion) bDevotion.setTextColor(selectedTextColor);
    if (this instanceof ReadingPlan) bReadingPlan.setTextColor(selectedTextColor);
    if (this instanceof Songs) bSongs.setTextColor(selectedTextColor);

    // hide and show according to app config
    if (!isInEditMode()) {
      bSongs.setVisibility(AppConfig.get().menuSongs ? VISIBLE : GONE);
      bDevotion.setVisibility(AppConfig.get().menuDevotion ? VISIBLE : GONE);
    }

    bBible.setOnClickListener(
        v -> {
          bBible_click();
          closeDrawer();
        });

    bDevotion.setOnClickListener(
        v -> {
          bDevotion_click();
          closeDrawer();
        });

    bReadingPlan.setOnClickListener(
        v -> {
          bReadingPlan_click();
          closeDrawer();
        });

    bSongs.setOnClickListener(
        v -> {
          bSongs_click();
          closeDrawer();
        });

    bSettings.setOnClickListener(
        v -> {
          bSettings_click();
          closeDrawer();
        });

    bHelp.setOnClickListener(
        v -> {
          bHelp_click();
          closeDrawer();
        });
  }
Esempio n. 2
0
 {
   // gather available devotions based on app config
   for (String devotionName : AppConfig.get().devotionNames) {
     kinds.add(DevotionActivity.DevotionKind.getByName(devotionName));
   }
 }