10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/timezone_searchview.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_redo.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_undo.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_save.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/dictionaries/matt.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | barfill
5 | bootup
6 | ctor
7 | datepicker
8 | disp
9 | dropdowns
10 | edittext
11 | github
12 | mattvchandler
13 | noninfringement
14 | opensource
15 | progressbars
16 | rowid
17 | rowids
18 | sqlite
19 | timepicker
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/deploymentTargetDropDown.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
20 |
21 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | android.defaults.buildfeatures.buildconfig=true
13 | android.enableJetifier=true
14 | android.nonFinalResIds=false
15 | android.nonTransitiveRClass=true
16 | android.useAndroidX=true
17 | org.gradle.jvmargs=-Xmx1536m
18 |
19 | # When configured, Gradle will run in incubating parallel mode.
20 | # This option should only be used with decoupled projects. More details, visit
21 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
22 | # org.gradle.parallel=true
23 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/PRIVACY.md:
--------------------------------------------------------------------------------
1 | # Privacy Policy
2 |
3 | ProgressBars does not:
4 |
5 | * record, collect, store any personal information
6 | * transmit or receive any information
7 |
8 | ### Note on location permission
9 |
10 | ProgressBars will ask for permission to access your device's locations if
11 |
12 | * You are running a version of Android before Marshmallow
13 | * OR you choose 'Auto (location / time based)' for the Day / Night theme setting
14 |
15 | The location is used to determine local sunset sunrise times and switch to the
16 | night theme after sunset.
17 |
18 | The location is only used within the built-in Android theming library code. See
19 | the [Android documentation](https://developer.android.com/reference/android/support/v7/app/AppCompatDelegate#mode_night_auto)
20 | for details.
21 |
22 | ProgressBars does not access, use, store, or transmit the location
23 |
24 | Should you choose to deny the location permission, normal functionality will
25 | continue, and the theming library falls back to switching on preset times.
26 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /home/matt/Android/Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2023 Matthew Chandler
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7 | the Software, and to permit persons to whom the Software is furnished to do so,
8 | subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_descriptor.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/values/bools.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
25 | true
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/bools.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
25 | false
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v26/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 | #B3FFFFFF
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night-v26/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 | #B3000000
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 | #FF1B5E20
26 | #FF003300
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v24/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 | #C04CAF50
26 | #F0388E3C
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night-v24/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 | #C01B5E20
26 | #F0003300
27 |
28 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 | Follow System
25 | Day
26 | Night
27 | Auto (location / time based)
28 | Auto Battery (Night mode when saving battery)
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-anydpi-v26/ic_notification.xml:
--------------------------------------------------------------------------------
1 |
21 |
22 |
25 |
28 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/values.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
25 |
26 | @string/pref_theme_value_system
27 | @string/pref_theme_value_day
28 | @string/pref_theme_value_night
29 | @string/pref_theme_value_auto
30 | @string/pref_theme_value_auto_batt
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/settings_action_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v23/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v27/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v29/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v27/values.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
25 | auto
26 |
27 |
28 | @string/pref_widget_text_color_auto
29 | @string/pref_widget_text_color_white
30 | @string/pref_widget_text_color_black
31 |
32 | @string/pref_widget_text_color_auto
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_add_shortcut_foreground.xml:
--------------------------------------------------------------------------------
1 |
21 |
22 |
25 |
28 |
31 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/xml-v25/shortcuts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 |
32 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-kapt'
4 |
5 | android {
6 | compileSdk 34
7 | dataBinding.enabled = true
8 | defaultConfig {
9 | applicationId "org.mattvchandler.progressbars"
10 | minSdkVersion 19
11 | targetSdkVersion 34
12 | versionName "2.1.2"
13 | // version code is 0<2-digit MAJOR><2-digit MINOR><2-digit PATCH>
14 | versionCode 190020102
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | vectorDrawables.useSupportLibrary = true
17 | }
18 | compileOptions {
19 | sourceCompatibility = 1.8
20 | targetCompatibility = 1.8
21 | }
22 | kotlinOptions {
23 | jvmTarget = "1.8"
24 | }
25 | buildTypes {
26 | release {
27 | minifyEnabled true
28 | shrinkResources true
29 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
30 | }
31 | }
32 | productFlavors {
33 | }
34 | namespace 'org.mattvchandler.progressbars'
35 | buildToolsVersion = '34.0.0'
36 | }
37 |
38 | dependencies {
39 | implementation fileTree(include: ['*.jar'], dir: 'libs')
40 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
41 | implementation 'androidx.appcompat:appcompat:1.6.1'
42 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
43 | implementation 'androidx.core:core-ktx:1.12.0-rc01'
44 | implementation 'androidx.core:core-ktx:1.12.0-rc01'
45 | implementation 'androidx.preference:preference-ktx:1.2.1'
46 | implementation 'androidx.recyclerview:recyclerview:1.3.1'
47 | implementation 'com.google.android.material:material:1.11.0-alpha02'
48 | }
49 | repositories {
50 | mavenCentral()
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/widget_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
36 |
37 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ProgressBars
2 |
3 | [](https://f-droid.org/packages/org.mattvchandler.progressbars/)
6 | [](https://play.google.com/store/apps/details?id=org.mattvchandler.progressbars)
9 |
10 | ProgressBars is a simple timer / countdown app for Android.
11 |
12 | 
13 |
14 | ### Basic Features
15 | * Countdown/up to/from a specified time
16 | * Percentage complete for a time interval
17 | * Notifications on timer completion
18 | * Swipe to delete timers
19 | * Drag to reorder timers
20 | * Show time remaining / elapsed in any combination of:
21 | * Years
22 | * Months
23 | * Weeks
24 | * Days
25 | * Hours
26 | * Minutes
27 | * Seconds
28 |
29 | ## Note for recent versions of Android
30 | Android has had several changes in how notifications are handled, especially
31 | restricting the ability to send a notification at an exact time, and what apps
32 | are able to run in the background in the name of reducing battery usage. For
33 | ProgressBars, this impacts the ability to send notifications for timer
34 | completion reliably. I recommend giving ProgressBars Unrestricted battery usage
35 | if you are going to rely on notifications from this app. ProgressBars consumes
36 | very little battery with typical usage, even with optimizations turned off.
37 |
38 | ### Android 12/12L
39 | By default, apps can't set exact alarms on Android 12/12L. Timer notifications
40 | may go off seconds to minutes after the timer itself ends. If this will be a
41 | problem for you, you will need to grant the special "Alarms & reminders"
42 | permission to ProgressBars
43 |
44 | * This limitation did not exist in android versions prior to 12
45 | * Android 13, and later have a different permission mechanism to send exact alarms
46 |
--------------------------------------------------------------------------------
/app/src/main/java/util/Resetting_application.kt:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2020 Matthew Chandler
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | this software and associated documentation files (the "Software"), to deal in
6 | the Software without restriction, including without limitation the rights to
7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8 | the Software, and to permit persons to whom the Software is furnished to do so,
9 | subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 | */
21 |
22 | package org.mattvchandler.progressbars.util
23 |
24 | import android.app.Application
25 |
26 | import org.mattvchandler.progressbars.db.DB
27 | import org.mattvchandler.progressbars.db.Data
28 | import org.mattvchandler.progressbars.db.Progress_bars_table
29 |
30 | class Resetting_application: Application()
31 | {
32 | override fun onCreate() // runs on App startup
33 | {
34 | super.onCreate()
35 |
36 | val db = DB(this).writableDatabase
37 | val cursor = db.rawQuery(Progress_bars_table.SELECT_ALL_ROWS_NO_WIDGET, null)
38 | if(cursor.count == 0)
39 | {
40 | val data = Data(this)
41 | data.order_ind = 0
42 | data.insert(db)
43 | }
44 |
45 | cursor.close()
46 | db.close()
47 |
48 | // register notification handler
49 | Notification_handler.setup_notification_channel(this)
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/progress_bar_action_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/timezone_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
26 |
27 |
28 |
29 |
30 |
31 |
35 |
42 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
29 |
30 |
34 |
41 |
48 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/app/src/main/java/util/About_dialog.kt:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2020 Matthew Chandler
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | this software and associated documentation files (the "Software"), to deal in
6 | the Software without restriction, including without limitation the rights to
7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8 | the Software, and to permit persons to whom the Software is furnished to do so,
9 | subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 | */
21 | package org.mattvchandler.progressbars.util
22 |
23 | import android.app.Dialog
24 | import android.os.Bundle
25 | import android.text.method.LinkMovementMethod
26 | import android.view.LayoutInflater
27 | import androidx.appcompat.app.AlertDialog
28 | import androidx.databinding.DataBindingUtil
29 | import androidx.fragment.app.DialogFragment
30 | import org.mattvchandler.progressbars.BuildConfig
31 | import org.mattvchandler.progressbars.R
32 | import org.mattvchandler.progressbars.databinding.AboutDialogBinding
33 |
34 | class About_dialog: DialogFragment()
35 | {
36 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog
37 | {
38 | val builder = AlertDialog.Builder(requireActivity())
39 | val binding = DataBindingUtil.inflate(LayoutInflater.from(activity), R.layout.about_dialog, null, false)
40 |
41 | builder.setView(binding.root)
42 | binding.version.text = requireActivity().resources.getString(R.string.app_version, BuildConfig.VERSION_NAME)
43 |
44 | // allow clicking links in license and website text
45 | binding.license.movementMethod = LinkMovementMethod.getInstance()
46 | binding.website.movementMethod = LinkMovementMethod.getInstance()
47 |
48 | return builder.create()
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
21 |
22 |
23 |
28 |
33 |
41 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_timezone.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
29 |
30 |
34 |
44 |
51 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
21 |
22 |
27 |
30 |
33 |
34 |
38 |
40 |
41 |
49 |
50 |
51 |
54 |
55 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_progress_bars.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
29 |
34 |
45 |
52 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/java/settings/Checkbox_dialog_frag.kt:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2020 Matthew Chandler
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | this software and associated documentation files (the "Software"), to deal in
6 | the Software without restriction, including without limitation the rights to
7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8 | the Software, and to permit persons to whom the Software is furnished to do so,
9 | subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 | */
21 |
22 | package org.mattvchandler.progressbars.settings
23 |
24 | import android.app.Dialog
25 | import android.os.Bundle
26 | import androidx.appcompat.app.AlertDialog
27 | import androidx.fragment.app.DialogFragment
28 | import java.security.InvalidParameterException
29 |
30 | // Dialog box w/ checkboxes
31 | class Checkbox_dialog_frag: DialogFragment()
32 | {
33 | private var selection: BooleanArray? = null
34 |
35 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog
36 | {
37 | super.onCreateDialog(savedInstanceState)
38 |
39 | selection = if(savedInstanceState == null)
40 | requireArguments().getBooleanArray(SELECTION_ARG)
41 | else
42 | savedInstanceState.getBooleanArray(SELECTION_ARG)
43 |
44 | if(selection == null)
45 | throw InvalidParameterException("No selection specified")
46 |
47 | val builder = AlertDialog.Builder(requireActivity())
48 | builder.setTitle(requireArguments().getInt(TITLE_ARG))
49 | .setMultiChoiceItems(requireArguments().getStringArray(ENTRIES_ARG), selection ) { _, which, isChecked -> selection!![which] = isChecked }
50 | .setPositiveButton(android.R.string.ok) { _, _ -> (activity as Settings).on_checkbox_dialog_ok(tag!!, selection!!.toTypedArray()) }
51 | .setNegativeButton(android.R.string.cancel, null)
52 |
53 | return builder.create()
54 | }
55 |
56 | override fun onSaveInstanceState(out: Bundle)
57 | {
58 | out.putBooleanArray(SELECTION_ARG, selection)
59 | }
60 |
61 | companion object
62 | {
63 | const val TITLE_ARG = "TITLE_ARG"
64 | const val ENTRIES_ARG = "ENTRIES_ARG"
65 | const val SELECTION_ARG = "SELECTION_ARG"
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/app/src/main/java/settings/Timepicker_frag.kt:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2020 Matthew Chandler
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | this software and associated documentation files (the "Software"), to deal in
6 | the Software without restriction, including without limitation the rights to
7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8 | the Software, and to permit persons to whom the Software is furnished to do so,
9 | subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 | */
21 |
22 | package org.mattvchandler.progressbars.settings
23 |
24 | import android.app.Dialog
25 | import android.app.TimePickerDialog
26 | import android.os.Bundle
27 | import android.widget.Toast
28 | import androidx.fragment.app.DialogFragment
29 | import org.mattvchandler.progressbars.R
30 | import org.mattvchandler.progressbars.settings.Settings.Companion.get_time_format
31 | import java.security.InvalidParameterException
32 | import java.text.ParsePosition
33 | import java.util.*
34 |
35 | // time-picker dialog
36 | class Timepicker_frag: DialogFragment()
37 | {
38 |
39 | override fun onCreateDialog(saved_instance_state: Bundle?): Dialog
40 | {
41 | // parse from current widget text
42 | val hour: Int
43 | val minute: Int
44 |
45 | val cal = Calendar.getInstance()
46 |
47 | val time = requireArguments().getString(TIME) ?: throw InvalidParameterException("No time argument given")
48 |
49 | val df = get_time_format()
50 | val date_obj = df.parse(time, ParsePosition(0))
51 | if(date_obj == null)
52 | {
53 | // couldn't parse
54 | Toast.makeText(activity, resources.getString(R.string.invalid_time, time, df.toLocalizedPattern()), Toast.LENGTH_LONG).show()
55 |
56 | // set to stored date
57 | cal.timeInMillis = requireArguments().getLong(STORE_TIME, 0) * 1000
58 | }
59 | else
60 | {
61 | cal.time = date_obj
62 | }
63 |
64 | hour = cal.get(Calendar.HOUR_OF_DAY)
65 | minute = cal.get(Calendar.MINUTE)
66 |
67 | return TimePickerDialog(activity, activity as Settings?, hour, minute, android.text.format.DateFormat.is24HourFormat(activity))
68 | }
69 |
70 | companion object
71 | {
72 | const val STORE_TIME = "STORE_TIME"
73 | const val TIME = "TIME"
74 | const val AM_PM = "AM_PM"
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/single_progress_bar_widget.xml:
--------------------------------------------------------------------------------
1 |
21 |
22 |
33 |
34 |
43 |
44 |
53 |
59 |
64 |
65 |
66 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/app/src/main/java/db/DB.kt:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2020 Matthew Chandler
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | this software and associated documentation files (the "Software"), to deal in
6 | the Software without restriction, including without limitation the rights to
7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8 | the Software, and to permit persons to whom the Software is furnished to do so,
9 | subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 | */
21 |
22 | package org.mattvchandler.progressbars.db
23 |
24 | import android.content.Context
25 | import android.database.Cursor
26 | import android.database.sqlite.SQLiteDatabase
27 | import android.database.sqlite.SQLiteOpenHelper
28 |
29 | // helper functions for getting data from a cursor
30 | fun Cursor.get_nullable_string(column_name: String): String?
31 | {
32 | val column_index = this.getColumnIndexOrThrow(column_name)
33 | return if(this.isNull(column_index)) null else this.getString(column_index)
34 | }
35 | fun Cursor.get_nullable_long(column_name: String): Long?
36 | {
37 | val column_index = this.getColumnIndexOrThrow(column_name)
38 | return if(this.isNull(column_index)) null else this.getLong(column_index)
39 | }
40 | fun Cursor.get_nullable_int(column_name: String): Int?
41 | {
42 | val column_index = this.getColumnIndexOrThrow(column_name)
43 | return if(this.isNull(column_index)) null else this.getInt(column_index)
44 | }
45 | fun Cursor.get_nullable_bool(column_name: String): Boolean?
46 | {
47 | val column_index = this.getColumnIndexOrThrow(column_name)
48 | return if(this.isNull(column_index)) null else this.getInt(column_index) != 0
49 | }
50 |
51 | // DB container
52 | class DB(private val context: Context): SQLiteOpenHelper(context, DB_NAME, null, DB_VERSION)
53 | {
54 | companion object
55 | {
56 | private const val DB_VERSION = 5
57 | private const val DB_NAME = "progress_bar_db"
58 | }
59 | // build the tables / whatever else when new
60 | override fun onCreate(sqLiteDatabase: SQLiteDatabase)
61 | {
62 | sqLiteDatabase.execSQL(Progress_bars_table.CREATE_TABLE)
63 | }
64 |
65 | // if DB schema changes, put logic to migrate data here
66 | override fun onUpgrade(db: SQLiteDatabase, old_version: Int, new_version: Int)
67 | {
68 | check(new_version == DB_VERSION) { "DB version mismatch" }
69 |
70 | if(old_version < 4)
71 | db.execSQL("DROP TABLE IF EXISTS undo")
72 |
73 | Progress_bars_table.upgrade(context, db, old_version)
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |