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


Java ClipboardManager.OnPrimaryClipChangedListener方法代碼示例

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


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

示例1: onCreate

import android.content.ClipboardManager; //導入方法依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();

    context=getApplicationContext();

    mClipboard = (ClipboardManager) context.getSystemService(CLIPBOARD_SERVICE);
    notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    createNotificationChannel();


    listener = new ClipboardManager.OnPrimaryClipChangedListener() {
        public void onPrimaryClipChanged() {
            performClipboardCheck();
        }
    };
}
 
開發者ID:emmanuelkehinde,項目名稱:TwittaSave-Android,代碼行數:18,代碼來源:AutoListenService.java

示例2: readyClipboard

import android.content.ClipboardManager; //導入方法依賴的package包/類
private void readyClipboard(ClipboardManager.OnPrimaryClipChangedListener listener) {
    ClipboardManager clipboardManager = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
    if (null != mPrimaryClipChangedListener) {
        clipboardManager.removePrimaryClipChangedListener(mPrimaryClipChangedListener);
    }
    mPrimaryClipChangedListener = listener;
    clipboardManager.addPrimaryClipChangedListener(mPrimaryClipChangedListener);
}
 
開發者ID:littleRich,項目名稱:AutoInteraction-Library,代碼行數:9,代碼來源:QQSimulateBusiness.java

示例3: onStartCommand

import android.content.ClipboardManager; //導入方法依賴的package包/類
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    //super.onStartCommand(intent, flags, startId);
    if((intent!=null)&&(intent.hasExtra(INSTASHARE_MESSAGE))){
        switch (intent.getIntExtra(INSTASHARE_MESSAGE,DO_NONE)) {
            case START:
                if (mOnPrimaryClipChangedListener == null){
                    mOnPrimaryClipChangedListener =
                        new ClipboardManager.OnPrimaryClipChangedListener() {
                            @Override
                            public void onPrimaryClipChanged() {
                                Log.d(TAG, "onPrimaryClipChanged");
                                ClipData clip = mClipboardManager.getPrimaryClip();
                                CharSequence mTextToWrite = clip.getItemAt(0).getText();
                                new RetrieveUrlTask().execute(mTextToWrite.toString());
                            }
                        };
                    mClipboardManager.addPrimaryClipChangedListener(
                            mOnPrimaryClipChangedListener);
                }
                showNotification();
                Intent startintent = new Intent(BROADCAST_MESSAGE_INSTASHARE);
                startintent.putExtra(INSTASHARE_MONITORING, true);
                sendBroadcast(startintent);
                break;
            case GET_INFO:
                boolean bmonitoring = (mOnPrimaryClipChangedListener != null);
                Intent getinfo = new Intent(BROADCAST_MESSAGE_INSTASHARE);
                getinfo.putExtra(INSTASHARE_MONITORING, bmonitoring);
                sendBroadcast(getinfo);
                break;
        }
    }
    return START_STICKY;
}
 
開發者ID:atareao,項目名稱:InstaShare,代碼行數:36,代碼來源:ClipboardMonitorService.java

示例4: createListener

import android.content.ClipboardManager; //導入方法依賴的package包/類
/**
 * The implementation will be invoked in constructor.
 * It should not assume the instance is fully initialized yet.
 *
 */
abstract protected ClipboardManager.OnPrimaryClipChangedListener createListener();
 
開發者ID:orionlee,項目名稱:aDictOnCopy,代碼行數:7,代碼來源:ClipChangedListenerService.java


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