Search in sources :

Example 11 with MainActivity

use of com.hippo.ehviewer.ui.MainActivity in project EhViewer by seven332.

the class CrashScene method onClick.

@Override
public void onClick(View v) {
    MainActivity activity = getActivity2();
    if (mSend == v && null != mCrash && null != activity) {
        AppHelper.sendEmail(activity, EhApplication.getDeveloperEmail(), "I found a bug in EhViewer !", mCrash);
    }
    Crash.resetCrashFile();
    // Start new scene and finish it self
    if (null != activity) {
        startSceneForCheckStep(CHECK_STEP_CRASH, getArguments());
    }
    finish();
}
Also used : MainActivity(com.hippo.ehviewer.ui.MainActivity)

Example 12 with MainActivity

use of com.hippo.ehviewer.ui.MainActivity in project EhViewer by seven332.

the class DownloadsScene method guideDownloadThumb.

private void guideDownloadThumb() {
    MainActivity activity = getActivity2();
    if (null == activity || !Settings.getGuideDownloadThumb() || null == mLayoutManager || null == mRecyclerView) {
        guideDownloadLabels();
        return;
    }
    int position = mLayoutManager.findFirstCompletelyVisibleItemPositions(null)[0];
    if (position < 0) {
        guideDownloadLabels();
        return;
    }
    RecyclerView.ViewHolder holder = mRecyclerView.findViewHolderForAdapterPosition(position);
    if (null == holder) {
        guideDownloadLabels();
        return;
    }
    mShowcaseView = new ShowcaseView.Builder(activity).withMaterialShowcase().setStyle(R.style.Guide).setTarget(new ViewTarget(((DownloadHolder) holder).thumb)).blockAllTouches().setContentTitle(R.string.guide_download_thumb_title).setContentText(R.string.guide_download_thumb_text).replaceEndButton(R.layout.button_guide).setShowcaseEventListener(new SimpleShowcaseEventListener() {

        @Override
        public void onShowcaseViewDidHide(ShowcaseView showcaseView) {
            mShowcaseView = null;
            ViewUtils.removeFromParent(showcaseView);
            Settings.putGuideDownloadThumb(false);
            guideDownloadLabels();
        }
    }).build();
}
Also used : SimpleShowcaseEventListener(com.github.amlcurran.showcaseview.SimpleShowcaseEventListener) CheckBoxDialogBuilder(com.hippo.app.CheckBoxDialogBuilder) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) MainActivity(com.hippo.ehviewer.ui.MainActivity) ViewTarget(com.github.amlcurran.showcaseview.targets.ViewTarget) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 13 with MainActivity

use of com.hippo.ehviewer.ui.MainActivity in project EhViewer by seven332.

the class DownloadsScene method guideDownloadLabels.

private void guideDownloadLabels() {
    MainActivity activity = getActivity2();
    if (null == activity || !Settings.getGuideDownloadLabels()) {
        return;
    }
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point point = new Point();
    display.getSize(point);
    mShowcaseView = new ShowcaseView.Builder(activity).withMaterialShowcase().setStyle(R.style.Guide).setTarget(new PointTarget(point.x, point.y / 3)).blockAllTouches().setContentTitle(R.string.guide_download_labels_title).setContentText(R.string.guide_download_labels_text).replaceEndButton(R.layout.button_guide).setShowcaseEventListener(new SimpleShowcaseEventListener() {

        @Override
        public void onShowcaseViewDidHide(ShowcaseView showcaseView) {
            mShowcaseView = null;
            ViewUtils.removeFromParent(showcaseView);
            Settings.puttGuideDownloadLabels(false);
            openDrawer(Gravity.RIGHT);
        }
    }).build();
}
Also used : SimpleShowcaseEventListener(com.github.amlcurran.showcaseview.SimpleShowcaseEventListener) CheckBoxDialogBuilder(com.hippo.app.CheckBoxDialogBuilder) PointTarget(com.github.amlcurran.showcaseview.targets.PointTarget) MainActivity(com.hippo.ehviewer.ui.MainActivity) Point(android.graphics.Point) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) Display(android.view.Display)

Example 14 with MainActivity

use of com.hippo.ehviewer.ui.MainActivity in project EhViewer by seven332.

the class HistoryScene method onItemLongClick.

@Override
public boolean onItemLongClick(EasyRecyclerView parent, View view, int position, long id) {
    final Context context = getContext2();
    final MainActivity activity = getActivity2();
    if (null == context || null == activity || null == mLazyList) {
        return false;
    }
    final GalleryInfo gi = mLazyList.get(position);
    new AlertDialog.Builder(context).setTitle(EhUtils.getSuitableTitle(gi)).setItems(R.array.gallery_list_menu_entries, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            switch(which) {
                case // Download
                0:
                    CommonOperations.startDownload(activity, gi, false);
                    break;
                case // Favorites
                1:
                    CommonOperations.addToFavorites(activity, gi, new addToFavoriteListener(context, activity.getStageId(), getTag()));
                    break;
            }
        }
    }).show();
    return true;
}
Also used : Context(android.content.Context) AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) GalleryInfo(com.hippo.ehviewer.client.data.GalleryInfo) MainActivity(com.hippo.ehviewer.ui.MainActivity)

Example 15 with MainActivity

use of com.hippo.ehviewer.ui.MainActivity in project EhViewer by seven332.

the class SecurityScene method onShake.

@Override
public void onShake(int count) {
    if (count == 10) {
        MainActivity activity = getActivity2();
        if (null == activity) {
            return;
        }
        Settings.putSecurity("");
        startSceneForCheckStep(CHECK_STEP_SECURITY, getArguments());
        finish();
    }
}
Also used : MainActivity(com.hippo.ehviewer.ui.MainActivity)

Aggregations

MainActivity (com.hippo.ehviewer.ui.MainActivity)18 Context (android.content.Context)10 EhRequest (com.hippo.ehviewer.client.EhRequest)6 AlertDialog (android.support.v7.app.AlertDialog)3 GalleryInfo (com.hippo.ehviewer.client.data.GalleryInfo)3 DialogInterface (android.content.DialogInterface)2 Point (android.graphics.Point)2 ShowcaseView (com.github.amlcurran.showcaseview.ShowcaseView)2 SimpleShowcaseEventListener (com.github.amlcurran.showcaseview.SimpleShowcaseEventListener)2 CheckBoxDialogBuilder (com.hippo.app.CheckBoxDialogBuilder)2 Announcer (com.hippo.scene.Announcer)2 SuppressLint (android.annotation.SuppressLint)1 Dialog (android.app.Dialog)1 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 RecyclerView (android.support.v7.widget.RecyclerView)1 SpannableString (android.text.SpannableString)1 Display (android.view.Display)1 PointTarget (com.github.amlcurran.showcaseview.targets.PointTarget)1 ViewTarget (com.github.amlcurran.showcaseview.targets.ViewTarget)1