当前位置: 首页>>代码示例>>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;未经允许,请勿转载。