Пример #1
0
    @Override
    protected void onFinishInflate() {
      super.onFinishInflate();

      cbKind = V.get(this, R.id.cbKind);
      tCurrentDate = V.get(this, R.id.tCurrentDate);
      bPrev = V.get(this, R.id.bPrev);
      bNext = V.get(this, R.id.bNext);
      bReload = V.get(this, R.id.bReload);

      cbKind.setAdapter(adapter = new DevotionKindAdapter());
      cbKind.setOnItemSelectedListener(
          new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(
                final AdapterView<?> parent, final View view, final int position, final long id) {
              listener.cbKind_itemSelected(adapter.getItem(position));
            }

            @Override
            public void onNothingSelected(final AdapterView<?> parent) {}
          });

      bPrev.setOnClickListener(v -> listener.bPrev_click());

      bNext.setOnClickListener(v -> listener.bNext_click());

      bReload.setOnClickListener(
          v -> {
            listener.bReload_click();
            closeDrawer();
          });
    }
Пример #2
0
    @Override
    protected void onFinishInflate() {
      super.onFinishInflate();

      scrollDescription = V.get(this, R.id.scrollDescription);
      tDescription = V.get(this, R.id.tDescription);
      bRestart = V.get(this, R.id.bRestart);

      bRestart.setOnClickListener(v -> listener.bRestart_click());
    }
Пример #3
0
    @Override
    protected void onFinishInflate() {
      super.onFinishInflate();

      bChangeBook = V.get(this, R.id.bChangeBook);
      bChangeCode = V.get(this, R.id.bChangeCode);

      bOk = V.get(this, R.id.bOk);
      bDigitA = V.get(this, R.id.bDigitA);
      bDigitB = V.get(this, R.id.bDigitB);
      bDigitC = V.get(this, R.id.bDigitC);

      bChangeBook.setOnClickListener(
          v -> {
            final PopupMenu popupChangeBook =
                SongBookUtil.getSongBookPopupMenu(activity, false, true, bChangeBook);
            popupChangeBook.setOnMenuItemClickListener(
                SongBookUtil.getSongBookOnMenuItemClickListener(
                    new SongBookUtil.DefaultOnSongBookSelectedListener() {
                      @Override
                      public void onSongBookSelected(final String name) {
                        listener.songBookSelected(name);
                      }

                      @Override
                      public void onMoreSelected() {
                        listener.moreSelected();
                      }
                    }));

            popupChangeBook.show();
          });

      // all buttons
      for (int buttonId :
          new int[] {
            R.id.bDigit0,
            R.id.bDigit1,
            R.id.bDigit2,
            R.id.bDigit3,
            R.id.bDigit4,
            R.id.bDigit5,
            R.id.bDigit6,
            R.id.bDigit7,
            R.id.bDigit8,
            R.id.bDigit9,
            R.id.bDigitA,
            R.id.bDigitB,
            R.id.bDigitC,
            R.id.bOk,
            R.id.bBackspace,
          }) {
        V.get(this, buttonId).setOnClickListener(button_click);
      }
    }
Пример #4
0
    @Override
    protected void onFinishInflate() {
      super.onFinishInflate();

      bMarkers = V.get(this, R.id.bMarkers);
      bDisplay = V.get(this, R.id.bDisplay);
      cFullScreen = V.get(this, R.id.cFullScreen);
      cNightMode = V.get(this, R.id.cNightMode);
      cSplitVersion = V.get(this, R.id.cSplitVersion);

      bProgressMarkList = V.get(this, R.id.bProgressMarkList);
      bProgress1 = V.get(this, R.id.bProgress1);
      bProgress2 = V.get(this, R.id.bProgress2);
      bProgress3 = V.get(this, R.id.bProgress3);
      bProgress4 = V.get(this, R.id.bProgress4);
      bProgress5 = V.get(this, R.id.bProgress5);

      panelCurrentReadingHeader = V.get(this, R.id.panelCurrentReadingHeader);
      bCurrentReadingClose = V.get(this, R.id.bCurrentReadingClose);
      bCurrentReadingReference = V.get(this, R.id.bCurrentReadingReference);

      cNightMode.setChecked(
          !isInEditMode() && Preferences.getBoolean(Prefkey.is_night_mode, false));

      bProgressMarkList.setOnClickListener(v -> listener.bProgressMarkList_click());

      final View[] views = new View[] {bProgress1, bProgress2, bProgress3, bProgress4, bProgress5};
      for (int i = 0; i < views.length; i++) {
        final View b = views[i];
        final int preset_id = i;
        b.setOnClickListener(
            v -> {
              listener.bProgress_click(preset_id);
              closeDrawer();
            });
        b.setOnLongClickListener(
            v -> {
              final ClipData dragData =
                  new ClipData(
                      "progress_mark",
                      new String[] {VerseItem.PROGRESS_MARK_DRAG_MIME_TYPE},
                      new ClipData.Item("" + preset_id));
              b.setPressed(false);
              final DragShadowBuilder dragShadowBuilder = new DragShadowBuilder(b);
              performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
              closeDrawer();
              v.startDrag(dragData, dragShadowBuilder, null, 0);

              return true;
            });
      }

      bMarkers.setOnClickListener(
          v -> {
            listener.bMarkers_click();
            closeDrawer();
          });

      bDisplay.setOnClickListener(
          v -> {
            listener.bDisplay_click();
            closeDrawer();
          });

      cFullScreen.setOnCheckedChangeListener(cFullScreen_checkedChange);

      cNightMode.setOnCheckedChangeListener(cNightMode_checkedChange);

      cSplitVersion.setOnCheckedChangeListener(cSplitVersion_checkedChange);

      bCurrentReadingClose.setOnClickListener(v -> listener.bCurrentReadingClose_click());
      bCurrentReadingReference.setOnClickListener(v -> listener.bCurrentReadingReference_click());

      displayCurrentReading();

      // The following is not in onAttachedFromWindow, because we need to listen to
      // ACTION_ACTIVE_VERSION_CHANGED as early as possible, so we do not end up with
      // a verse reference from a version that was not actually selected during app startup.
      final IntentFilter filter = new IntentFilter();
      filter.addAction(CurrentReading.ACTION_CURRENT_READING_CHANGED);
      filter.addAction(IsiActivity.ACTION_ACTIVE_VERSION_CHANGED);
      App.getLbm().registerReceiver(currentReadingChangeReceiver, filter);
    }