コード例 #1
0
ファイル: LeftDrawer.java プロジェクト: lepumin/androidbible
 @Override
 public boolean onDragEvent(final DragEvent event) {
   if (event.getAction() == DragEvent.ACTION_DRAG_STARTED) {
     App.trackEvent("pin_drag_started");
     if (event.getClipDescription().hasMimeType(VerseItem.PROGRESS_MARK_DRAG_MIME_TYPE)) {
       return true; // Just to that the progress pin is not dropped to the verses
     }
   }
   return false;
 }
コード例 #2
0
ファイル: LeftDrawer.java プロジェクト: lepumin/androidbible
    @Override
    protected void onDetachedFromWindow() {
      super.onDetachedFromWindow();

      App.getLbm().unregisterReceiver(currentReadingChangeReceiver);
    }
コード例 #3
0
ファイル: LeftDrawer.java プロジェクト: lepumin/androidbible
    @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);
    }