mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Hide streaks for numerical habits
This commit is contained in:
@@ -85,7 +85,15 @@
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||
|
||||
<activity
|
||||
android:name=".widgets.HabitPickerDialog"
|
||||
android:name=".widgets.activities.HabitPickerDialog"
|
||||
android:theme="@style/Theme.AppCompat.Light.Dialog">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".widgets.activities.BooleanHabitPickerDialog"
|
||||
android:theme="@style/Theme.AppCompat.Light.Dialog">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
|
||||
|
||||
@@ -158,6 +158,7 @@ public class ShowHabitRootView extends BaseRootView
|
||||
|
||||
if(habit.isNumerical()) {
|
||||
overviewCard.setVisibility(View.GONE);
|
||||
streakCard.setVisibility(View.GONE);
|
||||
} else {
|
||||
targetCard.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2016-2020 Á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/>.
|
||||
*/
|
||||
|
||||
package org.isoron.uhabits.widgets.activities
|
||||
|
||||
class BooleanHabitPickerDialog : HabitPickerDialog() {
|
||||
override fun shouldHideNumerical() = true
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
|
||||
* Copyright (C) 2016-2020 Álinson Santos Xavier <isoron@gmail.com>
|
||||
*
|
||||
* This file is part of Loop Habit Tracker.
|
||||
*
|
||||
@@ -17,7 +17,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.isoron.uhabits.widgets
|
||||
package org.isoron.uhabits.widgets.activities
|
||||
|
||||
import android.app.*
|
||||
import android.appwidget.AppWidgetManager.*
|
||||
@@ -27,14 +27,17 @@ import android.widget.*
|
||||
import android.widget.AbsListView.*
|
||||
import org.isoron.uhabits.*
|
||||
import org.isoron.uhabits.core.preferences.*
|
||||
import org.isoron.uhabits.widgets.*
|
||||
import java.util.*
|
||||
|
||||
class HabitPickerDialog : Activity() {
|
||||
open class HabitPickerDialog : Activity() {
|
||||
|
||||
private var widgetId = 0
|
||||
private lateinit var widgetPreferences: WidgetPreferences
|
||||
private lateinit var widgetUpdater: WidgetUpdater
|
||||
|
||||
protected open fun shouldHideNumerical() = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val component = (applicationContext as HabitsApplication).component
|
||||
@@ -48,6 +51,7 @@ class HabitPickerDialog : Activity() {
|
||||
val habitNames = ArrayList<String>()
|
||||
for (h in habitList) {
|
||||
if (h.isArchived) continue
|
||||
if (h.isNumerical and shouldHideNumerical()) continue
|
||||
habitIds.add(h.id!!)
|
||||
habitNames.add(h.name)
|
||||
}
|
||||
@@ -25,6 +25,6 @@
|
||||
android:previewImage="@drawable/widget_preview_checkmark"
|
||||
android:resizeMode="none"
|
||||
android:updatePeriodMillis="3600000"
|
||||
android:configure="org.isoron.uhabits.widgets.HabitPickerDialog"
|
||||
android:configure="org.isoron.uhabits.widgets.activities.HabitPickerDialog"
|
||||
android:widgetCategory="home_screen">
|
||||
</appwidget-provider>
|
||||
@@ -27,7 +27,7 @@
|
||||
android:previewImage="@drawable/widget_preview_frequency"
|
||||
android:resizeMode="vertical|horizontal"
|
||||
android:updatePeriodMillis="3600000"
|
||||
android:configure="org.isoron.uhabits.widgets.HabitPickerDialog"
|
||||
android:configure="org.isoron.uhabits.widgets.activities.HabitPickerDialog"
|
||||
android:widgetCategory="home_screen">
|
||||
|
||||
</appwidget-provider>
|
||||
@@ -27,7 +27,7 @@
|
||||
android:previewImage="@drawable/widget_preview_history"
|
||||
android:resizeMode="vertical|horizontal"
|
||||
android:updatePeriodMillis="3600000"
|
||||
android:configure="org.isoron.uhabits.widgets.HabitPickerDialog"
|
||||
android:configure="org.isoron.uhabits.widgets.activities.HabitPickerDialog"
|
||||
android:widgetCategory="home_screen">
|
||||
|
||||
</appwidget-provider>
|
||||
@@ -27,7 +27,7 @@
|
||||
android:previewImage="@drawable/widget_preview_score"
|
||||
android:resizeMode="vertical|horizontal"
|
||||
android:updatePeriodMillis="3600000"
|
||||
android:configure="org.isoron.uhabits.widgets.HabitPickerDialog"
|
||||
android:configure="org.isoron.uhabits.widgets.activities.HabitPickerDialog"
|
||||
android:widgetCategory="home_screen">
|
||||
|
||||
</appwidget-provider>
|
||||
@@ -27,7 +27,7 @@
|
||||
android:previewImage="@drawable/widget_preview_streaks"
|
||||
android:resizeMode="vertical|horizontal"
|
||||
android:updatePeriodMillis="3600000"
|
||||
android:configure="org.isoron.uhabits.widgets.HabitPickerDialog"
|
||||
android:configure="org.isoron.uhabits.widgets.activities.BooleanHabitPickerDialog"
|
||||
android:widgetCategory="home_screen">
|
||||
|
||||
</appwidget-provider>
|
||||
Reference in New Issue
Block a user