Merge pull request #13 from finnmglas/fix/black-screen

Clean up code and translate
This commit is contained in:
Finn M Glas 2020-05-19 19:54:36 +02:00 committed by GitHub
commit 3379df5f11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 589 additions and 575 deletions

View file

@ -1,6 +1,5 @@
package com.finnmglas.launcher package com.finnmglas.launcher
import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.content.Intent import android.content.Intent
import android.graphics.Color import android.graphics.Color
@ -18,11 +17,8 @@ class ChooseActivity : AppCompatActivity() {
val UNINSTALL_REQUEST_CODE = 1 val UNINSTALL_REQUEST_CODE = 1
fun backHome(view: View) { /** Activity Lifecycle functions */
finish()
}
@SuppressLint("SetTextI18n") // I do not care
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -36,13 +32,13 @@ class ChooseActivity : AppCompatActivity() {
val forApp = bundle.getString("forApp") // which app we choose val forApp = bundle.getString("forApp") // which app we choose
if (action == "launch") if (action == "launch")
heading.text = "Launch Apps" heading.text = getString(R.string.choose_title_launch)
else if (action == "pick") { else if (action == "pick") {
heading.text = "Choose App" heading.text = getString(R.string.choose_title)
subheading.text = forApp subheading.text = forApp // TODO: make translatable
} }
else if (action == "uninstall") else if (action == "uninstall")
heading.text = "Uninstall Apps" heading.text = getString(R.string.choose_title_remove)
/* Build Layout */ /* Build Layout */
@ -95,28 +91,21 @@ class ChooseActivity : AppCompatActivity() {
} }
} }
override fun onActivityResult( override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
requestCode: Int,
resultCode: Int,
data: Intent?
) {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
if (requestCode == UNINSTALL_REQUEST_CODE) { if (requestCode == UNINSTALL_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) { if (resultCode == Activity.RESULT_OK) {
Toast.makeText( Toast.makeText(this, getString(R.string.choose_removed_toast), Toast.LENGTH_LONG).show()
this,
"Removed the selected application",
Toast.LENGTH_LONG
).show()
finish() finish()
} else if (resultCode == Activity.RESULT_FIRST_USER) { } else if (resultCode == Activity.RESULT_FIRST_USER) {
Toast.makeText( Toast.makeText(this, getString(R.string.choose_not_removed_toast), Toast.LENGTH_LONG).show()
this,
"Can't remove this app",
Toast.LENGTH_LONG
).show()
finish() finish()
} }
} }
} }
/** onClick functions */
fun backHome(view: View) { finish() }
} }

View file

@ -1,6 +1,5 @@
package com.finnmglas.launcher package com.finnmglas.launcher
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
@ -30,12 +29,13 @@ fun View.blink(
class FirstStartupActivity : AppCompatActivity(){ class FirstStartupActivity : AppCompatActivity(){
var menuNumber = 0 /** Variables for this activity */
var defaultApps = mutableListOf<String>()
/* Overrides */ private var menuNumber = 0
private var defaultApps = mutableListOf<String>()
/** Activity Lifecycle functions */
@SuppressLint("SetTextI18n") // I do not care
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -48,14 +48,14 @@ class FirstStartupActivity : AppCompatActivity(){
setContentView(R.layout.activity_firststartup) setContentView(R.layout.activity_firststartup)
continue_text.blink() // animate hintText.blink() // animate
loadMenu(this) loadMenu(this)
val sharedPref = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE)
defaultApps = resetSettings(sharedPref, this) // UP, DOWN, RIGHT, LEFT, VOLUME_UP, VOLUME_DOWN
} }
fun clickAnywhere(view: View){ /** Touch- and Key-related functions to navigate */
menuNumber++
loadMenu(this)
}
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP){ if (keyCode == KeyEvent.KEYCODE_VOLUME_UP){
@ -73,68 +73,30 @@ class FirstStartupActivity : AppCompatActivity(){
return true return true
} }
@SuppressLint("SetTextI18n") // I don't care! (Yet) fun clickAnywhere(view: View){
fun loadMenu(context :Context) { // Context needed for packageManager menuNumber++
loadMenu(this)
}
val sharedPref = this.getSharedPreferences( /** Touch- and Key-related functions to navigate */
getString(R.string.preference_file_key), Context.MODE_PRIVATE)
// Intro private fun loadMenu(context :Context) { // Context needed for packageManager
if (menuNumber == 0){
heading.text = "" val intro = resources.getStringArray(R.array.intro)
description.text = "Take a few seconds to learn how to use this Launcher!\n\n"
continue_text.text = "-- Tap anywhere to continue --" if (menuNumber < intro.size){
val entry = intro[menuNumber].split("|").toTypedArray() //heading|infoText|hintText|size
heading.text = entry[0]
if (entry[4] == "1")infoText.text = String.format(entry[1],
defaultApps[0], defaultApps[1], defaultApps[2], defaultApps[3], defaultApps[4], defaultApps[5])
else infoText.text = entry[1]
hintText.text = entry[2]
infoText.setTextSize(TypedValue.COMPLEX_UNIT_SP, entry[3].toFloat())
} else { // End intro
val sharedPref = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE)
defaultApps = resetSettings(sharedPref, context) // UP, DOWN, RIGHT, LEFT, VOLUME_UP, VOLUME_DOWN
}
// Concept
else if (menuNumber == 1){
heading.text = "Concept"
description.text = "It is designed to be minimal, efficient and free of distraction."
}
else if (menuNumber == 2){
heading.text = "Concept"
description.text = "It is free of payments, ads and tracking services."
continue_text.text = "-- Tap anywhere to continue --"
}
// Usage
else if (menuNumber == 3){
heading.text = "Usage"
description.text = "Your home screen contains the local date and time. No distraction."
continue_text.text = "-- Use volume keys to navigate --"
}
else if (menuNumber == 4){
heading.text = "Usage"
description.text = "You can open your apps with a single swipe or button press."
}
// Setup
else if (menuNumber == 5){
heading.text = "Setup"
description.setTextSize(TypedValue.COMPLEX_UNIT_SP,36F)
description.text = "We have set up some default actions for you..."
}
else if (menuNumber == 6){
description.setTextSize(TypedValue.COMPLEX_UNIT_SP,18F)
description.text = "Swipe Up: Open a Browser (" + defaultApps[0] + ")\n\n" +
"Swipe Down: Open internal Search App (" + defaultApps[1] + ")\n\n" +
"Swipe Right: Open Mail (" + defaultApps[2] + ")\n\n" +
"Swipe Left: Open Calendar (" + defaultApps[3] + ")\n\n" +
"Volume Up: Open a messenger (" + defaultApps[4] + ")\n\n" +
"Volume Down: Open Utilities (" + defaultApps[5] + ")"
}
else if (menuNumber == 7){
heading.text = "Setup"
description.setTextSize(TypedValue.COMPLEX_UNIT_SP,36F)
description.text = "You can choose your own apps:\n\nOpen settings by tapping and holding the home screen."
continue_text.text = "-- Use volume keys to navigate --"
}
else if (menuNumber == 8){
heading.text = ""
description.text = "You are ready to get started!\n\n I hope this provides great value to you!\n\n- Finn M Glas\n\n"
continue_text.text = "-- Launcher by Finn M Glas --"
}
// End Intro
else {
val editor: SharedPreferences.Editor = sharedPref.edit() val editor: SharedPreferences.Editor = sharedPref.edit()
editor.putBoolean("startedBefore", true) // never run this again editor.putBoolean("startedBefore", true) // never run this again
editor.putLong("firstStartup", System.currentTimeMillis() / 1000L) // record first startup timestamp editor.putLong("firstStartup", System.currentTimeMillis() / 1000L) // record first startup timestamp
@ -142,6 +104,5 @@ class FirstStartupActivity : AppCompatActivity(){
finish() finish()
} }
} }
} }

View file

@ -1,33 +0,0 @@
package com.finnmglas.launcher;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;
public class FontAwesome extends androidx.appcompat.widget.AppCompatTextView {
public FontAwesome(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public FontAwesome(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public FontAwesome(Context context) {
super(context);
init();
}
private void init() {
//Font name should not contain "/".
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),
"fonts/fa-solid-900.ttf");
setTypeface(tf);
}
}

View file

@ -1,32 +0,0 @@
package com.finnmglas.launcher;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
public class FontAwesomeBrand extends androidx.appcompat.widget.AppCompatTextView {
public FontAwesomeBrand(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public FontAwesomeBrand(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public FontAwesomeBrand(Context context) {
super(context);
init();
}
private void init() {
//Font name should not contain "/".
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),
"fonts/fa-brand-400.ttf");
setTypeface(tf);
}
}

View file

@ -0,0 +1,156 @@
package com.finnmglas.launcher
import android.app.Activity
import android.app.AlertDialog
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.provider.Settings
import android.widget.Toast
/** Parsing functions */
// Related question: https://stackoverflow.com/q/3013655/12787264
fun parseStringMap(stringArrayResourceId: Int, context: Context): HashMap<String, String>? {
val stringArray: Array<String> =
context.resources.getStringArray(stringArrayResourceId)
val outputArray = HashMap<String, String>(stringArray.size)
for (entry in stringArray) {
val splitResult = entry.split("|").toTypedArray()
outputArray.put(splitResult[0], splitResult[1])
}
return outputArray
}
/** Activity related */
fun isInstalled(uri: String, context: Context): Boolean {
try {
context.packageManager.getPackageInfo(uri, PackageManager.GET_ACTIVITIES)
return true
} catch (e: PackageManager.NameNotFoundException) {
}
return false
}
private fun getIntent(packageName: String, context: Context): Intent? {
val intent: Intent? = context.packageManager.getLaunchIntentForPackage(packageName)
intent?.addCategory(Intent.CATEGORY_LAUNCHER)
return intent
}
fun launchApp(packageName: String, context: Context) {
val intent1 = getIntent(packageName, context)
if (intent1 != null) {
context.startActivity(intent1)
if (context is Activity) {
context.overridePendingTransition(0, 0)
}
} else {
if (isInstalled(packageName, context)){
AlertDialog.Builder(context)
.setTitle(context.getString(R.string.alert_cant_open_title))
.setMessage(context.getString(R.string.alert_cant_open_message))
.setPositiveButton(android.R.string.yes,
DialogInterface.OnClickListener { dialog, which ->
openAppSettings(packageName, context)
})
.setNegativeButton(android.R.string.no, null)
.setIcon(android.R.drawable.ic_dialog_info)
.show()
} else {
Toast.makeText( context, context.getString(R.string.toast_cant_open_message), Toast.LENGTH_SHORT).show()
}
}
}
fun openNewTabWindow(urls: String, context : Context) {
val uris = Uri.parse(urls)
val intents = Intent(Intent.ACTION_VIEW, uris)
val b = Bundle()
b.putBoolean("new_window", true)
intents.putExtras(b)
context.startActivity(intents)
}
/** Settings related functions */
fun openAppSettings(pkg :String, context:Context){
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:$pkg")
context.startActivity(intent)
}
fun loadSettings(sharedPref : SharedPreferences){
upApp = sharedPref.getString("action_upApp", "").toString()
downApp = sharedPref.getString("action_downApp", "").toString()
rightApp = sharedPref.getString("action_rightApp", "").toString()
leftApp = sharedPref.getString("action_leftApp", "").toString()
volumeUpApp = sharedPref.getString("action_volumeUpApp", "").toString()
volumeDownApp = sharedPref.getString("action_volumeDownApp", "").toString()
calendarApp = sharedPref.getString("action_calendarApp", "").toString()
clockApp = sharedPref.getString("action_clockApp", "").toString()
}
fun resetSettings(sharedPref : SharedPreferences, context: Context) : MutableList<String>{
val defaultList :MutableList<String> = mutableListOf<String>()
val editor: SharedPreferences.Editor = sharedPref.edit()
val (chosenUpName, chosenUpPackage) = pickDefaultApp("action_upApp", context)
editor.putString("action_upApp", chosenUpPackage)
defaultList.add(chosenUpName)
val (chosenDownName, chosenDownPackage) = pickDefaultApp("action_downApp", context)
editor.putString("action_downApp", chosenDownPackage)
defaultList.add(chosenDownName)
val (chosenRightName, chosenRightPackage) = pickDefaultApp("action_rightApp", context)
editor.putString("action_rightApp", chosenRightPackage)
defaultList.add(chosenRightName)
val (chosenLeftName, chosenLeftPackage) = pickDefaultApp("action_leftApp", context)
editor.putString("action_leftApp", chosenLeftPackage)
editor.putString("action_calendarApp", chosenLeftPackage)
defaultList.add(chosenLeftName)
val (chosenVolumeUpName, chosenVolumeUpPackage) = pickDefaultApp("action_volumeUpApp", context)
editor.putString("action_volumeUpApp", chosenVolumeUpPackage)
defaultList.add(chosenVolumeUpName)
val (chosenVolumeDownName, chosenVolumeDownPackage) = pickDefaultApp("action_volumeDownApp", context)
editor.putString("action_volumeDownApp", chosenVolumeDownPackage)
defaultList.add(chosenVolumeDownName)
val (_, chosenClockPackage) = pickDefaultApp("action_clockApp", context)
editor.putString("action_clockApp", chosenClockPackage)
editor.apply()
return defaultList // UP, DOWN, RIGHT, LEFT, VOLUME_UP, VOLUME_DOWN
}
fun pickDefaultApp(action: String, context: Context) : Pair<String, String>{
val arrayResource = when (action) {
"action_upApp" -> R.array.default_up
"action_downApp" -> R.array.default_down
"action_rightApp" -> R.array.default_right
"action_leftApp" -> R.array.default_left
"action_volumeUpApp" -> R.array.default_volume_up
"action_volumeDownApp" -> R.array.default_volume_down
"action_clockApp" -> R.array.default_clock
else -> return Pair(context.getString(R.string.none_found), "") // just prevent crashing on unknown input
}
val defaultAppsMap = parseStringMap(arrayResource, context)
for (item in defaultAppsMap!!) if (isInstalled(item.key, context)) return Pair(item.value, item.key)
return Pair(context.getString(R.string.none_found), "")
}

View file

@ -1,15 +1,10 @@
package com.finnmglas.launcher package com.finnmglas.launcher
import android.annotation.SuppressLint
import android.app.AlertDialog
import android.content.ActivityNotFoundException
import android.content.Context import android.content.Context
import android.content.DialogInterface
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.view.* import android.view.*
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.GestureDetectorCompat import androidx.core.view.GestureDetectorCompat
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
@ -18,7 +13,7 @@ import java.util.*
import kotlin.concurrent.fixedRateTimer import kotlin.concurrent.fixedRateTimer
import kotlin.math.abs import kotlin.math.abs
// App Launch Actions /** Variables for all of the app */
var upApp = "" var upApp = ""
var downApp = "" var downApp = ""
var rightApp = "" var rightApp = ""
@ -30,91 +25,16 @@ var calendarApp = ""
var clockApp = "" var clockApp = ""
class MainActivity : AppCompatActivity(), class MainActivity : AppCompatActivity(),
GestureDetector.OnGestureListener, GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener {
GestureDetector.OnDoubleTapListener {
/** Variables for this activity */
private lateinit var mDetector: GestureDetectorCompat private lateinit var mDetector: GestureDetectorCompat
// get device dimensions // get device dimensions
private val displayMetrics = DisplayMetrics() private val displayMetrics = DisplayMetrics()
private var clockTimer = Timer()
private fun getIntent(packageName: String): Intent? { /** Activity Lifecycle functions */
val intent: Intent? = packageManager.getLaunchIntentForPackage(packageName)
intent?.addCategory(Intent.CATEGORY_LAUNCHER)
return intent
}
private fun launchApp(packageName: String) {
val intent1 = getIntent(packageName)
if (intent1 != null) {
applicationContext.startActivity(intent1)
overridePendingTransition(0, 0)
} else {
if (isInstalled(packageName, this)){
AlertDialog.Builder(this)
.setTitle("Can't open app")
.setMessage("Want to change its settings ('add it to the apps screen')?")
.setPositiveButton(android.R.string.yes,
DialogInterface.OnClickListener { dialog, which ->
openAppSettings(packageName, this)
})
.setNegativeButton(android.R.string.no, null)
.setIcon(android.R.drawable.ic_dialog_info)
.show()
} else {
Toast.makeText(
this,
"Open settings to choose an app for this action",
Toast.LENGTH_SHORT
).show()
}
}
}
fun launchCalendar(v: View) {
launchApp(calendarApp)
}
fun launchClock(v: View) {
launchApp(clockApp)
}
fun launchUpApp() {
launchApp(upApp)
}
fun launchDownApp() {
launchApp(downApp)
}
fun lauchLeftApp() {
launchApp(leftApp)
}
fun lauchRightApp() {
launchApp(rightApp)
}
fun lauchVolumeUpApp() {
launchApp(volumeUpApp)
}
fun lauchVolumeDownApp() {
launchApp(volumeDownApp)
}
/* Overrides */
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK) return true
else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) lauchVolumeUpApp()
else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) lauchVolumeDownApp()
return true
}
@SuppressLint("SetTextI18n") // I do not care
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -126,8 +46,6 @@ GestureDetector.OnDoubleTapListener {
if (!sharedPref.getBoolean("startedBefore", false)) if (!sharedPref.getBoolean("startedBefore", false))
startActivity(Intent(this, FirstStartupActivity::class.java)) startActivity(Intent(this, FirstStartupActivity::class.java))
loadSettings(sharedPref)
// Flags // Flags
window.setFlags( window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN,
@ -135,40 +53,54 @@ GestureDetector.OnDoubleTapListener {
) )
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
val timeFormat = SimpleDateFormat("HH:mm:ss", Locale.getDefault())
fixedRateTimer("timer", false, 0L, 1000) {
this@MainActivity.runOnUiThread {
dateView.text = dateFormat.format(Date())
timeView.text = timeFormat.format(Date()) // not " GMT"
}
}
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
}
override fun onStart(){
super.onStart()
// Preferences
val sharedPref = this.getSharedPreferences(
getString(R.string.preference_file_key), Context.MODE_PRIVATE)
loadSettings(sharedPref)
mDetector = GestureDetectorCompat(this, this) mDetector = GestureDetectorCompat(this, this)
mDetector.setOnDoubleTapListener(this) mDetector.setOnDoubleTapListener(this)
} }
override fun onTouchEvent(event: MotionEvent): Boolean { override fun onResume() {
return if (mDetector.onTouchEvent(event)) { super.onResume()
true
} else { val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
super.onTouchEvent(event) val timeFormat = SimpleDateFormat("HH:mm:ss", Locale.getDefault())
clockTimer = fixedRateTimer("timer", true, 0L, 1000) {
this@MainActivity.runOnUiThread {
dateView.text = dateFormat.format(Date())
timeView.text = timeFormat.format(Date())
}
} }
} }
override fun onDown(event: MotionEvent): Boolean { override fun onPause() {
super.onPause()
clockTimer.cancel()
}
/** Touch- and Key-related functions to start activities */
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK) return true
else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) launchApp(volumeUpApp, this)
else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) launchApp(volumeDownApp, this)
return true return true
} }
override fun onFling( fun dateViewOnTouch(v: View) { launchApp(calendarApp, this) }
e1: MotionEvent, fun timeViewOnTouch(v: View) { launchApp(clockApp, this) }
e2: MotionEvent,
differenceX: Float, override fun onFling(e1: MotionEvent, e2: MotionEvent, dX: Float, dY: Float): Boolean {
differenceY: Float
): Boolean {
windowManager.defaultDisplay.getMetrics(displayMetrics) windowManager.defaultDisplay.getMetrics(displayMetrics)
val width = displayMetrics.widthPixels val width = displayMetrics.widthPixels
@ -177,55 +109,33 @@ GestureDetector.OnDoubleTapListener {
val diffX = e1.x - e2.x val diffX = e1.x - e2.x
val diffY = e1.y - e2.y val diffY = e1.y - e2.y
val strictness = 4 // of direction val strictness = 4 // how distinguished the swipe has to be to be accepted
/* Decide for an action */ // Only open if the swipe was not from the phones top edge
if (diffY < -height / 8 && abs(diffY) > strictness * abs(diffX) && e1.y > 100) launchApp(downApp, this)
if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) launchUpApp() else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) launchApp(upApp, this)
// Only open if the swipe was not from the phone edge else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) launchApp(leftApp, this)
else if (diffY < -height / 8 && abs(diffY) > strictness * abs(diffX) && e1.y > 100) launchDownApp() else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) launchApp(rightApp, this)
else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) lauchLeftApp()
else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) lauchRightApp()
return true return true
} }
// Open Settings // Open Settings Activity
override fun onLongPress(event: MotionEvent) { override fun onLongPress(event: MotionEvent) {
startActivity(Intent(this, SettingsActivity::class.java)) startActivity(Intent(this, SettingsActivity::class.java))
} }
override fun onScroll( override fun onTouchEvent(event: MotionEvent): Boolean {
e1: MotionEvent, return if (mDetector.onTouchEvent(event)) { true } else { super.onTouchEvent(event) }
e2: MotionEvent,
diffX: Float,
diffY: Float
): Boolean {
return true
}
override fun onShowPress(event: MotionEvent) {
}
override fun onSingleTapUp(event: MotionEvent): Boolean {
return true
}
override fun onDoubleTap(event: MotionEvent): Boolean {
return true
}
override fun onDoubleTapEvent(event: MotionEvent): Boolean {
return true
}
override fun onSingleTapConfirmed(event: MotionEvent): Boolean {
return true
} }
/* TODO: Remove those. For now they are necessary
* because this inherits from GestureDetector.OnGestureListener */
override fun onDoubleTap(event: MotionEvent): Boolean { return true }
override fun onDoubleTapEvent(event: MotionEvent): Boolean { return true }
override fun onDown(event: MotionEvent): Boolean { return true }
override fun onScroll(e1: MotionEvent, e2: MotionEvent, dX: Float, dY: Float): Boolean { return true }
override fun onShowPress(event: MotionEvent) {}
override fun onSingleTapUp(event: MotionEvent): Boolean { return true }
override fun onSingleTapConfirmed(event: MotionEvent): Boolean { return true }
} }

View file

@ -1,154 +0,0 @@
package com.finnmglas.launcher
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.net.Uri
import android.provider.Settings
import androidx.core.content.ContextCompat.startActivity
val none_msg = "None found"
fun isInstalled(uri: String, context: Context): Boolean {
try {
context.packageManager.getPackageInfo(uri, PackageManager.GET_ACTIVITIES)
return true
} catch (e: PackageManager.NameNotFoundException) {
}
return false
}
fun openAppSettings(pkg :String, context:Context){
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:$pkg")
context.startActivity(intent)
}
fun loadSettings(sharedPref : SharedPreferences){
upApp = sharedPref.getString("action_upApp", "").toString()
downApp = sharedPref.getString("action_downApp", "").toString()
rightApp = sharedPref.getString("action_rightApp", "").toString()
leftApp = sharedPref.getString("action_leftApp", "").toString()
volumeUpApp = sharedPref.getString("action_volumeUpApp", "").toString()
volumeDownApp = sharedPref.getString("action_volumeDownApp", "").toString()
calendarApp = sharedPref.getString("action_calendarApp", "").toString()
clockApp = sharedPref.getString("action_clockApp", "").toString()
}
// Default settings are set here.
fun resetSettings(sharedPref : SharedPreferences, context: Context) : MutableList<String>{
val defaultList :MutableList<String> = mutableListOf<String>()
val editor: SharedPreferences.Editor = sharedPref.edit()
val (chosenUpName, chosenUpPackage) = pickDefaultUpApp(context)
editor.putString("action_upApp", chosenUpPackage)
defaultList.add(chosenUpName)
val (chosenDownName, chosenDownPackage) = pickDefaultDownApp(context)
editor.putString("action_downApp", chosenDownPackage)
defaultList.add(chosenDownName)
val (chosenRightName, chosenRightPackage) = pickDefaultRightApp(context)
editor.putString("action_rightApp", chosenRightPackage)
defaultList.add(chosenRightName)
val (chosenLeftName, chosenLeftPackage) = pickDefaultLeftApp(context)
editor.putString("action_leftApp", chosenLeftPackage)
editor.putString("action_calendarApp", chosenLeftPackage)
defaultList.add(chosenLeftName)
val (chosenVolumeUpName, chosenVolumeUpPackage) = pickDefaultVolumeUpApp(context)
editor.putString("action_volumeUpApp", chosenVolumeUpPackage)
defaultList.add(chosenVolumeUpName)
val (chosenVolumeDownName, chosenVolumeDownPackage) = pickDefaultVolumeDownApp(context)
editor.putString("action_volumeDownApp", chosenVolumeDownPackage)
defaultList.add(chosenVolumeDownName)
// clockApp default
editor.putString("action_clockApp", "com.sec.android.app.clockpackage")
editor.apply()
return defaultList // UP, DOWN, RIGHT, LEFT, VOLUME_UP, VOLUME_DOWN
}
// Default upApps are Browsers
fun pickDefaultUpApp(context :Context) : Pair<String, String>{
if(isInstalled("org.mozilla.firefox", context))
return Pair("Firefox", "org.mozilla.firefox")
else if(isInstalled("com.android.chrome", context))
return Pair("Chrome", "com.android.chrome")
else if(isInstalled("com.sec.android.app.sbrowser", context))
return Pair("Samsung Internet", "com.sec.android.app.sbrowser")
else
return Pair("None, as we were unable to find one.", "")
}
// Default downApps are Internal Search Apps
fun pickDefaultDownApp(context :Context) : Pair<String, String>{
if(isInstalled("com.samsung.android.app.galaxyfinder", context))
return Pair("GalaxyFinder", "com.samsung.android.app.galaxyfinder")
else if(isInstalled("com.prometheusinteractive.voice_launcher", context))
return Pair("VoiceSearch", "com.prometheusinteractive.voice_launcher")
else
return Pair(none_msg, "")
}
// Default rightApps are Mailing Applications
fun pickDefaultRightApp(context :Context) : Pair<String, String>{
if(isInstalled("de.web.mobile.android.mail", context))
return Pair("WebMail", "de.web.mobile.android.mail")
else if(isInstalled("com.samsung.android.email.provider", context))
return Pair("Samsung Mail", "com.samsung.android.email.provider")
else if(isInstalled("com.google.android.gm", context))
return Pair("Google Mail", "com.google.android.gm")
else
return Pair(none_msg, "")
}
// Default leftApps are Calendar Applications
fun pickDefaultLeftApp(context :Context) : Pair<String, String>{
if(isInstalled("com.google.android.calendar", context))
return Pair("Google Calendar", "com.google.android.calendar")
else if(isInstalled("com.samsung.android.calendar", context))
return Pair("Samsung Calendar", "com.samsung.android.calendar")
else
return Pair(none_msg, "")
}
// Default volumeUpApps are Messengers
fun pickDefaultVolumeUpApp(context: Context) : Pair<String, String>{
if(isInstalled("com.whatsapp", context))
return Pair("WhatsApp", "com.whatsapp")
else if(isInstalled("com.facebook.orca", context))
return Pair("Facebook Messenger", "com.facebook.orca")
else if(isInstalled("com.viber.voip", context))
return Pair("Viber", "com.viber.voip")
else if(isInstalled("com.skype.raider", context))
return Pair("Skype", "com.skype.raider")
else if(isInstalled("com.snapchat.android", context))
return Pair("Snapchat", "com.snapchat.android")
else if(isInstalled("com.instagram.android", context))
return Pair("Instagram", "com.instagram.android")
else if(isInstalled("com.samsung.android.messaging", context))
return Pair("Samsung SMS", "com.samsung.android.messaging")
else
return Pair(none_msg, "")
}
// Default volumeDownApps are Utilities
fun pickDefaultVolumeDownApp(context: Context) : Pair<String, String>{
if(isInstalled("com.github.android", context))
return Pair("GitHub", "com.github.android")
else if(isInstalled("com.soundbrenner.pulse", context))
return Pair("Soundbrenner Metronome", "com.soundbrenner.pulse")
else if(isInstalled("com.sec.android.app.popupcalculator", context))
return Pair("Calculator", "com.sec.android.app.popupcalculator")
else
return Pair(none_msg, "")
}

View file

@ -1,21 +1,29 @@
package com.finnmglas.launcher package com.finnmglas.launcher
import android.annotation.SuppressLint
import android.app.AlertDialog import android.app.AlertDialog
import android.content.* import android.content.*
import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.provider.Settings import android.provider.Settings
import android.view.View import android.view.View
import android.view.WindowManager import android.view.WindowManager
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
//TODO Make Settings scrollable as soon as more are added //TODO Make Settings scrollable as soon as more are added
class SettingsActivity : AppCompatActivity() { class SettingsActivity : AppCompatActivity() {
/** Activity Lifecycle functions */
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
setContentView(R.layout.activity_settings)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if(requestCode == 5000) if(requestCode == 5000)
{ {
@ -37,6 +45,7 @@ class SettingsActivity : AppCompatActivity() {
} }
} }
/** onClick functions for Settings */
fun chooseDownApp(view: View) {chooseApp("downApp")} fun chooseDownApp(view: View) {chooseApp("downApp")}
fun chooseUpApp(view: View) {chooseApp("upApp")} fun chooseUpApp(view: View) {chooseApp("upApp")}
fun chooseLeftApp(view: View) {chooseApp("leftApp")} fun chooseLeftApp(view: View) {chooseApp("leftApp")}
@ -63,26 +72,9 @@ class SettingsActivity : AppCompatActivity() {
startActivity(intent) startActivity(intent)
} }
fun openNewTabWindow(urls: String, context : Context) { fun openFinnWebsite(view: View) { openNewTabWindow(getString(R.string.settings_footer_web), this) }
val uris = Uri.parse(urls) fun openGithubRepo(view: View) { openNewTabWindow(getString(R.string.settings_footer_repo), this) }
val intents = Intent(Intent.ACTION_VIEW, uris) fun backHome(view: View) { finish() }
val b = Bundle()
b.putBoolean("new_window", true)
intents.putExtras(b)
context.startActivity(intents)
}
fun openFinnWebsite(view: View) {
openNewTabWindow("https://www.finnmglas.com/", this)
}
fun openGithubRepo(view: View) {
openNewTabWindow("https://github.com/finnmglas/Launcher#en", this)
}
fun backHome(view: View) {
finish()
}
fun setLauncher(view: View) { fun setLauncher(view: View) {
// on newer sdk: choose launcher // on newer sdk: choose launcher
@ -93,8 +85,8 @@ class SettingsActivity : AppCompatActivity() {
// on older sdk: manage app details // on older sdk: manage app details
else { else {
AlertDialog.Builder(this) AlertDialog.Builder(this)
.setTitle("App Info") .setTitle(getString(R.string.alert_cant_choose_launcher))
.setMessage("Your device does not support this feature. Manage application details instead?") .setMessage(getString(R.string.alert_cant_choose_launcher_message))
.setPositiveButton(android.R.string.yes, .setPositiveButton(android.R.string.yes,
DialogInterface.OnClickListener { dialog, which -> DialogInterface.OnClickListener { dialog, which ->
try { try {
@ -113,8 +105,8 @@ class SettingsActivity : AppCompatActivity() {
// Show a dialog prompting for confirmation // Show a dialog prompting for confirmation
fun resetSettingsClick(view: View) { fun resetSettingsClick(view: View) {
AlertDialog.Builder(this) AlertDialog.Builder(this)
.setTitle("Reset Settings") .setTitle(getString(R.string.settings_reset))
.setMessage("This will discard all your App Choices. Sure you want to continue?") .setMessage(getString(R.string.settings_reset_message))
.setPositiveButton(android.R.string.yes, .setPositiveButton(android.R.string.yes,
DialogInterface.OnClickListener { dialog, which -> DialogInterface.OnClickListener { dialog, which ->
resetSettings(this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE), this) resetSettings(this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE), this)
@ -124,14 +116,4 @@ class SettingsActivity : AppCompatActivity() {
.setIcon(android.R.drawable.ic_dialog_alert) .setIcon(android.R.drawable.ic_dialog_alert)
.show() .show()
} }
@SuppressLint("SetTextI18n") // I do not care
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
setContentView(R.layout.activity_settings)
}
} }

View file

@ -11,7 +11,7 @@
android:id="@+id/heading" android:id="@+id/heading"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Choose App" android:text="@string/choose_title"
android:textColor="#cccccc" android:textColor="#cccccc"
android:textSize="36sp" android:textSize="36sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@ -55,11 +55,10 @@
</ScrollView> </ScrollView>
<Button <Button
android:id="@+id/button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="backHome" android:onClick="backHome"
android:text="Back to Settings" android:text="@string/choose_back_settings"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View file

@ -24,7 +24,7 @@
app:layout_constraintVertical_bias="0.100000024" /> app:layout_constraintVertical_bias="0.100000024" />
<TextView <TextView
android:id="@+id/description" android:id="@+id/infoText"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="32dp" android:layout_marginStart="32dp"
@ -43,7 +43,7 @@
app:layout_constraintTop_toBottomOf="@id/heading" /> app:layout_constraintTop_toBottomOf="@id/heading" />
<TextView <TextView
android:id="@+id/continue_text" android:id="@+id/hintText"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="32dp" android:layout_marginStart="32dp"
@ -60,6 +60,6 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.6" app:layout_constraintHorizontal_bias="0.6"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/description" /> app:layout_constraintTop_toBottomOf="@id/infoText" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -13,7 +13,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="left|center_vertical" android:gravity="left|center_vertical"
android:onClick="launchCalendar" android:onClick="dateViewOnTouch"
android:textColor="#ccc" android:textColor="#ccc"
android:textSize="30sp" android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@ -27,7 +27,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="left|center_vertical" android:gravity="left|center_vertical"
android:onClick="launchClock" android:onClick="timeViewOnTouch"
android:textColor="#ccc" android:textColor="#ccc"
android:textSize="18sp" android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

View file

@ -11,7 +11,7 @@
android:id="@+id/heading" android:id="@+id/heading"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Settings" android:text="@string/settings_title"
android:textColor="#cccccc" android:textColor="#cccccc"
android:textSize="36sp" android:textSize="36sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@ -24,7 +24,7 @@
android:id="@+id/sub_head_1" android:id="@+id/sub_head_1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Applications" android:text="@string/settings_sub_title1"
android:textColor="#999" android:textColor="#999"
android:textSize="18sp" android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@ -54,7 +54,9 @@
android:id="@+id/text_up" android:id="@+id/text_up"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Swipe Up" android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_up"
android:textColor="#ccc" android:textColor="#ccc"
android:textSize="24sp" /> android:textSize="24sp" />
@ -64,7 +66,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha=".8" android:alpha=".8"
android:onClick="chooseUpApp" android:onClick="chooseUpApp"
android:text="Choose App" /> android:text="@string/settings_choose_btn" />
</TableRow> </TableRow>
<TableRow <TableRow
@ -75,7 +77,9 @@
android:id="@+id/text_down" android:id="@+id/text_down"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Swipe Down" android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_down"
android:textColor="#ccc" android:textColor="#ccc"
android:textSize="24sp" /> android:textSize="24sp" />
@ -85,7 +89,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha=".8" android:alpha=".8"
android:onClick="chooseDownApp" android:onClick="chooseDownApp"
android:text="Choose App" /> android:text="@string/settings_choose_btn" />
</TableRow> </TableRow>
@ -97,7 +101,9 @@
android:id="@+id/text_left" android:id="@+id/text_left"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Swipe Left" android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_left"
android:textColor="#ccc" android:textColor="#ccc"
android:textSize="24sp" /> android:textSize="24sp" />
@ -107,7 +113,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha=".8" android:alpha=".8"
android:onClick="chooseLeftApp" android:onClick="chooseLeftApp"
android:text="Choose App" /> android:text="@string/settings_choose_btn" />
</TableRow> </TableRow>
<TableRow <TableRow
@ -118,7 +124,9 @@
android:id="@+id/text_right" android:id="@+id/text_right"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Swipe Right" android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_right"
android:textColor="#ccc" android:textColor="#ccc"
android:textSize="24sp" /> android:textSize="24sp" />
@ -128,7 +136,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha=".8" android:alpha=".8"
android:onClick="chooseRightApp" android:onClick="chooseRightApp"
android:text="Choose App" /> android:text="@string/settings_choose_btn" />
</TableRow> </TableRow>
@ -140,7 +148,9 @@
android:id="@+id/text_vol_up" android:id="@+id/text_vol_up"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Volume Up" android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_vol_up"
android:textColor="#ccc" android:textColor="#ccc"
android:textSize="24sp" /> android:textSize="24sp" />
@ -150,7 +160,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha=".8" android:alpha=".8"
android:onClick="chooseVolumeUpApp" android:onClick="chooseVolumeUpApp"
android:text="Choose App" /> android:text="@string/settings_choose_btn" />
</TableRow> </TableRow>
<TableRow <TableRow
@ -161,7 +171,9 @@
android:id="@+id/text_vol_down" android:id="@+id/text_vol_down"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Volume Down " android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_vol_down"
android:textColor="#ccc" android:textColor="#ccc"
android:textSize="24sp" /> android:textSize="24sp" />
@ -171,7 +183,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha=".8" android:alpha=".8"
android:onClick="chooseVolumeDownApp" android:onClick="chooseVolumeDownApp"
android:text="Choose App" /> android:text="@string/settings_choose_btn" />
</TableRow> </TableRow>
@ -181,7 +193,7 @@
android:id="@+id/sub_head_2" android:id="@+id/sub_head_2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Actions" android:text="@string/settings_sub_title2"
android:textColor="#999" android:textColor="#999"
android:textSize="18sp" android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@id/buttons" app:layout_constraintBottom_toBottomOf="@id/buttons"
@ -193,7 +205,7 @@
<TableLayout <TableLayout
android:id="@+id/buttons" android:id="@+id/buttons"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -207,18 +219,20 @@
android:gravity="center"> android:gravity="center">
<Button <Button
style="@style/Widget.AppCompat.Button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha=".3" android:alpha=".3"
android:onClick="setLauncher" android:onClick="setLauncher"
android:text="Select Launcher" /> android:text="@string/settings_select_launcher" />
<Button <Button
style="@style/Widget.AppCompat.Button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha=".3" android:alpha=".3"
android:onClick="resetSettingsClick" android:onClick="resetSettingsClick"
android:text="Reset Settings" /> android:text="@string/settings_reset" />
</TableRow> </TableRow>
@ -228,18 +242,20 @@
android:gravity="center"> android:gravity="center">
<Button <Button
style="@style/Widget.AppCompat.Button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha=".3" android:alpha=".3"
android:onClick="chooseLaunchApp" android:onClick="chooseLaunchApp"
android:text="Launch Apps" /> android:text="@string/settings_launch" />
<Button <Button
style="@style/Widget.AppCompat.Button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha=".3" android:alpha=".3"
android:onClick="chooseUninstallApp" android:onClick="chooseUninstallApp"
android:text="Uninstall Apps" /> android:text="@string/settings_uninstall" />
</TableRow> </TableRow>
@ -252,57 +268,53 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="backHome" android:onClick="backHome"
android:text="Back Home" /> android:text="@string/settings_home" />
</TableRow> </TableRow>
</TableLayout> </TableLayout>
<TableLayout <LinearLayout
android:id="@+id/about_footer" android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/actionschooser" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.9"> app:layout_constraintVertical_bias="0.98">
<TableRow <TextView
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:gravity="center"> android:text="@string/settings_footer_by"
android:textColor="#999"
android:textSize="18sp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="By " android:onClick="openFinnWebsite"
android:textColor="#999" android:text=" Finn M Glas"
android:textSize="18sp" /> android:textColor="?attr/colorAccent"
android:textSize="18sp"
tools:ignore="HardcodedText" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="openFinnWebsite" android:text=" | "
android:text="Finn M Glas" android:textColor="#999"
android:textColor="?attr/colorAccent" android:textSize="18sp"
android:textSize="18sp" /> tools:ignore="HardcodedText" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text=" | " android:onClick="openGithubRepo"
android:textColor="#999" android:text="Open Source"
android:textSize="18sp" /> android:textColor="?attr/colorAccent"
android:textSize="18sp"
<TextView tools:ignore="HardcodedText" />
android:layout_width="wrap_content" </LinearLayout>
android:layout_height="wrap_content"
android:onClick="openGithubRepo"
android:text="Open Source"
android:textColor="?attr/colorAccent"
android:textSize="18sp" />
</TableRow>
</TableLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Errors, Exceptions (Alerts, Toasts ...) -->
<string name="none_found">Nicht gefunden</string>
<string name="alert_cant_open_title">App kann nicht geöffnet werden</string>
<string name="alert_cant_open_message">Willst du ihre Einstellungen anpassen (\'app zum Startbildschirm hinzufügen\')?</string>
<string name="toast_cant_open_message">Öffne die Einstellungen um für diese Aktion eine App zu wählen</string>
<string name="alert_cant_choose_launcher">App Info</string>
<string name="alert_cant_choose_launcher_message">Dein Gerät unterstützt diese Funktion nicht. Stattdessen die App Details bearbeiten?</string>
<!-- Settings -->
<string name="settings_title">Einstellungen</string>
<string name="settings_sub_title1">Anwendungen</string>
<string name="settings_sub_title2">Aktionen</string>
<string name="settings_choose_up">Hochwischen</string>
<string name="settings_choose_down">Runterwischen</string>
<string name="settings_choose_left">Linkswischen</string>
<string name="settings_choose_right">Rechtswischen</string>
<string name="settings_choose_vol_up">Lautstärke +</string>
<string name="settings_choose_vol_down">Lautstärke -</string>
<string name="settings_choose_btn">App wählen</string>
<string name="settings_select_launcher">Launcher wählen</string>
<string name="settings_reset">Zurücksetzen</string>
<string name="settings_reset_message">All deine Einstellungen gehen verloren. Weitermachen?</string>
<string name="settings_launch">Apps öffnen</string>
<string name="settings_uninstall">Apps entfernen</string>
<string name="settings_home">Zurück</string>
<string name="settings_footer_by">Von</string>
<string name="settings_footer_repo">https://github.com/finnmglas/Launcher#de</string>
<string name="settings_footer_web">https://www.finnmglas.com/de/</string>
<!-- Choose Activity -->
<string name="choose_title">App wählen</string>
<string name="choose_title_launch">Apps öffnen</string>
<string name="choose_title_remove">Apps entfernen</string>
<string name="choose_back_settings">Zurück</string>
<string name="choose_removed_toast">Die App wurde entfernt</string>
<string name="choose_not_removed_toast">Die App konnte nicht entfernt werden</string>
<!-- FirstStartup Activity -->
<string-array name="intro">
<!--item> heading | infoText | hintText | size | format </item-->
<item>|Nimm dir kurz Zeit und lerne, wie du diesen Launcher verwendest!\n\n|— Tippe um weiterzukommen —|36F|0</item>
<item>Konzept|Er bietet dir eine minimalistische, effiziente und ablenkungsfreie digitale Umgebung.|— Tippe um weiterzukommen —|36F|0</item>
<item>Konzept|Er kostet dich nichts, enthält keine Werbung, sammelt keine persönlichen Daten.|— Tippe um weiterzukommen —|36F|0</item>
<item>Benutzung|Auf deinem Homescreen siehst du nur das Datum und die Uhrzeit. Keine Ablenkung.|— Tippe um weiterzukommen —|36F|0</item>
<item>Benutzung|Du öffnest Apps indem du über den Bildschirm wischt oder die Lautstärketasten drückst.|— Tippe um weiterzukommen —|36F|0</item>
<item>Einrichtung|Wir haben dir ein paar Standardaktionen eingerichtet…|— Zurück = Lautstärke Runter —|36F|0</item>
<item>Einrichtung|Hochwischen: Browser öffnen (%1$s)\n\nRunterwischen: Interne Such-app öffnen (%2$s)\n\n
Rechtswischen: Mails öffnen (%3$s)\n\nLinkswischen: Kalendar öffnen (%4$s)\n\n
Lautstärke Hoch: Messenger öffnen (%5$s)\n\nLautstärke Runter: Tools öffnen (%6$s)|— Zurück = Lautstärke Runter —|18F|1
</item>
<item>Einrichtung|Du kannst auch eigene Apps auswählen:\n\nÖffne die Einstellungen durch langes tippen auf den Startbildschirm.|— Zurück = Lautstärke Runter —|36F|0</item>
<item>|Du bist bereit loszulegen!\n\nIch hoffe diese App ist sehr wertvoll für dich!\n\n- Finn M Glas\n\n|— Launcher von Finn M Glas —|36F|0</item>
</string-array>
</resources>

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Errors, Exceptions (Alerts, Toasts ...) -->
<string name="none_found">Rien trouvé</string>
<string name="alert_cant_open_title">Impossible d\'ouvrir l\'application</string>
<string name="alert_cant_open_message">Vous souhaitez modifier ses paramètres («l\'ajouter à l\'écran des applications»)?</string>
<string name="toast_cant_open_message">Ouvrez les paramètres pour choisir une application pour cette action</string>
<string name="alert_cant_choose_launcher">Informations sur l\'application</string>
<string name="alert_cant_choose_launcher_message">Votre appareil ne prend pas en charge cette fonctionnalité. Gérez plutôt les détails de l\'application?</string>
<!-- Settings -->
<string name="settings_title">Réglages</string>
<string name="settings_sub_title1">Applications</string>
<string name="settings_sub_title2">Actions</string>
<string name="settings_choose_up">Balayez haut</string>
<string name="settings_choose_down">Balayez bas</string>
<string name="settings_choose_left">Balayez gauche</string>
<string name="settings_choose_right">Balayez droit</string>
<string name="settings_choose_vol_up">Monter volume</string>
<string name="settings_choose_vol_down">Baisser volume</string>
<string name="settings_choose_btn">Choisir App</string>
<string name="settings_select_launcher">Choisir Launcher</string>
<string name="settings_reset">Réinitialiser</string>
<string name="settings_reset_message">Vous allez supprimer toutes vos préférences. Continuer?</string>
<string name="settings_launch">Lancer applications</string>
<string name="settings_uninstall">Désinstaller applications</string>
<string name="settings_home">Retourner</string>
<string name="settings_footer_by">Par</string>
<string name="settings_footer_web">https://www.finnmglas.com/fr/</string>
<string name="settings_footer_repo">https://github.com/finnmglas/Launcher</string>
<!-- Choose Activity -->
<string name="choose_title">Choisir App</string>
<string name="choose_title_launch">Lancer Apps</string>
<string name="choose_title_remove">Désinstaller Apps</string>
<string name="choose_back_settings">Retourner</string>
<string name="choose_removed_toast">Application supprimée</string>
<string name="choose_not_removed_toast">Impossible de supprimer l\'application</string>
<!-- FirstStartup Activity -->
<string-array name="intro">
<!--item> heading | infoText | hintText | size | format </item-->
<item>|Prenez un moment et apprenez à utiliser ce lanceur!\n\n|— Appuyez pour continuer —|36F|0</item>
<item>Concept|Il vous offre un environnement minimaliste, efficace et sans distraction.|— Appuyez pour continuer —|36F|0</item>
<item>Concept|Il ne vous coûte rien, ne contient aucune publicité, ne recueille pas de données personnelles.|— Appuyez pour continuer —|36F|0</item>
<item>Utilisation|Vous ne voyez que la date et l\'heure sur votre écran d\'accueil. Aucune distraction.|— Appuyez pour continuer —|36F|0</item>
<item>Utilisation|Vous ouvrez des applications en faisant glisser l\'écran ou en appuyant sur les touches de volume.|— Appuyez pour continuer —|36F|0</item>
<item>Installer|Nous avons mis en place quelques promotions standards pour vous…|— Retour = volume en baisse —|36F|0</item>
<item>Installer|Balayez haut: Ouvrir le navigateur (%1$s)\n\nBalayez bas: Ouvrir l\'application de recherche interne (%2$s)\n\n
Balayez droit: Ouvrir Mail (%3$s)\n\nBalayez gauche: Ouvrir le Calendrier (%4$s)\n\n
Monter volume: Ouvrir Messenger (%5$s)\n\nBaisser volume: Ouvrir utilitaires (%6$s)|— Retour = volume en baisse —|18F|1
</item>
<item>Installer|Vous pouvez choisir vos applications:\n\nOuvrez les paramètres en appuyant longuement sur l\'écran d\'accueil.|— Retour = volume en baisse —|36F|0</item>
<item>|Vous êtes prêt à commencer!\n\nJ\'espère que cette application vous sera très précieuse!\n\n- Finn M Glas\n\n|— Launcher par Finn M Glas —|36F|0</item>
</string-array>
</resources>

View file

@ -1,6 +0,0 @@
<resources>
<string name="fa_icon_calendar">&#xf133;</string>
<string name="fa_icon_home">&#xf015;</string>
<string name="fa_icon_globe">&#xf0ac;</string>
<string name="fa_icon_bars">&#xf0c9;</string>
</resources>

View file

@ -1,4 +1,110 @@
<resources> <resources>
<string name="app_name">Launcher</string> <!-- General -->
<string name ="preference_file_key">V3RYR4ND0MK3YCR4P</string> <string name="app_name" translatable="false">Launcher</string>
<string name="preference_file_key" translatable="false">V3RYR4ND0MK3YCR4P</string>
<!-- Errors, Exceptions (Alerts, Toasts ...) -->
<string name="none_found">None found</string>
<string name="alert_cant_open_title">Can\'t open app</string>
<string name="alert_cant_open_message">Want to change its settings (\'add it to the apps screen\')?</string>
<string name="toast_cant_open_message">Open settings to choose an app for this action</string>
<string name="alert_cant_choose_launcher">App Info</string>
<string name="alert_cant_choose_launcher_message">Your device does not support this feature. Manage application details instead?</string>
<!-- Settings -->
<string name="settings_title">Settings</string>
<string name="settings_sub_title1">Applications</string>
<string name="settings_sub_title2">Actions</string>
<string name="settings_choose_up">Swipe Up</string>
<string name="settings_choose_down">Swipe Down</string>
<string name="settings_choose_left">Swipe Left</string>
<string name="settings_choose_right">Swipe Right</string>
<string name="settings_choose_vol_up">Volume Up</string>
<string name="settings_choose_vol_down">Volume Down</string>
<string name="settings_choose_btn">Choose App</string>
<string name="settings_select_launcher">Select Launcher</string>
<string name="settings_reset">Reset Settings</string>
<string name="settings_reset_message">You are going to discard all your preferences. Continue?</string>
<string name="settings_launch">Launch Apps</string>
<string name="settings_uninstall">Uninstall Apps</string>
<string name="settings_home">Back Home</string>
<string name="settings_footer_by">By</string>
<string name="settings_footer_repo">https://github.com/finnmglas/Launcher#en</string>
<string name="settings_footer_web">https://www.finnmglas.com</string>
<!-- Choose Activity -->
<string name="choose_title">Choose App</string>
<string name="choose_title_launch">Launch Apps</string>
<string name="choose_title_remove">Uninstall Apps</string>
<string name="choose_back_settings">Back to Settings</string>
<string name="choose_removed_toast">Removed the selected application</string>
<string name="choose_not_removed_toast">Unable to remove application</string>
<!-- FirstStartup Activity -->
<string-array name="intro">
<!--item> heading | infoText | hintText | size | format </item-->
<item>|Take a few seconds to learn how to use this Launcher!\n\n|— Tap anywhere to continue —|36F|0</item>
<item>Concept|It is designed to be minimal, efficient and free of distraction.|— Tap anywhere to continue —|36F|0</item>
<item>Concept|It is free of payments, ads and tracking services.|— Tap anywhere to continue —|36F|0</item>
<item>Usage|Your home screen contains the local date and time. No distraction.|— Tap anywhere to continue —|36F|0</item>
<item>Usage|You can open your apps with a single swipe or button press.|— Tap anywhere to continue —|36F|0</item>
<item>Setup|We have set up some default actions for you…|— Use volume keys to navigate —|36F|0</item>
<item>Setup|Swipe Up: Open a Browser (%1$s)\n\nSwipe Down: Open internal Search App (%2$s)\n\n
Swipe Right: Open Mail (%3$s)\n\nSwipe Left: Open Calendar (%4$s)\n\n
Volume Up: Open a messenger (%5$s)\n\nVolume Down: Open Utilities (%6$s)|— Use volume keys to navigate —|18F|1
</item>
<item>Setup|You can choose your own apps:\n\nOpen settings by tapping and holding the home screen.|— Use volume keys to navigate —|36F|0</item>
<item>|You are ready to get started!\n\n I hope this provides great value to you!\n\n- Finn M Glas\n\n|— Launcher by Finn M Glas —|36F|0</item>
</string-array>
<!-- Default Apps for different actions (button-press, swipes ...) -->
<string-array name="default_up">
<item>org.mozilla.firefox|Firefox</item>
<item>com.sec.android.app.sbrowser|Samsung Internet</item>
<item>com.android.chrome|Chrome</item>
</string-array>
<string-array name="default_down">
<item>com.samsung.android.app.galaxyfinder|GalaxyFinder</item>
<item>com.prometheusinteractive.voice_launcher|VoiceSearch</item>
</string-array>
<string-array name="default_right">
<item>de.web.mobile.android.mail|WebMail</item>
<item>com.samsung.android.email.provider|Samsung Mail</item>
<item>com.google.android.gm|Google Mail</item>
</string-array>
<string-array name="default_left">
<item>com.google.android.calendar|Google Calendar</item>
<item>com.samsung.android.calendar|Samsung Calendar</item>
</string-array>
<string-array name="default_volume_up">
<item>com.whatsapp|WhatsApp</item>
<item>com.facebook.orca|Facebook Messenger</item>
<item>com.viber.voip|Viber</item>
<item>com.skype.raider|Skype</item>
<item>com.snapchat.android|Snapchat</item>
<item>com.instagram.android|Instagram</item>
<item>com.samsung.android.messaging|Samsung SMS</item>
</string-array>
<string-array name="default_volume_down">
<item>com.github.android|GitHub</item>
<item>com.soundbrenner.pulse|Soundbrenner Metronome</item>
<item>com.sec.android.app.popupcalculator|Calculator</item>
</string-array>
<string-array name="default_clock">
<item>com.sec.android.app.clockpackage|Android Clock</item>
</string-array>
</resources> </resources>