custom ActionBar theme

This commit is contained in:
badaix 2016-01-16 13:08:27 +01:00
parent bdf5c16720
commit c5a7bbffb5
2 changed files with 12 additions and 3 deletions

View file

@ -106,7 +106,6 @@ public class MainActivity extends AppCompatActivity implements ClientInfoItem.Cl
clientInfoAdapter = new ClientInfoAdapter(this, this); clientInfoAdapter = new ClientInfoAdapter(this, this);
lvClient.setAdapter(clientInfoAdapter); lvClient.setAdapter(clientInfoAdapter);
getSupportActionBar().setSubtitle("Host: no Snapserver found"); getSupportActionBar().setSubtitle("Host: no Snapserver found");
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#37474F")));
Setup.copyAssets(this, new String[]{"snapclient"}); Setup.copyAssets(this, new String[]{"snapclient"});
initializeDiscoveryListener(); initializeDiscoveryListener();
@ -168,9 +167,9 @@ public class MainActivity extends AppCompatActivity implements ClientInfoItem.Cl
private void updateStartStopMenuItem() { private void updateStartStopMenuItem() {
if (snapclientService.isRunning()) { if (snapclientService.isRunning()) {
miStartStop.setIcon(android.R.drawable.ic_media_pause); miStartStop.setIcon(R.drawable.ic_media_stop);
} else { } else {
miStartStop.setIcon(android.R.drawable.ic_media_play); miStartStop.setIcon(R.drawable.ic_media_play);
} }
} }

View file

@ -1,13 +1,23 @@
<resources> <resources>
<color name="color_background">#EEEEEE</color> <color name="color_background">#EEEEEE</color>
<color name="actionbar_background">#37474F</color>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowBackground">@color/color_background</item> <item name="android:windowBackground">@color/color_background</item>
<item name="android:actionBarStyle">@style/MyActionBar</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">@style/MyActionBar</item>
<!-- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> --> <!-- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> -->
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
</style> </style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/actionbar_background</item>
<!-- Support library compatibility -->
<item name="background">@color/actionbar_background</item>
</style>
<style name="PlayerButton" parent="android:Widget.Holo.ImageButton"> <style name="PlayerButton" parent="android:Widget.Holo.ImageButton">
<item name="android:background">?android:attr/actionBarItemBackground</item> <item name="android:background">?android:attr/actionBarItemBackground</item>
<!-- <item name="android:minHeight">@dimen/playerbutton_height</item> --> <!-- <item name="android:minHeight">@dimen/playerbutton_height</item> -->