mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 14:31:30 +01:00
Create Fragments for settings
One fragment for every tab, openable with a swipe. The middle tab 'theme' still has to be filled.
This commit is contained in:
parent
abd7a44874
commit
716839e1b9
9 changed files with 347 additions and 2 deletions
|
@ -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'
|
||||||
|
|
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,6 +18,9 @@ class SectionsPagerAdapter(private val context: Context, fm: FragmentManager)
|
||||||
|
|
||||||
override fun getItem(position: Int): Fragment {
|
override fun getItem(position: Int): Fragment {
|
||||||
return when (position){
|
return when (position){
|
||||||
|
0 -> SettingsFragmentApps()
|
||||||
|
1 -> SettingsFragmentTheme()
|
||||||
|
2 -> SettingsFragmentLauncher()
|
||||||
else -> Fragment()
|
else -> Fragment()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<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:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/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">
|
||||||
|
@ -25,7 +26,8 @@
|
||||||
android:minHeight="?actionBarSize"
|
android:minHeight="?actionBarSize"
|
||||||
android:padding="@dimen/appbar_padding"
|
android:padding="@dimen/appbar_padding"
|
||||||
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" />
|
||||||
|
|
||||||
<com.finnmglas.launcher.FontAwesomeSolid
|
<com.finnmglas.launcher.FontAwesomeSolid
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -51,6 +53,5 @@
|
||||||
android:id="@+id/view_pager"
|
android:id="@+id/view_pager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/colorPrimary"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
188
app/src/main/res/layout/fragment_settings_apps.xml
Normal file
188
app/src/main/res/layout/fragment_settings_apps.xml
Normal 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>
|
69
app/src/main/res/layout/fragment_settings_launcher.xml
Normal file
69
app/src/main/res/layout/fragment_settings_launcher.xml
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<?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="resetSettingsClick"
|
||||||
|
android:text="@string/settings_reset"
|
||||||
|
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>
|
23
app/src/main/res/layout/fragment_settings_theme.xml
Normal file
23
app/src/main/res/layout/fragment_settings_theme.xml
Normal 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>
|
Loading…
Add table
Reference in a new issue