Reactivate widget view tests; update widget previews
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 585 B |
|
Before Width: | Height: | Size: 543 B |
|
Before Width: | Height: | Size: 583 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 15 KiB |
@@ -78,15 +78,49 @@ public class HabitFixtures
|
|||||||
return habit;
|
return habit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Habit createVeryLongHabit()
|
||||||
|
{
|
||||||
|
Habit habit = createEmptyHabit();
|
||||||
|
habit.setFrequency(new Frequency(1, 2));
|
||||||
|
habit.setColor(11);
|
||||||
|
|
||||||
|
Timestamp today = DateUtils.getToday();
|
||||||
|
int marks[] = {0, 3, 5, 6, 7, 10, 13, 14, 15, 18, 21, 22, 23, 24, 27, 28, 30, 31, 34, 37,
|
||||||
|
39, 42, 43, 46, 47, 48, 51, 52, 54, 55, 57, 59, 62, 65, 68, 71, 73, 76, 79,
|
||||||
|
80, 81, 83, 85, 86, 89, 90, 91, 94, 96, 98, 100, 103, 104, 106, 109, 111,
|
||||||
|
112, 113, 115, 117, 120, 123, 126, 129, 132, 134, 136, 139, 141, 142, 145,
|
||||||
|
148, 149, 151, 152, 154, 156, 157, 159, 161, 162, 163, 164, 166, 168, 170,
|
||||||
|
172, 173, 174, 175, 176, 178, 180, 181, 184, 185, 188, 189, 190, 191, 194,
|
||||||
|
195, 197, 198, 199, 200, 202, 205, 208, 211, 213, 215, 216, 218, 220, 222,
|
||||||
|
223, 225, 227, 228, 230, 231, 232, 234, 235, 238, 241, 242, 244, 247, 250,
|
||||||
|
251, 253, 254, 257, 260, 261, 263, 264, 266, 269, 272, 273, 276, 279, 281,
|
||||||
|
284, 285, 288, 291, 292, 294, 296, 297, 299, 300, 301, 303, 306, 307, 308,
|
||||||
|
309, 310, 313, 316, 319, 322, 324, 326, 329, 330, 332, 334, 335, 337, 338,
|
||||||
|
341, 344, 345, 346, 347, 350, 352, 355, 358, 360, 361, 362, 363, 365, 368,
|
||||||
|
371, 373, 374, 376, 379, 380, 382, 384, 385, 387, 389, 390, 392, 393, 395,
|
||||||
|
396, 399, 401, 404, 407, 410, 411, 413, 414, 416, 417, 419, 420, 423, 424,
|
||||||
|
427, 429, 431, 433, 436, 439, 440, 442, 445, 447, 450, 453, 454, 456, 459,
|
||||||
|
460, 461, 464, 466, 468, 470, 473, 474, 475, 477, 479, 481, 482, 483, 486,
|
||||||
|
489, 491, 493, 495, 497, 498, 500, 503, 504, 507, 510, 511, 512, 515, 518,
|
||||||
|
519, 521, 522, 525, 528, 531, 532, 534, 537, 539, 541, 543, 544, 547, 550,
|
||||||
|
551, 554, 556, 557, 560, 561, 564, 567, 568, 569, 570, 572, 575, 576, 579,
|
||||||
|
582, 583, 584, 586, 589};
|
||||||
|
|
||||||
|
for (int mark : marks)
|
||||||
|
habit.getRepetitions().toggle(today.minus(mark));
|
||||||
|
|
||||||
|
return habit;
|
||||||
|
}
|
||||||
|
|
||||||
public Habit createLongNumericalHabit()
|
public Habit createLongNumericalHabit()
|
||||||
{
|
{
|
||||||
Habit habit = modelFactory.buildHabit();
|
Habit habit = modelFactory.buildHabit();
|
||||||
habit.setName("Take a walk");
|
habit.setName("Read");
|
||||||
habit.setQuestion("How many steps did you walk today?");
|
habit.setQuestion("How many pages did you walk today?");
|
||||||
habit.setType(Habit.NUMBER_HABIT);
|
habit.setType(Habit.NUMBER_HABIT);
|
||||||
habit.setTargetType(Habit.AT_LEAST);
|
habit.setTargetType(Habit.AT_LEAST);
|
||||||
habit.setTargetValue(200.0);
|
habit.setTargetValue(200.0);
|
||||||
habit.setUnit("steps");
|
habit.setUnit("pages");
|
||||||
habitList.add(habit);
|
habitList.add(habit);
|
||||||
|
|
||||||
Timestamp timestamp = DateUtils.getToday();
|
Timestamp timestamp = DateUtils.getToday();
|
||||||
|
|||||||
@@ -51,11 +51,12 @@ public class CheckmarkWidgetTest extends BaseViewTest
|
|||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
setTheme(R.style.WidgetTheme);
|
setTheme(R.style.WidgetTheme);
|
||||||
|
prefs.setWidgetOpacity(255);
|
||||||
|
|
||||||
habit = fixtures.createShortHabit();
|
habit = fixtures.createVeryLongHabit();
|
||||||
checkmarks = habit.getCheckmarks();
|
checkmarks = habit.getCheckmarks();
|
||||||
CheckmarkWidget widget = new CheckmarkWidget(targetContext, 0, habit);
|
CheckmarkWidget widget = new CheckmarkWidget(targetContext, 0, habit);
|
||||||
view = convertToView(widget, 200, 250);
|
view = convertToView(widget, 150, 200);
|
||||||
|
|
||||||
assertThat(checkmarks.getTodayValue(), equalTo(CHECKED_EXPLICITLY));
|
assertThat(checkmarks.getTodayValue(), equalTo(CHECKED_EXPLICITLY));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,8 +47,9 @@ public class FrequencyWidgetTest extends BaseViewTest
|
|||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
setTheme(R.style.WidgetTheme);
|
setTheme(R.style.WidgetTheme);
|
||||||
|
prefs.setWidgetOpacity(255);
|
||||||
|
|
||||||
habit = fixtures.createLongHabit();
|
habit = fixtures.createVeryLongHabit();
|
||||||
FrequencyWidget widget = new FrequencyWidget(targetContext, 0, habit, Calendar.SUNDAY);
|
FrequencyWidget widget = new FrequencyWidget(targetContext, 0, habit, Calendar.SUNDAY);
|
||||||
view = convertToView(widget, 400, 400);
|
view = convertToView(widget, 400, 400);
|
||||||
}
|
}
|
||||||
@@ -59,9 +60,9 @@ public class FrequencyWidgetTest extends BaseViewTest
|
|||||||
assertWidgetProviderIsInstalled(FrequencyWidgetProvider.class);
|
assertWidgetProviderIsInstalled(FrequencyWidgetProvider.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
// public void testRender() throws Exception
|
public void testRender() throws Exception
|
||||||
// {
|
{
|
||||||
// assertRenders(view, PATH + "render.png");
|
assertRenders(view, PATH + "render.png");
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|||||||
|
|
||||||
import org.isoron.uhabits.*;
|
import org.isoron.uhabits.*;
|
||||||
import org.isoron.uhabits.core.models.*;
|
import org.isoron.uhabits.core.models.*;
|
||||||
|
import org.isoron.uhabits.utils.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.junit.runner.*;
|
import org.junit.runner.*;
|
||||||
|
|
||||||
@@ -47,8 +48,9 @@ public class HistoryWidgetTest extends BaseViewTest
|
|||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
setTheme(R.style.WidgetTheme);
|
setTheme(R.style.WidgetTheme);
|
||||||
|
prefs.setWidgetOpacity(255);
|
||||||
|
|
||||||
habit = fixtures.createLongHabit();
|
habit = fixtures.createVeryLongHabit();
|
||||||
HistoryWidget widget = new HistoryWidget(targetContext, 0, habit, Calendar.SUNDAY);
|
HistoryWidget widget = new HistoryWidget(targetContext, 0, habit, Calendar.SUNDAY);
|
||||||
view = convertToView(widget, 400, 400);
|
view = convertToView(widget, 400, 400);
|
||||||
}
|
}
|
||||||
@@ -59,9 +61,9 @@ public class HistoryWidgetTest extends BaseViewTest
|
|||||||
assertWidgetProviderIsInstalled(HistoryWidgetProvider.class);
|
assertWidgetProviderIsInstalled(HistoryWidgetProvider.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
// public void testRender() throws Exception
|
public void testRender() throws Exception
|
||||||
// {
|
{
|
||||||
// assertRenders(view, PATH + "render.png");
|
assertRenders(view, PATH + "render.png");
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,9 @@ public class ScoreWidgetTest extends BaseViewTest
|
|||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
setTheme(R.style.WidgetTheme);
|
setTheme(R.style.WidgetTheme);
|
||||||
|
prefs.setWidgetOpacity(255);
|
||||||
|
|
||||||
habit = fixtures.createLongHabit();
|
habit = fixtures.createVeryLongHabit();
|
||||||
ScoreWidget widget = new ScoreWidget(targetContext, 0, habit);
|
ScoreWidget widget = new ScoreWidget(targetContext, 0, habit);
|
||||||
view = convertToView(widget, 400, 400);
|
view = convertToView(widget, 400, 400);
|
||||||
}
|
}
|
||||||
@@ -57,9 +58,9 @@ public class ScoreWidgetTest extends BaseViewTest
|
|||||||
assertWidgetProviderIsInstalled(ScoreWidgetProvider.class);
|
assertWidgetProviderIsInstalled(ScoreWidgetProvider.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
// public void testRender() throws Exception
|
public void testRender() throws Exception
|
||||||
// {
|
{
|
||||||
// assertRenders(view, PATH + "render.png");
|
assertRenders(view, PATH + "render.png");
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,9 @@ public class StreakWidgetTest extends BaseViewTest
|
|||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
setTheme(R.style.WidgetTheme);
|
setTheme(R.style.WidgetTheme);
|
||||||
|
prefs.setWidgetOpacity(255);
|
||||||
|
|
||||||
habit = fixtures.createLongHabit();
|
habit = fixtures.createVeryLongHabit();
|
||||||
StreakWidget widget = new StreakWidget(targetContext, 0, habit);
|
StreakWidget widget = new StreakWidget(targetContext, 0, habit);
|
||||||
view = convertToView(widget, 400, 400);
|
view = convertToView(widget, 400, 400);
|
||||||
}
|
}
|
||||||
@@ -57,9 +58,9 @@ public class StreakWidgetTest extends BaseViewTest
|
|||||||
assertWidgetProviderIsInstalled(StreakWidgetProvider.class);
|
assertWidgetProviderIsInstalled(StreakWidgetProvider.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
// public void testRender() throws Exception
|
public void testRender() throws Exception
|
||||||
// {
|
{
|
||||||
// assertRenders(view, PATH + "render.png");
|
assertRenders(view, PATH + "render.png");
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.isoron.uhabits.widgets;
|
||||||
|
|
||||||
|
import android.widget.*;
|
||||||
|
|
||||||
|
import androidx.test.ext.junit.runners.*;
|
||||||
|
import androidx.test.filters.*;
|
||||||
|
|
||||||
|
import org.isoron.uhabits.*;
|
||||||
|
import org.isoron.uhabits.core.models.*;
|
||||||
|
import org.junit.*;
|
||||||
|
import org.junit.runner.*;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@MediumTest
|
||||||
|
public class TargetWidgetTest extends BaseViewTest
|
||||||
|
{
|
||||||
|
private static final String PATH = "widgets/TargetWidget/";
|
||||||
|
|
||||||
|
private Habit habit;
|
||||||
|
|
||||||
|
private FrameLayout view;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUp()
|
||||||
|
{
|
||||||
|
super.setUp();
|
||||||
|
setTheme(R.style.WidgetTheme);
|
||||||
|
prefs.setWidgetOpacity(255);
|
||||||
|
|
||||||
|
habit = fixtures.createLongNumericalHabit();
|
||||||
|
habit.setColor(11);
|
||||||
|
TargetWidget widget = new TargetWidget(targetContext, 0, habit);
|
||||||
|
view = convertToView(widget, 400, 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsInstalled()
|
||||||
|
{
|
||||||
|
assertWidgetProviderIsInstalled(TargetWidgetProvider.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRender() throws Exception
|
||||||
|
{
|
||||||
|
assertRenders(view, PATH + "render.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -100,6 +100,14 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".widgets.activities.NumericalHabitPickerDialog"
|
||||||
|
android:theme="@style/Theme.AppCompat.Light.Dialog">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.about.AboutActivity"
|
android:name=".activities.about.AboutActivity"
|
||||||
android:label="@string/about">
|
android:label="@string/about">
|
||||||
@@ -198,7 +206,7 @@
|
|||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.appwidget.provider"
|
android:name="android.appwidget.provider"
|
||||||
android:resource="@xml/widget_frequency_info" />
|
android:resource="@xml/widget_target_info" />
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<receiver android:name=".receivers.ReminderReceiver">
|
<receiver android:name=".receivers.ReminderReceiver">
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
}
|
|
||||||
@@ -30,6 +30,14 @@ import org.isoron.uhabits.core.preferences.*
|
|||||||
import org.isoron.uhabits.widgets.*
|
import org.isoron.uhabits.widgets.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
class BooleanHabitPickerDialog : HabitPickerDialog() {
|
||||||
|
override fun shouldHideNumerical() = true
|
||||||
|
}
|
||||||
|
|
||||||
|
class NumericalHabitPickerDialog : HabitPickerDialog() {
|
||||||
|
override fun shouldHideBoolean() = true
|
||||||
|
}
|
||||||
|
|
||||||
open class HabitPickerDialog : Activity() {
|
open class HabitPickerDialog : Activity() {
|
||||||
|
|
||||||
private var widgetId = 0
|
private var widgetId = 0
|
||||||
@@ -37,6 +45,7 @@ open class HabitPickerDialog : Activity() {
|
|||||||
private lateinit var widgetUpdater: WidgetUpdater
|
private lateinit var widgetUpdater: WidgetUpdater
|
||||||
|
|
||||||
protected open fun shouldHideNumerical() = false
|
protected open fun shouldHideNumerical() = false
|
||||||
|
protected open fun shouldHideBoolean() = false
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@@ -52,6 +61,7 @@ open class HabitPickerDialog : Activity() {
|
|||||||
for (h in habitList) {
|
for (h in habitList) {
|
||||||
if (h.isArchived) continue
|
if (h.isArchived) continue
|
||||||
if (h.isNumerical and shouldHideNumerical()) continue
|
if (h.isNumerical and shouldHideNumerical()) continue
|
||||||
|
if (!h.isNumerical and shouldHideBoolean()) continue
|
||||||
habitIds.add(h.id!!)
|
habitIds.add(h.id!!)
|
||||||
habitNames.add(h.name)
|
habitNames.add(h.name)
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 15 KiB |
@@ -27,7 +27,7 @@
|
|||||||
android:previewImage="@drawable/widget_preview_streaks"
|
android:previewImage="@drawable/widget_preview_streaks"
|
||||||
android:resizeMode="vertical|horizontal"
|
android:resizeMode="vertical|horizontal"
|
||||||
android:updatePeriodMillis="3600000"
|
android:updatePeriodMillis="3600000"
|
||||||
android:configure="org.isoron.uhabits.widgets.activities.BooleanHabitPickerDialog"
|
android:configure="org.isoron.uhabits.widgets.activities.NumericalHabitPickerDialog"
|
||||||
android:widgetCategory="home_screen">
|
android:widgetCategory="home_screen">
|
||||||
|
|
||||||
</appwidget-provider>
|
</appwidget-provider>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:minHeight="80dp"
|
||||||
|
android:minWidth="80dp"
|
||||||
|
android:minResizeWidth="40dp"
|
||||||
|
android:minResizeHeight="40dp"
|
||||||
|
android:initialLayout="@layout/widget_graph"
|
||||||
|
android:previewImage="@drawable/widget_preview_target"
|
||||||
|
android:resizeMode="vertical|horizontal"
|
||||||
|
android:updatePeriodMillis="3600000"
|
||||||
|
android:configure="org.isoron.uhabits.widgets.activities.BooleanHabitPickerDialog"
|
||||||
|
android:widgetCategory="home_screen">
|
||||||
|
|
||||||
|
</appwidget-provider>
|
||||||
@@ -333,6 +333,12 @@ public class Preferences
|
|||||||
return Integer.parseInt(storage.getString("pref_widget_opacity", "255"));
|
return Integer.parseInt(storage.getString("pref_widget_opacity", "255"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setWidgetOpacity(int value)
|
||||||
|
{
|
||||||
|
storage.putString("pref_widget_opacity", Integer.toString(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return An integer representing the first day of the week. Sunday
|
* @return An integer representing the first day of the week. Sunday
|
||||||
* corresponds to 1, Monday to 2, and so on, until Saturday, which is
|
* corresponds to 1, Monday to 2, and so on, until Saturday, which is
|
||||||
|
|||||||