Merge pull request #18 from finnmglas/feature/tabbed-settings

Feature/tabbed settings
This commit is contained in:
Finn M Glas 2020-05-21 10:13:15 +02:00 committed by GitHub
commit 53a43f3eb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 542 additions and 313 deletions

View file

@ -31,6 +31,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

View file

@ -17,6 +17,7 @@ class FirstStartupActivity : AppCompatActivity(){
private var menuNumber = 0 private var menuNumber = 0
private var defaultApps = mutableListOf<String>() private var defaultApps = mutableListOf<String>()
private var isFirstTime = false
/** Activity Lifecycle functions */ /** Activity Lifecycle functions */
@ -36,6 +37,10 @@ class FirstStartupActivity : AppCompatActivity(){
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)
isFirstTime = !sharedPref.getBoolean("startedBefore", false)
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
} }
@ -72,19 +77,23 @@ class FirstStartupActivity : AppCompatActivity(){
val entry = intro[menuNumber].split("|").toTypedArray() //heading|infoText|hintText|size val entry = intro[menuNumber].split("|").toTypedArray() //heading|infoText|hintText|size
heading.text = entry[0] heading.text = entry[0]
if (entry[4] == "1")infoText.text = String.format(entry[1], if (entry[4] == "1" && isFirstTime)infoText.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 infoText.text = entry[1] else infoText.text = entry[1]
hintText.text = entry[2] hintText.text = entry[2]
infoText.setTextSize(TypedValue.COMPLEX_UNIT_SP, entry[3].toFloat()) infoText.setTextSize(TypedValue.COMPLEX_UNIT_SP, entry[3].toFloat())
} else { // End intro } else { // End intro
if (isFirstTime){
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)
val editor: SharedPreferences.Editor = sharedPref.edit() val editor: SharedPreferences.Editor = sharedPref.edit()
editor.putBoolean("startedBefore", true) // never run this again editor.putBoolean("startedBefore", true) // never auto run this again
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

@ -137,7 +137,7 @@ class MainActivity : AppCompatActivity(),
override fun onLongPress(event: MotionEvent) { openSettings() } override fun onLongPress(event: MotionEvent) { openSettings() }
// Tooltip // Tooltip
override fun onSingleTapUp(event: MotionEvent): Boolean { override fun onSingleTapConfirmed(event: MotionEvent): Boolean {
when(settingsIconShown) { when(settingsIconShown) {
true -> hideSettingsIcon() true -> hideSettingsIcon()
false -> showSettingsIcon() false -> showSettingsIcon()
@ -175,5 +175,5 @@ class MainActivity : AppCompatActivity(),
override fun onDown(event: MotionEvent): Boolean { return true } override fun onDown(event: MotionEvent): Boolean { return true }
override fun onScroll(e1: MotionEvent, e2: MotionEvent, dX: Float, dY: Float): Boolean { return true } override fun onScroll(e1: MotionEvent, e2: MotionEvent, dX: Float, dY: Float): Boolean { return true }
override fun onShowPress(event: MotionEvent) {} override fun onShowPress(event: MotionEvent) {}
override fun onSingleTapConfirmed(event: MotionEvent): Boolean { return true } override fun onSingleTapUp(event: MotionEvent): Boolean { return true }
} }

View file

@ -2,26 +2,34 @@ package com.finnmglas.launcher
import android.app.AlertDialog import android.app.AlertDialog
import android.content.* import android.content.*
import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.provider.Settings import android.provider.Settings
import android.view.View import android.view.View
import android.view.WindowManager import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager.widget.ViewPager
import com.finnmglas.launcher.ui.main.SectionsPagerAdapter
import com.google.android.material.tabs.TabLayout
//TODO Make Settings scrollable as soon as more are added
class SettingsActivity : AppCompatActivity() { class SettingsActivity : AppCompatActivity() {
/** Activity Lifecycle functions */ /** Activity Lifecycle functions */
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
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)
setContentView(R.layout.activity_settings) val sectionsPagerAdapter = SectionsPagerAdapter(this, supportFragmentManager)
val viewPager: ViewPager = findViewById(R.id.view_pager)
viewPager.adapter = sectionsPagerAdapter
val tabs: TabLayout = findViewById(R.id.tabs)
tabs.setupWithViewPager(viewPager)
} }
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
@ -74,6 +82,35 @@ class SettingsActivity : AppCompatActivity() {
fun openFinnWebsite(view: View) { openNewTabWindow(getString(R.string.settings_footer_web), this) } fun openFinnWebsite(view: View) { openNewTabWindow(getString(R.string.settings_footer_web), this) }
fun openGithubRepo(view: View) { openNewTabWindow(getString(R.string.settings_footer_repo), 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) { fun setLauncher(view: View) {
@ -102,6 +139,10 @@ class SettingsActivity : AppCompatActivity() {
} }
} }
fun viewTutorial (view: View){
startActivity(Intent(this, FirstStartupActivity::class.java))
}
// Show a dialog prompting for confirmation // Show a dialog prompting for confirmation
fun resetSettingsClick(view: View) { fun resetSettingsClick(view: View) {
AlertDialog.Builder(this) AlertDialog.Builder(this)

View file

@ -0,0 +1,20 @@
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

@ -0,0 +1,20 @@
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

@ -0,0 +1,20 @@
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

@ -0,0 +1,19 @@
package com.finnmglas.launcher.ui.main
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
class PageViewModel : ViewModel() {
private val _index = MutableLiveData<Int>()
val text: LiveData<String> = Transformations.map(_index) {
"Tab $it"
}
fun setIndex(index: Int) {
_index.value = index
}
}

View file

@ -0,0 +1,35 @@
package com.finnmglas.launcher.ui.main
import android.content.Context
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.finnmglas.launcher.*
private val TAB_TITLES = arrayOf(
R.string.settings_tab_app,
R.string.settings_tab_theme,
R.string.settings_tab_launcher
)
/** Returns the fragment corresponding to the selected tab.*/
class SectionsPagerAdapter(private val context: Context, fm: FragmentManager)
: FragmentPagerAdapter(fm) {
override fun getItem(position: Int): Fragment {
return when (position){
0 -> SettingsFragmentApps()
1 -> SettingsFragmentTheme()
2 -> SettingsFragmentLauncher()
else -> Fragment()
}
}
override fun getPageTitle(position: Int): CharSequence? {
return context.resources.getString(TAB_TITLES[position])
}
override fun getCount(): Int {
return 3
}
}

View file

@ -1,320 +1,57 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <?xml version="1.0" encoding="utf-8"?>
<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:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container" android:id="@+id/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"
tools:context=".SettingsActivity"> tools:context=".SettingsActivity">
<TextView <com.google.android.material.appbar.AppBarLayout
android:id="@+id/heading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_title"
android:textColor="#cccccc"
android:textSize="36sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.100000024" />
<TextView
android:id="@+id/sub_head_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_sub_title1"
android:textColor="#999"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias=".1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.189" />
<TableLayout
android:id="@+id/actionschooser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal|center_vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/sub_head_1"
app:layout_constraintVertical_bias="0.120000005">
<TableRow
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10sp" android:background="@color/colorPrimaryDark"
android:paddingRight="10sp" android:theme="@style/AppTheme.AppBarOverlay">
android:text="@string/settings_choose_up"
android:textColor="#ccc"
android:textSize="24sp" />
<Button
android:id="@+id/btn_choose_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".8"
android:onClick="chooseUpApp"
android:text="@string/settings_choose_btn" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_down"
android:textColor="#ccc"
android:textSize="24sp" />
<Button
android:id="@+id/btn_choose_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".8"
android:onClick="chooseDownApp"
android:text="@string/settings_choose_btn" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_left"
android:textColor="#ccc"
android:textSize="24sp" />
<Button
android:id="@+id/btn_choose_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".8"
android:onClick="chooseLeftApp"
android:text="@string/settings_choose_btn" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_right"
android:textColor="#ccc"
android:textSize="24sp" />
<Button
android:id="@+id/btn_choose_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".8"
android:onClick="chooseRightApp"
android:text="@string/settings_choose_btn" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_vol_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_vol_up"
android:textColor="#ccc"
android:textSize="24sp" />
<Button
android:id="@+id/btn_choose_volume_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".8"
android:onClick="chooseVolumeUpApp"
android:text="@string/settings_choose_btn" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_vol_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_vol_down"
android:textColor="#ccc"
android:textSize="24sp" />
<Button
android:id="@+id/btn_choose_volume_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".8"
android:onClick="chooseVolumeDownApp"
android:text="@string/settings_choose_btn" />
</TableRow>
</TableLayout>
<TextView
android:id="@+id/sub_head_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_sub_title2"
android:textColor="#999"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@id/buttons"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/actionschooser"
app:layout_constraintVertical_bias="0.65999997" />
<TableLayout
android:id="@+id/buttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/actionschooser"
app:layout_constraintVertical_bias="0.19999999">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".3"
android:onClick="setLauncher"
android:text="@string/settings_select_launcher" />
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".3"
android:onClick="resetSettingsClick"
android:text="@string/settings_reset" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".3"
android:onClick="chooseLaunchApp"
android:text="@string/settings_launch" />
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".3"
android:onClick="chooseUninstallApp"
android:text="@string/settings_uninstall" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="backHome"
android:text="@string/settings_home" />
</TableRow>
</TableLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="horizontal" android:orientation="horizontal">
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.98">
<TextView <TextView
android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/settings_footer_by" android:gravity="center"
android:textColor="#999" android:minHeight="?actionBarSize"
android:textSize="18sp" /> android:padding="@dimen/appbar_padding"
android:text="@string/settings_title"
android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"
android:textSize="30sp" />
<TextView <com.finnmglas.launcher.FontAwesomeSolid
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:onClick="openFinnWebsite" android:gravity="center|right"
android:text=" Finn M Glas" android:includeFontPadding="true"
android:textColor="?attr/colorAccent" android:onClick="backHome"
android:textSize="18sp" android:paddingLeft="16sp"
tools:ignore="HardcodedText" /> android:paddingRight="16sp"
android:text="@string/fas_close_window"
<TextView android:textColor="#ffffff"
android:layout_width="wrap_content" android:textSize="22sp" />
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>
</androidx.constraintlayout.widget.ConstraintLayout> <com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimaryDark" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -0,0 +1,188 @@
<?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">
<TableLayout
android:id="@+id/actionschooser"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="32sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<TextView
android:id="@+id/text_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_up"
android:textColor="#ccc"
android:textSize="20sp" />
<Button
android:id="@+id/btn_choose_up"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="chooseUpApp"
android:text="@string/settings_choose_btn"
android:textAllCaps="false" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<TextView
android:id="@+id/text_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_down"
android:textColor="#ccc"
android:textSize="20sp" />
<Button
android:id="@+id/btn_choose_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="chooseDownApp"
android:text="@string/settings_choose_btn"
android:textAllCaps="false" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<TextView
android:id="@+id/text_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_left"
android:textColor="#ccc"
android:textSize="20sp" />
<Button
android:id="@+id/btn_choose_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="chooseLeftApp"
android:text="@string/settings_choose_btn"
android:textAllCaps="false" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<TextView
android:id="@+id/text_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_right"
android:textColor="#ccc"
android:textSize="20sp" />
<Button
android:id="@+id/btn_choose_right"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="chooseRightApp"
android:text="@string/settings_choose_btn"
android:textAllCaps="false" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<TextView
android:id="@+id/text_vol_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_vol_up"
android:textColor="#ccc"
android:textSize="20sp" />
<Button
android:id="@+id/btn_choose_volume_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="chooseVolumeUpApp"
android:text="@string/settings_choose_btn"
android:textAllCaps="false" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<TextView
android:id="@+id/text_vol_down"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_vol_down"
android:textColor="#ccc"
android:textSize="20sp" />
<Button
android:id="@+id/btn_choose_volume_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="chooseVolumeDownApp"
android:text="@string/settings_choose_btn"
android:textAllCaps="false" />
</TableRow>
</TableLayout>
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="chooseLaunchApp"
android:text="@string/settings_launch"
android:textAllCaps="false" />
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="chooseUninstallApp"
android:text="@string/settings_uninstall"
android:textAllCaps="false" />
</LinearLayout>

View file

@ -0,0 +1,86 @@
<?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,23 @@
<?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" /-->
</LinearLayout>

View file

@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>

View file

@ -0,0 +1,8 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="appbar_padding">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
</resources>

View file

@ -4,6 +4,7 @@
<string name="fas_home" translatable="false">&#xf015;</string> <string name="fas_home" translatable="false">&#xf015;</string>
<string name="fas_globe" translatable="false">&#xf0ac;</string> <string name="fas_globe" translatable="false">&#xf0ac;</string>
<string name="fas_settings" translatable="false">&#xf013;</string> <string name="fas_settings" translatable="false">&#xf013;</string>
<string name="fas_close_window" translatable="false">&#xf410;</string>
<string name="fas_star" translatable="false">&#xf005;</string> <string name="fas_star" translatable="false">&#xf005;</string>
<string name="far_star" translatable="false">&#xf005;</string> <string name="far_star" translatable="false">&#xf005;</string>

View file

@ -18,6 +18,13 @@
<string name="settings_sub_title1">Applications</string> <string name="settings_sub_title1">Applications</string>
<string name="settings_sub_title2">Actions</string> <string name="settings_sub_title2">Actions</string>
<string name="settings_tab_app" translatable="false">Apps</string>
<string name="settings_tab_theme" translatable="false">Theme</string>
<string name="settings_tab_launcher" translatable="false">Launcher</string>
<string name="settings_feedback" translatable="false">Give some feedback</string>
<string name="settings_show_tutorial" translatable="false">View Launcher Tutorial</string>
<string name="settings_choose_up">Swipe Up</string> <string name="settings_choose_up">Swipe Up</string>
<string name="settings_choose_down">Swipe Down</string> <string name="settings_choose_down">Swipe Down</string>
<string name="settings_choose_left">Swipe Left</string> <string name="settings_choose_left">Swipe Left</string>

View file

@ -9,4 +9,12 @@
<item name="android:windowDisablePreview">true</item> <item name="android:windowDisablePreview">true</item>
</style> </style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources> </resources>