Skip to content

Commit

Permalink
update libraries & lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mattvchandler committed Mar 1, 2020
1 parent 54cf5a3 commit 0873145
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 37 deletions.
3 changes: 3 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.core:core-ktx:1.2.0-alpha04'
implementation 'androidx.core:core:1.2.0-alpha04'
implementation 'androidx.core:core-ktx:1.3.0-alpha01'
implementation 'androidx.core:core:1.3.0-alpha01'
implementation 'androidx.preference:preference:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta04'
implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01'
implementation 'com.google.android.material:material:1.2.0-alpha05'
}
repositories {
mavenCentral()
Expand Down
18 changes: 0 additions & 18 deletions app/src/main/java/Widget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ import org.mattvchandler.progressbars.list.View_data
import org.mattvchandler.progressbars.settings.Settings
import kotlin.math.sqrt

// TODO: cleanup debug stmts
// TODO: not always being updated (possibly not being initialized on startup)
// TODO: often can't click
// TODO: doesn't work in power save mode
// TODO: repeats not always honored (especially on first repeat)

class Widget: AppWidgetProvider()
{
override fun onUpdate(context: Context?, appWidgetManager: AppWidgetManager?, appWidgetIds: IntArray?)
Expand Down Expand Up @@ -81,15 +75,13 @@ class Widget: AppWidgetProvider()
val db = DB(context!!).writableDatabase
for(widget_id in appWidgetIds)
{
Log.d("Widget::onDeleted", "deleting: $widget_id")
val arg_array = arrayOf(widget_id.toString())

val cursor = db.rawQuery(Progress_bars_table.SELECT_WIDGET, arg_array)
if(cursor.count > 0)
{
cursor.moveToFirst()
val data = Data(cursor)
Log.d("Widget::onDeleted", "deleting: $widget_id from DB rowid: ${data.rowid}")

data.unregister_alarms(context)
db.delete(Progress_bars_table.TABLE_NAME, "${Progress_bars_table.WIDGET_ID_COL} = ?", arg_array)
Expand All @@ -103,7 +95,6 @@ class Widget: AppWidgetProvider()

override fun onReceive(context: Context?, intent: Intent?)
{
Log.v("Widget::onReceive", "${intent?.action}")
when(intent?.action)
{
Intent.ACTION_TIME_CHANGED, Intent.ACTION_TIMEZONE_CHANGED, ACTION_UPDATE_TIME -> if(context != null) update(context, null, null)
Expand All @@ -117,19 +108,15 @@ class Widget: AppWidgetProvider()

fun create_or_update_data(context: Context, widget_id: Int, data: Data)
{
Log.d("Widget::create_or_up…", "widget_id: ${widget_id}, data.id: ${data.id}, data.title: ${data.title}, data.rowid: ${data.rowid}")
val db = DB(context).writableDatabase
val cursor = db.rawQuery(Progress_bars_table.SELECT_WIDGET, arrayOf(widget_id.toString()))
if(cursor.count == 0)
{
Log.d("Widget::create", "$widget_id")

data.register_alarms(context)
data.insert(db)
}
else
{
Log.d("Widget::update", "$widget_id")
data.update_alarms(context)
data.update(db)
}
Expand Down Expand Up @@ -178,7 +165,6 @@ class Widget: AppWidgetProvider()
{
cursor.moveToFirst()
data = Data(cursor)
Log.d("Widget::create_data_fr…", "widget_id: $widget_id, data.id: ${data.id}, data.rowid: ${data.rowid}")
}

cursor.close()
Expand All @@ -188,7 +174,6 @@ class Widget: AppWidgetProvider()
{
data = Data(context)
data.widget_id = widget_id
Log.d("Widget::create_data_fr…", "created new data, widget_id: $widget_id, data.id: ${data.id}, data.rowid: ${data.rowid}")
}

return data
Expand All @@ -205,7 +190,6 @@ class Widget: AppWidgetProvider()
{
cursor.moveToFirst()
data = Data(cursor)
Log.d("Widget::get_data_from_…", "widget_id: $widget_id, data.id: ${data.id}, data.rowid: ${data.rowid}")
}

cursor.close()
Expand All @@ -216,7 +200,6 @@ class Widget: AppWidgetProvider()

private fun update(context: Context, appWidgetManager: AppWidgetManager?, appWidgetIds: IntArray?)
{
Log.d("Widget::update", "$appWidgetIds")
val pm = context.getSystemService(Context.POWER_SERVICE) as PowerManager
val screen_on = if(Build.VERSION.SDK_INT >= 20) pm.isInteractive else true
if(screen_on)
Expand All @@ -225,7 +208,6 @@ class Widget: AppWidgetProvider()

for(appWidgetId in appWidgetIds?: appWidgetManager_default.getAppWidgetIds(ComponentName(context, Widget::class.java)))
{
Log.d("Widget::update", "for loop: $appWidgetId")
val data = get_data_from_id(context, appWidgetId)
if(data != null)
build_view(context, appWidgetManager_default, appWidgetId, View_data(context, data))
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/settings/Settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import android.database.ContentObserver
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.view.View
Expand Down Expand Up @@ -114,7 +113,6 @@ class Settings: Dynamic_theme_activity(), DatePickerDialog.OnDateSetListener, Ti

consume_insets(this, binding.mainList, binding.appbarLayout)

Log.v("Settings::onCreate", "${intent?.action}")
// only run this on 1st creation
if(savedInstanceState == null)
{
Expand All @@ -124,13 +122,11 @@ class Settings: Dynamic_theme_activity(), DatePickerDialog.OnDateSetListener, Ti
intent.action == AppWidgetManager.ACTION_APPWIDGET_CONFIGURE ->
{
val widget_id = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID)
Log.d("Settings::onCreate", "widgetid: ${widget_id}")

Widget.create_data_from_id(this, widget_id)
}
else -> Data(this)
}
Log.d("Settings::onCreate", "data id: ${data.id}")

// no rowid passed? make a new one
if(data.rowid != null)
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.61'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
12 changes: 6 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Sep 20 11:34:11 AKDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
#Sun Mar 01 11:42:22 AKST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

0 comments on commit 0873145

Please sign in to comment.