Switch to AppCompatActivity

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

@ -32,14 +32,17 @@ android {
} }
dependencies { 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 'com.github.paolorotolo:appintro:3.4.0'
compile 'org.apmem.tools:layouts:1.10@aar' compile 'org.apmem.tools:layouts:1.10@aar'
compile 'com.opencsv:opencsv:3.7' compile 'com.opencsv:opencsv:3.7'
compile project(':libs:drag-sort-listview:library') compile project(':libs:drag-sort-listview:library')
compile files('libs/ActiveAndroid.jar') 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:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1' androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'

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

@ -19,10 +19,13 @@
package org.isoron.uhabits; package org.isoron.uhabits;
import android.app.Activity;
import android.app.backup.BackupManager; import android.app.backup.BackupManager;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; 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 android.widget.Toast;
import org.isoron.uhabits.commands.Command; import org.isoron.uhabits.commands.Command;
@ -30,7 +33,7 @@ import org.isoron.uhabits.helpers.UIHelper;
import java.util.LinkedList; 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; private static int MAX_UNDO_LEVEL = 15;
@ -120,6 +123,23 @@ abstract public class BaseActivity extends Activity implements Thread.UncaughtEx
showToast(command.getExecuteStringId()); 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) public void onPostExecuteCommand(Long refreshKey)
{ {
} }

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

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

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

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

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

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

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

@ -21,6 +21,7 @@ package org.isoron.uhabits.helpers;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.util.Log;
import org.isoron.uhabits.R; import org.isoron.uhabits.R;
@ -67,7 +68,10 @@ public class ColorHelper
int palette[] = getPalette(context); int palette[] = getPalette(context);
if(paletteColor < 0 || paletteColor >= palette.length) 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]; return palette[paletteColor];
} }

@ -28,17 +28,9 @@
android:angle="270"/> android:angle="270"/>
</shape> </shape>
</item> </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"> <item android:bottom="21dp">
<shape android:shape="rectangle" > <shape android:shape="rectangle" >
<solid android:color="#ffffff" /> <solid android:color="@color/grey_200" />
</shape> </shape>
</item> </item>

@ -18,164 +18,177 @@
~ with this program. If not, see <http://www.gnu.org/licenses/>. ~ 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_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?windowBackgroundColor" android:background="?windowBackgroundColor"
android:fillViewport="true"> android:fillViewport="true">
<LinearLayout <android.support.v7.widget.Toolbar
style="@style/CardList"> android:id="@+id/toolbar"
app:popupTheme="?toolbarPopupTheme"
style="@style/Toolbar"/>
<LinearLayout <ScrollView
style="@style/Card" android:layout_width="match_parent"
android:gravity="center"> android:layout_height="wrap_content"
android:layout_below="@id/toolbar">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="6dp"
android:src="@drawable/intro_icon_1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textStyle="bold"
android:textSize="16sp"
android:layout_margin="6dp"
android:textColor="?aboutScreenColor"
android:text="@string/app_name"/>
<TextView
android:id="@+id/tvVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""/>
</LinearLayout>
<LinearLayout <LinearLayout
style="@style/Card" style="@style/CardList">
android:gravity="center">
<LinearLayout
<TextView style="@style/Card"
style="@style/CardHeader" android:gravity="center">
android:text="@string/links"
android:textColor="?aboutScreenColor"/> <ImageView
android:layout_width="100dp"
<TextView android:layout_height="100dp"
android:id="@+id/tvRate" android:layout_margin="6dp"
style="@style/About.Item.Clickable" android:src="@drawable/intro_icon_1"/>
android:text="@string/pref_rate_this_app"/>
<TextView
<TextView android:layout_width="wrap_content"
android:id="@+id/tvFeedback" android:layout_height="wrap_content"
style="@style/About.Item.Clickable" android:gravity="center"
android:text="@string/pref_send_feedback"/> android:textStyle="bold"
android:textSize="16sp"
<TextView android:layout_margin="6dp"
android:id="@+id/tvSource" android:textColor="?aboutScreenColor"
style="@style/About.Item.Clickable" android:text="@string/app_name"/>
android:text="@string/pref_view_source_code"/>
<TextView
android:id="@+id/tvVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""/>
</LinearLayout>
<LinearLayout
style="@style/Card"
android:gravity="center">
<TextView
style="@style/CardHeader"
android:text="@string/links"
android:textColor="?aboutScreenColor"/>
<TextView
android:id="@+id/tvRate"
style="@style/About.Item.Clickable"
android:text="@string/pref_rate_this_app"/>
<TextView
android:id="@+id/tvFeedback"
style="@style/About.Item.Clickable"
android:text="@string/pref_send_feedback"/>
<TextView
android:id="@+id/tvSource"
style="@style/About.Item.Clickable"
android:text="@string/pref_view_source_code"/>
</LinearLayout>
<LinearLayout
style="@style/Card"
android:gravity="center">
<TextView
style="@style/CardHeader"
android:text="@string/developers"
android:textColor="?aboutScreenColor"/>
<TextView
style="@style/About.Item"
android:text="Álinson Xavier"/>
</LinearLayout>
<LinearLayout
style="@style/Card"
android:gravity="center">
<TextView
style="@style/CardHeader"
android:text="@string/translators"
android:textColor="?aboutScreenColor"/>
<TextView
style="@style/About.Item"
android:text="Limin Lu (中文)"/>
<TextView
style="@style/About.Item"
android:text="François Mahé (Français)"/>
<TextView
style="@style/About.Item"
android:text="Naofumi F (日本語)"/>
<TextView
style="@style/About.Item"
android:text="Matthias Meisser (Deutsch)"/>
<TextView
style="@style/About.Item"
android:text="Al Alloush (العَرَبِية‎)"/>
<TextView
style="@style/About.Item"
android:text="Thibaut Girka (Français)"/>
<TextView
style="@style/About.Item"
android:text="Can Altas (Deutsch)"/>
<TextView
style="@style/About.Item"
android:text="Marco Cavazza (Italiano)"/>
<TextView
style="@style/About.Item"
android:text="Adam Jurkiewicz (Polski)"/>
<TextView
style="@style/About.Item"
android:text="Dmitriy Bogdanov (Русский)"/>
<TextView
style="@style/About.Item"
android:text="Dalecarlian (Svenska)"/>
<TextView
style="@style/About.Item"
android:text="Robin (Svenska)"/>
<TextView
style="@style/About.Item"
android:text="Josh (한국어 )"/>
<TextView
style="@style/About.Item"
android:text="Ander Raso Vazquez (Español)"/>
<TextView
style="@style/About.Item"
android:text="XuToTo (中文)"/>
<TextView
style="@style/About.Item"
android:text="Tomáš Borovec (Čeština)"/>
<TextView
style="@style/About.Item"
android:text="Mathis Chenuet (Français)"/>
<TextView
style="@style/About.Item"
android:text="Álinson Xavier (Português)"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView>
<LinearLayout </RelativeLayout>
style="@style/Card"
android:gravity="center">
<TextView
style="@style/CardHeader"
android:text="@string/developers"
android:textColor="?aboutScreenColor"/>
<TextView
style="@style/About.Item"
android:text="Álinson Xavier"/>
</LinearLayout>
<LinearLayout
style="@style/Card"
android:gravity="center">
<TextView
style="@style/CardHeader"
android:text="@string/translators"
android:textColor="?aboutScreenColor"/>
<TextView
style="@style/About.Item"
android:text="Limin Lu (中文)"/>
<TextView
style="@style/About.Item"
android:text="François Mahé (Français)"/>
<TextView
style="@style/About.Item"
android:text="Naofumi F (日本語)"/>
<TextView
style="@style/About.Item"
android:text="Matthias Meisser (Deutsch)"/>
<TextView
style="@style/About.Item"
android:text="Al Alloush (العَرَبِية‎)"/>
<TextView
style="@style/About.Item"
android:text="Thibaut Girka (Français)"/>
<TextView
style="@style/About.Item"
android:text="Can Altas (Deutsch)"/>
<TextView
style="@style/About.Item"
android:text="Marco Cavazza (Italiano)"/>
<TextView
style="@style/About.Item"
android:text="Adam Jurkiewicz (Polski)"/>
<TextView
style="@style/About.Item"
android:text="Dmitriy Bogdanov (Русский)"/>
<TextView
style="@style/About.Item"
android:text="Dalecarlian (Svenska)"/>
<TextView
style="@style/About.Item"
android:text="Robin (Svenska)"/>
<TextView
style="@style/About.Item"
android:text="Josh (한국어 )"/>
<TextView
style="@style/About.Item"
android:text="Ander Raso Vazquez (Español)"/>
<TextView
style="@style/About.Item"
android:text="XuToTo (中文)"/>
<TextView
style="@style/About.Item"
android:text="Tomáš Borovec (Čeština)"/>
<TextView
style="@style/About.Item"
android:text="Mathis Chenuet (Français)"/>
<TextView
style="@style/About.Item"
android:text="Álinson Xavier (Português)"/>
</LinearLayout>
</LinearLayout>
</ScrollView>

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

@ -18,18 +18,25 @@
--> -->
<RelativeLayout 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:tools="http://schemas.android.com/tools"
android:id="@+id/container" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:id="@+id/container"
android:layout_height="match_parent" android:layout_width="match_parent"
tools:context="org.isoron.uhabits.MainActivity" android:layout_height="match_parent"
tools:ignore="MergeRootFrame" > 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 <fragment
android:id="@+id/fragment1" android:id="@+id/fragment1"
android:name="org.isoron.uhabits.fragments.ListHabitsFragment" android:name="org.isoron.uhabits.fragments.ListHabitsFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="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> </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,14 +17,21 @@
~ with this program. If not, see <http://www.gnu.org/licenses/>. ~ 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:tools="http://schemas.android.com/tools"
android:id="@+id/container" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:id="@+id/container"
android:layout_height="match_parent" android:layout_width="match_parent"
tools:context="org.isoron.uhabits.ShowHabitActivity" android:layout_height="match_parent"
tools:ignore="MergeRootFrame" tools:context="org.isoron.uhabits.ShowHabitActivity"
tools:menu="show_habit_activity_menu,show_habit_fragment_menu"> 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 <fragment
android:id="@+id/fragment2" android:id="@+id/fragment2"
@ -32,6 +39,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:layout="@layout/show_habit" 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" xmlns:tools="http://schemas.android.com/tools"
tools:context="org.isoron.uhabits.MainActivity"> tools:context="org.isoron.uhabits.MainActivity">
<item
android:id="@+id/action_add"
android:icon="?iconAdd"
android:title="@string/add_habit"
app:showAsAction="ifRoom"/>
<item <item
android:id="@+id/action_show_archived" android:id="@+id/action_show_archived"
android:checkable="true" android:checkable="true"
android:enabled="true" android:enabled="true"
android:title="@string/show_archived"/> android:title="@string/show_archived"
app:showAsAction="never"/>
<item <item
android:id="@+id/action_night_mode" android:id="@+id/action_night_mode"
android:checkable="true" android:checkable="true"
android:enabled="true" android:enabled="true"
android:title="@string/night_mode"/> android:title="@string/night_mode"
app:showAsAction="never"/>
<item <item
android:id="@+id/action_settings" android:id="@+id/action_settings"

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

@ -18,12 +18,13 @@
~ with this program. If not, see <http://www.gnu.org/licenses/>. ~ 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 <item
android:id="@+id/action_edit_habit" android:id="@+id/action_edit_habit"
android:icon="?iconEdit" android:icon="?iconEdit"
android:title="@string/edit" android:title="@string/edit"
android:showAsAction="ifRoom"/> app:showAsAction="ifRoom"/>
</menu> </menu>

@ -18,105 +18,6 @@
--> -->
<resources> <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"> <style name="Card" parent="CardCommon">
<item name="android:elevation">1dp</item> <item name="android:elevation">1dp</item>
<item name="android:background">?attr/cardBackgroundColor</item> <item name="android:background">?attr/cardBackgroundColor</item>

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

@ -18,14 +18,22 @@
--> -->
<resources> <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="selectedBackground">@drawable/selected_box_light</item>
<item name="headerBackground">@drawable/habits_list_header_light_background</item> <item name="headerBackground">@drawable/habits_list_header_light_background</item>
<item name="cardBackground">@drawable/card_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="windowBackgroundColor">@color/grey_200</item>
<item name="headerBackgroundColor">@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="android:textColor">@color/grey_800</item>
<item name="useHabitColorAsPrimary">true</item> <item name="useHabitColorAsPrimary">true</item>
@ -39,24 +47,33 @@
<item name="mediumContrastTextColor">@color/grey_500</item> <item name="mediumContrastTextColor">@color/grey_500</item>
<item name="lowContrastTextColor">@color/grey_300</item> <item name="lowContrastTextColor">@color/grey_300</item>
<item name="iconAdd">@drawable/ic_action_add_light</item> <item name="iconAdd">@drawable/ic_action_add_dark</item>
<item name="iconArchive">@drawable/ic_action_archive_light</item> <item name="iconArchive">@drawable/ic_action_archive_dark</item>
<item name="iconEdit">@drawable/ic_action_edit_light</item> <item name="iconEdit">@drawable/ic_action_edit_dark</item>
<item name="iconUnarchive">@drawable/ic_action_unarchive_light</item> <item name="iconUnarchive">@drawable/ic_action_unarchive_dark</item>
<item name="iconChangeColor">@drawable/ic_action_color_light</item> <item name="iconChangeColor">@drawable/ic_action_color_dark</item>
<item name="dialogIconChangeColor">@drawable/ic_action_color_light</item> <item name="dialogIconChangeColor">@drawable/ic_action_color_dark</item>
<item name="dialogFormSpinnerTheme">@style/dialogFormSpinnerLight</item> <item name="dialogFormSpinnerTheme">@style/dialogFormSpinnerLight</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="aboutScreenColor">@color/blue_700</item> <item name="aboutScreenColor">@color/blue_700</item>
</style> </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="selectedBackground">@drawable/selected_box_dark</item>
<item name="headerBackground">@drawable/habits_list_header_dark_background</item> <item name="headerBackground">@drawable/habits_list_header_dark_background</item>
<item name="cardBackground">@drawable/card_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="cardBackgroundColor">@color/grey_850</item>
<item name="windowBackgroundColor">@color/grey_900</item> <item name="windowBackgroundColor">@color/grey_900</item>
<item name="headerBackgroundColor">@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="android:textColor">@color/grey_100</item>
<item name="useHabitColorAsPrimary">false</item> <item name="useHabitColorAsPrimary">false</item>
@ -76,6 +93,7 @@
<item name="iconChangeColor">@drawable/ic_action_color_dark</item> <item name="iconChangeColor">@drawable/ic_action_color_dark</item>
<item name="dialogIconChangeColor">@drawable/ic_action_color_dark</item> <item name="dialogIconChangeColor">@drawable/ic_action_color_dark</item>
<item name="dialogFormSpinnerTheme">@style/dialogFormSpinnerDark</item> <item name="dialogFormSpinnerTheme">@style/dialogFormSpinnerDark</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat</item>
<item name="palette">@array/darkPalette</item> <item name="palette">@array/darkPalette</item>
@ -86,9 +104,14 @@
<item name="selectedBackground">@drawable/selected_box_amoled</item> <item name="selectedBackground">@drawable/selected_box_amoled</item>
<item name="headerBackground">@drawable/habits_list_header_amoled_background</item> <item name="headerBackground">@drawable/habits_list_header_amoled_background</item>
<item name="cardBackground">@drawable/card_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="cardBackgroundColor">@color/black</item>
<item name="windowBackgroundColor">@color/black</item> <item name="windowBackgroundColor">@color/black</item>
<item name="headerBackgroundColor">@color/black</item> <item name="headerBackgroundColor">@color/black</item>
<item name="highlightedBackgroundColor">@color/black</item>
<item name="lowContrastTextColor">@color/grey_900</item> <item name="lowContrastTextColor">@color/grey_900</item>
<item name="highContrastReverseTextColor">@color/black</item> <item name="highContrastReverseTextColor">@color/black</item>
</style> </style>
@ -174,4 +197,23 @@
<item name="android:textColor">?mediumContrastTextColor</item> <item name="android:textColor">?mediumContrastTextColor</item>
</style> </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> </resources>

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

Loading…
Cancel
Save