Skip to content

Commit

Permalink
[LEIP-120] Upgrade android-utils to 3.5.0 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
hb0 authored Jul 24, 2023
1 parent 6864a26 commit b9ec895
Show file tree
Hide file tree
Showing 12 changed files with 1,082 additions and 981 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ext {
cyfaceEnergySettingsVersion = "0.0.0" // Automatically overwritten by CI

// Cyface dependencies
cyfaceUtilsVersion = "3.3.7"
cyfaceUtilsVersion = "3.5.0"

// Android SDK versions
minSdkVersion = 21 // device support
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with the Cyface Energy Settings for Android. If not, see <http://www.gnu.org/licenses/>.
*/
package de.cyface.energy_settings;
package de.cyface.energy_settings

/**
* Holds constants required by multiple classes.
Expand All @@ -25,29 +25,28 @@
* @version 1.0.1
* @since 1.0.0
*/
public final class Constants {

final static String TAG = "de.cyface.es";
private final static String PACKAGE = "de.cyface.energy_settings";
@Suppress("SpellCheckingInspection")
object Constants {
const val TAG = "de.cyface.es"
private const val PACKAGE = "de.cyface.energy_settings"

// Dialog codes to identify the different dialogs
public final static int DIALOG_ENERGY_SAFER_WARNING_CODE = 2019071101;
final static int DIALOG_BACKGROUND_RESTRICTION_WARNING_CODE = 2019071102;
final static int DIALOG_PROBLEMATIC_MANUFACTURER_WARNING_CODE = 2019071103;
final static int DIALOG_GPS_DISABLED_WARNING_CODE = 2019071104;
final static int DIALOG_NO_GUIDANCE_NEEDED_DIALOG_CODE = 2019071105;
const val DIALOG_ENERGY_SAFER_WARNING_CODE = 2019071101
const val DIALOG_BACKGROUND_RESTRICTION_WARNING_CODE = 2019071102
const val DIALOG_PROBLEMATIC_MANUFACTURER_WARNING_CODE = 2019071103
const val DIALOG_GPS_DISABLED_WARNING_CODE = 2019071104
const val DIALOG_NO_GUIDANCE_NEEDED_DIALOG_CODE = 2019071105

// Preference key for shared preferences
final static String PREFERENCES_MANUFACTURER_WARNING_SHOWN_KEY = PACKAGE + ".manufacturer_warning_shown";
const val PREFERENCES_MANUFACTURER_WARNING_SHOWN_KEY = "$PACKAGE.manufacturer_warning_shown"

// Manufacturer names
final static String MANUFACTURER_HUAWEI = "huawei";
final static String MANUFACTURER_HONOR = "honor"; // sub brand of huawei
final static String MANUFACTURER_SAMSUNG = "samsung";
final static String MANUFACTURER_XIAOMI = "xiaomi";
final static String MANUFACTURER_SONY = "sony";

// The following manufacturers seem to be as restrictive as Huawei etc. (see https://dontkillmyapp.com)
const val MANUFACTURER_HUAWEI = "huawei"
const val MANUFACTURER_HONOR = "honor" // sub brand of huawei
const val MANUFACTURER_SAMSUNG = "samsung"
const val MANUFACTURER_XIAOMI = "xiaomi"
const val MANUFACTURER_SONY =
"sony" // The following manufacturers seem to be as restrictive as Huawei etc. (see https://dontkillmyapp.com)
// but we have no negative reports yet from such devices, nor can we test them.
// For those reasons this part is uncommented but we keep this info here as it's some work to collect this data.
// public final static String MANUFACTURER_HTC = "htc";
Expand All @@ -58,4 +57,4 @@ public final class Constants {
// public final static String MANUFACTURER_MEIZU = "meizu";
// public final static String MANUFACTURER_DEWAV = "dewav";
// public final static String MANUFACTURER_QMOBILE = "qmobile";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package de.cyface.energy_settings

import android.content.Context
import androidx.core.content.edit
import de.cyface.energy_settings.Constants.PREFERENCES_MANUFACTURER_WARNING_SHOWN_KEY
import de.cyface.utils.AppPreferences

class CustomPreferences(context: Context): AppPreferences(context) {

fun saveWarningShown(warningShown: Boolean) {
preferences.edit {
putBoolean(PREFERENCES_MANUFACTURER_WARNING_SHOWN_KEY, warningShown)
apply()
}
}

fun getWarningShown(): Boolean {
return preferences.getBoolean(PREFERENCES_MANUFACTURER_WARNING_SHOWN_KEY, false)
}
}
Loading

0 comments on commit b9ec895

Please sign in to comment.