mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 977336 - Support action bar 'up' for FxAccountStatusActivity. r=rnewman
This commit is contained in:
parent
62718468ec
commit
8882caff5a
@ -9,9 +9,13 @@ import org.mozilla.gecko.fxa.FirefoxAccounts;
|
|||||||
import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
|
import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.app.ActionBar;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity which displays account status.
|
* Activity which displays account status.
|
||||||
@ -31,6 +35,29 @@ public class FxAccountStatusActivity extends FragmentActivity {
|
|||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(android.R.id.content, statusFragment)
|
.replace(android.R.id.content, statusFragment)
|
||||||
.commit();
|
.commit();
|
||||||
|
|
||||||
|
maybeSetHomeButtonEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sufficiently recent Android versions need additional code to receive taps
|
||||||
|
* on the status bar to go "up". See <a
|
||||||
|
* href="http://stackoverflow.com/a/8953148">this stackoverflow answer</a> for
|
||||||
|
* more information.
|
||||||
|
*/
|
||||||
|
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||||
|
protected void maybeSetHomeButtonEnabled() {
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||||
|
Logger.debug(LOG_TAG, "Not enabling home button; version too low.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final ActionBar actionBar = getActionBar();
|
||||||
|
if (actionBar != null) {
|
||||||
|
Logger.debug(LOG_TAG, "Enabling home button.");
|
||||||
|
actionBar.setHomeButtonEnabled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Logger.debug(LOG_TAG, "Not enabling home button.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -65,4 +92,15 @@ public class FxAccountStatusActivity extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
return new AndroidFxAccount(this, account);
|
return new AndroidFxAccount(this, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int itemId = item.getItemId();
|
||||||
|
switch (itemId) {
|
||||||
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- FxAccountStatusActivity ActionBar -->
|
||||||
|
<style name="ActionBar.FxAccountStatusActivity">
|
||||||
|
<item name="android:displayOptions">showHome|homeAsUp|showTitle</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="FxAccountTheme" parent="@style/Gecko" />
|
||||||
|
|
||||||
|
<style name="FxAccountTheme.FxAccountStatusActivity" parent="@FxAccountTheme">
|
||||||
|
<item name="android:windowActionBar">true</item>
|
||||||
|
<item name="android:windowNoTitle">false</item>
|
||||||
|
<item name="android:actionBarStyle">@style/ActionBar.FxAccountStatusActivity</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
@ -9,6 +9,10 @@
|
|||||||
|
|
||||||
<style name="FxAccountTheme" parent="@style/Gecko" />
|
<style name="FxAccountTheme" parent="@style/Gecko" />
|
||||||
|
|
||||||
|
<style name="FxAccountTheme.FxAccountStatusActivity" parent="@style/FxAccountTheme">
|
||||||
|
<item name="android:windowNoTitle">false</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="FxAccountMiddle">
|
<style name="FxAccountMiddle">
|
||||||
<item name="android:background">@android:color/white</item>
|
<item name="android:background">@android:color/white</item>
|
||||||
<item name="android:orientation">vertical</item>
|
<item name="android:orientation">vertical</item>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<activity
|
<activity
|
||||||
android:theme="@style/FxAccountTheme"
|
android:theme="@style/FxAccountTheme.FxAccountStatusActivity"
|
||||||
android:icon="@drawable/fxaccount_icon"
|
android:label="@string/fxaccount_status_activity_label"
|
||||||
android:label="Status"
|
|
||||||
android:clearTaskOnLaunch="true"
|
android:clearTaskOnLaunch="true"
|
||||||
android:taskAffinity="@ANDROID_PACKAGE_NAME@.FXA"
|
android:taskAffinity="@ANDROID_PACKAGE_NAME@.FXA"
|
||||||
android:name="org.mozilla.gecko.fxa.activities.FxAccountStatusActivity"
|
android:name="org.mozilla.gecko.fxa.activities.FxAccountStatusActivity"
|
||||||
@ -16,8 +15,7 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:theme="@style/FxAccountTheme"
|
android:theme="@style/FxAccountTheme"
|
||||||
android:icon="@drawable/fxaccount_icon"
|
android:label="@string/sync_app_name"
|
||||||
android:label="Setup"
|
|
||||||
android:clearTaskOnLaunch="true"
|
android:clearTaskOnLaunch="true"
|
||||||
android:taskAffinity="@ANDROID_PACKAGE_NAME@.FXA"
|
android:taskAffinity="@ANDROID_PACKAGE_NAME@.FXA"
|
||||||
android:name="org.mozilla.gecko.fxa.activities.FxAccountGetStartedActivity"
|
android:name="org.mozilla.gecko.fxa.activities.FxAccountGetStartedActivity"
|
||||||
@ -32,42 +30,36 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:theme="@style/FxAccountTheme"
|
android:theme="@style/FxAccountTheme"
|
||||||
android:icon="@drawable/fxaccount_icon"
|
|
||||||
android:name="org.mozilla.gecko.fxa.activities.FxAccountCreateAccountActivity"
|
android:name="org.mozilla.gecko.fxa.activities.FxAccountCreateAccountActivity"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:theme="@style/FxAccountTheme"
|
android:theme="@style/FxAccountTheme"
|
||||||
android:icon="@drawable/fxaccount_icon"
|
|
||||||
android:name="org.mozilla.gecko.fxa.activities.FxAccountConfirmAccountActivity"
|
android:name="org.mozilla.gecko.fxa.activities.FxAccountConfirmAccountActivity"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:theme="@style/FxAccountTheme"
|
android:theme="@style/FxAccountTheme"
|
||||||
android:icon="@drawable/fxaccount_icon"
|
|
||||||
android:name="org.mozilla.gecko.fxa.activities.FxAccountSignInActivity"
|
android:name="org.mozilla.gecko.fxa.activities.FxAccountSignInActivity"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:theme="@style/FxAccountTheme"
|
android:theme="@style/FxAccountTheme"
|
||||||
android:icon="@drawable/fxaccount_icon"
|
|
||||||
android:name="org.mozilla.gecko.fxa.activities.FxAccountVerifiedAccountActivity"
|
android:name="org.mozilla.gecko.fxa.activities.FxAccountVerifiedAccountActivity"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:theme="@style/FxAccountTheme"
|
android:theme="@style/FxAccountTheme"
|
||||||
android:icon="@drawable/fxaccount_icon"
|
|
||||||
android:name="org.mozilla.gecko.fxa.activities.FxAccountUpdateCredentialsActivity"
|
android:name="org.mozilla.gecko.fxa.activities.FxAccountUpdateCredentialsActivity"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:theme="@style/FxAccountTheme"
|
android:theme="@style/FxAccountTheme"
|
||||||
android:icon="@drawable/fxaccount_icon"
|
|
||||||
android:name="org.mozilla.gecko.fxa.activities.FxAccountCreateAccountNotAllowedActivity"
|
android:name="org.mozilla.gecko.fxa.activities.FxAccountCreateAccountNotAllowedActivity"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
</activity>
|
</activity>
|
||||||
|
@ -165,6 +165,7 @@
|
|||||||
<string name="fxaccount_update_credentials_button_label">&fxaccount_update_credentials_button_label;</string>
|
<string name="fxaccount_update_credentials_button_label">&fxaccount_update_credentials_button_label;</string>
|
||||||
<string name="fxaccount_update_credentials_unknown_error">&fxaccount_update_credentials_unknown_error;</string>
|
<string name="fxaccount_update_credentials_unknown_error">&fxaccount_update_credentials_unknown_error;</string>
|
||||||
|
|
||||||
|
<string name="fxaccount_status_activity_label">&syncBrand.shortName.label;</string>
|
||||||
<string name="fxaccount_status_header">&fxaccount_status_header;</string>
|
<string name="fxaccount_status_header">&fxaccount_status_header;</string>
|
||||||
<string name="fxaccount_status_sync">&fxaccount_status_sync;</string>
|
<string name="fxaccount_status_sync">&fxaccount_status_sync;</string>
|
||||||
<string name="fxaccount_status_sync_enabled">&fxaccount_status_sync_enabled;</string>
|
<string name="fxaccount_status_sync_enabled">&fxaccount_status_sync_enabled;</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user