本文整理汇总了Java中android.support.wearable.activity.ConfirmationActivity类的典型用法代码示例。如果您正苦于以下问题:Java ConfirmationActivity类的具体用法?Java ConfirmationActivity怎么用?Java ConfirmationActivity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConfirmationActivity类属于android.support.wearable.activity包,在下文中一共展示了ConfirmationActivity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: snoozeAlarm
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
private void snoozeAlarm() {
Intent intent = new Intent(this, ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE,
ConfirmationActivity.SUCCESS_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE,
getString(R.string.alarm_snoozed));
startActivity(intent);
Intent alarmActivityIntent = new Intent(this, AlarmActivity.class);
alarmActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
alarmActivityIntent.putExtra(AlarmActivity.EXTRA_ALARM_COMMAND_BYTES, ParcelPacker.getData(alarmCommand));
startActivity(alarmActivityIntent);
PendingIntent alarmPendingIntent = PendingIntent.getActivity(this, 0, alarmActivityIntent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + alarmCommand.getSnoozeDuration(), alarmPendingIntent);
finish();
}
示例2: onPostExecute
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
@Override
protected void onPostExecute(Boolean success) {
Intent intent = new Intent(TimedMuteActivity.this, ConfirmationActivity.class);
if (success) {
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE,
ConfirmationActivity.SUCCESS_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE,
getString(R.string.timed_mute_success));
} else {
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE,
ConfirmationActivity.FAILURE_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE,
getString(R.string.timed_mute_fail));
}
startActivity(intent);
finish();
}
示例3: onPostExecute
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
@Override
protected void onPostExecute(Boolean success) {
Intent intent = new Intent(AppMuteActivity.this, ConfirmationActivity.class);
if (success) {
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE,
ConfirmationActivity.SUCCESS_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE,
getString(R.string.app_muted));
} else {
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE,
ConfirmationActivity.FAILURE_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE,
getString(R.string.timed_mute_fail));
}
startActivity(intent);
finish();
}
示例4: onButtonClicked
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
private void onButtonClicked()
{
PendingResult<DataApi.DataItemResult> pendingResult = Message.sendActionMessage(mGoogleApiClient);
pendingResult.setResultCallback(new ResultCallback<DataApi.DataItemResult>() {
@Override
public void onResult(@NonNull DataApi.DataItemResult dataItemResult) {
Message.emptyActionMessage(mGoogleApiClient);
}
});
Intent intent = new Intent(this, ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE,
ConfirmationActivity.SUCCESS_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE,
getString(R.string.action_sent));
startActivity(intent);
}
示例5: onTimerFinished
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
@Override
public void onTimerFinished(View view) {
Intent intent = new Intent(this, ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, ConfirmationActivity.SUCCESS_ANIMATION);
switch (mActionMode) {
case ACTION_MODE_CLOSE_SUNROOF:
EventBus.getDefault().post(new ToHandHoldRequestEvent(WEAR_CLOSE_SUNROOF));
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, getString(R.string.notification_bad_weather_confirmation_done));
break;
case ACTION_MODE_LOCK_DOOR:
EventBus.getDefault().post(new ToHandHoldRequestEvent(WEAR_ACTION_DOOR_LOCK));
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, getString(R.string.notification_car_unlocked_confirmation_done));
break;
case ACTION_MODE_START_CHARGING:
EventBus.getDefault().post(new ToHandHoldRequestEvent(WEAR_ACTION_CHARGING_START));
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, getString(R.string.notification_unexpected_charge_stop_confirmation_done));
break;
}
startActivity(intent);
finish();
}
示例6: onStartCommand
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null && intent.getAction() != null) {
if ("open_ticket".equals(intent.getAction())) {
final Ticket t = (Ticket)intent.getExtras().getSerializable("ticket");
sendMessage("openTicket/" + t.getId(), null);
Intent confirmationIntent = new Intent(this, ConfirmationActivity.class);
confirmationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
confirmationIntent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, ConfirmationActivity.OPEN_ON_PHONE_ANIMATION);
startActivity(confirmationIntent);
}
}
return super.onStartCommand(intent, flags, startId);
}
示例7: performActionWhenConnected
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
public static void performActionWhenConnected (final Activity context, GoogleApiClient.ConnectionCallbacks action)
{
if (mGoogleApiClient != null && mGoogleApiClient.isConnected())
{
action.onConnected(null);
}
else {
mGoogleApiClient = new GoogleApiClient.Builder(context)
.addConnectionCallbacks(action)
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult result) {
Intent intent = new Intent(context, ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, ConfirmationActivity.FAILURE_ANIMATION);
context.startActivity(intent);
}
})
.addApi(Wearable.API)
.build();
mGoogleApiClient.connect();
}
}
示例8: sendMessage
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
@Override
public void sendMessage(String path, @Nullable byte[] data) {
Log.v(TAG, String.format("...to node %s", mobileNodeId));
Wearable.MessageApi.sendMessage(googleApiClient, mobileNodeId, path, data).setResultCallback(new ResultCallback<MessageApi.SendMessageResult>() {
@Override
public void onResult(MessageApi.SendMessageResult sendMessageResult) {
if (sendMessageResult.getStatus().isSuccess()) {
Log.v(TAG, "Successful send");
// intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, ConfirmationActivity.SUCCESS_ANIMATION);
// intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, mActivity.getString(R.string.message_sent));
} else {
Log.v(TAG, "Send error");
Intent intent = new Intent(mActivity.getApplicationContext(), ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, ConfirmationActivity.FAILURE_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, mActivity.getString(R.string.send_error));
mActivity.startActivity(intent);
}
}
});
}
示例9: onTimerFinished
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
@Override
public void onTimerFinished(View view) {
mIsAnimating = false;
final Activity activity = getActivity();
if (activity == null) {
Log.e(TAG_LOG, "Fragment not attached anymore to the activity (Skipping action).");
return;
}
// Updating the book state
final long bookId = getArguments().getLong(ARG_ID);
BookService.Invoker.get(activity).bookId(bookId).owned(true).invoke();
// Starting the confirmation screen
Intent intent = new Intent(activity, ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, ConfirmationActivity.SUCCESS_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, getString(R.string.item_purchased));
startActivity(intent);
activity.finish();
}
示例10: getOpenOnPhonePendingIntent
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
private PendingIntent getOpenOnPhonePendingIntent(String permalink,
boolean openOnPhoneDismisses,
int notificationId) {
Intent openOnPhone = new Intent(this, ActionReceiver.class);
openOnPhone.putExtra(Constants.KEY_PATH, Constants.PATH_OPEN_ON_PHONE);
openOnPhone.putExtra(Constants.KEY_CONFIRMATION_MESSAGE, getString(R.string.open_on_phone));
openOnPhone.putExtra(Constants.KEY_CONFIRMATION_ANIMATION,
ConfirmationActivity.SUCCESS_ANIMATION);
openOnPhone.putExtra(Constants.KEY_POST_PERMALINK, permalink);
openOnPhone.putExtra(Constants.KEY_DISMISS_AFTER_ACTION, openOnPhoneDismisses);
openOnPhone.putExtra(Constants.KEY_NOTIFICATION_ID, notificationId);
return PendingIntent.getBroadcast(this,
REQUEST_CODE_OPEN_ON_PHONE + notificationId,
openOnPhone,
PendingIntent.FLAG_UPDATE_CURRENT);
}
示例11: onTimerFinished
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
@Override
public void onTimerFinished(View view) {
// save only if user hasn't canceled
if(!this.isFinishing()) {
saveClimb();
String savedString = getString(R.string.climb_saved, routeGradeLabelToSave);
Intent intent = new Intent(this, ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, ConfirmationActivity.SUCCESS_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, savedString);
startActivity(intent);
}
finish();
}
示例12: showOpenOnPhoneAnimation
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
private void showOpenOnPhoneAnimation() {
Intent intent = new Intent(this, ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, ConfirmationActivity.OPEN_ON_PHONE_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, getString(R.string.notification_openedOnPhone));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
示例13: onSuccess
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
@Override
public void onSuccess() {
final Intent intent = new Intent(ControlActivity.this, ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE,
ConfirmationActivity.SUCCESS_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, getString(R.string.sound_profile_change_confirmation));
startActivity(intent);
finish();
}
示例14: onFailure
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
@Override
public void onFailure() {
final Intent intent = new Intent(ControlActivity.this, ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE,
ConfirmationActivity.FAILURE_ANIMATION);
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, getString(R.string.sound_profile_change_failure));
startActivity(intent);
}
示例15: startAction
import android.support.wearable.activity.ConfirmationActivity; //导入依赖的package包/类
/**
* Use the Wear Message API to execute an action. Clears local and remote notifications and
* also runs a confirmation animation before finishing the Wear activity.
*
* @param attraction The attraction to start the action on
* @param pathName The Wear Message API pathname
* @param confirmAnimationType The confirmation animation type from ConfirmationActivity
*/
private void startAction(Attraction attraction, String pathName, int confirmAnimationType) {
Intent intent = new Intent(mActivity, ConfirmationActivity.class);
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, confirmAnimationType);
mActivity.startActivity(intent);
UtilityService.clearNotification(mActivity);
UtilityService.clearRemoteNotifications(mActivity);
UtilityService.startDeviceActivity(mActivity, pathName, attraction.name, attraction.city);
((Activity) mActivity).finish();
}