diff options
author | lambroslambrou <lambroslambrou@chromium.org> | 2015-02-09 18:13:29 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-10 02:14:00 +0000 |
commit | 6b76e25b31bdea94b1145253c0a2fe9301691e26 (patch) | |
tree | c62faf00a94a8b8fcd1754556f35ad8a11d65d3a /remoting | |
parent | 17e878ce6362ffe65a0893b601960f86556d6237 (diff) | |
download | chromium_src-6b76e25b31bdea94b1145253c0a2fe9301691e26.zip chromium_src-6b76e25b31bdea94b1145253c0a2fe9301691e26.tar.gz chromium_src-6b76e25b31bdea94b1145253c0a2fe9301691e26.tar.bz2 |
Chromoting Android: Update styling for Material Design
This updates the styling for all activities to use the AppCompat themes,
which will use the Material theme on Lollipop. This also uses the
"Light" version of the theme.
BUG=430328
Review URL: https://codereview.chromium.org/705563003
Cr-Commit-Position: refs/heads/master@{#315472}
Diffstat (limited to 'remoting')
7 files changed, 50 insertions, 37 deletions
diff --git a/remoting/android/java/AndroidManifest.xml.jinja2 b/remoting/android/java/AndroidManifest.xml.jinja2 index 97c6364..8a330b9 100644 --- a/remoting/android/java/AndroidManifest.xml.jinja2 +++ b/remoting/android/java/AndroidManifest.xml.jinja2 @@ -9,11 +9,11 @@ <uses-permission android:name="android.permission.USE_CREDENTIALS"/> <application android:label="@string/product_name_android" android:icon="@drawable/chromoting128" - android:theme="@android:style/Theme.Holo" + android:theme="@style/BaseTheme" android:allowBackup="false"> <activity android:name="org.chromium.chromoting.Chromoting" android:configChanges="orientation|screenSize" - android:theme="@style/MainTheme" + android:theme="@style/BaseTheme.NoTitle" android:launchMode="singleTask"> <intent-filter> <action android:name="android.intent.action.MAIN"/> @@ -34,8 +34,7 @@ </activity> <activity android:name="org.chromium.chromoting.Desktop" android:configChanges="orientation|screenSize" - android:windowSoftInputMode="adjustResize" - android:theme="@style/Theme.AppCompat"/> + android:windowSoftInputMode="adjustResize"/> <activity android:name="org.chromium.chromoting.HelpActivity" android:configChanges="orientation|screenSize" android:uiOptions="splitActionBarWhenNarrow"/> diff --git a/remoting/android/java/res/menu/chromoting_actionbar.xml b/remoting/android/java/res/menu/chromoting_actionbar.xml index 07b97f0..30e9d25 100644 --- a/remoting/android/java/res/menu/chromoting_actionbar.xml +++ b/remoting/android/java/res/menu/chromoting_actionbar.xml @@ -6,16 +6,19 @@ --> <!--Action bar buttons for the Android app's host listing--> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:id="@+id/actionbar_directoryrefresh" - android:title="@string/tooltip_refresh" - android:icon="@android:drawable/ic_popup_sync" - android:showAsAction="ifRoom"/> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + <item + android:id="@+id/actionbar_directoryrefresh" + android:title="@string/tooltip_refresh" + android:icon="@android:drawable/ic_popup_sync" + app:showAsAction="ifRoom"/> <!-- The Help option must be the final menu item and it must only appear in the action-bar overflow menu. --> - <item android:id="@+id/actionbar_help" - android:title="@string/actionbar_help" - android:showAsAction="never"/> + <item + android:id="@+id/actionbar_help" + android:title="@string/actionbar_help" + app:showAsAction="never"/> </menu> diff --git a/remoting/android/java/res/menu/help_actionbar.xml b/remoting/android/java/res/menu/help_actionbar.xml index 09f2625..8b21fd9 100644 --- a/remoting/android/java/res/menu/help_actionbar.xml +++ b/remoting/android/java/res/menu/help_actionbar.xml @@ -5,11 +5,14 @@ found in the LICENSE file. --> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:id="@+id/actionbar_feedback" - android:title="@string/actionbar_feedback" - android:showAsAction="ifRoom|withText"/> - <item android:id="@+id/actionbar_play_store" - android:title="@string/actionbar_play_store" - android:showAsAction="never"/> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + <item + android:id="@+id/actionbar_feedback" + android:title="@string/actionbar_feedback" + app:showAsAction="ifRoom|withText"/> + <item + android:id="@+id/actionbar_play_store" + android:title="@string/actionbar_play_store" + app:showAsAction="never"/> </menu> diff --git a/remoting/android/java/res/values-v17/styles.xml b/remoting/android/java/res/values-v17/styles.xml index 881d2bb..e1e6d4f 100644 --- a/remoting/android/java/res/values-v17/styles.xml +++ b/remoting/android/java/res/values-v17/styles.xml @@ -6,16 +6,21 @@ --> <resources> - <style name="MainTheme" parent="@android:style/Theme.Holo"> - <item name="android:actionBarStyle">@style/MainActionBar</item> + <style name="BaseTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> + <item name="colorPrimary">#4285F4</item> + <item name="colorPrimaryDark">#3367D6</item> </style> - <style name="MainActionBar" parent="@android:style/Widget.Holo.ActionBar"> + <style name="BaseTheme.NoTitle" parent="@style/BaseTheme"> + <item name="android:actionBarStyle">@style/BaseActionBar.NoTitle</item> + </style> + <style name="BaseActionBar.NoTitle" parent="@style/Widget.AppCompat.ActionBar"> <item name="android:displayOptions">showHome</item> </style> - <style name="EmptyStateText" parent="@android:style/TextAppearance.Holo.Large"> + + <style name="EmptyStateText" parent="@android:style/TextAppearance.Large"> <item name="android:textColor">#888</item> </style> - <style name="EmptyStateText.Hyperlink"> + <style name="EmptyStateText.Hyperlink" parent="@style/EmptyStateText"> <item name="android:textColor">@android:color/holo_blue_light</item> <item name="android:textStyle">italic</item> </style> diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java index 3e02563..dca539e 100644 --- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java +++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java @@ -11,8 +11,6 @@ import android.accounts.AccountManagerFuture; import android.accounts.AuthenticatorException; import android.accounts.OperationCanceledException; import android.annotation.SuppressLint; -import android.app.ActionBar; -import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; @@ -21,6 +19,8 @@ import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Bundle; import android.provider.Settings; +import android.support.v7.app.ActionBar; +import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; @@ -40,7 +40,7 @@ import java.util.Arrays; * The user interface for querying and displaying a user's host list from the directory server. It * also requests and renews authentication tokens using the system account manager. */ -public class Chromoting extends Activity implements JniInterface.ConnectionListener, +public class Chromoting extends ActionBarActivity implements JniInterface.ConnectionListener, AccountManagerCallback<Bundle>, AdapterView.OnItemSelectedListener, HostListLoader.Callback, View.OnClickListener { /** Only accounts of this type will be selectable for authentication. */ @@ -213,18 +213,19 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe mAccount = mAccounts[0]; } + ActionBar actionBar = getSupportActionBar(); if (mAccounts.length == 1) { - getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, + actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); - getActionBar().setTitle(R.string.mode_me2me); - getActionBar().setSubtitle(mAccount.name); + actionBar.setTitle(R.string.mode_me2me); + actionBar.setSubtitle(mAccount.name); } else { mAccountsAdapter = new AccountsAdapter(this, mAccounts); - Spinner accountsSpinner = new Spinner(getActionBar().getThemedContext(), null, + Spinner accountsSpinner = new Spinner(actionBar.getThemedContext(), null, android.R.attr.actionDropDownStyle); accountsSpinner.setAdapter(mAccountsAdapter); - getActionBar().setCustomView(accountsSpinner); - getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, + actionBar.setCustomView(accountsSpinner); + actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); accountsSpinner.setOnItemSelectedListener(this); accountsSpinner.setSelection(index); diff --git a/remoting/android/java/src/org/chromium/chromoting/HelpActivity.java b/remoting/android/java/src/org/chromium/chromoting/HelpActivity.java index 7870335..b6132d4 100644 --- a/remoting/android/java/src/org/chromium/chromoting/HelpActivity.java +++ b/remoting/android/java/src/org/chromium/chromoting/HelpActivity.java @@ -17,6 +17,7 @@ import android.os.Bundle; import android.os.IBinder; import android.os.Parcel; import android.os.RemoteException; +import android.support.v7.app.ActionBarActivity; import android.text.TextUtils; import android.util.Log; import android.view.Menu; @@ -30,7 +31,7 @@ import org.chromium.ui.UiUtils; /** * The Activity for showing the Help screen. */ -public class HelpActivity extends Activity { +public class HelpActivity extends ActionBarActivity { private static final String PLAY_STORE_URL = "market://details?id="; private static final String FEEDBACK_PACKAGE = "com.google.android.gms"; @@ -113,7 +114,7 @@ public class HelpActivity extends Activity { WebView webView = new WebView(this); setContentView(webView); - getActionBar().setTitle(getString(R.string.actionbar_help_title)); + getSupportActionBar().setTitle(getString(R.string.actionbar_help_title)); CharSequence appName = getTitle(); CharSequence versionName = null; @@ -125,7 +126,7 @@ public class HelpActivity extends Activity { } CharSequence subtitle = TextUtils.concat(appName, " ", versionName); - getActionBar().setSubtitle(subtitle); + getSupportActionBar().setSubtitle(subtitle); // This line ensures the WebView remains embedded in this activity and doesn't launch an // external Chrome browser. diff --git a/remoting/android/java/src/org/chromium/chromoting/ThirdPartyTokenFetcher.java b/remoting/android/java/src/org/chromium/chromoting/ThirdPartyTokenFetcher.java index c8bd88a..fd983f7 100644 --- a/remoting/android/java/src/org/chromium/chromoting/ThirdPartyTokenFetcher.java +++ b/remoting/android/java/src/org/chromium/chromoting/ThirdPartyTokenFetcher.java @@ -11,6 +11,7 @@ import android.content.ComponentName; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; +import android.support.v7.app.ActionBarActivity; import android.text.TextUtils; import android.util.Base64; import android.util.Log; @@ -215,7 +216,7 @@ public class ThirdPartyTokenFetcher { * together with its intent filter, by default. |OAuthRedirectActivity| is only enabled when * there is a pending token fetch request. */ - public static class OAuthRedirectActivity extends Activity { + public static class OAuthRedirectActivity extends ActionBarActivity { @Override public void onStart() { super.onStart(); |