New notification icon and setting for toolbar opaque

This commit is contained in:
Karim Abou Zeid 2015-04-09 15:44:28 +02:00
commit 9cd1b4f3ba
12 changed files with 37 additions and 9 deletions

View file

@ -46,7 +46,7 @@ public class PlayingNotificationHelper {
R.layout.notification_playing_expanded);
notification = new NotificationCompat.Builder(service)
.setSmallIcon(R.drawable.ic_audiotrack_white_24dp)
.setSmallIcon(R.drawable.ic_notification)
.setContentIntent(getOpenMusicControllerPendingIntent())
.setCategory(NotificationCompat.CATEGORY_PROGRESS)
.setPriority(NotificationCompat.PRIORITY_MAX)

View file

@ -9,10 +9,8 @@ import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import com.astuetz.PagerSlidingTabStrip;
@ -24,6 +22,7 @@ import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
import com.kabouzeid.gramophone.model.MusicRemoteEvent;
import com.kabouzeid.gramophone.model.Song;
import com.kabouzeid.gramophone.model.UIPreferenceChangedEvent;
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
import com.kabouzeid.gramophone.ui.fragments.NavigationDrawerFragment;
import com.kabouzeid.gramophone.ui.fragments.mainactivityfragments.AbsMainActivityFragment;
@ -116,14 +115,19 @@ public class MainActivity extends AbsFabActivity
setTitle(getResources().getString(R.string.app_name));
toolbar = (Toolbar) findViewById(R.id.toolbar);
statusBar = findViewById(R.id.statusBar);
setToolBarTransparent(PreferenceUtils.getInstance(this).transparentToolbar());
setSupportActionBar(toolbar);
float alpha = 0.97f;
ViewUtil.setBackgroundAlpha(toolbar, alpha, Util.resolveColor(this, R.attr.colorPrimary));
ViewUtil.setBackgroundAlpha(statusBar, alpha, Util.resolveColor(this, R.attr.colorPrimary));
ViewUtil.setBackgroundAlpha(slidingTabLayout, alpha, Util.resolveColor(this, R.attr.colorPrimary));
setUpDrawerToggle();
}
private void setToolBarTransparent(boolean transparent){
float alpha = transparent ? 0.97f : 1f;
final int colorPrimary = Util.resolveColor(this, R.attr.colorPrimary);
ViewUtil.setBackgroundAlpha(toolbar, alpha, colorPrimary);
ViewUtil.setBackgroundAlpha(statusBar, alpha, colorPrimary);
ViewUtil.setBackgroundAlpha(slidingTabLayout, alpha, colorPrimary);
}
private void setUpDrawerToggle() {
drawerToggle = new ActionBarDrawerToggle(
this,
@ -269,6 +273,16 @@ public class MainActivity extends AbsFabActivity
super.onConfigurationChanged(newConfig);
}
@Override
public void onUIPreferenceChangedEvent(UIPreferenceChangedEvent event) {
super.onUIPreferenceChangedEvent(event);
switch (event.getAction()) {
case UIPreferenceChangedEvent.TOOLBAR_TRANSPARENT_CHANGED:
setToolBarTransparent((boolean) event.getValue());
break;
}
}
@Override
public void onBackPressed() {
if (navigationDrawerFragment.isDrawerOpen()) {

View file

@ -54,6 +54,14 @@ public class SettingsActivity extends AbsBaseActivity {
}
});
findPreference("transparent_toolbar").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
App.bus.post(new UIPreferenceChangedEvent(UIPreferenceChangedEvent.TOOLBAR_TRANSPARENT_CHANGED, o));
return true;
}
});
findPreference("colored_album_footers").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -32,6 +32,7 @@
<item>0</item>
<item>1</item>
</string-array>
<string name="pref_title_transparent_toolbar">Semi-Transparent toolbar</string>
<string name="pref_title_show_playback_controller_card">Playback controller card</string>
<string name="pref_title_colored_navigation_bar_artists">Colored navigation bar artist view</string>
<string name="pref_title_colored_navigation_bar_albums">Colored navigation bar album view</string>

View file

@ -10,6 +10,11 @@
android:positiveButtonText="@null"
android:title="@string/pref_title_general_theme"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="transparent_toolbar"
android:title="@string/pref_title_transparent_toolbar"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="playback_controller_card"