Commit dfa8f8ae authored by Himanshu Jaju's avatar Himanshu Jaju Committed by Commit Bot

Add button to chrome settings in sharesheet

For users who have sync turned off on their
current device, we show a button to direct them to the
settings page to enable sync.

Light mode - https://drive.google.com/open?id=1hYpPBCBQdAfxTsw0a13lS2aBSsvTrqk6
Dark mode - https://drive.google.com/open?id=1FYts7p-9W7duyv9Gqs5XEReJT8j3yYnd

Bug: 1001102
Change-Id: I0ad3de82739b74541a06249447ad5c7c72b3ae23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795426
Commit-Queue: Himanshu Jaju <himanshujaju@chromium.org>
Reviewed-by: default avatarMichael van Ouwerkerk <mvanouwerkerk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695234}
parent 4457fd96
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@android:color/transparent" /> android:background="@android:color/transparent"/>
<LinearLayout <LinearLayout
android:id="@+id/device_picker_content" android:id="@+id/device_picker_content"
...@@ -34,52 +34,59 @@ ...@@ -34,52 +34,59 @@
android:ellipsize="end" android:ellipsize="end"
android:visibility="gone" android:visibility="gone"
android:textAppearance="@style/TextAppearance.BlackToolbarTitle" android:textAppearance="@style/TextAppearance.BlackToolbarTitle"
android:text="@string/send_tab_to_self_sheet_toolbar" /> android:text="@string/send_tab_to_self_sheet_toolbar"/>
<ListView <ListView
android:id="@+id/device_picker_list" android:id="@+id/device_picker_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:divider="@null" /> android:divider="@null"/>
<LinearLayout <LinearLayout
android:id="@+id/empty_state" android:id="@+id/empty_state"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="32dp"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/empty_state_image" android:id="@+id/empty_state_image"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width ="match_parent" android:layout_width ="match_parent"
android:gravity="center_vertical"
android:contentDescription="@string/sharing_no_devices_available_text" android:contentDescription="@string/sharing_no_devices_available_text"
android:src="@drawable/shared_clipboard_zero_state"/> android:src="@drawable/shared_clipboard_zero_state"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/min_touch_target_size" android:layout_height="@dimen/min_touch_target_size"
android:gravity="center_vertical" android:gravity="center"
android:paddingStart="30dp" android:paddingStart="30dp"
android:paddingEnd="30dp" android:paddingEnd="30dp"
android:paddingTop="16dp" android:paddingTop="16dp"
android:ellipsize="end" android:ellipsize="end"
android:textAppearance="@style/TextAppearance.BlackToolbarTitle" android:textAppearance="@style/TextAppearance.BlackToolbarTitle"
android:text="@string/sharing_no_devices_available_title" /> android:text="@string/sharing_no_devices_available_title"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center"
android:paddingStart="30dp" android:paddingStart="30dp"
android:paddingEnd="30dp" android:paddingEnd="30dp"
android:paddingTop="16dp" android:paddingTop="16dp"
android:paddingBottom="32dp"
android:ellipsize="end" android:ellipsize="end"
android:textAppearance="@style/TextAppearance.BlackHint1" android:textAppearance="@style/TextAppearance.BlackHint1"
android:text="@string/sharing_no_devices_available_text"/> android:text="@string/sharing_no_devices_available_text"/>
<!-- TODO(himanshujaju) - Add a hidden button which is visible when sync isn't enabled --> <org.chromium.ui.widget.ButtonCompat
android:id="@+id/chrome_settings"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:text="@string/sharing_chrome_settings"
android:visibility="gone"
style="@style/FilledButton"/>
</LinearLayout> </LinearLayout>
......
...@@ -21,10 +21,13 @@ import org.chromium.base.task.TaskTraits; ...@@ -21,10 +21,13 @@ import org.chromium.base.task.TaskTraits;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.init.AsyncInitializationActivity; import org.chromium.chrome.browser.init.AsyncInitializationActivity;
import org.chromium.chrome.browser.preferences.PreferencesLauncher;
import org.chromium.chrome.browser.sharing.SharingAdapter; import org.chromium.chrome.browser.sharing.SharingAdapter;
import org.chromium.chrome.browser.sharing.SharingDeviceCapability; import org.chromium.chrome.browser.sharing.SharingDeviceCapability;
import org.chromium.chrome.browser.sharing.SharingServiceProxy; import org.chromium.chrome.browser.sharing.SharingServiceProxy;
import org.chromium.chrome.browser.sharing.SharingServiceProxy.DeviceInfo; import org.chromium.chrome.browser.sharing.SharingServiceProxy.DeviceInfo;
import org.chromium.components.sync.AndroidSyncSettings;
import org.chromium.ui.widget.ButtonCompat;
/** /**
* Activity to display device targets to share text. * Activity to display device targets to share text.
...@@ -80,6 +83,14 @@ public class SharedClipboardShareActivity ...@@ -80,6 +83,14 @@ public class SharedClipboardShareActivity
View content = findViewById(R.id.device_picker_content); View content = findViewById(R.id.device_picker_content);
content.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_up)); content.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_up));
ButtonCompat chromeSettingsButton = findViewById(R.id.chrome_settings);
if (!AndroidSyncSettings.get().isChromeSyncEnabled()) {
chromeSettingsButton.setVisibility(View.VISIBLE);
chromeSettingsButton.setOnClickListener(view -> {
PreferencesLauncher.launchSettingsPage(ContextUtils.getApplicationContext(), null);
});
}
onInitialLayoutInflationComplete(); onInitialLayoutInflationComplete();
} }
......
...@@ -3890,6 +3890,9 @@ The site does NOT gain access to the camera. The camera images are only visible ...@@ -3890,6 +3890,9 @@ The site does NOT gain access to the camera. The camera images are only visible
<message name="IDS_SHARING_NO_DEVICES_AVAILABLE_TEXT" desc="Text to show when no device targets are available for sharing."> <message name="IDS_SHARING_NO_DEVICES_AVAILABLE_TEXT" desc="Text to show when no device targets are available for sharing.">
To share something from your phone to another device, turn on sync in Chrome settings on both devices To share something from your phone to another device, turn on sync in Chrome settings on both devices
</message> </message>
<message name="IDS_SHARING_CHROME_SETTINGS" desc="Text shown in a button when user has turned off sync.">
Go to Chrome settings
</message>
<!-- ClickToCall --> <!-- ClickToCall -->
<message name="IDS_CLICK_TO_CALL_NOTIFICATION_TEXT" desc="Text displayed in a click to call notification to call on a number."> <message name="IDS_CLICK_TO_CALL_NOTIFICATION_TEXT" desc="Text displayed in a click to call notification to call on a number.">
......
fcba509995c0311872240db5d281c9d5bd905632
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment