mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Bump minSdk to 28
This change is mostly to reduce the number of APIs we need to run tests for (from 11 APIs to 6). API 27 was released 5 years ago. Also, as of 2022-09-01, 95.1% of our monthly active users are on API 28 or higher.
This commit is contained in:
@@ -37,7 +37,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
versionCode = 20100
|
versionCode = 20100
|
||||||
versionName = "2.1.0"
|
versionName = "2.1.0"
|
||||||
minSdk = 23
|
minSdk = 28
|
||||||
targetSdk = 31
|
targetSdk = 31
|
||||||
applicationId = "org.isoron.uhabits"
|
applicationId = "org.isoron.uhabits"
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import android.animation.Keyframe;
|
|||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.animation.PropertyValuesHolder;
|
import android.animation.PropertyValuesHolder;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.os.Build;
|
|
||||||
import android.text.format.Time;
|
import android.text.format.Time;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
@@ -43,17 +42,13 @@ public class Utils {
|
|||||||
|
|
||||||
static final String SHARED_PREFS_NAME = "com.android.calendar_preferences";
|
static final String SHARED_PREFS_NAME = "com.android.calendar_preferences";
|
||||||
|
|
||||||
public static boolean isJellybeanOrLater() {
|
|
||||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to speak the specified text, for accessibility. Only available on JB or later.
|
* Try to speak the specified text, for accessibility. Only available on JB or later.
|
||||||
* @param text Text to announce.
|
* @param text Text to announce.
|
||||||
*/
|
*/
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
public static void tryAccessibilityAnnounce(View view, CharSequence text) {
|
public static void tryAccessibilityAnnounce(View view, CharSequence text) {
|
||||||
if (isJellybeanOrLater() && view != null && text != null) {
|
if (view != null && text != null) {
|
||||||
view.announceForAccessibility(text);
|
view.announceForAccessibility(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -383,10 +383,6 @@ public abstract class DayPickerView extends ListView implements OnScrollListener
|
|||||||
if (child instanceof MonthView) {
|
if (child instanceof MonthView) {
|
||||||
final CalendarDay focus = ((MonthView) child).getAccessibilityFocus();
|
final CalendarDay focus = ((MonthView) child).getAccessibilityFocus();
|
||||||
if (focus != null) {
|
if (focus != null) {
|
||||||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
|
||||||
// Clear focus to avoid ListView bug in Jelly Bean MR1.
|
|
||||||
((MonthView) child).clearAccessibilityFocus();
|
|
||||||
}
|
|
||||||
return focus;
|
return focus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ import android.app.backup.BackupManager
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
||||||
import android.os.Build
|
|
||||||
import android.os.Build.VERSION.SDK_INT
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
@@ -98,7 +96,6 @@ class SettingsFragment : PreferenceFragmentCompat(), OnSharedPreferenceChangeLis
|
|||||||
showRingtonePicker()
|
showRingtonePicker()
|
||||||
return true
|
return true
|
||||||
} else if (key == "reminderCustomize") {
|
} else if (key == "reminderCustomize") {
|
||||||
if (SDK_INT < Build.VERSION_CODES.O) return true
|
|
||||||
createAndroidNotificationChannel(requireContext())
|
createAndroidNotificationChannel(requireContext())
|
||||||
val intent = Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
|
val intent = Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
|
||||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, requireContext().packageName)
|
intent.putExtra(Settings.EXTRA_APP_PACKAGE, requireContext().packageName)
|
||||||
@@ -120,11 +117,7 @@ class SettingsFragment : PreferenceFragmentCompat(), OnSharedPreferenceChangeLis
|
|||||||
}
|
}
|
||||||
updateWeekdayPreference()
|
updateWeekdayPreference()
|
||||||
|
|
||||||
if (SDK_INT < Build.VERSION_CODES.O)
|
findPreference("reminderSound").isVisible = false
|
||||||
findPreference("reminderCustomize").isVisible = false
|
|
||||||
else {
|
|
||||||
findPreference("reminderSound").isVisible = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateWeekdayPreference() {
|
private fun updateWeekdayPreference() {
|
||||||
|
|||||||
@@ -168,14 +168,12 @@ class AndroidNotificationTray
|
|||||||
fun createAndroidNotificationChannel(context: Context) {
|
fun createAndroidNotificationChannel(context: Context) {
|
||||||
val notificationManager = context.getSystemService(Activity.NOTIFICATION_SERVICE)
|
val notificationManager = context.getSystemService(Activity.NOTIFICATION_SERVICE)
|
||||||
as NotificationManager
|
as NotificationManager
|
||||||
if (SDK_INT >= Build.VERSION_CODES.O) {
|
val channel = NotificationChannel(
|
||||||
val channel = NotificationChannel(
|
REMINDERS_CHANNEL_ID,
|
||||||
REMINDERS_CHANNEL_ID,
|
context.resources.getString(R.string.reminder),
|
||||||
context.resources.getString(R.string.reminder),
|
NotificationManager.IMPORTANCE_DEFAULT
|
||||||
NotificationManager.IMPORTANCE_DEFAULT
|
)
|
||||||
)
|
notificationManager.createNotificationChannel(channel)
|
||||||
notificationManager.createNotificationChannel(channel)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,18 +21,11 @@ package org.isoron.uhabits.utils
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.KeyguardManager
|
import android.app.KeyguardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
|
||||||
import android.os.Build.VERSION.SDK_INT
|
|
||||||
import android.view.WindowManager
|
|
||||||
|
|
||||||
object SystemUtils {
|
object SystemUtils {
|
||||||
|
|
||||||
fun unlockScreen(activity: Activity) {
|
fun unlockScreen(activity: Activity) {
|
||||||
if (SDK_INT >= Build.VERSION_CODES.O) {
|
val km = activity.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||||
val km = activity.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
km.requestDismissKeyguard(activity, null)
|
||||||
km.requestDismissKeyguard(activity, null)
|
|
||||||
} else {
|
|
||||||
activity.window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ package org.isoron.uhabits.widgets
|
|||||||
|
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import org.isoron.platform.gui.toInt
|
import org.isoron.platform.gui.toInt
|
||||||
import org.isoron.uhabits.core.models.Entry
|
import org.isoron.uhabits.core.models.Entry
|
||||||
import org.isoron.uhabits.core.models.Habit
|
import org.isoron.uhabits.core.models.Habit
|
||||||
@@ -49,7 +47,6 @@ open class CheckmarkWidget(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
override fun refreshData(widgetView: View) {
|
override fun refreshData(widgetView: View) {
|
||||||
(widgetView as CheckmarkWidgetView).apply {
|
(widgetView as CheckmarkWidgetView).apply {
|
||||||
val today = DateUtils.getTodayWithOffset()
|
val today = DateUtils.getTodayWithOffset()
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
<!--
|
|
||||||
~ Copyright (C) 2016-2021 Álinson Santos Xavier <git@axavier.org>
|
|
||||||
~
|
|
||||||
~ 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/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item
|
|
||||||
android:top="1dp"
|
|
||||||
android:left="1dp"
|
|
||||||
android:bottom="3dp"
|
|
||||||
android:right="3dp">
|
|
||||||
<ripple
|
|
||||||
android:color="#60ffffff">
|
|
||||||
|
|
||||||
<item android:id="@android:id/mask">
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<corners android:radius="5dp"/>
|
|
||||||
<solid android:color="?android:colorPrimary"/>
|
|
||||||
</shape>
|
|
||||||
<color android:color="@color/white"/>
|
|
||||||
</item>
|
|
||||||
</ripple>
|
|
||||||
</item>
|
|
||||||
|
|
||||||
</layer-list>
|
|
||||||
@@ -17,18 +17,23 @@
|
|||||||
~ with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:state_enabled="true" android:state_pressed="true">
|
<item
|
||||||
<layer-list>
|
android:top="1dp"
|
||||||
<item android:bottom="3dp"
|
android:left="1dp"
|
||||||
android:left="1dp"
|
android:bottom="3dp"
|
||||||
android:right="3dp"
|
android:right="3dp">
|
||||||
android:top="1dp">
|
<ripple
|
||||||
|
android:color="#60ffffff">
|
||||||
|
|
||||||
|
<item android:id="@android:id/mask">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<corners android:radius="5dp"/>
|
<corners android:radius="5dp"/>
|
||||||
<solid android:color="#30ffffff"/>
|
<solid android:color="?android:colorPrimary"/>
|
||||||
</shape>
|
</shape>
|
||||||
|
<color android:color="@color/white"/>
|
||||||
</item>
|
</item>
|
||||||
</layer-list>
|
</ripple>
|
||||||
</item>
|
</item>
|
||||||
</selector>
|
|
||||||
|
</layer-list>
|
||||||
|
|||||||
0
uhabits-android/src/main/res/mipmap-anydpi
Normal file
0
uhabits-android/src/main/res/mipmap-anydpi
Normal file
@@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright (C) 2016-2021 Álinson Santos Xavier <git@axavier.org>
|
|
||||||
~
|
|
||||||
~ 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/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
Reference in New Issue
Block a user