Merge pull request #21 from finnmglas/feature/customize

Feature/customize
This commit is contained in:
Finn M Glas 2020-05-24 21:23:31 +02:00 committed by GitHub
commit 6862be3521
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 1100 additions and 457 deletions

View file

@ -37,4 +37,5 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0' implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.palette:palette:1.0.0'
} }

View file

@ -4,6 +4,7 @@
package="com.finnmglas.launcher"> package="com.finnmglas.launcher">
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application <application
android:allowBackup="true" android:allowBackup="true"
@ -11,7 +12,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/finnmglasTheme">
<activity android:name=".MainActivity" <activity android:name=".MainActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"

View file

@ -10,13 +10,12 @@ import android.view.WindowManager
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.finnmglas.launcher.extern.*
import kotlinx.android.synthetic.main.activity_choose.* import kotlinx.android.synthetic.main.activity_choose.*
class ChooseActivity : AppCompatActivity() { class ChooseActivity : AppCompatActivity() {
val UNINSTALL_REQUEST_CODE = 1
/** Activity Lifecycle functions */ /** Activity Lifecycle functions */
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -25,19 +24,34 @@ class ChooseActivity : AppCompatActivity() {
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN) window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
setTheme(
when (getSavedTheme(this)) {
"dark" -> R.style.darkTheme
"finn" -> R.style.finnmglasTheme
else -> R.style.finnmglasTheme
}
)
setContentView(R.layout.activity_choose) setContentView(R.layout.activity_choose)
if (getSavedTheme(this) == "custom") {
activity_choose_container.setBackgroundColor(dominantColor)
activity_choose_app_bar.setBackgroundColor(dominantColor)
activity_choose_close.setTextColor(vibrantColor)
}
// As older APIs somehow do not recognize the xml defined onClick
activity_choose_close.setOnClickListener() { finish() }
val bundle = intent.extras val bundle = intent.extras
val action = bundle!!.getString("action") // why choose an app val action = bundle!!.getString("action") // why choose an app
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 = getString(R.string.choose_title_launch) activity_choose_heading.text = getString(R.string.choose_title_launch)
else if (action == "pick") { else if (action == "pick")
heading.text = getString(R.string.choose_title) activity_choose_heading.text = getString(R.string.choose_title)
}
else if (action == "uninstall") else if (action == "uninstall")
heading.text = getString(R.string.choose_title_remove) activity_choose_heading.text = getString(R.string.choose_title_remove)
/* Build Layout */ /* Build Layout */
@ -59,7 +73,7 @@ class ChooseActivity : AppCompatActivity() {
returnIntent.putExtra("value", app.packageName) returnIntent.putExtra("value", app.packageName)
returnIntent.putExtra("forApp", forApp) returnIntent.putExtra("forApp", forApp)
setResult( setResult(
5000, REQUEST_CHOOSE_APP,
returnIntent returnIntent
) )
finish() finish()
@ -70,16 +84,18 @@ class ChooseActivity : AppCompatActivity() {
val intent = Intent(Intent.ACTION_UNINSTALL_PACKAGE) val intent = Intent(Intent.ACTION_UNINSTALL_PACKAGE)
intent.data = Uri.parse("package:" + app.packageName) intent.data = Uri.parse("package:" + app.packageName)
intent.putExtra(Intent.EXTRA_RETURN_RESULT, true) intent.putExtra(Intent.EXTRA_RETURN_RESULT, true)
startActivityForResult(intent, UNINSTALL_REQUEST_CODE) startActivityForResult(intent,
REQUEST_UNINSTALL
)
} }
} }
apps_list.addView(tvdynamic) activity_choose_apps_list.addView(tvdynamic)
} }
} }
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 == UNINSTALL_REQUEST_CODE) { 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) updateAppList(packageManager)

View file

@ -5,9 +5,8 @@ import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import android.util.TypedValue import android.util.TypedValue
import android.view.* import android.view.*
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.finnmglas.launcher.extern.*
import kotlinx.android.synthetic.main.activity_firststartup.* import kotlinx.android.synthetic.main.activity_firststartup.*
@ -31,9 +30,22 @@ class FirstStartupActivity : AppCompatActivity(){
) )
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
setTheme(
when (getSavedTheme(this)) {
"dark" -> R.style.darkTheme
"finn" -> R.style.finnmglasTheme
else -> R.style.finnmglasTheme
}
)
setContentView(R.layout.activity_firststartup) setContentView(R.layout.activity_firststartup)
hintText.blink() // animate if (getSavedTheme(this) == "custom") {
activity_firststartup_app_bar.setBackgroundColor(dominantColor)
activity_firststartup_container.setBackgroundColor(dominantColor)
activity_firststartup_close.setTextColor(vibrantColor)
}
activity_firststartup_hint_text.blink() // animate
loadMenu(this) loadMenu(this)
val sharedPref = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE) val sharedPref = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE)
@ -42,6 +54,11 @@ class FirstStartupActivity : AppCompatActivity(){
if (isFirstTime) if (isFirstTime)
defaultApps = resetSettings(sharedPref, this) // UP, DOWN, RIGHT, LEFT, VOLUME_UP, VOLUME_DOWN defaultApps = resetSettings(sharedPref, this) // UP, DOWN, RIGHT, LEFT, VOLUME_UP, VOLUME_DOWN
else
activity_firststartup_app_bar.visibility = View.VISIBLE
// As older APIs somehow do not recognize the xml defined onClick
activity_firststartup_close.setOnClickListener() { finish() }
} }
/** Touch- and Key-related functions to navigate */ /** Touch- and Key-related functions to navigate */
@ -67,6 +84,10 @@ class FirstStartupActivity : AppCompatActivity(){
loadMenu(this) loadMenu(this)
} }
fun backToSettings(view: View){
finish()
}
/** Touch- and Key-related functions to navigate */ /** Touch- and Key-related functions to navigate */
private fun loadMenu(context :Context) { // Context needed for packageManager private fun loadMenu(context :Context) { // Context needed for packageManager
@ -76,14 +97,16 @@ class FirstStartupActivity : AppCompatActivity(){
if (menuNumber < intro.size){ if (menuNumber < intro.size){
val entry = intro[menuNumber].split("|").toTypedArray() //heading|infoText|hintText|size val entry = intro[menuNumber].split("|").toTypedArray() //heading|infoText|hintText|size
heading.text = entry[0] activity_firststartup_section_heading.text = entry[0]
if (entry[4] == "1" && isFirstTime)infoText.text = String.format(entry[1], if (entry[4] == "1" && isFirstTime)
activity_firststartup_descriptive_text.text = String.format(entry[1],
defaultApps[0], defaultApps[1], defaultApps[2], defaultApps[3], defaultApps[4], defaultApps[5]) defaultApps[0], defaultApps[1], defaultApps[2], defaultApps[3], defaultApps[4], defaultApps[5])
else if (entry[4] == "1" && !isFirstTime)infoText.text = String.format(entry[1], else if (entry[4] == "1" && !isFirstTime)
activity_firststartup_descriptive_text.text = String.format(entry[1],
"-", "-", "-", "-", "-", "-") "-", "-", "-", "-", "-", "-")
else infoText.text = entry[1] else activity_firststartup_descriptive_text.text = entry[1]
hintText.text = entry[2] activity_firststartup_hint_text.text = entry[2]
infoText.setTextSize(TypedValue.COMPLEX_UNIT_SP, entry[3].toFloat()) activity_firststartup_descriptive_text.setTextSize(TypedValue.COMPLEX_UNIT_SP, entry[3].toFloat())
} else { // End intro } else { // End intro
if (isFirstTime){ if (isFirstTime){
@ -94,7 +117,6 @@ class FirstStartupActivity : AppCompatActivity(){
editor.putLong("firstStartup", System.currentTimeMillis() / 1000L) // record first startup timestamp editor.putLong("firstStartup", System.currentTimeMillis() / 1000L) // record first startup timestamp
editor.apply() editor.apply()
} }
finish() finish()
} }
} }

View file

@ -2,21 +2,27 @@ package com.finnmglas.launcher
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri
import android.os.AsyncTask import android.os.AsyncTask
import android.os.Bundle import android.os.Bundle
import android.provider.MediaStore
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.view.* import android.view.*
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.GestureDetectorCompat import androidx.core.view.GestureDetectorCompat
import com.finnmglas.launcher.extern.*
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
import kotlin.concurrent.fixedRateTimer import kotlin.concurrent.fixedRateTimer
import kotlin.math.abs import kotlin.math.abs
class MainActivity : AppCompatActivity(), class MainActivity : AppCompatActivity(),
GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener { GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener {
private var currentTheme = "" // keep track of theme changes
/** Variables for this activity */ /** Variables for this activity */
private lateinit var mDetector: GestureDetectorCompat private lateinit var mDetector: GestureDetectorCompat
@ -38,10 +44,6 @@ class MainActivity : AppCompatActivity(),
val sharedPref = this.getSharedPreferences( val sharedPref = this.getSharedPreferences(
getString(R.string.preference_file_key), Context.MODE_PRIVATE) getString(R.string.preference_file_key), Context.MODE_PRIVATE)
// First Startup
if (!sharedPref.getBoolean("startedBefore", false))
startActivity(Intent(this, FirstStartupActivity::class.java))
// Flags // Flags
window.setFlags( window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN,
@ -49,17 +51,37 @@ class MainActivity : AppCompatActivity(),
) )
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
currentTheme = getSavedTheme(this)
if (currentTheme == "custom") {
try {
background = MediaStore.Images.Media.getBitmap(this.contentResolver, Uri.parse(sharedPref.getString("background_uri", "")))
} catch (e: Exception) { }
if (background == null)
currentTheme = saveTheme(this, "finn")
}
setTheme(
when (currentTheme) {
"dark" -> R.style.darkTheme
"finn" -> R.style.finnmglasTheme
else -> R.style.finnmglasTheme
}
)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
// Start by showing the settings icon // Start by showing the settings icon
showSettingsIcon() showSettingsIcon()
// As older APIs somehow do not recognize the xml defined onClick // As older APIs somehow do not recognize the xml defined onClick
findViewById<View>(R.id.settingstooltip).setOnClickListener() { activity_main_settings_icon.setOnClickListener() { openSettings() }
openSettings()
true
}
// First Startup
if (!sharedPref.getBoolean("startedBefore", false)){
startActivity(Intent(this, FirstStartupActivity::class.java))
tooltipTimer.cancel()
}
} }
override fun onStart(){ override fun onStart(){
@ -71,6 +93,10 @@ class MainActivity : AppCompatActivity(),
loadSettings(sharedPref) loadSettings(sharedPref)
if (currentTheme == "custom") {
activity_main_settings_icon.setTextColor(vibrantColor)
}
mDetector = GestureDetectorCompat(this, this) mDetector = GestureDetectorCompat(this, this)
mDetector.setOnDoubleTapListener(this) mDetector.setOnDoubleTapListener(this)
@ -80,13 +106,23 @@ class MainActivity : AppCompatActivity(),
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
// TODO: do this immediately after changing preferences
if (currentTheme != getSavedTheme(this)) recreate()
if (activity_main_background_image != null && getSavedTheme(this) == "custom")
activity_main_background_image.setImageBitmap(background)
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()) val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
val timeFormat = SimpleDateFormat("HH:mm:ss", Locale.getDefault()) val timeFormat = SimpleDateFormat("HH:mm:ss", Locale.getDefault())
clockTimer = fixedRateTimer("clockTimer", true, 0L, 1000) { clockTimer = fixedRateTimer("clockTimer", true, 0L, 100) {
this@MainActivity.runOnUiThread { this@MainActivity.runOnUiThread {
dateView.text = dateFormat.format(Date()) val t = timeFormat.format(Date())
timeView.text = timeFormat.format(Date()) if (activity_main_time_view.text != t)
activity_main_time_view.text = t
val d = dateFormat.format(Date())
if (activity_main_date_view.text != d)
activity_main_date_view.text = d
} }
} }
@ -103,15 +139,15 @@ class MainActivity : AppCompatActivity(),
loadAppsTimer.cancel() loadAppsTimer.cancel()
} }
private fun openSettings(){ private fun openSettings(){
startActivity(Intent(this, SettingsActivity::class.java)) startActivity(Intent(this, SettingsActivity::class.java))
overridePendingTransition(R.anim.bottom_up, android.R.anim.fade_out)
} }
/** Touch- and Key-related functions to start activities */ /** Touch- and Key-related functions to start activities */
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK) return true if (keyCode == KeyEvent.KEYCODE_BACK) { if (settingsIconShown) hideSettingsIcon() }
else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) launchApp(volumeUpApp, this) else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) launchApp(volumeUpApp, this)
else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) launchApp(volumeDownApp, this) else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) launchApp(volumeDownApp, this)
return true return true
@ -153,8 +189,8 @@ class MainActivity : AppCompatActivity(),
} }
private fun showSettingsIcon(){ private fun showSettingsIcon(){
settingstooltip.fadeIn() activity_main_settings_icon.fadeRotateIn()
settingstooltip.visibility = View.VISIBLE activity_main_settings_icon.visibility = View.VISIBLE
settingsIconShown = true settingsIconShown = true
tooltipTimer = fixedRateTimer("tooltipTimer", true, 10000, 1000) { tooltipTimer = fixedRateTimer("tooltipTimer", true, 10000, 1000) {
@ -164,8 +200,8 @@ class MainActivity : AppCompatActivity(),
private fun hideSettingsIcon(){ private fun hideSettingsIcon(){
tooltipTimer.cancel() tooltipTimer.cancel()
settingstooltip.fadeOut() activity_main_settings_icon.fadeRotateOut()
settingstooltip.visibility = View.INVISIBLE activity_main_settings_icon.visibility = View.INVISIBLE
settingsIconShown = false settingsIconShown = false
} }

View file

@ -1,19 +1,26 @@
package com.finnmglas.launcher package com.finnmglas.launcher
import android.Manifest
import android.app.AlertDialog import android.app.AlertDialog
import android.content.* import android.content.*
import android.content.pm.PackageManager
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.provider.MediaStore
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 android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import com.finnmglas.launcher.ui.main.SectionsPagerAdapter import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.settings.SectionsPagerAdapter
import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*
import kotlinx.android.synthetic.main.fragment_settings_apps.*
import kotlinx.android.synthetic.main.fragment_settings_theme.*
class SettingsActivity : AppCompatActivity() { class SettingsActivity : AppCompatActivity() {
@ -22,153 +29,49 @@ class SettingsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setTheme(
when (getSavedTheme(this)) {
"dark" -> R.style.darkTheme
"finn" -> R.style.finnmglasTheme
else -> R.style.finnmglasTheme
}
)
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN) window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
val sectionsPagerAdapter = SectionsPagerAdapter(this, supportFragmentManager) val sectionsPagerAdapter = SectionsPagerAdapter(this, supportFragmentManager)
val viewPager: ViewPager = findViewById(R.id.view_pager) val viewPager: ViewPager = findViewById(R.id.activity_settings_view_pager)
viewPager.adapter = sectionsPagerAdapter viewPager.adapter = sectionsPagerAdapter
val tabs: TabLayout = findViewById(R.id.tabs) val tabs: TabLayout = findViewById(R.id.activity_settings_tabs)
tabs.setupWithViewPager(viewPager) tabs.setupWithViewPager(viewPager)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { // As older APIs somehow do not recognize the xml defined onClick
if(requestCode == 5000) activity_settings_close.setOnClickListener() { finish() }
{ activity_settings_device_settings.setOnClickListener {
val value = data?.getStringExtra("value") startActivityForResult(Intent(android.provider.Settings.ACTION_SETTINGS), 0)
val forApp = data?.getStringExtra("forApp") ?: return
// Save the new App to Preferences
val sharedPref = this.getSharedPreferences(
getString(R.string.preference_file_key), Context.MODE_PRIVATE)
val editor :SharedPreferences.Editor = sharedPref.edit()
editor.putString("action_$forApp", value.toString())
editor.apply()
loadSettings(sharedPref)
}
else {
super.onActivityResult(requestCode, resultCode, data)
} }
} }
/** onClick functions for Settings */ override fun onStart() {
fun chooseDownApp(view: View) {chooseApp("downApp")} super.onStart()
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) { if (getSavedTheme(this) == "custom") {
val intent = Intent(this, ChooseActivity::class.java) activity_settings_container.setBackgroundColor(dominantColor)
intent.putExtra("action", "pick") activity_settings_app_bar.setBackgroundColor(dominantColor)
intent.putExtra("forApp", forAction) // for which action we choose the app
startActivityForResult(intent, 5000)
}
fun chooseUninstallApp(view: View) { activity_settings_device_settings.setTextColor(vibrantColor)
val intent = Intent(this, ChooseActivity::class.java) activity_settings_close.setTextColor(vibrantColor)
intent.putExtra("action", "uninstall") activity_settings_tabs.setSelectedTabIndicatorColor(vibrantColor)
startActivity(intent)
}
fun chooseLaunchApp(view: View) {
val intent = Intent(this, ChooseActivity::class.java)
intent.putExtra("action", "launch")
startActivity(intent)
}
fun chooseInstallApp(view : View) {
try {
val rateIntent = Intent(
Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/"))
startActivity(rateIntent)
} catch (e: ActivityNotFoundException) {
Toast.makeText(this,getString(R.string.settings_toast_store_not_found), Toast.LENGTH_SHORT)
.show()
} }
} }
fun openFinnWebsite(view: View) { openNewTabWindow(getString(R.string.settings_footer_web), this) }
fun openGithubRepo(view: View) { openNewTabWindow(getString(R.string.settings_footer_repo), this) }
// Rate App
// Just copied code from https://stackoverflow.com/q/10816757/12787264
// that is how we write good software ^
fun rateApp(view: View) {
try {
val rateIntent = rateIntentForUrl("market://details")
startActivity(rateIntent)
} catch (e: ActivityNotFoundException) {
val rateIntent = rateIntentForUrl("https://play.google.com/store/apps/details")
startActivity(rateIntent)
}
}
private fun rateIntentForUrl(url: String): Intent {
val intent = Intent(
Intent.ACTION_VIEW,
Uri.parse(String.format("%s?id=%s", url, packageName))
)
var flags = Intent.FLAG_ACTIVITY_NO_HISTORY or Intent.FLAG_ACTIVITY_MULTIPLE_TASK
flags = if (Build.VERSION.SDK_INT >= 21) {
flags or Intent.FLAG_ACTIVITY_NEW_DOCUMENT
} else {
flags or Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
}
intent.addFlags(flags)
return intent
}
fun backHome(view: View) { finish() } fun backHome(view: View) { finish() }
fun setLauncher(view: View) { /** Theme - related */
// on newer sdk: choose launcher
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
val callHomeSettingIntent = Intent(Settings.ACTION_HOME_SETTINGS)
startActivity(callHomeSettingIntent)
}
// on older sdk: manage app details
else {
AlertDialog.Builder(this)
.setTitle(getString(R.string.alert_cant_choose_launcher))
.setMessage(getString(R.string.alert_cant_choose_launcher_message))
.setPositiveButton(android.R.string.yes,
DialogInterface.OnClickListener { dialog, which ->
try {
openAppSettings(packageName, this)
} catch ( e : ActivityNotFoundException) {
val intent = Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS)
startActivity(intent)
}
})
.setNegativeButton(android.R.string.no, null)
.setIcon(android.R.drawable.ic_dialog_info)
.show()
}
}
fun viewTutorial (view: View){
startActivity(Intent(this, FirstStartupActivity::class.java))
}
// Show a dialog prompting for confirmation
fun resetSettingsClick(view: View) {
AlertDialog.Builder(this)
.setTitle(getString(R.string.settings_reset))
.setMessage(getString(R.string.settings_reset_message))
.setPositiveButton(android.R.string.yes,
DialogInterface.OnClickListener { dialog, which ->
resetSettings(this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE), this)
finish()
})
.setNegativeButton(android.R.string.no, null)
.setIcon(android.R.drawable.ic_dialog_alert)
.show()
}
} }

View file

@ -1,20 +0,0 @@
package com.finnmglas.launcher
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
/** The 'Apps' Tab associated Fragment in Settings */
class SettingsFragmentApps : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_settings_apps, container, false)
}
}

View file

@ -1,20 +0,0 @@
package com.finnmglas.launcher
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
/** The 'Launcher' Tab associated Fragment in Settings */
class SettingsFragmentLauncher : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_settings_launcher, container, false)
}
}

View file

@ -1,20 +0,0 @@
package com.finnmglas.launcher
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
/** The 'Theme' Tab associated Fragment in Settings */
class SettingsFragmentTheme : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_settings_theme, container, false)
}
}

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher // replace with your package package com.finnmglas.launcher.extern // replace with your package
// On GitHub: https://github.com/finnmglas/fontawesome-android // On GitHub: https://github.com/finnmglas/fontawesome-android
@ -6,6 +6,7 @@ import android.content.Context
import android.graphics.Typeface import android.graphics.Typeface
import android.util.AttributeSet import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView import androidx.appcompat.widget.AppCompatTextView
import com.finnmglas.launcher.R
/** [FontAwesome] is just a type of TextView with special functions: /** [FontAwesome] is just a type of TextView with special functions:
* *
@ -28,7 +29,9 @@ class FontAwesome : AppCompatTextView {
private fun init(attrs: AttributeSet?) { private fun init(attrs: AttributeSet?) {
if (attrs != null) { if (attrs != null) {
val a = context!!.obtainStyledAttributes(attrs, R.styleable.FontAwesome) val a = context!!.obtainStyledAttributes(attrs,
R.styleable.FontAwesome
)
if (a.hasValue(R.styleable.FontAwesome_type)) if (a.hasValue(R.styleable.FontAwesome_type))
type = a.getString(R.styleable.FontAwesome_type)!! type = a.getString(R.styleable.FontAwesome_type)!!
a.recycle() a.recycle()

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher package com.finnmglas.launcher.extern
import android.app.Activity import android.app.Activity
import android.app.AlertDialog import android.app.AlertDialog
@ -8,14 +8,19 @@ 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.content.pm.ResolveInfo
import android.graphics.Bitmap
import android.graphics.BlendMode
import android.graphics.BlendModeColorFilter
import android.graphics.PorterDuff
import android.net.Uri import android.net.Uri
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.animation.AlphaAnimation import android.view.animation.*
import android.view.animation.Animation import android.widget.Button
import android.view.animation.DecelerateInterpolator
import android.widget.Toast import android.widget.Toast
import com.finnmglas.launcher.R
/** Variables for all of the app */ /** Variables for all of the app */
var upApp = "" var upApp = ""
@ -30,6 +35,20 @@ var clockApp = ""
var appsList : MutableList<ResolveInfo> = mutableListOf() var appsList : MutableList<ResolveInfo> = mutableListOf()
var background : Bitmap? = null
var dominantColor = 0
var vibrantColor = 0
/** REQUEST CODES */
val REQUEST_PICK_IMAGE = 1
val REQUEST_CHOOSE_APP = 2
val REQUEST_UNINSTALL = 3
val REQUEST_PERMISSION_STORAGE = 4
/** Animate */
// Taken from https://stackoverflow.com/questions/47293269 // Taken from https://stackoverflow.com/questions/47293269
fun View.blink( fun View.blink(
times: Int = Animation.INFINITE, times: Int = Animation.INFINITE,
@ -47,20 +66,58 @@ fun View.blink(
}) })
} }
fun View.fadeIn(duration: Long = 1000L) { fun View.fadeIn(duration: Long = 300L) {
startAnimation(AlphaAnimation(0f, 1f).also { startAnimation(AlphaAnimation(0f, 1f).also {
it.interpolator = DecelerateInterpolator() it.interpolator = DecelerateInterpolator()
it.duration = duration it.duration = duration
}) })
} }
fun View.fadeOut(duration: Long = 1000L) { fun View.fadeOut(duration: Long = 300L) {
startAnimation(AlphaAnimation(1f, 0f).also { startAnimation(AlphaAnimation(1f, 0f).also {
it.interpolator = DecelerateInterpolator() it.interpolator = DecelerateInterpolator()
it.duration = duration it.duration = duration
}) })
} }
fun View.fadeRotateIn(duration: Long = 500L) {
val combined = AnimationSet(false)
combined.addAnimation(
AlphaAnimation(0f, 1F).also {
it.interpolator = DecelerateInterpolator()
it.duration = duration
}
)
combined.addAnimation(
RotateAnimation(0F, 180F, Animation.RELATIVE_TO_SELF,
0.5f, Animation.RELATIVE_TO_SELF,0.5f).also {
it.duration = duration * 2
it.interpolator = DecelerateInterpolator()
}
)
startAnimation(combined)
}
fun View.fadeRotateOut(duration: Long = 500L) {
val combined = AnimationSet(false)
combined.addAnimation(
AlphaAnimation(1F, 0F).also {
it.interpolator = AccelerateInterpolator()
it.duration = duration
}
)
combined.addAnimation(
RotateAnimation(0F, 180F, Animation.RELATIVE_TO_SELF,
0.5f, Animation.RELATIVE_TO_SELF,0.5f).also {
it.duration = duration
it.interpolator = AccelerateInterpolator()
}
)
startAnimation(combined)
}
/** Activity related */ /** Activity related */
fun isInstalled(uri: String, context: Context): Boolean { fun isInstalled(uri: String, context: Context): Boolean {
@ -86,10 +143,11 @@ private fun getIntent(packageName: String, context: Context): Intent? {
} }
fun launchApp(packageName: String, context: Context) { fun launchApp(packageName: String, context: Context) {
val intent1 = getIntent(packageName, context) val intent =
getIntent(packageName, context)
if (intent1 != null) { if (intent != null) {
context.startActivity(intent1) context.startActivity(intent)
if (context is Activity) { if (context is Activity) {
context.overridePendingTransition(0, 0) context.overridePendingTransition(0, 0)
@ -97,12 +155,17 @@ fun launchApp(packageName: String, context: Context) {
} else { } else {
if (isInstalled(packageName, context)){ if (isInstalled(packageName, context)){
AlertDialog.Builder(context) AlertDialog.Builder(context,
R.style.AlertDialogCustom
)
.setTitle(context.getString(R.string.alert_cant_open_title)) .setTitle(context.getString(R.string.alert_cant_open_title))
.setMessage(context.getString(R.string.alert_cant_open_message)) .setMessage(context.getString(R.string.alert_cant_open_message))
.setPositiveButton(android.R.string.yes, .setPositiveButton(android.R.string.yes,
DialogInterface.OnClickListener { dialog, which -> DialogInterface.OnClickListener { dialog, which ->
openAppSettings(packageName, context) openAppSettings(
packageName,
context
)
}) })
.setNegativeButton(android.R.string.no, null) .setNegativeButton(android.R.string.no, null)
.setIcon(android.R.drawable.ic_dialog_info) .setIcon(android.R.drawable.ic_dialog_info)
@ -124,6 +187,24 @@ fun openNewTabWindow(urls: String, context : Context) {
/** Settings related functions */ /** Settings related functions */
fun getSavedTheme(context : Context) : String {
val sharedPref = context.getSharedPreferences(
context.getString(R.string.preference_file_key), Context.MODE_PRIVATE)
return sharedPref.getString("theme", "finn").toString()
}
fun saveTheme(context : Context, themeName : String) : String {
val sharedPref = context.getSharedPreferences(
context.getString(R.string.preference_file_key), Context.MODE_PRIVATE)
val editor: SharedPreferences.Editor = sharedPref.edit()
editor.putString("theme", themeName)
editor.apply()
return themeName
}
fun openAppSettings(pkg :String, context:Context){ fun openAppSettings(pkg :String, context:Context){
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:$pkg") intent.data = Uri.parse("package:$pkg")
@ -140,39 +221,67 @@ fun loadSettings(sharedPref : SharedPreferences){
calendarApp = sharedPref.getString("action_calendarApp", "").toString() calendarApp = sharedPref.getString("action_calendarApp", "").toString()
clockApp = sharedPref.getString("action_clockApp", "").toString() clockApp = sharedPref.getString("action_clockApp", "").toString()
dominantColor = sharedPref.getInt("custom_dominant", 0)
vibrantColor = sharedPref.getInt("custom_vibrant", 0)
} }
fun resetSettings(sharedPref : SharedPreferences, context: Context) : MutableList<String>{ fun resetSettings(sharedPref : SharedPreferences, context: Context) : MutableList<String>{
// set default theme
saveTheme(context, "finn")
val defaultList :MutableList<String> = mutableListOf<String>() val defaultList :MutableList<String> = mutableListOf<String>()
val editor: SharedPreferences.Editor = sharedPref.edit() val editor: SharedPreferences.Editor = sharedPref.edit()
val (chosenUpName, chosenUpPackage) = pickDefaultApp("action_upApp", context) val (chosenUpName, chosenUpPackage) = pickDefaultApp(
"action_upApp",
context
)
editor.putString("action_upApp", chosenUpPackage) editor.putString("action_upApp", chosenUpPackage)
defaultList.add(chosenUpName) defaultList.add(chosenUpName)
val (chosenDownName, chosenDownPackage) = pickDefaultApp("action_downApp", context) val (chosenDownName, chosenDownPackage) = pickDefaultApp(
"action_downApp",
context
)
editor.putString("action_downApp", chosenDownPackage) editor.putString("action_downApp", chosenDownPackage)
defaultList.add(chosenDownName) defaultList.add(chosenDownName)
val (chosenRightName, chosenRightPackage) = pickDefaultApp("action_rightApp", context) val (chosenRightName, chosenRightPackage) = pickDefaultApp(
"action_rightApp",
context
)
editor.putString("action_rightApp", chosenRightPackage) editor.putString("action_rightApp", chosenRightPackage)
defaultList.add(chosenRightName) defaultList.add(chosenRightName)
val (chosenLeftName, chosenLeftPackage) = pickDefaultApp("action_leftApp", context) val (chosenLeftName, chosenLeftPackage) = pickDefaultApp(
"action_leftApp",
context
)
editor.putString("action_leftApp", chosenLeftPackage) editor.putString("action_leftApp", chosenLeftPackage)
editor.putString("action_calendarApp", chosenLeftPackage) editor.putString("action_calendarApp", chosenLeftPackage)
defaultList.add(chosenLeftName) defaultList.add(chosenLeftName)
val (chosenVolumeUpName, chosenVolumeUpPackage) = pickDefaultApp("action_volumeUpApp", context) val (chosenVolumeUpName, chosenVolumeUpPackage) = pickDefaultApp(
"action_volumeUpApp",
context
)
editor.putString("action_volumeUpApp", chosenVolumeUpPackage) editor.putString("action_volumeUpApp", chosenVolumeUpPackage)
defaultList.add(chosenVolumeUpName) defaultList.add(chosenVolumeUpName)
val (chosenVolumeDownName, chosenVolumeDownPackage) = pickDefaultApp("action_volumeDownApp", context) val (chosenVolumeDownName, chosenVolumeDownPackage) = pickDefaultApp(
"action_volumeDownApp",
context
)
editor.putString("action_volumeDownApp", chosenVolumeDownPackage) editor.putString("action_volumeDownApp", chosenVolumeDownPackage)
defaultList.add(chosenVolumeDownName) defaultList.add(chosenVolumeDownName)
val (_, chosenClockPackage) = pickDefaultApp("action_clockApp", context) val (_, chosenClockPackage) = pickDefaultApp(
"action_clockApp",
context
)
editor.putString("action_clockApp", chosenClockPackage) editor.putString("action_clockApp", chosenClockPackage)
editor.apply() editor.apply()
@ -194,7 +303,7 @@ fun pickDefaultApp(action: String, context: Context) : Pair<String, String>{
// Related question: https://stackoverflow.com/q/3013655/12787264 (Adjusted) // Related question: https://stackoverflow.com/q/3013655/12787264 (Adjusted)
val list = context.resources.getStringArray(arrayResource) val list = context.resources.getStringArray(arrayResource)
for (entry in list!!){ for (entry in list){
val splitResult = entry.split("|").toTypedArray() val splitResult = entry.split("|").toTypedArray()
val pkgname = splitResult[0] val pkgname = splitResult[0]
val name = splitResult[1] val name = splitResult[1]
@ -203,3 +312,19 @@ fun pickDefaultApp(action: String, context: Context) : Pair<String, String>{
} }
return Pair(context.getString(R.string.none_found), "") return Pair(context.getString(R.string.none_found), "")
} }
/** Bitmaps */
fun getDominantColor(bitmap: Bitmap?): Int {
val newBitmap = Bitmap.createScaledBitmap(bitmap!!, 1, 1, true)
val color = newBitmap.getPixel(0, 0)
newBitmap.recycle()
return color
}
fun setButtonColor(btn: Button, color: Int) {
if (Build.VERSION.SDK_INT >= 29)
btn.background.colorFilter = BlendModeColorFilter(color, BlendMode.MULTIPLY)
else
btn.background.setColorFilter(color, PorterDuff.Mode.MULTIPLY)
}

View file

@ -1,10 +1,9 @@
package com.finnmglas.launcher.ui.main package com.finnmglas.launcher.settings
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
class PageViewModel : ViewModel() { class PageViewModel : ViewModel() {

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.ui.main package com.finnmglas.launcher.settings
import android.content.Context import android.content.Context
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
@ -14,13 +14,13 @@ private val TAB_TITLES = arrayOf(
/** Returns the fragment corresponding to the selected tab.*/ /** Returns the fragment corresponding to the selected tab.*/
class SectionsPagerAdapter(private val context: Context, fm: FragmentManager) class SectionsPagerAdapter(private val context: Context, fm: FragmentManager)
: FragmentPagerAdapter(fm) { : FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
override fun getItem(position: Int): Fragment { override fun getItem(position: Int): Fragment {
return when (position){ return when (position){
0 -> SettingsFragmentApps() 0 -> SettingsFragmentApps()
1 -> SettingsFragmentTheme() 1 -> SettingsFragmentTheme()
2 -> SettingsFragmentLauncher() 2 -> SettingsFragmentMeta()
else -> Fragment() else -> Fragment()
} }
} }
@ -29,7 +29,5 @@ class SectionsPagerAdapter(private val context: Context, fm: FragmentManager)
return context.resources.getString(TAB_TITLES[position]) return context.resources.getString(TAB_TITLES[position])
} }
override fun getCount(): Int { override fun getCount(): Int { return 3 }
return 3
}
} }

View file

@ -0,0 +1,113 @@
package com.finnmglas.launcher.settings
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.net.Uri
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import com.finnmglas.launcher.ChooseActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import kotlinx.android.synthetic.main.fragment_settings_apps.*
/** The 'Apps' Tab associated Fragment in Settings */
class SettingsFragmentApps : Fragment() {
/** Lifecycle functions */
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_settings_apps, container, false)
}
override fun onStart() {
if (getSavedTheme(context!!) == "custom") {
fragment_settings_apps_container.setBackgroundColor(dominantColor)
setButtonColor(fragment_settings_apps_choose_up_btn, vibrantColor)
setButtonColor(fragment_settings_apps_choose_down_btn, vibrantColor)
setButtonColor(fragment_settings_apps_choose_left_btn, vibrantColor)
setButtonColor(fragment_settings_apps_choose_right_btn, vibrantColor)
setButtonColor(fragment_settings_apps_choose_vol_up_btn, vibrantColor)
setButtonColor(fragment_settings_apps_choose_vol_down_btn, vibrantColor)
setButtonColor(fragment_settings_apps_launch_btn, vibrantColor)
setButtonColor(fragment_settings_apps_install_btn, vibrantColor)
setButtonColor(fragment_settings_apps_remove_btn, vibrantColor)
}
// Action - selecting buttons
fragment_settings_apps_choose_up_btn.setOnClickListener{ chooseApp("upApp") }
fragment_settings_apps_choose_down_btn.setOnClickListener{ chooseApp("downApp") }
fragment_settings_apps_choose_left_btn.setOnClickListener{ chooseApp("leftApp") }
fragment_settings_apps_choose_right_btn.setOnClickListener{ chooseApp("rightApp") }
fragment_settings_apps_choose_vol_up_btn.setOnClickListener{ chooseApp("volumeUpApp")}
fragment_settings_apps_choose_vol_down_btn.setOnClickListener{ chooseApp("volumeDownApp")}
// App management buttons
fragment_settings_apps_launch_btn.setOnClickListener{
val intent = Intent(this.context, ChooseActivity::class.java)
intent.putExtra("action", "launch")
startActivity(intent)
}
fragment_settings_apps_install_btn.setOnClickListener{
try {
val rateIntent = Intent(
Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/"))
startActivity(rateIntent)
} catch (e: ActivityNotFoundException) {
Toast.makeText(this.context, getString(R.string.settings_toast_store_not_found), Toast.LENGTH_SHORT)
.show()
}
}
fragment_settings_apps_remove_btn.setOnClickListener{
val intent = Intent(this.context, ChooseActivity::class.java)
intent.putExtra("action", "uninstall")
startActivity(intent)
}
super.onStart()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
when (requestCode) {
REQUEST_CHOOSE_APP -> {
val value = data?.getStringExtra("value")
val forApp = data?.getStringExtra("forApp") ?: return
// Save the new App to Preferences
val sharedPref = this.context!!.getSharedPreferences(
getString(R.string.preference_file_key), Context.MODE_PRIVATE)
val editor : SharedPreferences.Editor = sharedPref.edit()
editor.putString("action_$forApp", value.toString())
editor.apply()
loadSettings(sharedPref)
}
else -> super.onActivityResult(requestCode, resultCode, data)
}
}
/** Extra functions */
private fun chooseApp(forAction: String) {
val intent = Intent(this.context, ChooseActivity::class.java)
intent.putExtra("action", "pick")
intent.putExtra("forApp", forAction) // for which action we choose the app
startActivityForResult(intent, REQUEST_CHOOSE_APP)
}
}

View file

@ -0,0 +1,141 @@
package com.finnmglas.launcher.settings
import android.app.AlertDialog
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.finnmglas.launcher.FirstStartupActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import kotlinx.android.synthetic.main.fragment_settings_meta.*
/** The 'Meta' Tab associated Fragment in Settings */
class SettingsFragmentMeta : Fragment() {
/** Lifecycle functions */
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_settings_meta, container, false)
}
override fun onStart() {
if (getSavedTheme(context!!) == "custom") {
fragment_settings_meta_container.setBackgroundColor(dominantColor)
setButtonColor(fragment_settings_meta_select_launcher_btn, vibrantColor)
setButtonColor(fragment_settings_meta_view_tutorial_btn, vibrantColor)
setButtonColor(fragment_settings_meta_reset_settings_btn, vibrantColor)
fragment_settings_meta_footer_play_icon.setTextColor(vibrantColor)
fragment_settings_meta_footer_github_icon.setTextColor(vibrantColor)
fragment_settings_meta_footer_globe_icon.setTextColor(vibrantColor)
}
// Button onClicks
fragment_settings_meta_select_launcher_btn.setOnClickListener {
// on newer sdk: choose launcher
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
val callHomeSettingIntent = Intent(Settings.ACTION_HOME_SETTINGS)
startActivity(callHomeSettingIntent)
}
// on older sdk: manage app details
else {
AlertDialog.Builder(this.context!!, R.style.AlertDialogCustom)
.setTitle(getString(R.string.alert_cant_choose_launcher))
.setMessage(getString(R.string.alert_cant_choose_launcher_message))
.setPositiveButton(android.R.string.yes,
DialogInterface.OnClickListener { _, _ ->
try {
openAppSettings(this.context!!.packageName, this.context!!)
} catch ( e : ActivityNotFoundException) {
val intent = Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS)
startActivity(intent)
}
})
.setNegativeButton(android.R.string.no, null)
.setIcon(android.R.drawable.ic_dialog_info)
.show()
}
}
fragment_settings_meta_view_tutorial_btn.setOnClickListener {
startActivity(Intent(this.context, FirstStartupActivity::class.java))
}
// prompting for settings-reset confirmation
fragment_settings_meta_reset_settings_btn.setOnClickListener {
AlertDialog.Builder(this.context!!, R.style.AlertDialogCustom)
.setTitle(getString(R.string.settings_reset))
.setMessage(getString(R.string.settings_reset_message))
.setPositiveButton(android.R.string.yes,
DialogInterface.OnClickListener { _, _ ->
resetSettings(this.context!!.getSharedPreferences(getString(R.string.preference_file_key),
Context.MODE_PRIVATE), this.context!!)
activity!!.finish()
})
.setNegativeButton(android.R.string.no, null)
.setIcon(android.R.drawable.ic_dialog_alert)
.show()
}
// Footer onClicks
fragment_settings_meta_footer_github_icon.setOnClickListener {
openNewTabWindow(getString(R.string.settings_footer_repo), this.context!!)
}
// rate app
fragment_settings_meta_footer_play_icon.setOnClickListener {
try {
val rateIntent = rateIntentForUrl("market://details")
startActivity(rateIntent)
} catch (e: ActivityNotFoundException) {
val rateIntent = rateIntentForUrl("https://play.google.com/store/apps/details")
startActivity(rateIntent)
}
}
/*fragment_settings_meta_footer_website_icon.setOnClickListener {
openNewTabWindow(getString(R.string.settings_footer_web), this.context!!)
}*/
fragment_settings_meta_footer_globe_icon.setOnClickListener {
openNewTabWindow(getString(R.string.settings_footer_web), this.context!!)
}
super.onStart()
}
/** Extra functions */
// Rate App
// Just copied code from https://stackoverflow.com/q/10816757/12787264
// that is how we write good software ^^
private fun rateIntentForUrl(url: String): Intent {
val intent = Intent(
Intent.ACTION_VIEW,
Uri.parse(String.format("%s?id=%s", url, this.context!!.packageName))
)
var flags = Intent.FLAG_ACTIVITY_NO_HISTORY or Intent.FLAG_ACTIVITY_MULTIPLE_TASK
flags = if (Build.VERSION.SDK_INT >= 21) {
flags or Intent.FLAG_ACTIVITY_NEW_DOCUMENT
} else {
flags or Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
}
intent.addFlags(flags)
return intent
}
}

View file

@ -0,0 +1,123 @@
package com.finnmglas.launcher.settings
import android.Manifest
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.provider.MediaStore
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.palette.graphics.Palette
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import kotlinx.android.synthetic.main.fragment_settings_theme.*
/** The 'Theme' Tab associated Fragment in Settings */
class SettingsFragmentTheme : Fragment() {
/** Lifecycle functions */
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_settings_theme, container, false)
}
override fun onStart(){
// Hide 'select' button for the selected theme or allow customisation
when (getSavedTheme(context!!)) {
"dark" -> fragment_settings_theme_select_dark_btn.visibility = View.INVISIBLE
"finn" -> fragment_settings_theme_select_finn_btn.visibility = View.INVISIBLE
"custom" -> {
fragment_settings_theme_select_custom_btn.text = getString(R.string.settings_select_image)
fragment_settings_theme_container.setBackgroundColor(dominantColor)
setButtonColor(fragment_settings_theme_select_finn_btn, vibrantColor)
setButtonColor(fragment_settings_theme_select_dark_btn, vibrantColor)
setButtonColor(fragment_settings_theme_select_custom_btn, vibrantColor)
}
}
// Theme changing buttons
fragment_settings_theme_select_dark_btn.setOnClickListener {
saveTheme(context!!, "dark")
activity!!.recreate()
}
fragment_settings_theme_select_finn_btn.setOnClickListener {
saveTheme(context!!, "finn")
activity!!.recreate()
}
fragment_settings_theme_select_custom_btn.setOnClickListener {
// Request permission (on newer APIs)
if (Build.VERSION.SDK_INT >= 23) {
when {
ContextCompat.checkSelfPermission(context!!,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
-> letUserPickImage()
shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)
-> {}
else
-> requestPermissions(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), REQUEST_PERMISSION_STORAGE)
}
}
else letUserPickImage()
}
super.onStart()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
when (requestCode) {
REQUEST_PERMISSION_STORAGE -> letUserPickImage()
REQUEST_PICK_IMAGE -> handlePickedImage(resultCode, data)
else -> super.onActivityResult(requestCode, resultCode, data)
}
}
/** Extra functions */
private fun letUserPickImage(crop: Boolean = false) {
val intent = Intent()
intent.type = "image/*"
intent.action = Intent.ACTION_PICK // other option: Intent.ACTION_GET_CONTENT
if (crop) intent.putExtra("crop", "true")
startActivityForResult(intent, REQUEST_PICK_IMAGE)
}
private fun handlePickedImage(resultCode: Int, data: Intent?) {
if (resultCode == AppCompatActivity.RESULT_OK) {
if (data == null) return
val imageUri = data.data
background = MediaStore.Images.Media.getBitmap(context!!.contentResolver, imageUri)
Palette.Builder(background!!).generate {
it?.let { palette ->
dominantColor = palette.getDominantColor(ContextCompat.getColor(context!!, R.color.darkTheme_accent_color))
vibrantColor = palette.getVibrantColor(ContextCompat.getColor(context!!, R.color.darkTheme_accent_color))
/* Save image Uri as string */
val editor: SharedPreferences.Editor = context!!.getSharedPreferences(
context!!.getString(R.string.preference_file_key), Context.MODE_PRIVATE).edit()
editor.putString("background_uri", imageUri.toString())
editor.putInt("custom_dominant", dominantColor)
editor.putInt("custom_vibrant", vibrantColor)
editor.apply()
saveTheme(context!!, "custom")
activity!!.recreate()
}
}
}
}
}

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromYDelta="75%p"
android:toYDelta="0%p"
android:interpolator="@android:anim/decelerate_interpolator"
android:duration="150"/>
</set>

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View file

@ -1,20 +1,19 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto" xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container" android:id="@+id/activity_choose_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorPrimaryDark" android:background="?attr/colorPrimary"
tools:context=".ChooseActivity"> tools:context=".ChooseActivity">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar" android:id="@+id/activity_choose_app_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:gravity="center" android:gravity="center"
android:theme="@style/AppTheme.AppBarOverlay"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
@ -24,7 +23,7 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView <TextView
android:id="@+id/heading" android:id="@+id/activity_choose_heading"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
@ -37,8 +36,8 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<com.finnmglas.launcher.FontAwesome <com.finnmglas.launcher.extern.FontAwesome
android:id="@+id/close_settings" android:id="@+id/activity_choose_close"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
@ -49,7 +48,7 @@
android:paddingLeft="16sp" android:paddingLeft="16sp"
android:paddingRight="16sp" android:paddingRight="16sp"
android:text="@string/fa_close_window" android:text="@string/fa_close_window"
android:textColor="#ffffff" android:textColor="?attr/colorAccent"
android:textSize="22sp" android:textSize="22sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -71,10 +70,10 @@
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/app_bar"> app:layout_constraintTop_toBottomOf="@id/activity_choose_app_bar">
<LinearLayout <LinearLayout
android:id="@+id/apps_list" android:id="@+id/activity_choose_apps_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" /> android:orientation="vertical" />

View file

@ -1,16 +1,66 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container" android:id="@+id/activity_firststartup_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorPrimaryDark" android:background="?attr/colorPrimary"
android:longClickable="false"
android:onClick="clickAnywhere" android:onClick="clickAnywhere"
tools:context=".FirstStartupActivity"> tools:context=".FirstStartupActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/activity_firststartup_app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:visibility="invisible"
custom:layout_constraintEnd_toEndOf="parent"
custom:layout_constraintStart_toStartOf="parent"
custom:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/activity_firststartup_heading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:minHeight="?actionBarSize"
android:padding="@dimen/appbar_padding"
android:text="@string/tutorial_title"
android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"
custom:layout_constraintEnd_toEndOf="parent"
custom:layout_constraintStart_toStartOf="parent"
custom:layout_constraintTop_toTopOf="parent" />
<com.finnmglas.launcher.extern.FontAwesome
android:id="@+id/activity_firststartup_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="center"
android:includeFontPadding="true"
android:onClick="backToSettings"
android:paddingLeft="16sp"
android:paddingRight="16sp"
android:text="@string/fa_close_window"
android:textColor="?attr/colorAccent"
android:textSize="22sp"
custom:layout_constraintBottom_toBottomOf="parent"
custom:layout_constraintEnd_toEndOf="parent"
custom:layout_constraintTop_toTopOf="parent"
custom:type="solid" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.appbar.AppBarLayout>
<TextView <TextView
android:id="@+id/heading" android:id="@+id/activity_firststartup_section_heading"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
@ -24,7 +74,7 @@
app:layout_constraintVertical_bias="0.100000024" /> app:layout_constraintVertical_bias="0.100000024" />
<TextView <TextView
android:id="@+id/infoText" android:id="@+id/activity_firststartup_descriptive_text"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="32dp" android:layout_marginStart="32dp"
@ -40,10 +90,10 @@
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/heading" /> app:layout_constraintTop_toBottomOf="@id/activity_firststartup_section_heading" />
<TextView <TextView
android:id="@+id/hintText" android:id="@+id/activity_firststartup_hint_text"
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 +110,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/infoText" /> app:layout_constraintTop_toBottomOf="@id/activity_firststartup_descriptive_text" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,21 +1,30 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto" xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container" android:id="@+id/activity_main_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorPrimaryDark" android:background="?attr/colorPrimary"
android:longClickable="false" android:longClickable="false"
tools:context=".MainActivity"> tools:context=".MainActivity">
<ImageView
android:id="@+id/activity_main_background_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:orientation="vertical"
android:scaleType="centerCrop"
tools:ignore="ContentDescription" />
<TextView <TextView
android:id="@+id/dateView" android:id="@+id/activity_main_date_view"
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="start|center_vertical"
android:onClick="dateViewOnTouch" android:onClick="dateViewOnTouch"
android:textColor="#ccc"
android:textSize="30sp" android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -24,12 +33,11 @@
app:layout_constraintVertical_bias="0.45" /> app:layout_constraintVertical_bias="0.45" />
<TextView <TextView
android:id="@+id/timeView" android:id="@+id/activity_main_time_view"
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="start|center_vertical"
android:onClick="timeViewOnTouch" android:onClick="timeViewOnTouch"
android:textColor="#ccc"
android:textSize="18sp" android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -37,13 +45,13 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<com.finnmglas.launcher.FontAwesome <com.finnmglas.launcher.extern.FontAwesome
android:id="@+id/settingstooltip" android:id="@+id/activity_main_settings_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="settingsIconOnTouch" android:onClick="settingsIconOnTouch"
android:text="@string/fas_settings" android:text="@string/fas_settings"
android:textColor="#999" android:textColor="?attr/colorAccent"
android:textSize="36sp" android:textSize="36sp"
android:visibility="invisible" android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

View file

@ -1,25 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto" xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container" android:id="@+id/activity_settings_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".SettingsActivity"> tools:context=".SettingsActivity">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/activity_settings_app_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:background="@color/colorPrimaryDark"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView <TextView
android:id="@+id/heading" android:id="@+id/activity_settings_heading"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
@ -28,14 +28,16 @@
android:text="@string/settings_title" android:text="@string/settings_title"
android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"
android:textSize="30sp" android:textSize="30sp"
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_toTopOf="parent" />
<com.finnmglas.launcher.FontAwesome <com.finnmglas.launcher.extern.FontAwesome
android:id="@+id/close_settings" android:id="@+id/activity_settings_close"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="8dp" android:layout_marginLeft="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:gravity="center" android:gravity="center"
android:includeFontPadding="true" android:includeFontPadding="true"
@ -43,24 +45,41 @@
android:paddingLeft="16sp" android:paddingLeft="16sp"
android:paddingRight="16sp" android:paddingRight="16sp"
android:text="@string/fa_close_window" android:text="@string/fa_close_window"
android:textColor="#ffffff" android:textColor="?attr/colorAccent"
android:textSize="22sp" android:textSize="22sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
custom:type="solid" /> custom:type="solid" />
<com.finnmglas.launcher.extern.FontAwesome
android:id="@+id/activity_settings_device_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:gravity="center"
android:includeFontPadding="true"
android:paddingLeft="16sp"
android:paddingRight="16sp"
android:text="@string/fas_settings"
android:textColor="?attr/colorAccent"
android:textSize="22sp"
custom:layout_constraintBottom_toBottomOf="parent"
custom:layout_constraintStart_toStartOf="parent"
custom:layout_constraintTop_toTopOf="parent"
custom:type="solid" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/tabs" android:id="@+id/activity_settings_tabs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorPrimaryDark" /> app:tabTextColor="?attr/android:textColor" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager" android:id="@+id/activity_settings_view_pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />

View file

@ -2,17 +2,18 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container" android:id="@+id/fragment_settings_apps_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorPrimaryDark" android:background="?attr/colorPrimary"
android:gravity="center|top" android:gravity="center|top"
android:orientation="vertical" android:orientation="vertical"
android:padding="32sp" android:paddingLeft="32sp"
tools:context=".SettingsActivity"> android:paddingTop="16sp"
android:paddingRight="32sp"
tools:context=".settings.SettingsFragmentApps">
<TableLayout <TableLayout
android:id="@+id/actionschooser"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="32sp" android:paddingBottom="32sp"
@ -27,20 +28,18 @@
android:gravity="center"> android:gravity="center">
<TextView <TextView
android:id="@+id/text_up" android:id="@+id/fragment_settings_apps_text_up"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10sp" android:paddingLeft="10sp"
android:paddingRight="10sp" android:paddingRight="10sp"
android:text="@string/settings_choose_up" android:text="@string/settings_choose_up"
android:textColor="#ccc"
android:textSize="20sp" /> android:textSize="20sp" />
<Button <Button
android:id="@+id/btn_choose_up" android:id="@+id/fragment_settings_apps_choose_up_btn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="chooseUpApp"
android:text="@string/settings_choose_btn" android:text="@string/settings_choose_btn"
android:textAllCaps="false" /> android:textAllCaps="false" />
</TableRow> </TableRow>
@ -51,20 +50,18 @@
android:gravity="center"> android:gravity="center">
<TextView <TextView
android:id="@+id/text_down" android:id="@+id/fragment_settings_apps_choose_down_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10sp" android:paddingLeft="10sp"
android:paddingRight="10sp" android:paddingRight="10sp"
android:text="@string/settings_choose_down" android:text="@string/settings_choose_down"
android:textColor="#ccc"
android:textSize="20sp" /> android:textSize="20sp" />
<Button <Button
android:id="@+id/btn_choose_down" android:id="@+id/fragment_settings_apps_choose_down_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="chooseDownApp"
android:text="@string/settings_choose_btn" android:text="@string/settings_choose_btn"
android:textAllCaps="false" /> android:textAllCaps="false" />
@ -76,20 +73,18 @@
android:gravity="center"> android:gravity="center">
<TextView <TextView
android:id="@+id/text_left" android:id="@+id/fragment_settings_apps_choose_left_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10sp" android:paddingLeft="10sp"
android:paddingRight="10sp" android:paddingRight="10sp"
android:text="@string/settings_choose_left" android:text="@string/settings_choose_left"
android:textColor="#ccc"
android:textSize="20sp" /> android:textSize="20sp" />
<Button <Button
android:id="@+id/btn_choose_left" android:id="@+id/fragment_settings_apps_choose_left_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="chooseLeftApp"
android:text="@string/settings_choose_btn" android:text="@string/settings_choose_btn"
android:textAllCaps="false" /> android:textAllCaps="false" />
</TableRow> </TableRow>
@ -100,20 +95,18 @@
android:gravity="center"> android:gravity="center">
<TextView <TextView
android:id="@+id/text_right" android:id="@+id/fragment_settings_apps_choose_right_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10sp" android:paddingLeft="10sp"
android:paddingRight="10sp" android:paddingRight="10sp"
android:text="@string/settings_choose_right" android:text="@string/settings_choose_right"
android:textColor="#ccc"
android:textSize="20sp" /> android:textSize="20sp" />
<Button <Button
android:id="@+id/btn_choose_right" android:id="@+id/fragment_settings_apps_choose_right_btn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="chooseRightApp"
android:text="@string/settings_choose_btn" android:text="@string/settings_choose_btn"
android:textAllCaps="false" /> android:textAllCaps="false" />
@ -125,20 +118,18 @@
android:gravity="center"> android:gravity="center">
<TextView <TextView
android:id="@+id/text_vol_up" android:id="@+id/fragment_settings_apps_choose_vol_up_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10sp" android:paddingLeft="10sp"
android:paddingRight="10sp" android:paddingRight="10sp"
android:text="@string/settings_choose_vol_up" android:text="@string/settings_choose_vol_up"
android:textColor="#ccc"
android:textSize="20sp" /> android:textSize="20sp" />
<Button <Button
android:id="@+id/btn_choose_volume_up" android:id="@+id/fragment_settings_apps_choose_vol_up_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="chooseVolumeUpApp"
android:text="@string/settings_choose_btn" android:text="@string/settings_choose_btn"
android:textAllCaps="false" /> android:textAllCaps="false" />
</TableRow> </TableRow>
@ -149,20 +140,18 @@
android:gravity="center"> android:gravity="center">
<TextView <TextView
android:id="@+id/text_vol_down" android:id="@+id/fragment_settings_apps_choose_vol_down_text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10sp" android:paddingLeft="10sp"
android:paddingRight="10sp" android:paddingRight="10sp"
android:text="@string/settings_choose_vol_down" android:text="@string/settings_choose_vol_down"
android:textColor="#ccc"
android:textSize="20sp" /> android:textSize="20sp" />
<Button <Button
android:id="@+id/btn_choose_volume_down" android:id="@+id/fragment_settings_apps_choose_vol_down_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="chooseVolumeDownApp"
android:text="@string/settings_choose_btn" android:text="@string/settings_choose_btn"
android:textAllCaps="false" /> android:textAllCaps="false" />
@ -171,26 +160,23 @@
</TableLayout> </TableLayout>
<Button <Button
style="@style/Widget.AppCompat.Button" android:id="@+id/fragment_settings_apps_launch_btn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="chooseLaunchApp"
android:text="@string/settings_launch" android:text="@string/settings_launch"
android:textAllCaps="false" /> android:textAllCaps="false" />
<Button <Button
style="@style/Widget.AppCompat.Button" android:id="@+id/fragment_settings_apps_install_btn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="chooseInstallApp"
android:text="@string/settings_install" android:text="@string/settings_install"
android:textAllCaps="false" /> android:textAllCaps="false" />
<Button <Button
style="@style/Widget.AppCompat.Button" android:id="@+id/fragment_settings_apps_remove_btn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:onClick="chooseUninstallApp"
android:text="@string/settings_uninstall" android:text="@string/settings_uninstall"
android:textAllCaps="false" /> android:textAllCaps="false" />
</LinearLayout> </LinearLayout>

View file

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimaryDark"
android:gravity="center|top"
android:orientation="vertical"
android:padding="32sp"
tools:context=".SettingsActivity">
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="setLauncher"
android:text="@string/settings_select_launcher"
android:textAllCaps="false" />
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="viewTutorial"
android:text="@string/settings_show_tutorial"
android:textAllCaps="false" />
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32sp"
android:onClick="resetSettingsClick"
android:text="@string/settings_reset"
android:textAllCaps="false" />
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="rateApp"
android:text="@string/settings_feedback"
android:textAllCaps="false" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32sp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_footer_by"
android:textColor="#999"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="openFinnWebsite"
android:text=" Finn M Glas"
android:textColor="?attr/colorAccent"
android:textSize="18sp"
tools:ignore="HardcodedText" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | "
android:textColor="#999"
android:textSize="18sp"
tools:ignore="HardcodedText" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="openGithubRepo"
android:text="Open Source"
android:textColor="?attr/colorAccent"
android:textSize="18sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_settings_meta_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
android:gravity="center|top"
android:orientation="vertical"
android:paddingLeft="32sp"
android:paddingTop="16sp"
android:paddingRight="32sp"
tools:context=".settings.SettingsFragmentMeta">
<Button
android:id="@+id/fragment_settings_meta_select_launcher_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_select_launcher"
android:textAllCaps="false" />
<Button
android:id="@+id/fragment_settings_meta_view_tutorial_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_show_tutorial"
android:textAllCaps="false" />
<Button
android:id="@+id/fragment_settings_meta_reset_settings_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32sp"
android:text="@string/settings_reset"
android:textAllCaps="false" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32sp"
android:gravity="center"
android:orientation="horizontal">
<com.finnmglas.launcher.extern.FontAwesome
android:id="@+id/fragment_settings_meta_footer_play_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:gravity="center"
android:includeFontPadding="true"
android:paddingLeft="16sp"
android:paddingRight="16sp"
android:text="@string/fab_google_play"
android:textColor="?attr/colorAccent"
android:textSize="40sp"
custom:type="brands" />
<com.finnmglas.launcher.extern.FontAwesome
android:id="@+id/fragment_settings_meta_footer_github_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:gravity="center"
android:includeFontPadding="true"
android:paddingLeft="16sp"
android:paddingRight="16sp"
android:text="@string/fab_github"
android:textColor="?attr/colorAccent"
android:textSize="40sp"
custom:type="brands" />
<com.finnmglas.launcher.extern.FontAwesome
android:id="@+id/fragment_settings_meta_footer_globe_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:gravity="center"
android:includeFontPadding="true"
android:paddingLeft="16sp"
android:paddingRight="16sp"
android:text="@string/fas_globe"
android:textColor="?attr/colorAccent"
android:textSize="40sp"
custom:type="solid" />
</LinearLayout>
</LinearLayout>

View file

@ -1,23 +1,120 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container" android:id="@+id/fragment_settings_theme_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorPrimaryDark" android:background="?attr/colorPrimary"
android:gravity="center|top" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:padding="32sp" android:paddingLeft="32sp"
tools:context=".SettingsActivity"> android:paddingTop="16sp"
android:paddingRight="32sp"
tools:context=".settings.SettingsFragmentMeta">
<!--Button <ScrollView
style="@style/Widget.AppCompat.Button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent">
android:onClick="setLauncher"
android:text="@string/settings_select_launcher"
android:textAllCaps="false" /-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10sp"
app:cardCornerRadius="8dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitXY"
app:srcCompat="@drawable/finnmglas_theme"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/fragment_settings_theme_select_finn_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_select_theme"
android:textAllCaps="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10sp"
app:cardCornerRadius="8dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitXY"
app:srcCompat="@drawable/dark_theme"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/fragment_settings_theme_select_dark_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_select_theme"
android:textAllCaps="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10sp"
app:cardCornerRadius="8dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitXY"
app:srcCompat="@drawable/custom_theme"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/fragment_settings_theme_select_custom_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_select_theme"
android:textAllCaps="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</ScrollView>
</LinearLayout> </LinearLayout>

View file

@ -13,7 +13,7 @@
<string name="settings_title">Einstellungen</string> <string name="settings_title">Einstellungen</string>
<string name="settings_show_tutorial">Zum Launcher Tutorial</string> <string name="settings_show_tutorial">Zum Launcher Tutorial</string>
<string name="settings_feedback">Feedback geben</string> <string name="settings_rate_google_play">Jetzt im Playstore bewerten</string>
<string name="settings_choose_up">Hochwischen</string> <string name="settings_choose_up">Hochwischen</string>
<string name="settings_choose_down">Runterwischen</string> <string name="settings_choose_down">Runterwischen</string>
@ -33,6 +33,9 @@
<string name="settings_toast_store_not_found">PlayStore nicht gefunden</string> <string name="settings_toast_store_not_found">PlayStore nicht gefunden</string>
<string name="settings_select_theme">Wählen</string>
<string name="settings_select_image">Bild ändern</string>
<string name="settings_footer_by">Von</string> <string name="settings_footer_by">Von</string>
<string name="settings_footer_repo">https://github.com/finnmglas/Launcher#de</string> <string name="settings_footer_repo">https://github.com/finnmglas/Launcher#de</string>
<string name="settings_footer_web">https://www.finnmglas.com/de/</string> <string name="settings_footer_web">https://www.finnmglas.com/de/</string>
@ -48,6 +51,7 @@
<string name="choose_not_removed_toast">Die App konnte nicht entfernt werden</string> <string name="choose_not_removed_toast">Die App konnte nicht entfernt werden</string>
<!-- FirstStartup Activity --> <!-- FirstStartup Activity -->
<string name="tutorial_title">Tutorial</string>
<string-array name="intro"> <string-array name="intro">
<!--item> heading | infoText | hintText | size | format </item--> <!--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>|Nimm dir kurz Zeit und lerne, wie du diesen Launcher verwendest!\n\n|— Tippe um weiterzukommen —|36F|0</item>

View file

@ -12,7 +12,7 @@
<!-- Settings --> <!-- Settings -->
<string name="settings_title">Réglages</string> <string name="settings_title">Réglages</string>
<string name="settings_feedback">Donner une rétroaction</string> <string name="settings_rate_google_play">Donner une rétroaction</string>
<string name="settings_show_tutorial">Regardez le tutoriel</string> <string name="settings_show_tutorial">Regardez le tutoriel</string>
<string name="settings_choose_up">Balayez haut</string> <string name="settings_choose_up">Balayez haut</string>
@ -33,6 +33,9 @@
<string name="settings_toast_store_not_found">Pas trouvé le PlayStore</string> <string name="settings_toast_store_not_found">Pas trouvé le PlayStore</string>
<string name="settings_select_theme">Choisir</string>
<string name="settings_select_image">Changer Image</string>
<string name="settings_footer_by">Par</string> <string name="settings_footer_by">Par</string>
<string name="settings_footer_web">https://www.finnmglas.com/fr/</string> <string name="settings_footer_web">https://www.finnmglas.com/fr/</string>
<string name="settings_footer_repo">https://github.com/finnmglas/Launcher</string> <string name="settings_footer_repo">https://github.com/finnmglas/Launcher</string>
@ -40,7 +43,7 @@
<!-- Choose Activity --> <!-- Choose Activity -->
<string name="choose_title">Choisir App</string> <string name="choose_title">Choisir App</string>
<string name="choose_title_launch">Lancer Apps</string> <string name="choose_title_launch">Lancer Apps</string>
<string name="choose_title_remove">Désinstaller Apps</string> <string name="choose_title_remove">Désinstaller</string>
<string name="choose_back_settings">Retourner</string> <string name="choose_back_settings">Retourner</string>
@ -48,6 +51,7 @@
<string name="choose_not_removed_toast">Impossible de supprimer l\'application</string> <string name="choose_not_removed_toast">Impossible de supprimer l\'application</string>
<!-- FirstStartup Activity --> <!-- FirstStartup Activity -->
<string name="tutorial_title">Le Tutoriel</string>
<string-array name="intro"> <string-array name="intro">
<!--item> heading | infoText | hintText | size | format </item--> <!--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>|Prenez un moment et apprenez à utiliser ce lanceur!\n\n|— Appuyez pour continuer —|36F|0</item>

View file

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#2d2d2d</color> <color name="finnmglasTheme_background_color">#252827</color>
<color name="colorPrimaryDark">#252827</color> <color name="finnmglasTheme_accent_color">#5555ff</color>
<color name="colorAccent">#5555ff</color> <color name="finnmglasTheme_text_color">#fff</color>
<color name="darkTheme_background_color">#000</color>
<color name="darkTheme_accent_color">#444</color>
<color name="darkTheme_text_color">#fff</color>
</resources> </resources>

View file

@ -8,10 +8,14 @@
<string name="fas_ad" translatable="false">&#xf641;</string> <string name="fas_ad" translatable="false">&#xf641;</string>
<string name="fas_backspace" translatable="false">&#xf55a;</string> <string name="fas_backspace" translatable="false">&#xf55a;</string>
<string name="fas_calendar" translatable="false">&#xf133;</string> <string name="fas_calendar" translatable="false">&#xf133;</string>
<string name="fas_donate" translatable="false">&#xf4b9;</string>
<string name="fas_share" translatable="false">&#xf064;</string>
<!-- icons that can be used with type="brands" --> <!-- icons that can be used with type="brands" -->
<string name="fab_apple" translatable="false">&#xf179;</string> <string name="fab_apple" translatable="false">&#xf179;</string>
<string name="fab_instagram" translatable="false">&#xf16d;</string> <string name="fab_instagram" translatable="false">&#xf16d;</string>
<string name="fab_github" translatable="false">&#xf09b;</string>
<string name="fab_google_play" translatable="false">&#xf3ab;</string>
<!-- icons that can be used with type="solid" and type="regular" --> <!-- icons that can be used with type="solid" and type="regular" -->
<string name="fa_close_window" translatable="false">&#xf410;</string> <string name="fa_close_window" translatable="false">&#xf410;</string>

View file

@ -17,10 +17,10 @@
<string name="settings_title">Settings</string> <string name="settings_title">Settings</string>
<string name="settings_tab_app" translatable="false">Apps</string> <string name="settings_tab_app" translatable="false">Apps</string>
<string name="settings_tab_theme" translatable="false">Theme</string> <string name="settings_tab_theme" translatable="false">Themes</string>
<string name="settings_tab_launcher" translatable="false">Launcher</string> <string name="settings_tab_launcher" translatable="false">Meta</string>
<string name="settings_feedback">Give some feedback</string> <string name="settings_rate_google_play">Rate us on Google Play</string>
<string name="settings_show_tutorial">View Launcher Tutorial</string> <string name="settings_show_tutorial">View Launcher Tutorial</string>
<string name="settings_choose_up">Swipe Up</string> <string name="settings_choose_up">Swipe Up</string>
@ -41,6 +41,9 @@
<string name="settings_toast_store_not_found">PlayStore not found</string> <string name="settings_toast_store_not_found">PlayStore not found</string>
<string name="settings_select_theme">Select</string>
<string name="settings_select_image">Change Image</string>
<string name="settings_footer_by">By</string> <string name="settings_footer_by">By</string>
<string name="settings_footer_repo">https://github.com/finnmglas/Launcher#en</string> <string name="settings_footer_repo">https://github.com/finnmglas/Launcher#en</string>
<string name="settings_footer_web">https://www.finnmglas.com</string> <string name="settings_footer_web">https://www.finnmglas.com</string>
@ -56,6 +59,7 @@
<string name="choose_not_removed_toast">Unable to remove application</string> <string name="choose_not_removed_toast">Unable to remove application</string>
<!-- FirstStartup Activity --> <!-- FirstStartup Activity -->
<string name="tutorial_title">Tutorial</string>
<string-array name="intro"> <string-array name="intro">
<!--item> heading | infoText | hintText | size | format </item--> <!--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>|Take a few seconds to learn how to use this Launcher!\n\n|— Tap anywhere to continue —|36F|0</item>

View file

@ -1,20 +1,43 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Personal Theme of Finn M Glas -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <style name="finnmglasTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. --> <item name="colorPrimary">@color/finnmglasTheme_background_color</item>
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/finnmglasTheme_background_color</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="android:colorBackground">@color/finnmglasTheme_background_color</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorAccent">@color/finnmglasTheme_accent_color</item>
<item name="android:textColor">@color/finnmglasTheme_text_color</item>
<item name="android:buttonStyle">@style/Widget.AppCompat.Button.Colored</item>
<item name="colorButtonNormal">@color/finnmglasTheme_accent_color</item>
<item name="android:windowDisablePreview">true</item> <item name="android:windowDisablePreview">true</item>
<item name="android:windowAnimationStyle">@style/WindowFadeTransition</item>
</style> </style>
<style name="AppTheme.NoActionBar"> <!-- A dark efficiency theme -->
<item name="windowActionBar">false</item> <style name="darkTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowNoTitle">true</item> <item name="colorPrimary">@color/darkTheme_background_color</item>
<item name="colorPrimaryDark">@color/darkTheme_background_color</item>
<item name="colorAccent">@color/darkTheme_accent_color</item>
<item name="android:textColor">@color/darkTheme_text_color</item>
<item name="android:buttonStyle">@style/Widget.AppCompat.Button.Colored</item>
<item name="colorButtonNormal">@color/darkTheme_accent_color</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowAnimationStyle">@style/WindowFadeTransition</item>
</style> </style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AlertDialogCustom" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:textColor">#000000</item>
</style>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> <!-- Set the fade in animation on all activities by default -->
<style name="WindowFadeTransition">
<item name="android:windowEnterAnimation">@android:anim/fade_in</item>
<item name="android:windowExitAnimation">@android:anim/fade_out</item>
</style>
</resources> </resources>