當前位置: 首頁>>代碼示例>>Java>>正文


Java Message.setTarget方法代碼示例

本文整理匯總了Java中android.os.Message.setTarget方法的典型用法代碼示例。如果您正苦於以下問題:Java Message.setTarget方法的具體用法?Java Message.setTarget怎麽用?Java Message.setTarget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.os.Message的用法示例。


在下文中一共展示了Message.setTarget方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onLongPress

import android.os.Message; //導入方法依賴的package包/類
@Override
/**
 * handles long presses for the browser, tries to get the
 * url of the item that was clicked and sends it (it can be null)
 * to the click handler that does cool stuff with it
 */
public void onLongPress() {
	if (mClickHandler == null) {
		mClickHandler = new ClickHandler(mActivity);
	}
	Message click = mClickHandler.obtainMessage();
	if (click != null) {
		click.setTarget(mClickHandler);
		getCurrentWebView().getWebView().requestFocusNodeHref(click);
	}
}
 
開發者ID:NewCasino,項目名稱:browser,代碼行數:17,代碼來源:BrowserActivity.java

示例2: initScriptsFramework

import android.os.Message; //導入方法依賴的package包/類
/**
 * Initialize JavaScript framework
 * @param framework String representation of the framework to be init.
 */
public synchronized void initScriptsFramework(String framework) {
  Message msg = mJSHandler.obtainMessage();
  msg.obj = framework;
  msg.what = WXJSBridgeMsgType.INIT_FRAMEWORK;
  msg.setTarget(mJSHandler);
  msg.sendToTarget();
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:12,代碼來源:WXBridgeManager.java

示例3: takeJSHeapSnapshot

import android.os.Message; //導入方法依賴的package包/類
public void takeJSHeapSnapshot(String filename) {
  Message msg = mJSHandler.obtainMessage();
  msg.obj = filename;
  msg.what = WXJSBridgeMsgType.TAKE_HEAP_SNAPSHOT;
  msg.setTarget(mJSHandler);
  msg.sendToTarget();
}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:8,代碼來源:WXBridgeManager.java

示例4: onLongPress

import android.os.Message; //導入方法依賴的package包/類
@Override
public void onLongPress(MotionEvent e) {
    if (mCanTriggerLongPress) {
        Message msg = mWebViewHandler.obtainMessage();
        if (msg != null) {
            msg.setTarget(mWebViewHandler);
            if (mWebView == null) {
                return;
            }
            mWebView.requestFocusNodeHref(msg);
        }
    }
}
 
開發者ID:XndroidDev,項目名稱:Xndroid,代碼行數:14,代碼來源:LightningView.java

示例5: onLongClick

import android.os.Message; //導入方法依賴的package包/類
@Override
public boolean onLongClick(View v) {
    if (callback == null) {
        return false;
    }

    final AmazonWebView.HitTestResult hitTestResult = webView.getHitTestResult();

    switch (hitTestResult.getType()) {
        case AmazonWebView.HitTestResult.SRC_ANCHOR_TYPE:
            final String linkURL = hitTestResult.getExtra();
            callback.onLongPress(new IWebView.HitTarget(true, linkURL, false, null));
            return true;

        case AmazonWebView.HitTestResult.IMAGE_TYPE:
            final String imageURL = hitTestResult.getExtra();
            callback.onLongPress(new IWebView.HitTarget(false, null, true, imageURL));
            return true;

        case AmazonWebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE:
            // hitTestResult.getExtra() contains only the image URL, and not the link
            // URL. Internally, WebView's HitTestData contains both, but they only
            // make it available via requestFocusNodeHref...
            final Message message = new Message();
            message.setTarget(new Handler() {
                @Override
                public void handleMessage(Message msg) {
                    final Bundle data = msg.getData();
                    final String url = data.getString("url");
                    final String src = data.getString("src");

                    if (url == null || src == null) {
                        throw new IllegalStateException("WebView did not supply url or src for image link");
                    }

                    if (callback != null) {
                        callback.onLongPress(new IWebView.HitTarget(true, url, true, src));
                    }
                }
            });

            webView.requestFocusNodeHref(message);
            return true;

        default:
            return false;
    }
}
 
開發者ID:mozilla-mobile,項目名稱:firefox-tv,代碼行數:49,代碼來源:LinkHandler.java


注:本文中的android.os.Message.setTarget方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。