diff --git a/android/uhabits-android/build.gradle b/android/uhabits-android/build.gradle index 521f4f19a..1b7282409 100644 --- a/android/uhabits-android/build.gradle +++ b/android/uhabits-android/build.gradle @@ -4,6 +4,7 @@ plugins { id 'kotlin-android' id 'kotlin-kapt' id 'com.github.triplet.play' version '2.6.2' + id 'kotlin-android-extensions' } android { @@ -88,6 +89,7 @@ dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$KOTLIN_VERSION" + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' compileOnly "javax.annotation:jsr250-api:1.0" compileOnly "com.google.auto.factory:auto-factory:$AUTO_FACTORY_VERSION" kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION" @@ -134,4 +136,4 @@ kapt { play { serviceAccountCredentials = file("../../.secret/gcp-key.json") track = "alpha" -} \ No newline at end of file +} diff --git a/android/uhabits-android/src/main/AndroidManifest.xml b/android/uhabits-android/src/main/AndroidManifest.xml index 0c298306b..dfabd05fc 100644 --- a/android/uhabits-android/src/main/AndroidManifest.xml +++ b/android/uhabits-android/src/main/AndroidManifest.xml @@ -1,229 +1,212 @@ - - - - - - - - + + + + + android:name=".HabitsApplication" + android:allowBackup="true" + android:backupAgent=".HabitsBackupAgent" + android:icon="@mipmap/ic_launcher" + android:label="@string/main_activity_title" + android:supportsRtl="true" + android:theme="@style/AppBaseTheme"> + + + + android:name="com.google.android.backup.api_key" + android:value="AEdPqrEAAAAI6aeWncbnMNo8E5GWeZ44dlc5cQ7tCROwFhOtiw" /> + android:name=".activities.habits.list.ListHabitsActivity" + android:exported="true" + android:label="@string/main_activity_title" + android:launchMode="singleTop" /> + android:name=".MainActivity" + android:label="@string/main_activity_title" + android:launchMode="singleTop" + android:targetActivity=".activities.habits.list.ListHabitsActivity"> - - + + + + android:name=".activities.habits.show.ShowHabitActivity" + android:label="@string/title_activity_show_habit"> + android:name="android.support.PARENT_ACTIVITY" + android:value=".activities.habits.list.ListHabitsActivity" /> + android:name=".activities.settings.SettingsActivity" + android:label="@string/settings"> + android:name="android.support.PARENT_ACTIVITY" + android:value=".activities.habits.list.ListHabitsActivity" /> + android:name=".activities.intro.IntroActivity" + android:label="" + android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> + android:name=".widgets.HabitPickerDialog" + android:theme="@style/Theme.AppCompat.Light.Dialog"> - + + android:name=".activities.about.AboutActivity" + android:label="@string/about"> - - + android:name="android.support.PARENT_ACTIVITY" + android:value=".activities.habits.list.ListHabitsActivity" /> + + android:name=".widgets.CheckmarkWidgetProvider" + android:label="@string/checkmark"> - + + android:name="android.appwidget.provider" + android:resource="@xml/widget_checkmark_info" /> - + + + + android:name=".widgets.HistoryWidgetProvider" + android:label="@string/history"> - + + android:name="android.appwidget.provider" + android:resource="@xml/widget_history_info" /> + android:name=".widgets.ScoreWidgetProvider" + android:label="@string/habit_strength"> - + + android:name="android.appwidget.provider" + android:resource="@xml/widget_score_info" /> + android:name=".widgets.StreakWidgetProvider" + android:label="@string/streaks"> - + + android:name="android.appwidget.provider" + android:resource="@xml/widget_streak_info" /> + android:name=".widgets.FrequencyWidgetProvider" + android:label="@string/frequency"> - + + android:name="android.appwidget.provider" + android:resource="@xml/widget_frequency_info" /> - + - + - + + android:host="org.isoron.uhabits" + android:scheme="content" /> - + - + + android:host="org.isoron.uhabits" + android:scheme="content" /> - + - + + android:host="org.isoron.uhabits" + android:scheme="content" /> - - - + + android:name=".automation.EditSettingActivity" + android:exported="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name"> - + - - - + + android:name=".automation.FireSettingReceiver" + android:exported="true"> - + + android:name="androidx.core.content.FileProvider" + android:authorities="org.isoron.uhabits" + android:exported="false" + android:grantUriPermissions="true"> + android:name="android.support.FILE_PROVIDER_PATHS" + android:resource="@xml/file_paths" /> - + android:name=".sync.SyncService" + android:enabled="true" + android:exported="false"> \ No newline at end of file diff --git a/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/edit/EditHabitActivity.kt b/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/edit/EditHabitActivity.kt new file mode 100644 index 000000000..b8446034e --- /dev/null +++ b/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/edit/EditHabitActivity.kt @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2016 Álinson Santos Xavier + * + * 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 . + */ + +package org.isoron.uhabits.activities.habits.edit + +import android.graphics.* +import android.os.* +import androidx.appcompat.app.* +import androidx.appcompat.widget.* +import org.isoron.uhabits.* + +class EditHabitActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_edit_habit) + + window.statusBarColor = Color.parseColor("#B4285A") + + val toolbar = findViewById(R.id.toolbar) + setSupportActionBar(toolbar) + supportActionBar?.setDisplayHomeAsUpEnabled(true) + supportActionBar?.setDisplayShowHomeEnabled(true) + supportActionBar?.elevation = 10.0f + } +} diff --git a/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/list/ListHabitsScreen.kt b/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/list/ListHabitsScreen.kt index 4cf89c363..a55fee4df 100644 --- a/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/list/ListHabitsScreen.kt +++ b/android/uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/list/ListHabitsScreen.kt @@ -138,8 +138,8 @@ class ListHabitsScreen } override fun showCreateBooleanHabitScreen() { - val dialog = editHabitDialogFactory.createBoolean() - activity.showDialog(dialog, "editHabit") + val intent = intentFactory.startEditActivity(activity) + activity.startActivity(intent) } override fun showCreateNumericalHabitScreen() { diff --git a/android/uhabits-android/src/main/java/org/isoron/uhabits/intents/IntentFactory.kt b/android/uhabits-android/src/main/java/org/isoron/uhabits/intents/IntentFactory.kt index 11ac9d24c..03d418f68 100644 --- a/android/uhabits-android/src/main/java/org/isoron/uhabits/intents/IntentFactory.kt +++ b/android/uhabits-android/src/main/java/org/isoron/uhabits/intents/IntentFactory.kt @@ -21,8 +21,10 @@ package org.isoron.uhabits.intents import android.content.* import android.net.* +import org.isoron.androidbase.activities.* import org.isoron.uhabits.* import org.isoron.uhabits.activities.about.* +import org.isoron.uhabits.activities.habits.edit.* import org.isoron.uhabits.activities.habits.show.* import org.isoron.uhabits.activities.intro.* import org.isoron.uhabits.activities.settings.* @@ -81,4 +83,8 @@ class IntentFactory fun codeContributors(context: Context) = buildViewIntent(context.getString(R.string.codeContributorsURL)) + + fun startEditActivity(context: Context): Intent? { + return Intent(context, EditHabitActivity::class.java) + } } diff --git a/android/uhabits-android/src/main/res/drawable/ic_arrow_drop_down_dark.xml b/android/uhabits-android/src/main/res/drawable/ic_arrow_drop_down_dark.xml new file mode 100644 index 000000000..64aecb682 --- /dev/null +++ b/android/uhabits-android/src/main/res/drawable/ic_arrow_drop_down_dark.xml @@ -0,0 +1,9 @@ + + + diff --git a/android/uhabits-android/src/main/res/drawable/input_box_background.xml b/android/uhabits-android/src/main/res/drawable/input_box_background.xml new file mode 100644 index 000000000..6bbf34405 --- /dev/null +++ b/android/uhabits-android/src/main/res/drawable/input_box_background.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/android/uhabits-android/src/main/res/layout/activity_edit_habit.xml b/android/uhabits-android/src/main/res/layout/activity_edit_habit.xml new file mode 100644 index 000000000..9e6d5be32 --- /dev/null +++ b/android/uhabits-android/src/main/res/layout/activity_edit_habit.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file