本文整理汇总了Java中android.app.RemoteInput类的典型用法代码示例。如果您正苦于以下问题:Java RemoteInput类的具体用法?Java RemoteInput怎么用?Java RemoteInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RemoteInput类属于android.app包,在下文中一共展示了RemoteInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: send
import android.app.RemoteInput; //导入依赖的package包/类
public static void send(String room, String message) throws IllegalArgumentException { // @author ManDongI
Notification.Action session = null;
for(KakaoData data : KakaoManager.getInstance().getDataList().toArray(new KakaoData[0])) {
if(data.room.equals(room)) {
session = data.session;
break;
}
}
if(session == null) {
throw new IllegalArgumentException("Can't find the room");
}
Intent sendIntent = new Intent();
Bundle msg = new Bundle();
for (RemoteInput inputable : session.getRemoteInputs()) msg.putCharSequence(inputable.getResultKey(), message);
RemoteInput.addResultsToIntent(session.getRemoteInputs(), sendIntent, msg);
try {
session.actionIntent.send(context, 0, sendIntent);
Logger.Log log = new Logger.Log();
log.type = Logger.Type.APP;
log.title = "send message";
log.index = "room: " + room +"\nmessage: " + message;
Logger.getInstance().add(log);
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例2: send
import android.app.RemoteInput; //导入依赖的package包/类
public static void send(String room, String message) throws IllegalArgumentException { // @author ManDongI
Notification.Action session = null;
for(Session i : sessions) {
if(i.room.equals(room)) {
session = i.session;
break;
}
}
if(session == null) {
throw new IllegalArgumentException("Can't find the room");
}
Intent sendIntent = new Intent();
Bundle msg = new Bundle();
for (RemoteInput inputable : session.getRemoteInputs()) msg.putCharSequence(inputable.getResultKey(), message);
RemoteInput.addResultsToIntent(session.getRemoteInputs(), sendIntent, msg);
try {
session.actionIntent.send(context, 0, sendIntent);
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
示例3: fromCompat
import android.app.RemoteInput; //导入依赖的package包/类
static RemoteInput[] fromCompat(RemoteInputCompatBase.RemoteInput[] srcArray) {
if (srcArray == null) {
return null;
}
RemoteInput[] result = new RemoteInput[srcArray.length];
for (int i = 0; i < srcArray.length; i++) {
RemoteInputCompatBase.RemoteInput src = srcArray[i];
result[i] = new RemoteInput.Builder(src.getResultKey())
.setLabel(src.getLabel())
.setChoices(src.getChoices())
.setAllowFreeFormInput(src.getAllowFreeFormInput())
.addExtras(src.getExtras())
.build();
}
return result;
}
示例4: onReceive
import android.app.RemoteInput; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
// Get remote input
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
// Exit if remote input is null (always true for API < 24)
if (remoteInput == null) {
return;
}
// Get reply text
String reply = remoteInput.getString(KEY_TEXT_REPLY);
// Create reply notification
Notification replyNotification =
new Notification.Builder(context)
.setSmallIcon(R.drawable.ic_notifications_active_black_24dp)
.setContentTitle("Reply received!")
.setContentText(reply)
.build();
// Send reply notification
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(REPLY_NOTIFICATION_ID, replyNotification);
}
示例5: fromCompat
import android.app.RemoteInput; //导入依赖的package包/类
static RemoteInput[] fromCompat(RemoteInputCompatBase.RemoteInput[] paramArrayOfRemoteInput)
{
RemoteInput[] arrayOfRemoteInput;
if (paramArrayOfRemoteInput == null) {
arrayOfRemoteInput = null;
}
for (;;)
{
return arrayOfRemoteInput;
arrayOfRemoteInput = new RemoteInput[paramArrayOfRemoteInput.length];
for (int i = 0; i < paramArrayOfRemoteInput.length; i++)
{
RemoteInputCompatBase.RemoteInput localRemoteInput = paramArrayOfRemoteInput[i];
arrayOfRemoteInput[i] = new RemoteInput.Builder(localRemoteInput.getResultKey()).setLabel(localRemoteInput.getLabel()).setChoices(localRemoteInput.getChoices()).setAllowFreeFormInput(localRemoteInput.getAllowFreeFormInput()).addExtras(localRemoteInput.getExtras()).build();
}
}
}
示例6: addAction
import android.app.RemoteInput; //导入依赖的package包/类
public static void addAction(Notification.Builder paramBuilder, NotificationCompatBase.Action paramAction)
{
Notification.Action.Builder localBuilder = new Notification.Action.Builder(paramAction.getIcon(), paramAction.getTitle(), paramAction.getActionIntent());
if (paramAction.getRemoteInputs() != null)
{
RemoteInput[] arrayOfRemoteInput = RemoteInputCompatApi20.fromCompat(paramAction.getRemoteInputs());
int i = arrayOfRemoteInput.length;
for (int j = 0; j < i; j++) {
localBuilder.addRemoteInput(arrayOfRemoteInput[j]);
}
}
if (paramAction.getExtras() != null) {
localBuilder.addExtras(paramAction.getExtras());
}
paramBuilder.addAction(localBuilder.build());
}
示例7: a
import android.app.RemoteInput; //导入依赖的package包/类
public static void a(Notification.Builder paramBuilder, ea paramea)
{
Notification.Action.Builder localBuilder = new Notification.Action.Builder(paramea.a(), paramea.b(), paramea.c());
if (paramea.e() != null)
{
RemoteInput[] arrayOfRemoteInput = a(paramea.e());
int i1 = arrayOfRemoteInput.length;
for (int i2 = 0; i2 < i1; i2++) {
localBuilder.addRemoteInput(arrayOfRemoteInput[i2]);
}
}
if (paramea.d() != null) {
localBuilder.addExtras(paramea.d());
}
paramBuilder.addAction(localBuilder.build());
}
示例8: getNotificationReply
import android.app.RemoteInput; //导入依赖的package包/类
@Nullable
static String getNotificationReply(Intent intent) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
// RemoteInput was added in KITKAT_WATCH.
if (intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_REPLY) != null) {
// If the notification click went through the job scheduler, we will have set
// the reply as a standard string extra.
return intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_REPLY);
}
Bundle remoteInputResults = RemoteInput.getResultsFromIntent(intent);
if (remoteInputResults != null) {
CharSequence reply =
remoteInputResults.getCharSequence(NotificationConstants.KEY_TEXT_REPLY);
if (reply != null) {
return reply.toString();
}
}
}
return null;
}
示例9: fromCompat
import android.app.RemoteInput; //导入依赖的package包/类
static RemoteInput[] fromCompat(RemoteInputCompatBase.RemoteInput aremoteinput[])
{
if (aremoteinput != null) goto _L2; else goto _L1
_L1:
RemoteInput aremoteinput1[] = null;
_L4:
return aremoteinput1;
_L2:
RemoteInput aremoteinput2[] = new RemoteInput[aremoteinput.length];
int i = 0;
do
{
aremoteinput1 = aremoteinput2;
if (i >= aremoteinput.length)
{
continue;
}
RemoteInputCompatBase.RemoteInput remoteinput = aremoteinput[i];
aremoteinput2[i] = (new android.app.RemoteInput.Builder(remoteinput.getResultKey())).setLabel(remoteinput.getLabel()).setChoices(remoteinput.getChoices()).setAllowFreeFormInput(remoteinput.getAllowFreeFormInput()).addExtras(remoteinput.getExtras()).build();
i++;
} while (true);
if (true) goto _L4; else goto _L3
_L3:
}
示例10: toCompat
import android.app.RemoteInput; //导入依赖的package包/类
static RemoteInputCompatBase.RemoteInput[] toCompat(RemoteInput aremoteinput[], RemoteInputCompatBase.RemoteInput.Factory factory)
{
if (aremoteinput != null) goto _L2; else goto _L1
_L1:
RemoteInputCompatBase.RemoteInput aremoteinput1[] = null;
_L4:
return aremoteinput1;
_L2:
RemoteInputCompatBase.RemoteInput aremoteinput2[] = factory.newArray(aremoteinput.length);
int i = 0;
do
{
aremoteinput1 = aremoteinput2;
if (i >= aremoteinput.length)
{
continue;
}
RemoteInput remoteinput = aremoteinput[i];
aremoteinput2[i] = factory.build(remoteinput.getResultKey(), remoteinput.getLabel(), remoteinput.getChoices(), remoteinput.getAllowFreeFormInput(), remoteinput.getExtras());
i++;
} while (true);
if (true) goto _L4; else goto _L3
_L3:
}
示例11: getNotificationReply
import android.app.RemoteInput; //导入依赖的package包/类
@Nullable
private static String getNotificationReply(Intent intent) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
// RemoteInput was added in KITKAT_WATCH.
Bundle remoteInputResults = RemoteInput.getResultsFromIntent(intent);
if (remoteInputResults != null) {
CharSequence reply =
remoteInputResults.getCharSequence(NotificationConstants.KEY_TEXT_REPLY);
if (reply != null) {
return reply.toString();
}
}
}
return null;
}
示例12: addAction
import android.app.RemoteInput; //导入依赖的package包/类
public static void addAction(android.app.Notification.Builder b, Action action) {
android.app.Notification.Action.Builder actionBuilder = new android.app.Notification.Action.Builder(action.getIcon(), action.getTitle(), action.getActionIntent());
if (action.getRemoteInputs() != null) {
for (RemoteInput remoteInput : RemoteInputCompatApi20.fromCompat(action.getRemoteInputs())) {
actionBuilder.addRemoteInput(remoteInput);
}
}
if (action.getExtras() != null) {
actionBuilder.addExtras(action.getExtras());
}
b.addAction(actionBuilder.build());
}
示例13: getActionFromActionCompat
import android.app.RemoteInput; //导入依赖的package包/类
private static Notification.Action getActionFromActionCompat(Action actionCompat) {
android.app.Notification.Action.Builder actionBuilder = new android.app.Notification.Action.Builder(actionCompat.getIcon(), actionCompat.getTitle(), actionCompat.getActionIntent()).addExtras(actionCompat.getExtras());
RemoteInputCompatBase.RemoteInput[] remoteInputCompats = actionCompat.getRemoteInputs();
if (remoteInputCompats != null) {
for (RemoteInput remoteInput : RemoteInputCompatApi20.fromCompat(remoteInputCompats)) {
actionBuilder.addRemoteInput(remoteInput);
}
}
return actionBuilder.build();
}
示例14: getActionsFromParcelableArrayList
import android.app.RemoteInput; //导入依赖的package包/类
public static Action[] getActionsFromParcelableArrayList(ArrayList<Parcelable> parcelables, Factory actionFactory, RemoteInputCompatBase.RemoteInput.Factory remoteInputFactory) {
if (parcelables == null) {
return null;
}
Action[] actions = actionFactory.newArray(parcelables.size());
for (int i = 0; i < actions.length; i++) {
actions[i] = getActionCompatFromAction((Notification.Action) parcelables.get(i), actionFactory, remoteInputFactory);
}
return actions;
}
示例15: toCompat
import android.app.RemoteInput; //导入依赖的package包/类
static RemoteInputCompatBase.RemoteInput[] toCompat(RemoteInput[] srcArray,
RemoteInputCompatBase.RemoteInput.Factory factory) {
if (srcArray == null) {
return null;
}
RemoteInputCompatBase.RemoteInput[] result = factory.newArray(srcArray.length);
for (int i = 0; i < srcArray.length; i++) {
RemoteInput src = srcArray[i];
result[i] = factory.build(src.getResultKey(), src.getLabel(), src.getChoices(),
src.getAllowFreeFormInput(), src.getExtras());
}
return result;
}