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


Java ShareAlert类代码示例

本文整理汇总了Java中org.telegram.ui.Components.ShareAlert的典型用法代码示例。如果您正苦于以下问题:Java ShareAlert类的具体用法?Java ShareAlert怎么用?Java ShareAlert使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: postEvent

import org.telegram.ui.Components.ShareAlert; //导入依赖的package包/类
@JavascriptInterface
public void postEvent(final String eventName, final String eventData) {
    AndroidUtilities.runOnUIThread(new Runnable() {
        @Override
        public void run() {
            if (getParentActivity() == null) {
                return;
            }
            FileLog.e("tmessages", eventName);
            switch (eventName) {
                case "share_game":
                    currentMessageObject.messageOwner.with_my_score = false;
                    break;
                case "share_score":
                    currentMessageObject.messageOwner.with_my_score = true;
                    break;
            }
            showDialog2(new ShareAlert(getParentActivity(), currentMessageObject, null, false, linkToCopy));

        }
    });
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:23,代码来源:WebviewActivity.java

示例2: postEvent

import org.telegram.ui.Components.ShareAlert; //导入依赖的package包/类
@JavascriptInterface
public void postEvent(final String eventName, final String eventData) {
    AndroidUtilities.runOnUIThread(new Runnable() {
        @Override
        public void run() {
            if (getParentActivity() == null) {
                return;
            }
            FileLog.e(eventName);
            switch (eventName) {
                case "share_game":
                    currentMessageObject.messageOwner.with_my_score = false;
                    break;
                case "share_score":
                    currentMessageObject.messageOwner.with_my_score = true;
                    break;
            }
            showDialog(ShareAlert.createShareAlert(getParentActivity(), currentMessageObject, null, false, linkToCopy, false));
        }
    });
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:22,代码来源:WebviewActivity.java

示例3: onCreate

import org.telegram.ui.Components.ShareAlert; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    ApplicationLoader.postInitApplication();
    AndroidUtilities.checkDisplaySize(this, getResources().getConfiguration());
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setTheme(R.style.Theme_TMessages_Transparent);
    super.onCreate(savedInstanceState);
    setContentView(new View(this), new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    Intent intent = getIntent();
    if (intent == null || !Intent.ACTION_VIEW.equals(intent.getAction()) || intent.getData() == null) {
        finish();
        return;
    }
    Uri data = intent.getData();
    String scheme = data.getScheme();
    String url = data.toString();
    String hash = data.getQueryParameter("hash");
    if (!"tgb".equals(scheme) || !url.toLowerCase().startsWith("tgb://share_game_score") || TextUtils.isEmpty(hash)) {
        finish();
        return;
    }

    SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("botshare", Activity.MODE_PRIVATE);
    String message = sharedPreferences.getString(hash + "_m", null);
    if (TextUtils.isEmpty(message)) {
        finish();
        return;
    }
    SerializedData serializedData = new SerializedData(Utilities.hexToBytes(message));
    TLRPC.Message mess = TLRPC.Message.TLdeserialize(serializedData, serializedData.readInt32(false), false);
    if (mess == null) {
        finish();
        return;
    }
    String link = sharedPreferences.getString(hash + "_link", null);
    MessageObject messageObject = new MessageObject(mess, null, false);
    messageObject.messageOwner.with_my_score = true;

    try {
        visibleDialog = ShareAlert.createShareAlert(this, messageObject, null, false, link, false);
        visibleDialog.setCanceledOnTouchOutside(true);
        visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                if (!isFinishing()) {
                    finish();
                }
                visibleDialog = null;
            }
        });
        visibleDialog.show();
    } catch (Exception e) {
        FileLog.e(e);
        finish();
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:58,代码来源:ShareActivity.java


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