Switch to AppCompatActivity

pull/84/head
Alinson S. Xavier 10 years ago
parent 33b5215b00
commit 6a5f2abb76

@ -32,14 +32,17 @@ android {
}
dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:preference-v7:23.2.1'
compile 'com.github.paolorotolo:appintro:3.4.0'
compile 'org.apmem.tools:layouts:1.10@aar'
compile 'com.opencsv:opencsv:3.7'
compile project(':libs:drag-sort-listview:library')
compile files('libs/ActiveAndroid.jar')
androidTestCompile 'com.android.support:support-annotations:23.1.1'
androidTestCompile 'com.android.support:support-annotations:23.2.1'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'

@ -19,35 +19,34 @@
package org.isoron.uhabits;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.view.View;
import android.widget.TextView;
import org.isoron.uhabits.helpers.ColorHelper;
import org.isoron.uhabits.helpers.UIHelper;
public class AboutActivity extends Activity implements View.OnClickListener
public class AboutActivity extends BaseActivity implements View.OnClickListener
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
UIHelper.applyCurrentTheme(this);
setContentView(R.layout.about);
setupSupportActionBar(true);
if (android.os.Build.VERSION.SDK_INT >= 21 && !UIHelper.isNightMode())
{
int color = UIHelper.getStyledColor(this, R.attr.aboutScreenColor);
int darkerColor = ColorHelper.mixColors(color, Color.BLACK, 0.75f);
ActionBar actionBar = getActionBar();
ActionBar actionBar = getSupportActionBar();
if(actionBar != null) actionBar.setBackgroundDrawable(new ColorDrawable(color));
getWindow().setStatusBarColor(darkerColor);
}

@ -19,10 +19,13 @@
package org.isoron.uhabits;
import android.app.Activity;
import android.app.backup.BackupManager;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.Toast;
import org.isoron.uhabits.commands.Command;
@ -30,7 +33,7 @@ import org.isoron.uhabits.helpers.UIHelper;
import java.util.LinkedList;
abstract public class BaseActivity extends Activity implements Thread.UncaughtExceptionHandler
abstract public class BaseActivity extends AppCompatActivity implements Thread.UncaughtExceptionHandler
{
private static int MAX_UNDO_LEVEL = 15;
@ -120,6 +123,23 @@ abstract public class BaseActivity extends Activity implements Thread.UncaughtEx
showToast(command.getExecuteStringId());
}
protected void setupSupportActionBar(boolean homeButtonEnabled)
{
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if(toolbar == null) return;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
toolbar.setElevation(UIHelper.dpToPixels(this, 6));
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if(actionBar == null) return;
if(homeButtonEnabled)
actionBar.setDisplayHomeAsUpEnabled(true);
}
public void onPostExecuteCommand(Long refreshKey)
{
}

@ -74,6 +74,8 @@ public class MainActivity extends BaseActivity
setContentView(R.layout.list_habits_activity);
setupSupportActionBar(false);
prefs = PreferenceManager.getDefaultSharedPreferences(this);
listHabitsFragment =
(ListHabitsFragment) getFragmentManager().findFragmentById(R.id.fragment1);
@ -123,6 +125,7 @@ public class MainActivity extends BaseActivity
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
menu.clear();
getMenuInflater().inflate(R.menu.list_habits_menu, menu);
MenuItem nightModeItem = menu.findItem(R.id.action_night_mode);

@ -19,23 +19,15 @@
package org.isoron.uhabits;
import android.app.Activity;
import android.os.Bundle;
import org.isoron.uhabits.fragments.SettingsFragment;
import org.isoron.uhabits.helpers.UIHelper;
public class SettingsActivity extends Activity
public class SettingsActivity extends BaseActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
UIHelper.applyCurrentTheme(this);
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SettingsFragment())
.commit();
setContentView(R.layout.settings_activity);
setupSupportActionBar(true);
}
}

@ -19,12 +19,13 @@
package org.isoron.uhabits;
import android.app.ActionBar;
import android.content.ContentUris;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import org.isoron.uhabits.helpers.ColorHelper;
import org.isoron.uhabits.helpers.UIHelper;
@ -41,26 +42,33 @@ public class ShowHabitActivity extends BaseActivity
Uri data = getIntent().getData();
habit = Habit.get(ContentUris.parseId(data));
ActionBar actionBar = getActionBar();
if(actionBar != null && getHabit() != null)
{
actionBar.setTitle(getHabit().name);
setContentView(R.layout.show_habit_activity);
setupSupportActionBar(true);
setupHabitActionBar();
}
if (android.os.Build.VERSION.SDK_INT >= 21 &&
UIHelper.getStyledBoolean(this, R.attr.useHabitColorAsPrimary))
private void setupHabitActionBar()
{
int androidColor = ColorHelper.getColor(this, getHabit().color);
ColorDrawable drawable = new ColorDrawable(androidColor);
actionBar.setBackgroundDrawable(drawable);
if(habit == null) return;
ActionBar actionBar = getSupportActionBar();
if(actionBar == null) return;
actionBar.setTitle(habit.name);
if (!UIHelper.getStyledBoolean(this, R.attr.useHabitColorAsPrimary)) return;
int color = ColorHelper.getColor(this, habit.color);
int darkerHabitColor = ColorHelper.mixColors(color, Color.BLACK, 0.75f);
getWindow().setStatusBarColor(darkerHabitColor);
}
}
ColorDrawable drawable = new ColorDrawable(color);
actionBar.setBackgroundDrawable(drawable);
setContentView(R.layout.show_habit_activity);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
int darkerColor = ColorHelper.mixColors(color, Color.BLACK, 0.75f);
getWindow().setStatusBarColor(darkerColor);
}
}
public Habit getHabit()

@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.isoron.uhabits.fragments;
package org.isoron.uhabits.dialogs;
import android.annotation.SuppressLint;
import android.app.DialogFragment;
@ -44,7 +44,6 @@ import org.isoron.uhabits.R;
import org.isoron.uhabits.commands.Command;
import org.isoron.uhabits.commands.CreateHabitCommand;
import org.isoron.uhabits.commands.EditHabitCommand;
import org.isoron.uhabits.dialogs.WeekdayPickerDialog;
import org.isoron.uhabits.helpers.ColorHelper;
import org.isoron.uhabits.helpers.DateHelper;
import org.isoron.uhabits.helpers.UIHelper.OnSavedListener;
@ -52,7 +51,7 @@ import org.isoron.uhabits.models.Habit;
import java.util.Arrays;
public class EditHabitFragment extends DialogFragment
public class EditHabitDialogFragment extends DialogFragment
implements OnClickListener, WeekdayPickerDialog.OnWeekdaysPickedListener,
TimePickerDialog.OnTimeSetListener, Spinner.OnItemSelectedListener
{
@ -79,9 +78,9 @@ public class EditHabitFragment extends DialogFragment
private SharedPreferences prefs;
private boolean is24HourMode;
public static EditHabitFragment editSingleHabitFragment(long id)
public static EditHabitDialogFragment editSingleHabitFragment(long id)
{
EditHabitFragment frag = new EditHabitFragment();
EditHabitDialogFragment frag = new EditHabitDialogFragment();
Bundle args = new Bundle();
args.putLong("habitId", id);
args.putInt("editMode", EDIT_MODE);
@ -89,9 +88,9 @@ public class EditHabitFragment extends DialogFragment
return frag;
}
public static EditHabitFragment createHabitFragment()
public static EditHabitDialogFragment createHabitFragment()
{
EditHabitFragment frag = new EditHabitFragment();
EditHabitDialogFragment frag = new EditHabitDialogFragment();
Bundle args = new Bundle();
args.putInt("editMode", CREATE_MODE);
frag.setArguments(args);

@ -35,6 +35,7 @@ import org.isoron.uhabits.commands.ArchiveHabitsCommand;
import org.isoron.uhabits.commands.ChangeHabitColorCommand;
import org.isoron.uhabits.commands.DeleteHabitsCommand;
import org.isoron.uhabits.commands.UnarchiveHabitsCommand;
import org.isoron.uhabits.dialogs.EditHabitDialogFragment;
import org.isoron.uhabits.helpers.ColorHelper;
import org.isoron.uhabits.helpers.UIHelper;
import org.isoron.uhabits.loaders.HabitListLoader;
@ -155,7 +156,8 @@ public class HabitSelectionCallback implements ActionMode.Callback
case R.id.action_edit_habit:
{
EditHabitFragment frag = EditHabitFragment.editSingleHabitFragment(firstHabit.getId());
EditHabitDialogFragment
frag = EditHabitDialogFragment.editSingleHabitFragment(firstHabit.getId());
frag.setOnSavedListener(onSavedListener);
frag.show(activity.getFragmentManager(), "editHabit");
return true;

@ -54,6 +54,7 @@ import org.isoron.uhabits.R;
import org.isoron.uhabits.BaseActivity;
import org.isoron.uhabits.commands.Command;
import org.isoron.uhabits.commands.ToggleRepetitionCommand;
import org.isoron.uhabits.dialogs.EditHabitDialogFragment;
import org.isoron.uhabits.dialogs.FilePickerDialog;
import org.isoron.uhabits.helpers.DatabaseHelper;
import org.isoron.uhabits.helpers.DateHelper;
@ -141,7 +142,7 @@ public class ListHabitsFragment extends Fragment
if(savedInstanceState != null)
{
EditHabitFragment frag = (EditHabitFragment) getFragmentManager()
EditHabitDialogFragment frag = (EditHabitDialogFragment) getFragmentManager()
.findFragmentByTag("editHabit");
if(frag != null) frag.setOnSavedListener(this);
}
@ -217,7 +218,7 @@ public class ListHabitsFragment extends Fragment
{
case R.id.action_add:
{
EditHabitFragment frag = EditHabitFragment.createHabitFragment();
EditHabitDialogFragment frag = EditHabitDialogFragment.createHabitFragment();
frag.setOnSavedListener(this);
frag.show(getFragmentManager(), "editHabit");
return true;

@ -39,6 +39,7 @@ import org.isoron.uhabits.HabitBroadcastReceiver;
import org.isoron.uhabits.R;
import org.isoron.uhabits.ShowHabitActivity;
import org.isoron.uhabits.commands.Command;
import org.isoron.uhabits.dialogs.EditHabitDialogFragment;
import org.isoron.uhabits.dialogs.HistoryEditorDialog;
import org.isoron.uhabits.helpers.ColorHelper;
import org.isoron.uhabits.helpers.ReminderHelper;
@ -132,7 +133,7 @@ public class ShowHabitFragment extends Fragment
if(savedInstanceState != null)
{
EditHabitFragment fragEdit = (EditHabitFragment) getFragmentManager()
EditHabitDialogFragment fragEdit = (EditHabitDialogFragment) getFragmentManager()
.findFragmentByTag("editHabit");
HistoryEditorDialog fragEditor = (HistoryEditorDialog) getFragmentManager()
.findFragmentByTag("historyEditor");
@ -200,7 +201,8 @@ public class ShowHabitFragment extends Fragment
{
case R.id.action_edit_habit:
{
EditHabitFragment frag = EditHabitFragment.editSingleHabitFragment(habit.getId());
EditHabitDialogFragment
frag = EditHabitDialogFragment.editSingleHabitFragment(habit.getId());
frag.setOnSavedListener(this);
frag.show(getFragmentManager(), "editHabit");
return true;

@ -21,6 +21,7 @@ package org.isoron.uhabits.helpers;
import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import org.isoron.uhabits.R;
@ -67,7 +68,10 @@ public class ColorHelper
int palette[] = getPalette(context);
if(paletteColor < 0 || paletteColor >= palette.length)
throw new IllegalArgumentException(String.format("Invalid color: %d", paletteColor));
{
Log.w("ColorHelper", String.format("Invalid color: %d. Returning default.", paletteColor));
paletteColor = 0;
}
return palette[paletteColor];
}

@ -28,17 +28,9 @@
android:angle="270"/>
</shape>
</item>
<item android:top="21dp" android:bottom="2dp">
<shape android:shape="rectangle" >
<gradient
android:angle="270"
android:endColor="#ccffffff"
android:startColor="#ffffff" />
</shape>
</item>
<item android:bottom="21dp">
<shape android:shape="rectangle" >
<solid android:color="#ffffff" />
<solid android:color="@color/grey_200" />
</shape>
</item>

@ -18,12 +18,23 @@
~ with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?windowBackgroundColor"
android:fillViewport="true">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:popupTheme="?toolbarPopupTheme"
style="@style/Toolbar"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/toolbar">
<LinearLayout
style="@style/CardList">
@ -179,3 +190,5 @@
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>

@ -22,7 +22,7 @@
style="@style/dialogForm"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="org.isoron.uhabits.fragments.EditHabitFragment"
tools:context=".dialogs.EditHabitDialogFragment"
tools:ignore="MergeRootFrame">
<LinearLayout

@ -19,17 +19,24 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.isoron.uhabits.MainActivity"
tools:ignore="MergeRootFrame">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:popupTheme="?toolbarPopupTheme"
style="@style/Toolbar"/>
<fragment
android:id="@+id/fragment1"
android:name="org.isoron.uhabits.fragments.ListHabitsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/list_habits_fragment" />
tools:layout="@layout/list_habits_fragment"
android:layout_below="@id/toolbar"/>
</RelativeLayout>

@ -0,0 +1,42 @@
<!--
~ Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
~
~ This file is part of Loop Habit Tracker.
~
~ Loop Habit Tracker is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by the
~ Free Software Foundation, either version 3 of the License, or (at your
~ option) any later version.
~
~ Loop Habit Tracker is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along
~ with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.isoron.uhabits.SettingsActivity"
tools:ignore="MergeRootFrame">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:popupTheme="?toolbarPopupTheme"
style="@style/Toolbar"/>
<fragment
android:id="@+id/fragment"
android:name="org.isoron.uhabits.fragments.SettingsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_below="@id/toolbar"/>
</RelativeLayout>

@ -17,8 +17,9 @@
~ with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -26,12 +27,19 @@
tools:ignore="MergeRootFrame"
tools:menu="show_habit_activity_menu,show_habit_fragment_menu">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:popupTheme="?toolbarPopupTheme"
style="@style/Toolbar"/>
<fragment
android:id="@+id/fragment2"
android:name="org.isoron.uhabits.fragments.ShowHabitFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/show_habit"
android:layout_gravity="center"/>
android:layout_gravity="center"
android:layout_below="@id/toolbar"/>
</FrameLayout>
</RelativeLayout>

@ -22,17 +22,25 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context="org.isoron.uhabits.MainActivity">
<item
android:id="@+id/action_add"
android:icon="?iconAdd"
android:title="@string/add_habit"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_show_archived"
android:checkable="true"
android:enabled="true"
android:title="@string/show_archived"/>
android:title="@string/show_archived"
app:showAsAction="never"/>
<item
android:id="@+id/action_night_mode"
android:checkable="true"
android:enabled="true"
android:title="@string/night_mode"/>
android:title="@string/night_mode"
app:showAsAction="never"/>
<item
android:id="@+id/action_settings"

@ -19,12 +19,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="org.isoron.uhabits.MainActivity">
<item
android:id="@+id/action_add"
android:icon="?iconAdd"
android:title="@string/add_habit"
android:showAsAction="always"/>
</menu>

@ -18,12 +18,13 @@
~ with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_edit_habit"
android:icon="?iconEdit"
android:title="@string/edit"
android:showAsAction="ifRoom"/>
app:showAsAction="ifRoom"/>
</menu>

@ -18,105 +18,6 @@
-->
<resources>
<style name="AppBaseTheme" parent="android:Theme.Material.Light.DarkActionBar">
<item name="android:dialogTheme">@style/MyDialogStyle</item>
<item name="android:alertDialogTheme">@style/MyDialogStyle</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:spinnerItemStyle">@style/dialogFormSmallText</item>
<item name="android:colorPrimary">@color/blue_grey_800</item>
<item name="android:colorPrimaryDark">@color/blue_grey_900</item>
<item name="cardBackgroundColor">@color/grey_50</item>
<item name="windowBackgroundColor">@color/grey_200</item>
<item name="headerBackgroundColor">@color/grey_200</item>
<item name="highlightedBackgroundColor">@color/grey_100</item>
<item name="android:textColor">@color/grey_800</item>
<item name="useHabitColorAsPrimary">true</item>
<item name="palette">@array/lightPalette</item>
<item name="highContrastReverseTextColor">@color/white</item>
<item name="mediumContrastReverseTextColor">@color/grey_500</item>
<item name="lowContrastReverseTextColor">@color/grey_700</item>
<item name="highContrastTextColor">@color/grey_800</item>
<item name="mediumContrastTextColor">@color/grey_500</item>
<item name="lowContrastTextColor">@color/grey_300</item>
<item name="iconAdd">@drawable/ic_action_add_dark</item>
<item name="iconArchive">@drawable/ic_action_archive_dark</item>
<item name="iconEdit">@drawable/ic_action_edit_dark</item>
<item name="iconUnarchive">@drawable/ic_action_unarchive_dark</item>
<item name="iconChangeColor">@drawable/ic_action_color_dark</item>
<item name="dialogIconChangeColor">@drawable/ic_action_color_light</item>
<item name="dialogFormSpinnerTheme">@style/dialogFormSpinnerLight</item>
<item name="aboutScreenColor">@color/blue_700</item>
</style>
<style name="AppBaseThemeDark" parent="android:Theme.Material">
<item name="android:dialogTheme">@style/MyDialogStyleDark</item>
<item name="android:alertDialogTheme">@style/MyDialogStyleDark</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:colorPrimary">@color/grey_950</item>
<item name="android:colorPrimaryDark">@color/black</item>
<item name="cardBackgroundColor">@color/grey_850</item>
<item name="windowBackgroundColor">@color/grey_900</item>
<item name="headerBackgroundColor">@color/grey_900</item>
<item name="highlightedBackgroundColor">@color/grey_800</item>
<item name="android:textColor">@color/grey_100</item>
<item name="useHabitColorAsPrimary">false</item>
<item name="highContrastTextColor">@color/grey_100</item>
<item name="mediumContrastTextColor">@color/grey_500</item>
<item name="lowContrastTextColor">@color/grey_800</item>
<item name="highContrastReverseTextColor">@color/grey_900</item>
<item name="mediumContrastReverseTextColor">@color/grey_700</item>
<item name="lowContrastReverseTextColor">@color/grey_300</item>
<item name="iconAdd">@drawable/ic_action_add_dark</item>
<item name="iconArchive">@drawable/ic_action_archive_dark</item>
<item name="iconEdit">@drawable/ic_action_edit_dark</item>
<item name="iconUnarchive">@drawable/ic_action_unarchive_dark</item>
<item name="iconChangeColor">@drawable/ic_action_color_dark</item>
<item name="dialogIconChangeColor">@drawable/ic_action_color_dark</item>
<item name="dialogFormSpinnerTheme">@style/dialogFormSpinnerDark</item>
<item name="palette">@array/darkPalette</item>
<item name="aboutScreenColor">@color/blue_300</item>
</style>
<style name="AppBaseThemeDark.PureBlack">
<item name="android:colorPrimary">@color/black</item>
<item name="android:colorPrimaryDark">@color/black</item>
<item name="cardBackgroundColor">@color/black</item>
<item name="windowBackgroundColor">@color/black</item>
<item name="headerBackgroundColor">@color/black</item>
<item name="highlightedBackgroundColor">@color/black</item>
<item name="lowContrastTextColor">@color/grey_900</item>
<item name="highContrastReverseTextColor">@color/black</item>
</style>
<style name="MyDialogStyle" parent="android:Theme.Material.Light.Dialog">
<item name="android:spinnerItemStyle">@style/dialogFormText</item>
<item name="android:spinnerDropDownItemStyle">@style/dialogFormSpinnerDropDown</item>
</style>
<style name="MyDialogStyleDark" parent="android:Theme.Material.Dialog">
<item name="android:spinnerItemStyle">@style/dialogFormText</item>
<item name="android:spinnerDropDownItemStyle">@style/dialogFormSpinnerDropDown</item>
</style>
<style name="Card" parent="CardCommon">
<item name="android:elevation">1dp</item>
<item name="android:background">?attr/cardBackgroundColor</item>

@ -43,6 +43,7 @@
<attr name="dialogIconChangeColor" format="reference"/>
<attr name="dialogFormSpinnerTheme" format="reference"/>
<attr name="toolbarPopupTheme" format="reference"/>
<!-- Pre-Lollipop -->
<attr name="cardBackground" format="reference"/>

@ -18,14 +18,22 @@
-->
<resources>
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
<item name="windowActionModeOverlay">true</item>
<item name="android:dialogTheme">@style/MyDialogStyle</item>
<item name="android:alertDialogTheme">@style/MyDialogStyle</item>
<item name="android:spinnerItemStyle">@style/dialogFormSmallText</item>
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<item name="selectedBackground">@drawable/selected_box_light</item>
<item name="headerBackground">@drawable/habits_list_header_light_background</item>
<item name="cardBackground">@drawable/card_light_background</item>
<item name="cardBackgroundColor">@color/white</item>
<item name="colorPrimary">@color/blue_grey_800</item>
<item name="colorPrimaryDark">@color/blue_grey_900</item>
<item name="cardBackgroundColor">@color/grey_50</item>
<item name="windowBackgroundColor">@color/grey_200</item>
<item name="headerBackgroundColor">@color/grey_200</item>
<item name="highlightedBackgroundColor">@color/grey_100</item>
<item name="android:textColor">@color/grey_800</item>
<item name="useHabitColorAsPrimary">true</item>
@ -39,24 +47,33 @@
<item name="mediumContrastTextColor">@color/grey_500</item>
<item name="lowContrastTextColor">@color/grey_300</item>
<item name="iconAdd">@drawable/ic_action_add_light</item>
<item name="iconArchive">@drawable/ic_action_archive_light</item>
<item name="iconEdit">@drawable/ic_action_edit_light</item>
<item name="iconUnarchive">@drawable/ic_action_unarchive_light</item>
<item name="iconChangeColor">@drawable/ic_action_color_light</item>
<item name="dialogIconChangeColor">@drawable/ic_action_color_light</item>
<item name="iconAdd">@drawable/ic_action_add_dark</item>
<item name="iconArchive">@drawable/ic_action_archive_dark</item>
<item name="iconEdit">@drawable/ic_action_edit_dark</item>
<item name="iconUnarchive">@drawable/ic_action_unarchive_dark</item>
<item name="iconChangeColor">@drawable/ic_action_color_dark</item>
<item name="dialogIconChangeColor">@drawable/ic_action_color_dark</item>
<item name="dialogFormSpinnerTheme">@style/dialogFormSpinnerLight</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="aboutScreenColor">@color/blue_700</item>
</style>
<style name="AppBaseThemeDark" parent="android:Theme.Holo">
<style name="AppBaseThemeDark" parent="@style/Theme.AppCompat.NoActionBar">
<item name="windowActionModeOverlay">true</item>
<item name="android:dialogTheme">@style/MyDialogStyleDark</item>
<item name="android:alertDialogTheme">@style/MyDialogStyleDark</item>
<item name="selectedBackground">@drawable/selected_box_dark</item>
<item name="headerBackground">@drawable/habits_list_header_dark_background</item>
<item name="cardBackground">@drawable/card_dark_background</item>
<item name="colorPrimary">@color/grey_950</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="cardBackgroundColor">@color/grey_850</item>
<item name="windowBackgroundColor">@color/grey_900</item>
<item name="headerBackgroundColor">@color/grey_900</item>
<item name="highlightedBackgroundColor">@color/grey_800</item>
<item name="android:textColor">@color/grey_100</item>
<item name="useHabitColorAsPrimary">false</item>
@ -76,6 +93,7 @@
<item name="iconChangeColor">@drawable/ic_action_color_dark</item>
<item name="dialogIconChangeColor">@drawable/ic_action_color_dark</item>
<item name="dialogFormSpinnerTheme">@style/dialogFormSpinnerDark</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat</item>
<item name="palette">@array/darkPalette</item>
@ -86,9 +104,14 @@
<item name="selectedBackground">@drawable/selected_box_amoled</item>
<item name="headerBackground">@drawable/habits_list_header_amoled_background</item>
<item name="cardBackground">@drawable/card_amoled_background</item>
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="cardBackgroundColor">@color/black</item>
<item name="windowBackgroundColor">@color/black</item>
<item name="headerBackgroundColor">@color/black</item>
<item name="highlightedBackgroundColor">@color/black</item>
<item name="lowContrastTextColor">@color/grey_900</item>
<item name="highContrastReverseTextColor">@color/black</item>
</style>
@ -174,4 +197,23 @@
<item name="android:textColor">?mediumContrastTextColor</item>
</style>
<style name="Toolbar">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">?actionBarSize</item>
<item name="android:background">?colorPrimary</item>
<item name="android:theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="android:layout_alignParentTop">true</item>
</style>
<style name="MyDialogStyle" parent="@style/Theme.AppCompat.Light.Dialog">
<item name="android:spinnerItemStyle">@style/dialogFormText</item>
<item name="android:spinnerDropDownItemStyle">@style/dialogFormSpinnerDropDown</item>
</style>
<style name="MyDialogStyleDark" parent="@style/Theme.AppCompat.Dialog">
<item name="android:spinnerItemStyle">@style/dialogFormText</item>
<item name="android:spinnerDropDownItemStyle">@style/dialogFormSpinnerDropDown</item>
</style>
</resources>

@ -24,13 +24,13 @@
android:key="interfaceCategory"
android:title="@string/interface_preferences">
<SwitchPreference
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_short_toggle"
android:summary="@string/pref_toggle_description"
android:title="@string/pref_toggle_title"/>
<SwitchPreference
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_pure_black"
android:summary="@string/pure_black_description"

Loading…
Cancel
Save