mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1152314 - Duplicate action bar configuration in code. r=liuche
This is necessary because the configuration breaks on some devices if it's just set in XML - see the code comments for more details.
This commit is contained in:
parent
8a61e04761
commit
9aae76d264
@ -345,6 +345,7 @@ OnSharedPreferenceChangeListener
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
initActionBar();
|
||||
|
||||
// Use setResourceToOpen to specify these extras.
|
||||
Bundle intentExtras = getIntent().getExtras();
|
||||
@ -414,6 +415,27 @@ OnSharedPreferenceChangeListener
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the action bar configuration in code.
|
||||
*
|
||||
* Declaring these attributes in XML does not work on some devices for an unknown reason
|
||||
* (e.g. the back button stops working or the logo disappears; see bug 1152314) so we
|
||||
* duplicate those attributes in code here. Note: the order of these calls matters.
|
||||
*
|
||||
* We keep the XML attributes because not all of these methods are available on pre-v14.
|
||||
*/
|
||||
private void initActionBar() {
|
||||
if (Versions.feature14Plus) {
|
||||
final ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setLogo(R.drawable.logo);
|
||||
actionBar.setDisplayUseLogoEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set intent to display top-level settings fragment,
|
||||
* and show the correct title.
|
||||
|
@ -48,6 +48,7 @@
|
||||
|
||||
<!-- GeckoPreferences ActionBar -->
|
||||
<style name="ActionBar.GeckoPreferences">
|
||||
<!-- Partially duplicated in GeckoPreferences.initActionBar - look there for more details. -->
|
||||
<item name="android:displayOptions">showHome|homeAsUp|showTitle|useLogo</item>
|
||||
</style>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user