mirror of
https://github.com/jrpie/Launcher.git
synced 2025-04-19 10:20:51 +02:00
Implement a settings menu and connect the chooser to it
This commit is contained in:
parent
e2915dcfe7
commit
44c31dd3a3
4 changed files with 197 additions and 6 deletions
|
@ -3,11 +3,12 @@ package com.finnmglas.launcher
|
|||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.CountDownTimer
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.View.OnLongClickListener
|
||||
import android.view.View.OnTouchListener
|
||||
import android.view.WindowManager
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
@ -18,6 +19,7 @@ import java.util.*
|
|||
import kotlin.concurrent.fixedRateTimer
|
||||
import kotlin.math.abs
|
||||
|
||||
|
||||
var upApp = "org.mozilla.firefox"
|
||||
var downApp = "com.samsung.android.app.galaxyfinder"
|
||||
var rightApp = "com.samsung.android.email.provider"
|
||||
|
@ -49,7 +51,7 @@ class MainActivity : AppCompatActivity() {
|
|||
applicationContext.startActivity(intent2)
|
||||
overridePendingTransition(0,0)
|
||||
} else {
|
||||
Toast.makeText(this, "Package '$packageName' not found.", Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(this, "Package '$packageName' not found. Change your Settings.", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,10 +40,17 @@ class SettingsActivity : AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
fun chooseApp() {
|
||||
fun chooseDownApp(view: View) {chooseApp("downApp")}
|
||||
fun chooseUpApp(view: View) {chooseApp("upApp")}
|
||||
fun chooseLeftApp(view: View) {chooseApp("leftApp")}
|
||||
fun chooseRightApp(view: View) {chooseApp("rightApp")}
|
||||
fun chooseVolumeDownApp(view: View) {chooseApp("volumeDownApp")}
|
||||
fun chooseVolumeUpApp(view: View) {chooseApp("volumeUpApp")}
|
||||
|
||||
fun chooseApp(forAction :String) {
|
||||
val intent = Intent(this, ChooseActivity::class.java)
|
||||
intent.putExtra("action", "pick") // why choose an app
|
||||
intent.putExtra("forApp", "downApp") // which app we choose
|
||||
intent.putExtra("forApp", forAction) // which app we choose
|
||||
startActivityForResult(intent, 5000)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue