Search in sources :

Example 11 with Announcer

use of com.hippo.scene.Announcer in project EhViewer by seven332.

the class GalleryListScene method onItemClick.

@Override
public boolean onItemClick(EasyRecyclerView parent, View view, int position, long id) {
    if (null == mHelper || null == mRecyclerView) {
        return false;
    }
    GalleryInfo gi = mHelper.getDataAt(position);
    Bundle args = new Bundle();
    args.putString(GalleryDetailScene.KEY_ACTION, GalleryDetailScene.ACTION_GALLERY_INFO);
    args.putParcelable(GalleryDetailScene.KEY_GALLERY_INFO, gi);
    Announcer announcer = new Announcer(GalleryDetailScene.class).setArgs(args);
    View thumb;
    if (ApiHelper.SUPPORT_TRANSITION && null != (thumb = view.findViewById(R.id.thumb))) {
        announcer.setTranHelper(new EnterGalleryDetailTransaction(thumb));
    }
    startScene(announcer);
    return true;
}
Also used : Announcer(com.hippo.scene.Announcer) Bundle(android.os.Bundle) GalleryInfo(com.hippo.ehviewer.client.data.GalleryInfo) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) RecyclerView(android.support.v7.widget.RecyclerView)

Example 12 with Announcer

use of com.hippo.scene.Announcer in project EhViewer by seven332.

the class GalleryListScene method onCreateDrawerView.

@Override
public View onCreateDrawerView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.drawer_list, container, false);
    Toolbar toolbar = (Toolbar) ViewUtils.$$(view, R.id.toolbar);
    final TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
    final ListView listView = (ListView) ViewUtils.$$(view, R.id.list_view);
    Context context = getContext2();
    Assert.assertNotNull(context);
    final List<QuickSearch> list = EhDB.getAllQuickSearch();
    final ArrayAdapter<QuickSearch> adapter = new ArrayAdapter<>(context, R.layout.item_simple_list, list);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (null == mHelper || null == mUrlBuilder) {
                return;
            }
            mUrlBuilder.set(list.get(position));
            mUrlBuilder.setPageIndex(0);
            onUpdateUrlBuilder();
            mHelper.refresh();
            setState(STATE_NORMAL);
            closeDrawer(Gravity.RIGHT);
        }
    });
    tip.setText(R.string.quick_search_tip);
    toolbar.setTitle(R.string.quick_search);
    toolbar.inflateMenu(R.menu.drawer_gallery_list);
    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            int id = item.getItemId();
            switch(id) {
                case R.id.action_add:
                    if (Settings.getQuickSearchTip()) {
                        showQuickSearchTipDialog(list, adapter, listView, tip);
                    } else {
                        showAddQuickSearchDialog(list, adapter, listView, tip);
                    }
                    break;
                case R.id.action_settings:
                    startScene(new Announcer(QuickSearchScene.class));
                    break;
            }
            return true;
        }
    });
    if (0 == list.size()) {
        tip.setVisibility(View.VISIBLE);
        listView.setVisibility(View.GONE);
    } else {
        tip.setVisibility(View.GONE);
        listView.setVisibility(View.VISIBLE);
    }
    return view;
}
Also used : Context(android.content.Context) MenuItem(android.view.MenuItem) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) RecyclerView(android.support.v7.widget.RecyclerView) Point(android.graphics.Point) ListView(android.widget.ListView) Announcer(com.hippo.scene.Announcer) QuickSearch(com.hippo.ehviewer.dao.QuickSearch) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) ArrayAdapter(android.widget.ArrayAdapter) Toolbar(android.support.v7.widget.Toolbar)

Example 13 with Announcer

use of com.hippo.scene.Announcer in project EhViewer by seven332.

the class GalleryListScene method getStartAnnouncer.

public static Announcer getStartAnnouncer(ListUrlBuilder lub) {
    Bundle args = new Bundle();
    args.putString(KEY_ACTION, ACTION_LIST_URL_BUILDER);
    args.putParcelable(KEY_LIST_URL_BUILDER, lub);
    return new Announcer(GalleryListScene.class).setArgs(args);
}
Also used : Announcer(com.hippo.scene.Announcer) Bundle(android.os.Bundle)

Example 14 with Announcer

use of com.hippo.scene.Announcer in project EhViewer by seven332.

the class HistoryScene method onItemClick.

@Override
public boolean onItemClick(EasyRecyclerView parent, View view, int position, long id) {
    if (null == mLazyList) {
        return false;
    }
    Bundle args = new Bundle();
    args.putString(GalleryDetailScene.KEY_ACTION, GalleryDetailScene.ACTION_GALLERY_INFO);
    args.putParcelable(GalleryDetailScene.KEY_GALLERY_INFO, mLazyList.get(position));
    Announcer announcer = new Announcer(GalleryDetailScene.class).setArgs(args);
    View thumb;
    if (ApiHelper.SUPPORT_TRANSITION && null != (thumb = view.findViewById(R.id.thumb))) {
        announcer.setTranHelper(new EnterGalleryDetailTransaction(thumb));
    }
    startScene(announcer);
    return true;
}
Also used : Announcer(com.hippo.scene.Announcer) Bundle(android.os.Bundle) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) View(android.view.View) SimpleRatingView(com.hippo.ehviewer.widget.SimpleRatingView) LoadImageView(com.hippo.widget.LoadImageView) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView)

Example 15 with Announcer

use of com.hippo.scene.Announcer in project EhViewer by seven332.

the class ProgressScene method onGetGalleryTokenSuccess.

private void onGetGalleryTokenSuccess(String result) {
    Bundle arg = new Bundle();
    arg.putString(GalleryDetailScene.KEY_ACTION, GalleryDetailScene.ACTION_GID_TOKEN);
    arg.putLong(GalleryDetailScene.KEY_GID, mGid);
    arg.putString(GalleryDetailScene.KEY_TOKEN, result);
    arg.putInt(GalleryDetailScene.KEY_PAGE, mPage);
    startScene(new Announcer(GalleryDetailScene.class).setArgs(arg));
    finish();
}
Also used : Announcer(com.hippo.scene.Announcer) Bundle(android.os.Bundle)

Aggregations

Announcer (com.hippo.scene.Announcer)16 Bundle (android.os.Bundle)11 RecyclerView (android.support.v7.widget.RecyclerView)4 View (android.view.View)4 TextView (android.widget.TextView)4 EasyRecyclerView (com.hippo.easyrecyclerview.EasyRecyclerView)4 Context (android.content.Context)3 Intent (android.content.Intent)3 Point (android.graphics.Point)3 PersistableBundle (android.os.PersistableBundle)3 AdapterView (android.widget.AdapterView)3 ListView (android.widget.ListView)3 ShowcaseView (com.github.amlcurran.showcaseview.ShowcaseView)3 ListUrlBuilder (com.hippo.ehviewer.client.data.ListUrlBuilder)3 MainActivity (com.hippo.ehviewer.ui.MainActivity)3 GalleryListScene (com.hippo.ehviewer.ui.scene.GalleryListScene)3 Uri (android.net.Uri)2 Toolbar (android.support.v7.widget.Toolbar)2 MenuItem (android.view.MenuItem)2 GalleryInfo (com.hippo.ehviewer.client.data.GalleryInfo)2