當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。