mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Use grey toolbar on pre-Lollipop
This commit is contained in:
@@ -27,13 +27,16 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
@@ -84,9 +87,22 @@ public class MainActivity extends BaseActivity
|
|||||||
localBroadcastManager = LocalBroadcastManager.getInstance(this);
|
localBroadcastManager = LocalBroadcastManager.getInstance(this);
|
||||||
localBroadcastManager.registerReceiver(receiver, new IntentFilter(ACTION_REFRESH));
|
localBroadcastManager.registerReceiver(receiver, new IntentFilter(ACTION_REFRESH));
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
onPreLollipopStartup();
|
||||||
|
|
||||||
onStartup();
|
onStartup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onPreLollipopStartup()
|
||||||
|
{
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
if(actionBar == null) return;
|
||||||
|
if(UIHelper.isNightMode()) return;
|
||||||
|
|
||||||
|
int color = getResources().getColor(R.color.grey_900);
|
||||||
|
actionBar.setBackgroundDrawable(new ColorDrawable(color));
|
||||||
|
}
|
||||||
|
|
||||||
private void onStartup()
|
private void onStartup()
|
||||||
{
|
{
|
||||||
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user