本文整理汇总了Java中android.content.ClipboardManager.OnPrimaryClipChangedListener类的典型用法代码示例。如果您正苦于以下问题:Java OnPrimaryClipChangedListener类的具体用法?Java OnPrimaryClipChangedListener怎么用?Java OnPrimaryClipChangedListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnPrimaryClipChangedListener类属于android.content.ClipboardManager包,在下文中一共展示了OnPrimaryClipChangedListener类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import android.content.ClipboardManager.OnPrimaryClipChangedListener; //导入依赖的package包/类
@Override public void call(final Subscriber<? super String> subscriber) {
final OnPrimaryClipChangedListener listener = new OnPrimaryClipChangedListener() {
@Override public void onPrimaryClipChanged() {
if (!subscriber.isUnsubscribed()) {
propagate(subscriber);
}
}
};
clipboard.addPrimaryClipChangedListener(listener);
subscriber.add(new BaseUnsubscription() {
@Override protected void onUnsubscribe() {
clipboard.removePrimaryClipChangedListener(listener);
}
});
propagate(subscriber);
}
示例2: call
import android.content.ClipboardManager.OnPrimaryClipChangedListener; //导入依赖的package包/类
@Override public void call(final Subscriber<? super Intent> subscriber) {
final OnPrimaryClipChangedListener listener = new OnPrimaryClipChangedListener() {
@Override public void onPrimaryClipChanged() {
if (!subscriber.isUnsubscribed()) {
propagate(subscriber);
}
}
};
clipboard.addPrimaryClipChangedListener(listener);
subscriber.add(new BaseUnsubscription() {
@Override protected void onUnsubscribe() {
clipboard.removePrimaryClipChangedListener(listener);
}
});
propagate(subscriber);
}
示例3: call
import android.content.ClipboardManager.OnPrimaryClipChangedListener; //导入依赖的package包/类
@Override public void call(final Subscriber<? super ClipData> subscriber) {
final OnPrimaryClipChangedListener listener = new OnPrimaryClipChangedListener() {
@Override public void onPrimaryClipChanged() {
if (!subscriber.isUnsubscribed()) {
propagate(subscriber);
}
}
};
clipboard.addPrimaryClipChangedListener(listener);
subscriber.add(new BaseUnsubscription() {
@Override protected void onUnsubscribe() {
clipboard.removePrimaryClipChangedListener(listener);
}
});
propagate(subscriber);
}
示例4: call
import android.content.ClipboardManager.OnPrimaryClipChangedListener; //导入依赖的package包/类
@Override public void call(final Subscriber<? super Uri> subscriber) {
final OnPrimaryClipChangedListener listener = new OnPrimaryClipChangedListener() {
@Override public void onPrimaryClipChanged() {
if (!subscriber.isUnsubscribed()) {
propagate(subscriber);
}
}
};
clipboard.addPrimaryClipChangedListener(listener);
subscriber.add(new BaseUnsubscription() {
@Override protected void onUnsubscribe() {
clipboard.removePrimaryClipChangedListener(listener);
}
});
propagate(subscriber);
}
示例5: createListener
import android.content.ClipboardManager.OnPrimaryClipChangedListener; //导入依赖的package包/类
@Override
protected OnPrimaryClipChangedListener createListener() {
return new OnPrimaryClipChangedListener() {
public void onPrimaryClipChanged() {
performClipboardCheck();
}
};
}
示例6: setListener
import android.content.ClipboardManager.OnPrimaryClipChangedListener; //导入依赖的package包/类
public void setListener(final Context context, final Runnable listener)
{
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(context.CLIPBOARD_SERVICE);
clipboard.addPrimaryClipChangedListener(new OnPrimaryClipChangedListener()
{
public void onPrimaryClipChanged()
{
listener.run();
}
});
}
示例7: setPrimaryClip
import android.content.ClipboardManager.OnPrimaryClipChangedListener; //导入依赖的package包/类
@Implementation
public void setPrimaryClip(ClipData clip) {
if (clip != null) {
clip.prepareToLeaveProcess();
}
this.clip = clip;
for (OnPrimaryClipChangedListener listener : listeners) {
listener.onPrimaryClipChanged();
}
}
示例8: addPrimaryClipChangedListener
import android.content.ClipboardManager.OnPrimaryClipChangedListener; //导入依赖的package包/类
@Implementation
public void addPrimaryClipChangedListener(OnPrimaryClipChangedListener listener) {
listeners.add(listener);
}
示例9: removePrimaryClipChangedListener
import android.content.ClipboardManager.OnPrimaryClipChangedListener; //导入依赖的package包/类
@Implementation
public void removePrimaryClipChangedListener(OnPrimaryClipChangedListener listener) {
listeners.remove(listener);
}