2017-03-11 21:25:37 +00:00
|
|
|
|
|
|
|
using Android.App;
|
|
|
|
using Android.OS;
|
|
|
|
using Android.Preferences;
|
2017-09-24 19:45:05 +00:00
|
|
|
using System.Security;
|
2017-03-11 21:25:37 +00:00
|
|
|
|
|
|
|
namespace OrarendAndroidApp
|
|
|
|
{
|
|
|
|
public class ActivityBase : Activity
|
|
|
|
{
|
|
|
|
protected override void OnCreate(Bundle savedInstanceState)
|
|
|
|
{
|
|
|
|
base.OnCreate(savedInstanceState);
|
|
|
|
SetTheme(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void SetTheme(Activity activity)
|
|
|
|
{
|
|
|
|
var settings = PreferenceManager.GetDefaultSharedPreferences(activity);
|
|
|
|
bool darktheme = settings.GetBoolean("pref_theme", false);
|
2017-03-25 22:17:30 +00:00
|
|
|
if (activity is ActivityBase ab)
|
|
|
|
ab.DarkTheme = darktheme;
|
2017-03-11 21:25:37 +00:00
|
|
|
activity.SetTheme(darktheme ? Android.Resource.Style.ThemeDeviceDefault : Android.Resource.Style.ThemeDeviceDefaultLight);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool DarkTheme;
|
|
|
|
}
|
|
|
|
}
|