Refractor packages and activities

To improve the structure of Launcher
This commit is contained in:
Finn M Glas 2020-06-16 16:24:52 +02:00
parent f6fdd70995
commit e728fca0ee
No known key found for this signature in database
GPG key ID: 902A30146014DFBF
25 changed files with 54 additions and 47 deletions

View file

@ -24,15 +24,15 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TutorialActivity"
<activity android:name=".tutorial.TutorialActivity"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity">
</activity>
<activity android:name=".ChooseActivity"
<activity android:name=".choose.ChooseActivity"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity">
</activity>
<activity android:name=".SettingsActivity"
<activity android:name=".settings.SettingsActivity"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity">
</activity>

View file

@ -11,8 +11,9 @@ import android.view.*
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.GestureDetectorCompat
import androidx.recyclerview.widget.RecyclerView
import com.finnmglas.launcher.choose.AppsRecyclerAdapter
import com.finnmglas.launcher.choose.apps.AppsRecyclerAdapter
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.tutorial.TutorialActivity
import kotlinx.android.synthetic.main.activity_main.*
import java.text.SimpleDateFormat
import java.util.*
@ -82,7 +83,9 @@ class MainActivity : AppCompatActivity(),
activity_main_settings_icon.setOnClickListener() { openSettings(this) }
// Load apps list first - speed up settings that way
AsyncTask.execute { viewAdapter = AppsRecyclerAdapter( this, "", "") }
AsyncTask.execute { viewAdapter =
AppsRecyclerAdapter(this, "", "")
}
// First Startup
if (!sharedPref.getBoolean("startedBefore", false)){

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher
package com.finnmglas.launcher.choose
import android.app.Activity
import android.content.Intent
@ -8,8 +8,9 @@ import android.view.WindowManager
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager.widget.ViewPager
import com.finnmglas.launcher.choose.ChooseSectionsPagerAdapter
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.settings.intendedSettingsPause
import com.google.android.material.tabs.TabLayout
import kotlinx.android.synthetic.main.activity_choose.*

View file

@ -5,6 +5,8 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.finnmglas.launcher.*
import com.finnmglas.launcher.choose.apps.ChooseFragmentApps
import com.finnmglas.launcher.choose.other.ChooseFragmentOther
private val TAB_TITLES = arrayOf(
R.string.choose_tab_app,

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.choose
package com.finnmglas.launcher.choose.apps
import android.graphics.drawable.Drawable

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.choose
package com.finnmglas.launcher.choose.apps
import android.app.Activity
import android.content.Context
@ -14,7 +14,7 @@ import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.intendedChoosePause
import com.finnmglas.launcher.choose.intendedChoosePause
class AppsRecyclerAdapter(val activity: Activity, val action: String?, val forApp: String?):
RecyclerView.Adapter<AppsRecyclerAdapter.ViewHolder>() {

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.choose
package com.finnmglas.launcher.choose.apps
import android.os.Bundle
import android.view.LayoutInflater
@ -6,11 +6,10 @@ import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.finnmglas.launcher.R
import com.finnmglas.launcher.action
import com.finnmglas.launcher.choose.action
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.forApp
import com.finnmglas.launcher.choose.forApp
import kotlinx.android.synthetic.main.fragment_choose_apps.*
@ -36,7 +35,11 @@ class ChooseFragmentApps : Fragment() {
// set up the list / recycler
val viewManager = LinearLayoutManager(context)
val viewAdapter = AppsRecyclerAdapter( activity!!, action, forApp)
val viewAdapter = AppsRecyclerAdapter(
activity!!,
action,
forApp
)
fragment_choose_apps_recycler_view.apply {
// improve performance (since content changes don't change the layout size)

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.choose
package com.finnmglas.launcher.choose.other
import android.os.Bundle
import android.view.LayoutInflater
@ -7,7 +7,6 @@ import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.finnmglas.launcher.R
import com.finnmglas.launcher.choose.other.OtherRecyclerAdapter
import com.finnmglas.launcher.extern.dominantColor
import com.finnmglas.launcher.extern.getSavedTheme
import kotlinx.android.synthetic.main.fragment_choose_other.*

View file

@ -1,7 +1,6 @@
package com.finnmglas.launcher.choose.other
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
@ -10,7 +9,7 @@ import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.forApp
import com.finnmglas.launcher.choose.forApp
/* Will only be used if an app / action is picked */
class OtherRecyclerAdapter(val activity: Activity):

View file

@ -17,11 +17,10 @@ import android.view.animation.*
import android.widget.Button
import android.widget.ImageView
import android.widget.Toast
import androidx.core.content.ContextCompat.startActivity
import com.finnmglas.launcher.ChooseActivity
import com.finnmglas.launcher.choose.ChooseActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.SettingsActivity
import com.finnmglas.launcher.intendedSettingsPause
import com.finnmglas.launcher.settings.SettingsActivity
import com.finnmglas.launcher.settings.intendedSettingsPause
import kotlin.math.roundToInt

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher
package com.finnmglas.launcher.settings
import android.content.Context
import android.content.Intent
@ -9,8 +9,8 @@ import android.view.View
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager.widget.ViewPager
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.settings.SettingsSectionsPagerAdapter
import com.google.android.material.tabs.TabLayout
import kotlinx.android.synthetic.main.activity_settings.*

View file

@ -5,6 +5,9 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.finnmglas.launcher.*
import com.finnmglas.launcher.settings.actions.SettingsFragmentApps
import com.finnmglas.launcher.settings.meta.SettingsFragmentMeta
import com.finnmglas.launcher.settings.theme.SettingsFragmentTheme
private val TAB_TITLES = arrayOf(
R.string.settings_tab_app,

View file

@ -11,11 +11,11 @@ import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.finnmglas.launcher.ChooseActivity
import com.finnmglas.launcher.choose.ChooseActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.FontAwesome
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.intendedSettingsPause
import com.finnmglas.launcher.settings.intendedSettingsPause
import java.lang.Exception

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.settings
package com.finnmglas.launcher.settings.actions
import android.content.ActivityNotFoundException
import android.content.Intent
@ -10,11 +10,10 @@ import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.finnmglas.launcher.ChooseActivity
import com.finnmglas.launcher.choose.ChooseActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.intendedSettingsPause
import com.finnmglas.launcher.settings.actions.ActionsRecyclerAdapter
import com.finnmglas.launcher.settings.intendedSettingsPause
import kotlinx.android.synthetic.main.fragment_settings_apps.*

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.settings
package com.finnmglas.launcher.settings.meta
import android.app.AlertDialog
import android.content.ActivityNotFoundException
@ -13,10 +13,10 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.finnmglas.launcher.TutorialActivity
import com.finnmglas.launcher.tutorial.TutorialActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.intendedSettingsPause
import com.finnmglas.launcher.settings.intendedSettingsPause
import kotlinx.android.synthetic.main.fragment_settings_meta.*
/** The 'Meta' Tab associated Fragment in Settings */

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher.settings
package com.finnmglas.launcher.settings.theme
import android.Manifest
import android.content.Context
@ -18,9 +18,7 @@ import androidx.core.content.ContextCompat
import androidx.palette.graphics.Palette
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import com.finnmglas.launcher.intendedSettingsPause
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.activity_settings.*
import com.finnmglas.launcher.settings.intendedSettingsPause
import kotlinx.android.synthetic.main.fragment_settings_theme.*
/** The 'Theme' Tab associated Fragment in Settings */

View file

@ -1,4 +1,4 @@
package com.finnmglas.launcher
package com.finnmglas.launcher.tutorial
import android.content.Context
import android.content.SharedPreferences
@ -6,6 +6,7 @@ import android.os.Bundle
import android.util.TypedValue
import android.view.*
import androidx.appcompat.app.AppCompatActivity
import com.finnmglas.launcher.R
import com.finnmglas.launcher.extern.*
import kotlinx.android.synthetic.main.activity_tutorial.*

View file

@ -7,7 +7,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
tools:context=".ChooseActivity">
tools:context=".choose.ChooseActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/activity_choose_app_bar"

View file

@ -7,7 +7,7 @@
android:id="@+id/activity_settings_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SettingsActivity">
tools:context=".settings.SettingsActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/activity_settings_app_bar"

View file

@ -8,7 +8,7 @@
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
android:onClick="clickAnywhere"
tools:context=".TutorialActivity">
tools:context=".tutorial.TutorialActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/activity_firststartup_app_bar"

View file

@ -8,7 +8,7 @@
android:background="?attr/colorPrimary"
android:gravity="center|top"
android:orientation="vertical"
tools:context=".choose.ChooseFragmentApps">
tools:context=".choose.apps.ChooseFragmentApps">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

View file

@ -8,7 +8,7 @@
android:background="?attr/colorPrimary"
android:gravity="center|top"
android:orientation="vertical"
tools:context=".choose.ChooseFragmentOther">
tools:context=".choose.other.ChooseFragmentOther">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

View file

@ -11,7 +11,7 @@
android:paddingLeft="32sp"
android:paddingTop="16sp"
android:paddingRight="32sp"
tools:context=".settings.SettingsFragmentApps">
tools:context=".settings.actions.SettingsFragmentApps">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

View file

@ -12,7 +12,7 @@
android:paddingLeft="32sp"
android:paddingTop="16sp"
android:paddingRight="32sp"
tools:context=".settings.SettingsFragmentMeta">
tools:context=".settings.meta.SettingsFragmentMeta">
<Button
android:id="@+id/fragment_settings_meta_select_launcher_btn"

View file

@ -13,7 +13,7 @@
android:paddingLeft="32sp"
android:paddingTop="16sp"
android:paddingRight="32sp"
tools:context=".settings.SettingsFragmentMeta">
tools:context=".settings.meta.SettingsFragmentMeta">
<ScrollView
android:layout_width="match_parent"