Remove unnecessary leftover code

zombiecode, toasts and the old apps list
This commit is contained in:
Finn M Glas 2020-05-27 11:12:40 +02:00
parent 4c131e4aed
commit 9fa009bf99
No known key found for this signature in database
GPG key ID: 25037A2E81AB459C
4 changed files with 0 additions and 25 deletions

View file

@ -66,15 +66,11 @@ class ChooseActivity : AppCompatActivity() {
} }
} }
/*
}*/
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_UNINSTALL) { if (requestCode == REQUEST_UNINSTALL) {
if (resultCode == Activity.RESULT_OK) { if (resultCode == Activity.RESULT_OK) {
Toast.makeText(this, getString(R.string.choose_removed_toast), Toast.LENGTH_LONG).show() Toast.makeText(this, getString(R.string.choose_removed_toast), Toast.LENGTH_LONG).show()
updateAppList(packageManager)
finish() finish()
} else if (resultCode == Activity.RESULT_FIRST_USER) { } else if (resultCode == Activity.RESULT_FIRST_USER) {
Toast.makeText(this, getString(R.string.choose_not_removed_toast), Toast.LENGTH_LONG).show() Toast.makeText(this, getString(R.string.choose_not_removed_toast), Toast.LENGTH_LONG).show()

View file

@ -32,7 +32,6 @@ class MainActivity : AppCompatActivity(),
// timers // timers
private var clockTimer = Timer() private var clockTimer = Timer()
private var tooltipTimer = Timer() private var tooltipTimer = Timer()
private var loadAppsTimer = Timer()
private var settingsIconShown = false private var settingsIconShown = false
@ -125,18 +124,11 @@ class MainActivity : AppCompatActivity(),
activity_main_date_view.text = d activity_main_date_view.text = d
} }
} }
val pm = packageManager
loadAppsTimer = fixedRateTimer("loadAppsTimer", true, 0L, 30000) {
AsyncTask.execute { updateAppList(pm) }
}
} }
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
clockTimer.cancel() clockTimer.cancel()
loadAppsTimer.cancel()
} }
private fun openSettings(){ private fun openSettings(){

View file

@ -10,7 +10,6 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import android.widget.Toast
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.finnmglas.launcher.R import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.* import com.finnmglas.launcher.extern.*
@ -36,8 +35,6 @@ class AppsRecyclerAdapter(val activity: Activity, val action: String?, val forAp
val launchIntent: Intent = context.packageManager val launchIntent: Intent = context.packageManager
.getLaunchIntentForPackage(appPackageName)!! .getLaunchIntentForPackage(appPackageName)!!
context.startActivity(launchIntent) context.startActivity(launchIntent)
Toast.makeText(v.context, appsList[pos].label.toString(), Toast.LENGTH_LONG)
.show()
} }
"pick" -> { "pick" -> {
val returnIntent = Intent() val returnIntent = Intent()

View file

@ -7,7 +7,6 @@ import android.content.DialogInterface
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.content.pm.ResolveInfo
import android.graphics.* import android.graphics.*
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
@ -30,8 +29,6 @@ var volumeDownApp = ""
var calendarApp = "" var calendarApp = ""
var clockApp = "" var clockApp = ""
var appsList : MutableList<ResolveInfo> = mutableListOf()
var background : Bitmap? = null var background : Bitmap? = null
var dominantColor = 0 var dominantColor = 0
@ -126,13 +123,6 @@ fun isInstalled(uri: String, context: Context): Boolean {
return false return false
} }
fun updateAppList(pm : PackageManager) {
val intent = Intent(Intent.ACTION_MAIN)
.addCategory(Intent.CATEGORY_LAUNCHER)
appsList = pm.queryIntentActivities(intent, 0)
appsList.sortBy { it.activityInfo.loadLabel(pm).toString() }
}
private fun getIntent(packageName: String, context: Context): Intent? { private fun getIntent(packageName: String, context: Context): Intent? {
val intent: Intent? = context.packageManager.getLaunchIntentForPackage(packageName) val intent: Intent? = context.packageManager.getLaunchIntentForPackage(packageName)
intent?.addCategory(Intent.CATEGORY_LAUNCHER) intent?.addCategory(Intent.CATEGORY_LAUNCHER)