android.support.wearable.view.DelayedConfirmationView Java Examples

The following examples show how to use android.support.wearable.view.DelayedConfirmationView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfirmationNotificationActivity.java    From rnd-android-wear-tesla with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getIntent() != null) {
        String action = getIntent().getAction();
        if (ACTION_CLOSE_SUNROOF.equals(action)) {
            mActionMode = ACTION_MODE_CLOSE_SUNROOF;
        } else if (ACTION_LOCK_DOOR.equals(action)) {
            mActionMode = ACTION_MODE_LOCK_DOOR;
        } else if (ACTION_START_CHARGING.equals(action)) {
            mActionMode = ACTION_MODE_START_CHARGING;
        }
    }
    setContentView(R.layout.activity_notification_confirmation);
    mDelayedConfirmation = (DelayedConfirmationView) findViewById(R.id.delayed_confirm);
    mConfirmationText = (TextView) findViewById(R.id.confirmation_text);
    initView();
}
 
Example #2
Source File: ClimbConfirmation.java    From climb-tracker with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_confirmation);

    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addApi(Wearable.API)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .build();

    mGoogleApiClient.connect();

    mDelayedView = (DelayedConfirmationView) findViewById(R.id.delayed_confirm);
    mDelayedView.setListener(this);

    routeGradeLabelToSave = getIntent().getStringExtra(ClimbTrackerWear.EXTRA_ROUTE_GRADE_LABEL);

    // change the recap text
    TextView climbRecapText = (TextView) findViewById(R.id.climb_recap);
    String recapString = getString(R.string.climb_recap, routeGradeLabelToSave);
    climbRecapText.setText(recapString);

    // Four seconds to cancel the action
    mDelayedView.setTotalTimeMs(4000);
    // Start the timer
    mDelayedView.start();
}
 
Example #3
Source File: MainActivity.java    From AndroidWearable-Samples with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle b) {
    super.onCreate(b);
    setContentView(R.layout.main_activity);
    delayedConfirmationView = (DelayedConfirmationView) findViewById(R.id.delayed_confirmation);
    delayedConfirmationView.setTotalTimeMs(NUM_SECONDS * 1000);
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addApi(Wearable.API)
            .addOnConnectionFailedListener(this)
            .build();
}
 
Example #4
Source File: MainActivity.java    From AndroidWearable-Samples with Apache License 2.0 5 votes vote down vote up
@Override
public void onTimerSelected(View v) {
    v.setPressed(true);
    Notification notification = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle(getString(R.string.notification_title))
            .setContentText(getString(R.string.notification_timer_selected))
            .build();
    NotificationManagerCompat.from(this).notify(0, notification);
    sendMessageToCompanion(TIMER_SELECTED_PATH);
    // Prevent onTimerFinished from being heard.
    ((DelayedConfirmationView) v).setListener(null);
    finish();
}
 
Example #5
Source File: MainActivity.java    From AndroidWearable-Samples with Apache License 2.0 5 votes vote down vote up
/**
 * Handles the button to start a DelayedConfirmationView timer.
 */
public void onStartTimer(View view) {
    DelayedConfirmationView delayedConfirmationView = (DelayedConfirmationView)
            findViewById(R.id.timer);
    delayedConfirmationView.setTotalTimeMs(NUM_SECONDS * 1000);
    delayedConfirmationView.setListener(this);
    delayedConfirmationView.start();
    scroll(View.FOCUS_DOWN);
}
 
Example #6
Source File: MainActivity.java    From android-SkeletonWearableApp with Apache License 2.0 5 votes vote down vote up
/**
 * Handles the button to start a DelayedConfirmationView timer.
 */
public void onStartTimer(View view) {
    DelayedConfirmationView delayedConfirmationView = (DelayedConfirmationView)
            findViewById(R.id.timer);
    delayedConfirmationView.setTotalTimeMs(NUM_SECONDS * 1000);
    delayedConfirmationView.setListener(this);
    delayedConfirmationView.start();
    scroll(View.FOCUS_DOWN);
}