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;
}
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;
}
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);
}
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;
}
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();
}
Aggregations