Skip to content

Commit

Permalink
refractor: Some variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
axel358 committed Feb 21, 2024
1 parent c5fc061 commit 3de1873
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions app/src/main/java/cu/axel/smartdock/activities/LauncherActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ open class LauncherActivity : AppCompatActivity(), OnAppClickListener {
when (intent.getStringExtra("action")) {
DOCK_SERVICE_CONNECTED -> serviceBtn.visibility = View.GONE
DESKTOP_APP_PINNED -> loadDesktopApps()

}
}
}, IntentFilter(DOCK_SERVICE_ACTION),
Expand All @@ -127,33 +126,37 @@ open class LauncherActivity : AppCompatActivity(), OnAppClickListener {
.setPackage(packageName)
.putExtra("action", LAUNCHER_RESUMED)
)
if (DeviceUtils.isAccessibilityServiceEnabled(this)) serviceBtn.visibility = View.GONE else serviceBtn.visibility = View.VISIBLE

serviceBtn.visibility = if (DeviceUtils.isAccessibilityServiceEnabled(this)) View.GONE else View.VISIBLE

loadDesktopApps()

if (sharedPreferences.getBoolean("show_notes", false)) {
notesEt.visibility = View.VISIBLE
loadNotes()
} else {
} else
notesEt.visibility = View.GONE
}

appsGv.requestFocus()
}

override fun onPause() {
super.onPause()
if (sharedPreferences.getBoolean("show_notes", false)) saveNotes()
if (sharedPreferences.getBoolean("show_notes", false))
saveNotes()
}

override fun onBackPressed() {}
private fun loadNotes() {
val notes = File(getExternalFilesDir(null), "notes.txt")
try {
val br = BufferedReader(FileReader(notes))
val bufferedReader = BufferedReader(FileReader(notes))
var line: String?
val noteContent = StringBuilder()
while (br.readLine().also { line = it } != null) {
while (bufferedReader.readLine().also { line = it } != null) {
noteContent.append(line).append("\n")
}
br.close()
bufferedReader.close()
notesEt.setText(noteContent.toString())
} catch (_: IOException) {
}
Expand All @@ -164,9 +167,9 @@ open class LauncherActivity : AppCompatActivity(), OnAppClickListener {
if (noteContent.isNotEmpty()) {
val notes = File(getExternalFilesDir(null), "notes.txt")
try {
val fr = FileWriter(notes)
fr.write(noteContent)
fr.close()
val fileWriter = FileWriter(notes)
fileWriter.write(noteContent)
fileWriter.close()
} catch (_: IOException) {
}
}
Expand Down

0 comments on commit 3de1873

Please sign in to comment.