Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebShareEntryActivity.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebShareEntryActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebShareEntryActivity.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f152fecfec4364af4e4125dcd559a073939d7aa3 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebShareEntryActivity.java |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.chrome.browser.physicalweb; |
| + |
| +import android.app.Activity; |
| +import android.content.DialogInterface; |
| +import android.os.Bundle; |
| +import android.support.v7.app.AlertDialog; |
| + |
| +import org.chromium.chrome.R; |
| + |
| +/** |
| + * Activity used to interact with user before starting Physical Web Sharing. |
| + * TODO(iankc): add Bluetooth checks handling. |
| + */ |
| +public class PhysicalWebShareEntryActivity extends Activity { |
| + public static final String SHARING_ENTRY_URL = "physical_web.entry.url"; |
| + |
| + @Override |
| + protected void onCreate(Bundle savedInstanceState) { |
| + super.onCreate(savedInstanceState); |
| + Bundle extras = getIntent().getExtras(); |
| + if (extras == null) { |
| + finish(); |
| + return; |
| + } |
| + final String url = extras.getString(SHARING_ENTRY_URL); |
|
Ted C
2017/03/21 16:05:13
if the url is null, you should also probably finis
iankc
2017/03/21 18:43:25
Done.
|
| + |
| + new AlertDialog.Builder(this) |
|
Ted C
2017/03/21 16:05:12
ah with the activity style that I mentioned, I thi
iankc
2017/03/21 18:43:25
Done.
|
| + .setTitle(R.string.physical_web_share_entry_title) |
| + .setMessage(R.string.physical_web_share_entry_message) |
| + .setPositiveButton(R.string.continue_button, |
| + new DialogInterface.OnClickListener() { |
| + public void onClick(DialogInterface dialog, int which) { |
| + PhysicalWeb.setSharingOptedIn(); |
| + PhysicalWebBroadcastService.startBroadcastService(url); |
| + finish(); |
| + } |
| + }) |
| + .setNegativeButton(R.string.cancel, |
| + new DialogInterface.OnClickListener() { |
| + public void onClick(DialogInterface dialog, int which) { |
| + finish(); |
| + } |
| + }) |
| + .setIcon(android.R.drawable.ic_dialog_info) |
| + .setCancelable(false) |
| + .show(); |
| + } |
| +} |