Skip to content

Commit

Permalink
Fixed lint error and warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Adams committed Nov 24, 2024
1 parent 2144ec1 commit c6fdc0e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ import org.secuso.privacyfriendlytodolist.R
import org.secuso.privacyfriendlytodolist.model.ModelServices
import org.secuso.privacyfriendlytodolist.model.TodoSubtask
import org.secuso.privacyfriendlytodolist.model.TodoTask
import org.secuso.privacyfriendlytodolist.service.JobManager
import org.secuso.privacyfriendlytodolist.util.AlarmMgr
import org.secuso.privacyfriendlytodolist.util.Helper
import org.secuso.privacyfriendlytodolist.util.LogTag
import org.secuso.privacyfriendlytodolist.util.PreferenceMgr
Expand Down Expand Up @@ -418,7 +416,7 @@ class ExpandableTodoTaskAdapter(private val context: Context, private val model:
actualConvertView.findViewById(R.id.pb_task_progress)
)
tvh.done.tag = currentTask.getId()
tvh.done.setChecked(currentTask.isDone())
tvh.done.isChecked = currentTask.isDone()
tvh.done.jumpDrawablesToCurrentState()
actualConvertView.tag = tvh
}
Expand Down Expand Up @@ -469,14 +467,14 @@ class ExpandableTodoTaskAdapter(private val context: Context, private val model:
}
tvh.deadlineColorBar.setBackgroundColor(Helper.getDeadlineColor(context,
currentTask.getDeadlineColor(PreferenceMgr.getDefaultReminderTimeSpan(context))))
tvh.done.setChecked(currentTask.isDone())
tvh.done.isChecked = currentTask.isDone()
tvh.done.jumpDrawablesToCurrentState()
tvh.done.setOnCheckedChangeListener { buttonView, isChecked ->
if (buttonView.isPressed) {
val snackBar = Snackbar.make(buttonView, R.string.snack_check, Snackbar.LENGTH_LONG)
snackBar.setAction(R.string.snack_undo) {
val inverted = !isChecked
buttonView.setChecked(inverted)
buttonView.isChecked = inverted
currentTask.setDone(buttonView.isChecked)
currentTask.setAllSubtasksDone(inverted)
currentTask.getProgress(hasAutoProgress())
Expand Down Expand Up @@ -604,7 +602,7 @@ class ExpandableTodoTaskAdapter(private val context: Context, private val model:
}
svh.deadlineColorBar.setBackgroundColor(Helper.getDeadlineColor(context,
currentTask.getDeadlineColor(PreferenceMgr.getDefaultReminderTimeSpan(context))))
svh.done.setChecked(currentSubtask.isDone())
svh.done.isChecked = currentSubtask.isDone()
svh.done.jumpDrawablesToCurrentState()
svh.done.setOnCheckedChangeListener { buttonView, isChecked ->
if (buttonView.isPressed) {
Expand Down Expand Up @@ -808,7 +806,7 @@ class ExpandableTodoTaskAdapter(private val context: Context, private val model:
subtasksMetaData.add(SubtaskMetaData())
}
while (expectedSize < subtasksMetaData.size) {
subtasksMetaData.removeLast()
subtasksMetaData.removeAt(subtasksMetaData.size - 1)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
openContextMenu(exLv)
}
exLv!!.setAdapter(expandableTodoTaskAdapter)
exLv!!.setEmptyView(emptyView)
exLv!!.emptyView = emptyView
}

override fun onCreateContextMenu(menu: ContextMenu, v: View, menuInfo: ContextMenuInfo?) {
Expand Down Expand Up @@ -1086,10 +1086,10 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
val anim: Animation = AlphaAnimation(0.0f, 1.0f)
if (numberOfLists == 0 && numberOfTasksNotInRecycleBin == 0) {
initialAlert!!.visibility = View.VISIBLE
anim.setDuration(1500)
anim.duration = 1500
anim.startOffset = 20
anim.repeatMode = Animation.REVERSE
anim.setRepeatCount(Animation.INFINITE)
anim.repeatCount = Animation.INFINITE
initialAlert!!.startAnimation(anim)
} else /* if numberOfLists != 0 || numberOfTasksNotInRecycleBin != 0 */ {
initialAlert!!.visibility = View.GONE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class RecyclerActivity : AppCompatActivity() {
openContextMenu(exLv)
}
exLv.setAdapter(expandableTodoTaskAdapter)
exLv.setEmptyView(tv)
exLv.emptyView = tv
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class Settings : AppCompatActivity() {
//upArrow.setColorFilter(ContextCompat.getColor(this, R.color.white), PorterDuff.Mode.SRC_ATOP);
//getSupportActionBar().setHomeAsUpIndicator(upArrow);
}
supportFragmentManager.beginTransaction().replace(R.id.fragment_container, MyPreferenceFragment()).commit()
val transaction = supportFragmentManager.beginTransaction()
transaction.replace(R.id.fragment_container, MyPreferenceFragment())
transaction.commit()
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class TodoListWidget : AppWidgetProvider(), ModelObserver {

override fun onTodoDataChanged(context: Context, changedLists: Int, changedTasks: Int, changedSubtasks: Int) {
val appWidgetManager = AppWidgetManager.getInstance(context)
val thisComponentName = ComponentName(context.packageName, TodoListWidget::class.java.getName())
val thisComponentName = ComponentName(context.packageName, TodoListWidget::class.java.name)
val appWidgetIds = appWidgetManager.getAppWidgetIds(thisComponentName)
for (appWidgetId in appWidgetIds) {
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.listview_widget)
Expand All @@ -73,7 +73,7 @@ class TodoListWidget : AppWidgetProvider(), ModelObserver {

private fun initialUpdate(context: Context) {
val appWidgetManager = AppWidgetManager.getInstance(context)
val thisComponentName = ComponentName(context.packageName, TodoListWidget::class.java.getName())
val thisComponentName = ComponentName(context.packageName, TodoListWidget::class.java.name)
val appWidgetIds = appWidgetManager.getAppWidgetIds(thisComponentName)
onUpdate(context, appWidgetManager, appWidgetIds)
}
Expand All @@ -86,6 +86,7 @@ class TodoListWidget : AppWidgetProvider(), ModelObserver {
}
}

@Suppress("UnnecessaryVariable")
private fun update(context: Context, appWidgetManager: AppWidgetManager, appWidgetId: Int,
title: String? = null) {
val view = RemoteViews(context.packageName, R.layout.todo_list_widget)
Expand Down

0 comments on commit c6fdc0e

Please sign in to comment.