use of forpdateam.ru.forpda.common.webview.jsinterfaces.IPostFunctions in project ForPDA by RadiationX.
the class ThemeDialogsHelper method showUserMenu.
public static void showUserMenu(Context context, IPostFunctions theme, IBaseForumPost post) {
if (userMenu == null) {
userMenu = new DynamicDialogMenu<>();
userMenu.addItem(App.get().getString(R.string.profile), (context1, data) -> IntentHandler.handle("https://4pda.ru/forum/index.php?showuser=" + data.getUserId()));
userMenu.addItem(App.get().getString(R.string.reputation), IPostFunctions::showReputationMenu);
userMenu.addItem(App.get().getString(R.string.pm_qms), (context1, data) -> IntentHandler.handle("https://4pda.ru/forum/index.php?act=qms&mid=" + data.getUserId()));
userMenu.addItem(App.get().getString(R.string.user_themes), (context1, data) -> {
SearchSettings settings = new SearchSettings();
settings.setSource(SearchSettings.SOURCE_ALL.first);
settings.setNick(data.getNick());
settings.setResult(SearchSettings.RESULT_TOPICS.first);
IntentHandler.handle(settings.toUrl());
});
userMenu.addItem(App.get().getString(R.string.messages_in_this_theme), (context1, data) -> {
SearchSettings settings = new SearchSettings();
settings.addForum(Integer.toString(data.getForumId()));
settings.addTopic(Integer.toString(data.getTopicId()));
settings.setSource(SearchSettings.SOURCE_CONTENT.first);
settings.setNick(data.getNick());
settings.setResult(SearchSettings.RESULT_POSTS.first);
settings.setSubforums(SearchSettings.SUB_FORUMS_FALSE);
IntentHandler.handle(settings.toUrl());
});
userMenu.addItem(App.get().getString(R.string.user_messages), (context1, data) -> {
SearchSettings settings = new SearchSettings();
settings.setSource(SearchSettings.SOURCE_CONTENT.first);
settings.setNick(data.getNick());
settings.setResult(SearchSettings.RESULT_POSTS.first);
settings.setSubforums(SearchSettings.SUB_FORUMS_FALSE);
IntentHandler.handle(settings.toUrl());
});
}
userMenu.disallowAll();
userMenu.allow(0);
userMenu.allow(1);
if (ClientHelper.getAuthState() == ClientHelper.AUTH_STATE_LOGIN && post.getUserId() != ClientHelper.getUserId()) {
userMenu.allow(2);
}
userMenu.allow(3);
userMenu.allow(4);
userMenu.allow(5);
userMenu.show(context, theme, post);
}
use of forpdateam.ru.forpda.common.webview.jsinterfaces.IPostFunctions in project ForPDA by RadiationX.
the class ThemeDialogsHelper method showPostMenu.
public static void showPostMenu(Context context, IPostFunctions theme, IBaseForumPost post) {
if (postMenu == null) {
postMenu = new DynamicDialogMenu<>();
postMenu.addItem(App.get().getString(R.string.reply), IPostFunctions::reply);
postMenu.addItem(App.get().getString(R.string.quote_from_clipboard), (context1, data) -> {
String text = Utils.readFromClipboard();
if (text != null && !text.isEmpty()) {
theme.quotePost(text, data);
}
});
postMenu.addItem(App.get().getString(R.string.report), IPostFunctions::reportPost);
postMenu.addItem(App.get().getString(R.string.edit), IPostFunctions::editPost);
postMenu.addItem(App.get().getString(R.string.delete), IPostFunctions::deletePost);
postMenu.addItem(App.get().getString(R.string.copy_link), (context1, data) -> {
String url = "https://4pda.ru/forum/index.php?s=&showtopic=" + data.getTopicId() + "&view=findpost&p=" + data.getId();
Utils.copyToClipBoard(url);
});
postMenu.addItem(App.get().getString(R.string.create_note), (context1, data) -> {
String themeTitle = null;
if (context1 instanceof SearchFragment) {
SearchItem searchItem = (SearchItem) data;
themeTitle = searchItem.getTitle();
} else if (context1 instanceof ThemeFragment) {
ThemeFragment themeFragment = (ThemeFragment) context1;
themeTitle = themeFragment.currentPage.getTitle();
}
String title = String.format(App.get().getString(R.string.post_Topic_Nick_Number), themeTitle, data.getNick(), data.getId());
String url = "https://4pda.ru/forum/index.php?s=&showtopic=" + data.getTopicId() + "&view=findpost&p=" + data.getId();
NotesAddPopup.showAddNoteDialog(context, title, url);
});
postMenu.addItem(App.get().getString(R.string.share), (context12, data) -> {
String url = "https://4pda.ru/forum/index.php?s=&showtopic=" + data.getTopicId() + "&view=findpost&p=" + data.getId();
Utils.shareText(url);
});
}
postMenu.disallowAll();
if (ClientHelper.getAuthState() == ClientHelper.AUTH_STATE_LOGIN) {
if (post.canQuote()) {
postMenu.allow(0);
postMenu.allow(1);
}
if (post.canReport())
postMenu.allow(2);
if (post.canEdit())
postMenu.allow(3);
if (post.canDelete())
postMenu.allow(4);
}
postMenu.allow(5);
postMenu.allow(6);
postMenu.allow(7);
postMenu.show(context, theme, post);
}
Aggregations