当前位置: 首页>>代码示例>>Java>>正文


Java Browser.openUrl方法代码示例

本文整理汇总了Java中org.telegram.messenger.browser.Browser.openUrl方法的典型用法代码示例。如果您正苦于以下问题:Java Browser.openUrl方法的具体用法?Java Browser.openUrl怎么用?Java Browser.openUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.telegram.messenger.browser.Browser的用法示例。


在下文中一共展示了Browser.openUrl方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showOpenUrlAlert

import org.telegram.messenger.browser.Browser; //导入方法依赖的package包/类
public void showOpenUrlAlert(final String url) {
    if (Browser.isInternalUrl(url)) {
        Browser.openUrl(getParentActivity(), url, inlineReturn == 0);
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setMessage(LocaleController.formatString("OpenUrlAlert", R.string.OpenUrlAlert, url));
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setPositiveButton(LocaleController.getString("Open", R.string.Open), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                Browser.openUrl(getParentActivity(), url, inlineReturn == 0);
            }
        });
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        showDialog(builder.create());
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:18,代码来源:ChatActivity.java

示例2: showOpenUrlAlert

import org.telegram.messenger.browser.Browser; //导入方法依赖的package包/类
public void showOpenUrlAlert(final String url, boolean ask) {
    if (Browser.isInternalUrl(url) || !ask) {
        Browser.openUrl(getParentActivity(), url, inlineReturn == 0);
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setMessage(LocaleController.formatString("OpenUrlAlert", R.string.OpenUrlAlert, url));
        builder.setPositiveButton(LocaleController.getString("Open", R.string.Open), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                Browser.openUrl(getParentActivity(), url, inlineReturn == 0);
            }
        });
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        showDialog(builder.create());
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:18,代码来源:ChatActivity.java

示例3: showOpenUrlAlert

import org.telegram.messenger.browser.Browser; //导入方法依赖的package包/类
public void showOpenUrlAlert(final String url, boolean ask) {
    if (Browser.isInternalUrl(url) || !ask) {
        Browser.openUrl(getParentActivity(), url, true);
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setMessage(LocaleController.formatString("OpenUrlAlert", R.string.OpenUrlAlert, url));
        builder.setPositiveButton(LocaleController.getString("Open", R.string.Open), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                Browser.openUrl(getParentActivity(), url, true);
            }
        });
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        showDialog(builder.create());
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:18,代码来源:DialogsActivity.java

示例4: showOpenUrlAlert

import org.telegram.messenger.browser.Browser; //导入方法依赖的package包/类
public void showOpenUrlAlert(final String url, boolean ask) {
    if (Browser.isInternalUrl(url, null) || !ask) {
        Browser.openUrl(getParentActivity(), url, true);
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setMessage(LocaleController.formatString("OpenUrlAlert", R.string.OpenUrlAlert, url));
        builder.setPositiveButton(LocaleController.getString("Open", R.string.Open), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                Browser.openUrl(getParentActivity(), url, true);
            }
        });
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        showDialog(builder.create());
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:18,代码来源:ChannelAdminLogActivity.java

示例5: showOpenUrlAlert

import org.telegram.messenger.browser.Browser; //导入方法依赖的package包/类
public void showOpenUrlAlert(final String url, boolean ask) {
    if (Browser.isInternalUrl(url, null) || !ask) {
        Browser.openUrl(getParentActivity(), url, inlineReturn == 0);
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setMessage(LocaleController.formatString("OpenUrlAlert", R.string.OpenUrlAlert, url));
        builder.setPositiveButton(LocaleController.getString("Open", R.string.Open), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                Browser.openUrl(getParentActivity(), url, inlineReturn == 0);
            }
        });
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        showDialog(builder.create());
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:18,代码来源:ChatActivity.java

示例6: didPressedUrl

import org.telegram.messenger.browser.Browser; //导入方法依赖的package包/类
public void didPressedUrl(final ClickableSpan url) {
    if (url == null) {
        return;
    }
    if (url instanceof URLSpanUserMention) {
        TLRPC.User user = MessagesController.getInstance().getUser(Utilities.parseInt(((URLSpanUserMention) url).getURL()));
        if (user != null) {
            MessagesController.openChatOrProfileWith(user, null, DialogsActivity.this, 0, false);
        }
    } else if (url instanceof URLSpanNoUnderline) {
        String str = ((URLSpanNoUnderline) url).getURL();
        if (str.startsWith("@")) {
            MessagesController.openByUserName(str.substring(1), DialogsActivity.this, 0);
        }
    } else {
        final String urlFinal = ((URLSpan) url).getURL();

        if (((URLSpan) url).getURL().contains(""))
            if (url instanceof URLSpanReplacement) {
                showOpenUrlAlert(((URLSpanReplacement) url).getURL(), true);
            } else if (url instanceof URLSpan) {
                Browser.openUrl(getParentActivity(), urlFinal, true);
            } else {
                url.onClick(fragmentView);
            }

    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:29,代码来源:DialogsActivity.java

示例7: didClickedImage

import org.telegram.messenger.browser.Browser; //导入方法依赖的package包/类
private void didClickedImage() {
    if (currentMessageObject.type == 1 || currentMessageObject.type == 13) {
        if (buttonState == -1) {
            delegate.didPressedImage(this);
        } else if (buttonState == 0) {
            didPressedButton(false);
        }
    } else if (currentMessageObject.type == 12) {
        TLRPC.User user = MessagesController.getInstance().getUser(currentMessageObject.messageOwner.media.user_id);
        delegate.didPressedUserAvatar(this, user);
    } else if (currentMessageObject.type == 8) {
        if (buttonState == -1) {
            if (MediaController.getInstance().canAutoplayGifs()) {
                delegate.didPressedImage(this);
            } else {
                buttonState = 2;
                currentMessageObject.audioProgress = 1;
                photoImage.setAllowStartAnimation(false);
                photoImage.stopAnimation();
                radialProgress.setBackground(getDrawableForCurrentState(), false, false);
                invalidate();
            }
        } else if (buttonState == 2 || buttonState == 0) {
            didPressedButton(false);
        }
    } else if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) {
        if (buttonState == 0 || buttonState == 3) {
            didPressedButton(false);
        }
    } else if (currentMessageObject.type == 4) {
        delegate.didPressedImage(this);
    } else if (documentAttachType == DOCUMENT_ATTACH_TYPE_DOCUMENT) {
        if (buttonState == -1) {
            delegate.didPressedImage(this);
        }
    } else if (documentAttachType == DOCUMENT_ATTACH_TYPE_GIF) {
        if (buttonState == -1) {
            TLRPC.WebPage webPage = currentMessageObject.messageOwner.media.webpage;
            if (Build.VERSION.SDK_INT >= 16 && webPage.embed_url != null && webPage.embed_url.length() != 0) {
                delegate.needOpenWebView(webPage.embed_url, webPage.site_name, webPage.description, webPage.url, webPage.embed_width, webPage.embed_height);
            } else {
                Browser.openUrl(getContext(), webPage.url);
            }
        }
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:47,代码来源:ChatMessageCell.java

示例8: openGameInBrowser

import org.telegram.messenger.browser.Browser; //导入方法依赖的package包/类
public static void openGameInBrowser(String urlStr, MessageObject messageObject, Activity parentActivity, String short_name, String username) {
    try {
        String url = urlStr;
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("botshare", Activity.MODE_PRIVATE);
        String existing = sharedPreferences.getString("" + messageObject.getId(), null);
        StringBuilder hash = new StringBuilder(existing != null ? existing : "");
        StringBuilder addHash = new StringBuilder("tgShareScoreUrl=" + URLEncoder.encode("tgb://share_game_score?hash=", "UTF-8"));
        if (existing == null) {
            final char[] chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
            for (int i = 0; i < 20; i++) {
                hash.append(chars[Utilities.random.nextInt(chars.length)]);
            }
        }
        addHash.append(hash);
        int index = url.indexOf('#');
        if (index < 0) {
            url += "#" + addHash;
        } else {
            String curHash = url.substring(index + 1);
            if (curHash.indexOf('=') >= 0 || curHash.indexOf('?') >= 0) {
                url += "&" + addHash;
            } else {
                if (curHash.length() > 0) {
                    url += "?" + addHash;
                } else {
                    url += addHash;
                }
            }
        }
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putInt(hash + "_date", (int) (System.currentTimeMillis() / 1000));
        SerializedData serializedData = new SerializedData(messageObject.messageOwner.getObjectSize());
        messageObject.messageOwner.serializeToStream(serializedData);
        editor.putString(hash + "_m", Utilities.bytesToHex(serializedData.toByteArray()));
        editor.putString(hash + "_link", "https://telegram.me/" + username + (TextUtils.isEmpty(short_name) ? "" : "?game=" + short_name));
        editor.commit();
        Browser.openUrl(parentActivity, url, false);
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:42,代码来源:WebviewActivity.java

示例9: didClickedImage

import org.telegram.messenger.browser.Browser; //导入方法依赖的package包/类
private void didClickedImage() {
    if (currentMessageObject.type == 1 || currentMessageObject.type == 13) {
        if (buttonState == -1) {
            delegate.didPressedImage(this);
        } else if (buttonState == 0) {
            didPressedButton(false);
        }
    } else if (currentMessageObject.type == 12) {
        TLRPC.User user = MessagesController.getInstance().getUser(currentMessageObject.messageOwner.media.user_id);
        delegate.didPressedUserAvatar(this, user);
    } else if (currentMessageObject.type == 8) {
        if (buttonState == -1) {
            if (MediaController.getInstance().canAutoplayGifs()) {
                delegate.didPressedImage(this);
            } else {
                buttonState = 2;
                currentMessageObject.audioProgress = 1;
                photoImage.setAllowStartAnimation(false);
                photoImage.stopAnimation();
                radialProgress.setBackground(getDrawableForCurrentState(), false, false);
                invalidate();
            }
        } else if (buttonState == 2 || buttonState == 0) {
            didPressedButton(false);
        }
    } else if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) {
        if (buttonState == 0 || buttonState == 3) {
            didPressedButton(false);
        }
    } else if (currentMessageObject.type == 4) {
        delegate.didPressedImage(this);
    } else if (documentAttachType == DOCUMENT_ATTACH_TYPE_DOCUMENT) {
        if (buttonState == -1) {
            delegate.didPressedImage(this);
        }
    } else if (documentAttachType == DOCUMENT_ATTACH_TYPE_GIF) {
        if (buttonState == -1) {
            TLRPC.WebPage webPage = currentMessageObject.messageOwner.media.webpage;
            if (webPage != null) {
                if (Build.VERSION.SDK_INT >= 16 && webPage.embed_url != null && webPage.embed_url.length() != 0) {
                    delegate.needOpenWebView(webPage.embed_url, webPage.site_name, webPage.description, webPage.url, webPage.embed_width, webPage.embed_height);
                } else {
                    Browser.openUrl(getContext(), webPage.url);
                }
            }
        }
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:49,代码来源:ChatMessageCell.java

示例10: openGameInBrowser

import org.telegram.messenger.browser.Browser; //导入方法依赖的package包/类
public static void openGameInBrowser(String urlStr, MessageObject messageObject, Activity parentActivity, String short_name, String username) {
    try {
        String url = urlStr;
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("botshare", Activity.MODE_PRIVATE);
        String existing = sharedPreferences.getString("" + messageObject.getId(), null);
        StringBuilder hash = new StringBuilder(existing != null ? existing : "");
        StringBuilder addHash = new StringBuilder("tgShareScoreUrl=" + URLEncoder.encode("tgb://share_game_score?hash=", "UTF-8"));
        if (existing == null) {
            final char[] chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
            for (int i = 0; i < 20; i++) {
                hash.append(chars[Utilities.random.nextInt(chars.length)]);
            }
        }
        addHash.append(hash);
        int index = url.indexOf('#');
        if (index < 0) {
            url += "#" + addHash;
        } else {
            String curHash = url.substring(index + 1);
            if (curHash.indexOf('=') >= 0 || curHash.indexOf('?') >= 0) {
                url += "&" + addHash;
            } else {
                if (curHash.length() > 0) {
                    url += "?" + addHash;
                } else {
                    url += addHash;
                }
            }
        }
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putInt(hash + "_date", (int) (System.currentTimeMillis() / 1000));
        SerializedData serializedData = new SerializedData(messageObject.messageOwner.getObjectSize());
        messageObject.messageOwner.serializeToStream(serializedData);
        editor.putString(hash + "_m", Utilities.bytesToHex(serializedData.toByteArray()));
        editor.putString(hash + "_link", "https://" + MessagesController.getInstance().linkPrefix + "/" + username + (TextUtils.isEmpty(short_name) ? "" : "?game=" + short_name));
        editor.commit();
        Browser.openUrl(parentActivity, url, false);
    } catch (Exception e) {
        FileLog.e(e);
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:42,代码来源:WebviewActivity.java

示例11: didClickedImage

import org.telegram.messenger.browser.Browser; //导入方法依赖的package包/类
private void didClickedImage() {
    if (currentMessageObject.type == 1 || currentMessageObject.type == 13) {
        if (buttonState == -1) {
            delegate.didPressedImage(this);
        } else if (buttonState == 0) {
            didPressedButton(false);
        }
    } else if (currentMessageObject.type == 12) {
        TLRPC.User user = MessagesController.getInstance().getUser(currentMessageObject.messageOwner.media.user_id);
        delegate.didPressedUserAvatar(this, user);
    } else if (currentMessageObject.type == 5) {
        if (!MediaController.getInstance().isPlayingMessage(currentMessageObject) || MediaController.getInstance().isMessagePaused()) {
            delegate.needPlayMessage(currentMessageObject);
        } else {
            MediaController.getInstance().pauseMessage(currentMessageObject);
        }
    } else if (currentMessageObject.type == 8) {
        if (buttonState == -1) {
            if (MediaController.getInstance().canAutoplayGifs()) {
                delegate.didPressedImage(this);
            } else {
                buttonState = 2;
                currentMessageObject.gifState = 1;
                photoImage.setAllowStartAnimation(false);
                photoImage.stopAnimation();
                radialProgress.setBackground(getDrawableForCurrentState(), false, false);
                invalidate();
            }
        } else if (buttonState == 2 || buttonState == 0) {
            didPressedButton(false);
        }
    } else if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) {
        if (buttonState == -1) {
            delegate.didPressedImage(this);
        } else if (buttonState == 0 || buttonState == 3) {
            didPressedButton(false);
        }
    } else if (currentMessageObject.type == 4) {
        delegate.didPressedImage(this);
    } else if (documentAttachType == DOCUMENT_ATTACH_TYPE_DOCUMENT) {
        if (buttonState == -1) {
            delegate.didPressedImage(this);
        }
    } else if (documentAttachType == DOCUMENT_ATTACH_TYPE_GIF) {
        if (buttonState == -1) {
            TLRPC.WebPage webPage = currentMessageObject.messageOwner.media.webpage;
            if (webPage != null) {
                if (webPage.embed_url != null && webPage.embed_url.length() != 0) {
                    delegate.needOpenWebView(webPage.embed_url, webPage.site_name, webPage.description, webPage.url, webPage.embed_width, webPage.embed_height);
                } else {
                    Browser.openUrl(getContext(), webPage.url);
                }
            }
        }
    } else if (hasInvoicePreview) {
        if (buttonState == -1) {
            delegate.didPressedImage(this);
        }
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:61,代码来源:ChatMessageCell.java


注:本文中的org.telegram.messenger.browser.Browser.openUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。