Search in sources :

Example 1 with IBaseForumPost

use of forpdateam.ru.forpda.api.IBaseForumPost in project ForPDA by RadiationX.

the class ThemeFragmentWeb method anchorDialog.

@JavascriptInterface
public void anchorDialog(String postId, String name) {
    if (getContext() == null)
        return;
    runInUiThread(() -> {
        IBaseForumPost post = getPostById(Integer.parseInt(postId));
        String link = "https://4pda.ru/forum/index.php?act=findpost&pid=" + post.getId() + "&anchor=" + name;
        new AlertDialog.Builder(getContext()).setTitle(R.string.link_to_anchor).setMessage(link).setPositiveButton(R.string.copy, (dialog, which) -> {
            Utils.copyToClipBoard(link);
        }).setNegativeButton(R.string.cancel, null).show();
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) IBaseForumPost(forpdateam.ru.forpda.api.IBaseForumPost) JavascriptInterface(android.webkit.JavascriptInterface)

Example 2 with IBaseForumPost

use of forpdateam.ru.forpda.api.IBaseForumPost in project ForPDA by RadiationX.

the class ThemeFragmentWeb method copySpoilerLink.

@JavascriptInterface
public void copySpoilerLink(String postId, String spoilNumber) {
    if (getContext() == null)
        return;
    runInUiThread(() -> {
        new AlertDialog.Builder(getContext()).setMessage(R.string.spoiler_link_copy_ask).setPositiveButton(R.string.ok, (dialog, which) -> {
            IBaseForumPost post = getPostById(Integer.parseInt(postId));
            String s = "https://4pda.ru/forum/index.php?act=findpost&pid=" + post.getId() + "&anchor=Spoil-" + post.getId() + "-" + spoilNumber;
            Utils.copyToClipBoard(s);
        }).setNegativeButton(R.string.cancel, null).show();
    });
}
Also used : IBaseForumPost(forpdateam.ru.forpda.api.IBaseForumPost) JavascriptInterface(android.webkit.JavascriptInterface)

Aggregations

JavascriptInterface (android.webkit.JavascriptInterface)2 IBaseForumPost (forpdateam.ru.forpda.api.IBaseForumPost)2 AlertDialog (android.support.v7.app.AlertDialog)1