Parcourir la source

Merge branch 'master' into website

# Conflicts:
#	docs/index.html
#	docs/main.css
beautusg il y a 7 ans
Parent
commit
27d2630b4f
100 fichiers modifiés avec 1702 ajouts et 3167 suppressions
  1. 3 10
      README.md
  2. 7 11
      app/build.gradle
  3. BIN
      app/release/app.aab
  4. 12 12
      app/src/androidTest/java/com/sduduzog/slimlauncher/DBTest.kt
  5. 0 38
      app/src/androidTest/java/com/sduduzog/slimlauncher/DataRepositoryTest.kt
  6. 0 77
      app/src/androidTest/java/com/sduduzog/slimlauncher/SetupFragmentTest.kt
  7. 38 0
      app/src/androidTest/java/com/sduduzog/slimlauncher/TasksFragmentTest.kt
  8. 9 0
      app/src/main/AndroidManifest.xml
  9. 45 78
      app/src/main/java/com/sduduzog/slimlauncher/MainActivity.kt
  10. 0 5
      app/src/main/java/com/sduduzog/slimlauncher/Observer.kt
  11. 0 7
      app/src/main/java/com/sduduzog/slimlauncher/Subject.kt
  12. 44 0
      app/src/main/java/com/sduduzog/slimlauncher/adapters/AddAppAdapter.kt
  13. 93 0
      app/src/main/java/com/sduduzog/slimlauncher/adapters/CustomAppsAdapter.kt
  14. 47 0
      app/src/main/java/com/sduduzog/slimlauncher/adapters/HomeAdapter.kt
  15. 0 16
      app/src/main/java/com/sduduzog/slimlauncher/data/App.kt
  16. 0 34
      app/src/main/java/com/sduduzog/slimlauncher/data/AppDao.kt
  17. 21 0
      app/src/main/java/com/sduduzog/slimlauncher/data/BaseDao.kt
  18. 84 0
      app/src/main/java/com/sduduzog/slimlauncher/data/BaseDatabase.kt
  19. 0 163
      app/src/main/java/com/sduduzog/slimlauncher/data/DataRepository.kt
  20. 0 64
      app/src/main/java/com/sduduzog/slimlauncher/data/DataRoomDatabase.kt
  21. 37 0
      app/src/main/java/com/sduduzog/slimlauncher/data/MainViewModel.kt
  22. 0 21
      app/src/main/java/com/sduduzog/slimlauncher/data/Note.kt
  23. 0 20
      app/src/main/java/com/sduduzog/slimlauncher/data/NoteDao.kt
  24. 0 38
      app/src/main/java/com/sduduzog/slimlauncher/data/PopulateDatabaseTask.kt
  25. 54 0
      app/src/main/java/com/sduduzog/slimlauncher/data/Repository.kt
  26. 7 0
      app/src/main/java/com/sduduzog/slimlauncher/data/model/App.kt
  27. 8 2
      app/src/main/java/com/sduduzog/slimlauncher/data/model/HomeApp.kt
  28. 9 8
      app/src/main/java/com/sduduzog/slimlauncher/dialogs/ChangeThemeDialog.kt
  29. 40 0
      app/src/main/java/com/sduduzog/slimlauncher/dialogs/ChooseTimeFormatDialog.kt
  30. 57 0
      app/src/main/java/com/sduduzog/slimlauncher/dialogs/RenameAppDialog.kt
  31. 0 28
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/AboutFragment.kt
  32. 0 25
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/DoubleClickListener.kt
  33. 0 73
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/HomeAppsAdapter.kt
  34. 185 0
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/HomeFragment.kt
  35. 0 245
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/MainFragment.kt
  36. 0 57
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/MainViewModel.kt
  37. 0 40
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/StatusBarThemeFragment.kt
  38. 0 123
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/notes/NoteFragment.kt
  39. 0 97
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/notes/NotesListAdapter.kt
  40. 0 69
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/notes/NotesListFragment.kt
  41. 0 32
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/notes/NotesViewModel.kt
  42. 0 51
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/AppsFragment.kt
  43. 0 67
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/AppsListAdapter.kt
  44. 0 41
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/RenameAppDialog.kt
  45. 0 100
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/SettingsFragment.kt
  46. 0 138
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/SettingsListAdapter.kt
  47. 0 82
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/ChooseAppsDialog.kt
  48. 0 5
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/OnPagerListener.kt
  49. 0 7
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/PagerHelperFragment.kt
  50. 0 72
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/SetupFragment.kt
  51. 0 49
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/SplashFragment.kt
  52. 0 62
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/ThemeSetupFragment.kt
  53. 79 0
      app/src/main/java/com/sduduzog/slimlauncher/ui/options/AddAppFragment.kt
  54. 135 0
      app/src/main/java/com/sduduzog/slimlauncher/ui/options/CustomiseAppsFragment.kt
  55. 61 0
      app/src/main/java/com/sduduzog/slimlauncher/ui/options/OptionsFragment.kt
  56. 65 0
      app/src/main/java/com/sduduzog/slimlauncher/utils/BaseFragment.kt
  57. 45 0
      app/src/main/java/com/sduduzog/slimlauncher/utils/HomeWatcher.kt
  58. 61 0
      app/src/main/java/com/sduduzog/slimlauncher/utils/LoadInstalledApps.kt
  59. 7 0
      app/src/main/java/com/sduduzog/slimlauncher/utils/OnAppClickedListener.kt
  60. 1 1
      app/src/main/java/com/sduduzog/slimlauncher/utils/OnItemActionListener.kt
  61. 8 0
      app/src/main/java/com/sduduzog/slimlauncher/utils/OnLaunchAppListener.kt
  62. 9 0
      app/src/main/java/com/sduduzog/slimlauncher/utils/OnShitDoneToAppsListener.kt
  63. 0 9
      app/src/main/res/drawable-v21/ic_call.xml
  64. 0 9
      app/src/main/res/drawable-v21/ic_drag_handle.xml
  65. 0 9
      app/src/main/res/drawable-v21/ic_expand.xml
  66. 0 12
      app/src/main/res/drawable-v21/ic_photo_camera.xml
  67. 1 1
      app/src/main/res/drawable/ic_call.xml
  68. 0 9
      app/src/main/res/drawable/ic_drag_handle.xml
  69. 0 9
      app/src/main/res/drawable/ic_edit.xml
  70. 0 9
      app/src/main/res/drawable/ic_expand.xml
  71. 9 0
      app/src/main/res/drawable/ic_more_vert.xml
  72. 0 3
      app/src/main/res/drawable/ic_my_phone.xml
  73. 2 2
      app/src/main/res/drawable/ic_photo_camera.xml
  74. 0 12
      app/src/main/res/drawable/ic_slim.xml
  75. 0 9
      app/src/main/res/drawable/ic_text_fields.xml
  76. 0 14
      app/src/main/res/drawable/note_item_background.xml
  77. 59 0
      app/src/main/res/layout/add_app_fragment.xml
  78. 10 0
      app/src/main/res/layout/add_app_fragment_list_item.xml
  79. 0 11
      app/src/main/res/layout/apps_fragment.xml
  80. 0 13
      app/src/main/res/layout/apps_list_item.xml
  81. 66 0
      app/src/main/res/layout/customise_apps_fragment.xml
  82. 53 0
      app/src/main/res/layout/customise_apps_fragment_list_item.xml
  83. 85 0
      app/src/main/res/layout/home_fragment.xml
  84. 0 134
      app/src/main/res/layout/main_bottom_sheet.xml
  85. 0 77
      app/src/main/res/layout/main_content.xml
  86. 0 13
      app/src/main/res/layout/main_fragment.xml
  87. 12 0
      app/src/main/res/layout/main_fragment_list_item.xml
  88. 0 17
      app/src/main/res/layout/main_list_item.xml
  89. 0 73
      app/src/main/res/layout/note_fragment.xml
  90. 0 38
      app/src/main/res/layout/notes_list_fragment.xml
  91. 0 35
      app/src/main/res/layout/notes_list_item.xml
  92. 99 0
      app/src/main/res/layout/options_fragment.xml
  93. 2 1
      app/src/main/res/layout/rename_dialog_edit_text.xml
  94. 0 193
      app/src/main/res/layout/settings_fragment.xml
  95. 0 67
      app/src/main/res/layout/settings_list_item.xml
  96. 0 6
      app/src/main/res/layout/setup_fragment.xml
  97. 0 77
      app/src/main/res/layout/splash_fragment.xml
  98. 0 188
      app/src/main/res/layout/theme_setup_fragment.xml
  99. 10 0
      app/src/main/res/menu/customise_apps_popup_menu.xml
  100. 23 49
      app/src/main/res/navigation/nav_graph.xml

+ 3 - 10
README.md

@@ -24,17 +24,10 @@
 If you think you can come up with a better description, shoot me an email! I'm horrible at this marketing thing
 
 ## Milestones to reach
-- [x] Release on Google Play _(release the kraken!)_
-- [x] Variety of themes
-- [x] Clean up README _...continuous_.
-- [ ] Journal (text and audio)
-- [ ] Gesture controls for home screen modes
-- [ ] Tasks (like journal but better)
-- [X] Figure out whether to fully adopt Material Design or continue mixing with flat principles. Open an issue...if there is one. **EDIT** _Flat_ design is good
-- [X] Tests and README badges **!important;**
+- [X] Gesture controls for home screen modes
+- [X]README badges **!important;**
 - [ ] Landing page for the app.
-- [ ] A tutorial series in how to build an android launcher
-- [ ] App usage analytics. Offline of course
+- [ ] Phase 2 basically of this app. see https://github.com/sduduzog/slim-launcher/issues/14
 
 # Contributions
 

+ 7 - 11
app/build.gradle

@@ -12,8 +12,8 @@ android {
         applicationId "com.sduduzog.slimlauncher"
         minSdkVersion 16
         targetSdkVersion 28
-        versionCode 30
-        versionName "2.2.8"
+        versionCode 37
+        versionName "2.3.2"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         vectorDrawables.useSupportLibrary = true
     }
@@ -39,19 +39,15 @@ dependencies {
 
     // Support Libraries
     implementation 'androidx.appcompat:appcompat:1.0.2'
-    implementation 'androidx.cardview:cardview:1.0.0'
     implementation 'androidx.recyclerview:recyclerview:1.0.0'
-    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
-
-    // Google Libraries
-    implementation 'com.google.android.material:material:1.0.0'
+    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha5'
 
     // Arch Components
-    implementation 'androidx.core:core-ktx:1.1.0-alpha05'
+    implementation 'androidx.core:core-ktx:1.1.0-beta01'
     implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
     implementation 'android.arch.navigation:navigation-fragment:1.0.0'
-    implementation 'androidx.room:room-runtime:2.1.0-alpha06'
-    kapt "androidx.room:room-compiler:2.1.0-alpha06"
+    implementation 'androidx.room:room-runtime:2.1.0-beta01'
+    kapt "androidx.room:room-compiler:2.1.0-beta01"
     kapt "androidx.lifecycle:lifecycle-compiler:2.0.0"
 
     //3rd party libs
@@ -61,7 +57,7 @@ dependencies {
     // Test libs
     testImplementation 'junit:junit:4.12'
     testImplementation 'org.mockito:mockito-core:2.19.0'
-    androidTestImplementation 'androidx.room:room-testing:2.1.0-alpha06'
+    androidTestImplementation 'androidx.room:room-testing:2.1.0-beta01'
     androidTestImplementation 'androidx.test:runner:1.1.1'
     androidTestImplementation 'androidx.test:rules:1.1.1'
     androidTestImplementation 'androidx.annotation:annotation:1.0.2'

BIN
app/release/app.aab


+ 12 - 12
app/src/androidTest/java/com/sduduzog/slimlauncher/DBTest.kt

@@ -5,9 +5,9 @@ import androidx.lifecycle.Observer
 import androidx.room.Room
 import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
 import androidx.test.platform.app.InstrumentationRegistry
-import com.sduduzog.slimlauncher.data.App
-import com.sduduzog.slimlauncher.data.AppDao
-import com.sduduzog.slimlauncher.data.DataRoomDatabase
+import com.sduduzog.slimlauncher.data.BaseDao
+import com.sduduzog.slimlauncher.data.BaseDatabase
+import com.sduduzog.slimlauncher.data.model.HomeApp
 import org.hamcrest.CoreMatchers.equalTo
 import org.junit.After
 import org.junit.Assert.assertThat
@@ -21,8 +21,8 @@ import java.util.concurrent.TimeUnit
 @RunWith(AndroidJUnit4ClassRunner::class)
 class DBTest {
 
-    private var mAppDao: AppDao? = null
-    private var mDb: DataRoomDatabase? = null
+    private var baseDao: BaseDao? = null
+    private var mDb: BaseDatabase? = null
 
     @get:Rule
     var instantTaskExecutorRule = InstantTaskExecutorRule()
@@ -30,8 +30,8 @@ class DBTest {
     @Before
     fun createDb() {
         val context = InstrumentationRegistry.getInstrumentation().targetContext
-        mDb = Room.inMemoryDatabaseBuilder(context, DataRoomDatabase::class.java).build()
-        mAppDao = mDb!!.appDao()
+        mDb = Room.inMemoryDatabaseBuilder(context, BaseDatabase::class.java).build()
+        baseDao = mDb!!.baseDao()
     }
 
     @After
@@ -42,16 +42,16 @@ class DBTest {
     @Test
     @Throws(InterruptedException::class)
     fun testInsertLiveDataApps() {
-        val app = App("TestApp", "com.test.test.app", "TestMainActivity")
-        mAppDao!!.insert(app)
+        val app = HomeApp("TestApp", "com.test.test.app", "TestMainActivity", 0)
+        baseDao!!.add(app)
 
-        var appsInstalled: List<App> = listOf()
+        var appsInstalled: List<HomeApp> = listOf()
 
         val latch = CountDownLatch(1)
 
-        val appsLiveData = mAppDao!!.apps
+        val appsLiveData = baseDao!!.apps
 
-        val observer = Observer<List<App>> {
+        val observer = Observer<List<HomeApp>> {
             appsInstalled = it
             latch.countDown()
         }

+ 0 - 38
app/src/androidTest/java/com/sduduzog/slimlauncher/DataRepositoryTest.kt

@@ -1,38 +0,0 @@
-package com.sduduzog.slimlauncher
-
-import android.app.Application
-import androidx.test.filters.LargeTest
-import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
-import androidx.test.platform.app.InstrumentationRegistry
-import com.sduduzog.slimlauncher.data.DataRepository
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-
-
-@LargeTest
-@RunWith(AndroidJUnit4ClassRunner::class)
-class DataRepositoryTest {
-
-    private var repository: DataRepository? = null
-
-    @Before
-    fun createRepository(){
-        val context = InstrumentationRegistry.getInstrumentation().targetContext.applicationContext
-        repository = DataRepository.getInstance(context as Application)
-    }
-
-    @After
-    fun closeRepository(){
-        repository = null
-    }
-
-    @Test
-    fun assertList(){
-        val list = listOf(1, 2, 3, 4, 5)
-        val newList = list.distinctBy {
-            it == 2
-        }
-    }
-}

+ 0 - 77
app/src/androidTest/java/com/sduduzog/slimlauncher/SetupFragmentTest.kt

@@ -1,77 +0,0 @@
-package com.sduduzog.slimlauncher
-
-
-import android.content.Context.MODE_PRIVATE
-import android.content.SharedPreferences
-import androidx.test.espresso.Espresso.onView
-import androidx.test.espresso.action.ViewActions
-import androidx.test.espresso.action.ViewActions.click
-import androidx.test.espresso.assertion.ViewAssertions.matches
-import androidx.test.espresso.matcher.RootMatchers
-import androidx.test.espresso.matcher.ViewMatchers.*
-import androidx.test.filters.LargeTest
-import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
-import androidx.test.platform.app.InstrumentationRegistry
-import androidx.test.rule.ActivityTestRule
-import org.hamcrest.CoreMatchers.allOf
-import org.hamcrest.Matchers
-import org.junit.Before
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@LargeTest
-@RunWith(AndroidJUnit4ClassRunner::class)
-class SetupFragmentTest {
-
-    @Rule
-    @JvmField
-    var mActivityTestRule = ActivityTestRule(MainActivity::class.java)
-
-    private lateinit var sharedPreferences: SharedPreferences
-
-    @Before
-    fun clearPreferences() {
-        val context = InstrumentationRegistry.getInstrumentation().targetContext
-        sharedPreferences = context.getSharedPreferences(context.getString(R.string.prefs_settings), MODE_PRIVATE)
-        sharedPreferences.edit().clear().commit()
-    }
-
-
-    @Test
-    fun isAlertDialogShown() {
-        val appCompatButton = onView(
-                allOf(withText(R.string.setup_button_start), isDisplayed()))
-        appCompatButton.perform(click())
-
-
-        val frameLayout = onView(
-                allOf(withId(android.R.id.content), isDisplayed()))
-        frameLayout.check(matches(isDisplayed()))
-
-        val alertDialogTitle = onView(
-                allOf(withText(R.string.choose_apps_title)))
-        alertDialogTitle.check(matches(isDisplayed()))
-    }
-
-    @Test
-    fun isStartButtonShown() {
-        val button = onView(allOf(withText(R.string.setup_button_start)))
-        button.check(matches(isDisplayed()))
-    }
-
-    @Test
-    fun noAppsSelected() {
-        val startButton = onView(allOf(withText(R.string.setup_button_start)))
-        startButton.perform(click())
-
-        val appCompatButton2 = onView(
-                allOf(withText("DONE")))
-        appCompatButton2.perform(ViewActions.scrollTo(), click())
-
-        onView(withText(R.string.no_app_selected_toast_msg)).inRoot(
-                RootMatchers.withDecorView(Matchers.not(Matchers.`is`(mActivityTestRule.activity.window.decorView))))
-                .check(matches(isDisplayed()))
-    }
-
-}

+ 38 - 0
app/src/androidTest/java/com/sduduzog/slimlauncher/TasksFragmentTest.kt

@@ -0,0 +1,38 @@
+package com.sduduzog.slimlauncher
+
+
+import android.view.KeyEvent
+import androidx.test.espresso.Espresso.onView
+import androidx.test.espresso.action.ViewActions.*
+import androidx.test.espresso.assertion.ViewAssertions.matches
+import androidx.test.espresso.matcher.ViewMatchers.*
+import androidx.test.filters.LargeTest
+import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
+import androidx.test.rule.ActivityTestRule
+import org.hamcrest.CoreMatchers.allOf
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@LargeTest
+@RunWith(AndroidJUnit4ClassRunner::class)
+class TasksFragmentTest {
+
+    @Rule
+    @JvmField
+    var mActivityTestRule = ActivityTestRule(MainActivity::class.java)
+
+    @Test
+    fun userCanAddTask() {
+        val taskButton = onView(allOf(withText(R.string.home_fragment_tasks), isDisplayed()))
+        taskButton.perform(click())
+        val inputField = onView(allOf(withHint(R.string.tasks_fragment_enter_a_new_task), isDisplayed()))
+
+        inputField.perform(typeText("Testing"))
+        inputField.perform(pressKey(KeyEvent.KEYCODE_ENTER))
+
+        val checkBox = onView(allOf(withText("Testing"), isDisplayed()))
+
+        checkBox.check(matches(isNotChecked()))
+    }
+}

+ 9 - 0
app/src/main/AndroidManifest.xml

@@ -28,6 +28,15 @@
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
+        <provider
+            android:name="androidx.core.content.FileProvider"
+            android:authorities="@string/app_authority_for_file_provider"
+            android:exported="false"
+            android:grantUriPermissions="true">
+            <meta-data
+                android:name="android.support.FILE_PROVIDER_PATHS"
+                android:resource="@xml/filepaths" />
+        </provider>
     </application>
 
 </manifest>

+ 45 - 78
app/src/main/java/com/sduduzog/slimlauncher/MainActivity.kt

@@ -1,46 +1,38 @@
 package com.sduduzog.slimlauncher
 
-import android.content.Intent
 import android.content.SharedPreferences
 import android.content.res.Resources
 import android.os.Bundle
 import android.view.View
-import android.widget.Toast
 import androidx.appcompat.app.AppCompatActivity
-import androidx.lifecycle.ViewModelProviders
 import androidx.navigation.NavController
-import androidx.navigation.NavDestination
 import androidx.navigation.Navigation.findNavController
-import com.sduduzog.slimlauncher.ui.main.MainViewModel
+import com.sduduzog.slimlauncher.utils.BaseFragment
+import com.sduduzog.slimlauncher.utils.HomeWatcher
 
 
-class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceChangeListener, NavController.OnDestinationChangedListener {
+class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceChangeListener, HomeWatcher.OnHomePressedListener {
 
     private lateinit var settings: SharedPreferences
-    private val label = "main_fragment"
-    private lateinit var currentLabel: String
-    private lateinit var viewModel: MainViewModel
     private lateinit var navigator: NavController
-    var onBackPressedListener: OnBackPressedListener? = null
+    private lateinit var homeWatcher: HomeWatcher
+    private val subscribers: MutableSet<BaseFragment> = mutableSetOf()
 
+    fun attachSubscriber(s: BaseFragment) {
+        subscribers.add(s)
+    }
 
-    var dispatcher: Subject = object : Subject() {
-
-        var observers: MutableSet<Observer> = mutableSetOf()
-        override fun attachObserver(o: Observer) {
-            observers.add(o)
-        }
-
-        override fun detachObserver(o: Observer) {
-            observers.remove(o)
-        }
+    fun detachSubscriber(s: BaseFragment) {
+        subscribers.remove(s)
+    }
 
-        override fun notifyObservers() {
-            for (o in observers) {
-                o.update("onBackPressed")
-            }
-        }
+    private fun dispatchBack() {
+        for (s in subscribers) if (s.onBack()) return
+        completeBackAction()
+    }
 
+    private fun dispatchHome() {
+        for (s in subscribers) s.onHome()
     }
 
     override fun onCreate(savedInstanceState: Bundle?) {
@@ -49,13 +41,8 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
         settings = getSharedPreferences(getString(R.string.prefs_settings), MODE_PRIVATE)
         settings.registerOnSharedPreferenceChangeListener(this)
         navigator = findNavController(this, R.id.nav_host_fragment)
-        navigator.addOnDestinationChangedListener(this)
-        viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java)
-    }
-
-    override fun onStart() {
-        super.onStart()
-        viewModel.refreshApps()
+        homeWatcher = HomeWatcher(this)
+        homeWatcher.setOnHomePressedListener(this)
     }
 
     override fun onResume() {
@@ -64,6 +51,16 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
         toggleStatusBar()
     }
 
+    override fun onStart() {
+        super.onStart()
+        homeWatcher.startWatch()
+    }
+
+    override fun onStop() {
+        super.onStop()
+        homeWatcher.stopWatch()
+    }
+
     override fun onWindowFocusChanged(hasFocus: Boolean) {
         super.onWindowFocusChanged(hasFocus)
         if (hasFocus) toggleStatusBar()
@@ -74,7 +71,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
         if (s.equals(getString(R.string.prefs_settings_key_theme), true)) {
             recreate()
         }
-        if (s.equals(getString(R.string.prefs_settings_key_hide_status_bar), true)) {
+        if (s.equals(getString(R.string.prefs_settings_key_toggle_status_bar), true)) {
             toggleStatusBar()
         }
     }
@@ -88,42 +85,25 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
     }
 
     override fun onBackPressed() {
-        dispatcher.notifyObservers()
-        if (currentLabel != label)
-            super.onBackPressed()
-        else onBackPressedListener?.onBackPress()
+        dispatchBack()
     }
 
-    /**
-     * Make the activity aware of the current destination in our NavController.
-     */
-    override fun onDestinationChanged(controller: NavController, destination: NavDestination, arguments: Bundle?) {
-        currentLabel = destination.label.toString()
-    }
-
-    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
-        if (requestCode == REQUEST_CODE_ENABLE_ADMIN) {
-            if (resultCode == RESULT_OK) {
-                Toast.makeText(applicationContext, "Registered As Admin", Toast.LENGTH_SHORT).show()
-            } else {
-                Toast.makeText(applicationContext, "Failed to register as Admin", Toast.LENGTH_SHORT).show()
-            }
-        }
+    override fun onHomePressed() {
+        dispatchHome()
+        navigator.popBackStack(R.id.homeFragment, false)
     }
 
     private fun showSystemUI() {
-        window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
-                or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
+        window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
     }
 
     private fun hideSystemUI() {
         window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
-                or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                 or View.SYSTEM_UI_FLAG_FULLSCREEN)
     }
 
     private fun toggleStatusBar() {
-        val isHidden = settings.getBoolean(getString(R.string.prefs_settings_key_hide_status_bar), false)
+        val isHidden = settings.getBoolean(getString(R.string.prefs_settings_key_toggle_status_bar), false)
         if (isHidden) {
             hideSystemUI()
         } else {
@@ -134,31 +114,18 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
     companion object {
 
         fun resolveTheme(i: Int): Int {
-            when (i) {
-                1 -> {
-                    return R.style.AppDarkTheme
-                }
-                2 -> {
-                    return R.style.AppGreyTheme
-                }
-                3 -> {
-                    return R.style.AppTealTheme
-                }
-                4 -> {
-                    return R.style.AppCandyTheme
-                }
-                5 -> {
-                    return R.style.AppPinkTheme
-                }
+            return when (i) {
+                1 -> R.style.AppDarkTheme
+                2 -> R.style.AppGreyTheme
+                3 -> R.style.AppTealTheme
+                4 -> R.style.AppCandyTheme
+                5 -> R.style.AppPinkTheme
+                else -> R.style.AppTheme
             }
-            return R.style.AppTheme
         }
-
-        const val REQUEST_CODE_ENABLE_ADMIN = 1
     }
 
-    interface OnBackPressedListener {
-        fun onBackPress()
-        fun onBackPressed()
+    private fun completeBackAction() {
+        super.onBackPressed()
     }
 }

+ 0 - 5
app/src/main/java/com/sduduzog/slimlauncher/Observer.kt

@@ -1,5 +0,0 @@
-package com.sduduzog.slimlauncher
-
-interface Observer {
-    fun update(on: String)
-}

+ 0 - 7
app/src/main/java/com/sduduzog/slimlauncher/Subject.kt

@@ -1,7 +0,0 @@
-package com.sduduzog.slimlauncher
-
-abstract class Subject {
-    abstract fun attachObserver(o: Observer)
-    abstract fun detachObserver(o: Observer)
-    abstract fun notifyObservers()
-}

+ 44 - 0
app/src/main/java/com/sduduzog/slimlauncher/adapters/AddAppAdapter.kt

@@ -0,0 +1,44 @@
+package com.sduduzog.slimlauncher.adapters
+
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.sduduzog.slimlauncher.R
+import com.sduduzog.slimlauncher.data.model.App
+import com.sduduzog.slimlauncher.utils.OnAppClickedListener
+
+class AddAppAdapter(private val listener: OnAppClickedListener) : RecyclerView.Adapter<AddAppAdapter.ViewHolder>() {
+
+    private var apps: List<App> = listOf()
+
+    override fun getItemCount(): Int = apps.size
+
+    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
+        val item = apps[position]
+        holder.appName.text = item.appName
+        holder.itemView.setOnClickListener {
+            listener.onAppClicked(item)
+        }
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+        val view = LayoutInflater.from(parent.context).inflate(R.layout.add_app_fragment_list_item, parent, false)
+        return ViewHolder(view)
+    }
+
+    fun setItems(apps: List<App>){
+        this.apps = apps
+        notifyDataSetChanged()
+    }
+
+    inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+
+        val appName: TextView = itemView.findViewById(R.id.aa_list_item_app_name)
+
+        override fun toString(): String {
+            return super.toString() + " '${appName.text}'"
+        }
+    }
+}

+ 93 - 0
app/src/main/java/com/sduduzog/slimlauncher/adapters/CustomAppsAdapter.kt

@@ -0,0 +1,93 @@
+package com.sduduzog.slimlauncher.adapters
+
+import android.annotation.SuppressLint
+import android.view.LayoutInflater
+import android.view.MotionEvent
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.ItemTouchHelper
+import androidx.recyclerview.widget.RecyclerView
+import com.sduduzog.slimlauncher.R
+import com.sduduzog.slimlauncher.data.model.HomeApp
+import com.sduduzog.slimlauncher.utils.OnItemActionListener
+import com.sduduzog.slimlauncher.utils.OnShitDoneToAppsListener
+
+class CustomAppsAdapter(private val listener: OnShitDoneToAppsListener) : RecyclerView.Adapter<CustomAppsAdapter.ViewHolder>(), OnItemActionListener {
+
+    private var apps: MutableList<HomeApp> = mutableListOf()
+    private lateinit var touchHelper: ItemTouchHelper
+
+    override fun getItemCount(): Int = apps.size
+
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+        val view = LayoutInflater.from(parent.context).inflate(R.layout.customise_apps_fragment_list_item, parent, false)
+        return ViewHolder(view)
+    }
+
+    @SuppressLint("ClickableViewAccessibility")
+    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
+        val item = apps[position]
+        holder.appName.text = item.appName
+        holder.dragHandle.setOnTouchListener { _, motionEvent ->
+            if (motionEvent.actionMasked == MotionEvent.ACTION_DOWN) {
+                touchHelper.startDrag(holder)
+            }
+            false
+        }
+        holder.menuIcon.setOnClickListener {
+            listener.onAppMenuClicked(it, item)
+        }
+    }
+
+    fun setItems(apps: List<HomeApp>) {
+        this.apps = sanitiseIndexes(apps) as MutableList<HomeApp>
+        notifyDataSetChanged()
+    }
+
+    private fun sanitiseIndexes(apps: List<HomeApp>): List<HomeApp> {
+        for (i in apps.indices) {
+            apps[i].sortingIndex = i
+        }
+        return apps
+    }
+
+    fun setItemTouchHelper(touchHelper: ItemTouchHelper) {
+        this.touchHelper = touchHelper
+    }
+
+    override fun onViewMoved(oldPosition: Int, newPosition: Int): Boolean {
+        if ((oldPosition < apps.size) and (newPosition < apps.size)) {
+            val app1 = apps[oldPosition]
+            val app2 = apps[newPosition]
+            app1.sortingIndex = newPosition
+            app2.sortingIndex = oldPosition
+
+            apps[oldPosition] = app2
+            apps[newPosition] = app1
+            notifyItemMoved(oldPosition, newPosition)
+            return true
+        }
+        return false
+    }
+
+
+    override fun onViewIdle() {
+        listener.onAppsUpdated(apps)
+    }
+
+    override fun onViewSwiped(position: Int) {
+        // Do nothing. We are under attack!
+    }
+
+    inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+        val dragHandle: TextView = itemView.findViewById(R.id.ca_list_item_drag_handle)
+        val appName: TextView = itemView.findViewById(R.id.ca_list_item_app_name)
+        val menuIcon: ImageView = itemView.findViewById(R.id.ca_list_item_more_icon)
+
+        override fun toString(): String {
+            return super.toString() + " '${appName.text}'"
+        }
+    }
+}

+ 47 - 0
app/src/main/java/com/sduduzog/slimlauncher/adapters/HomeAdapter.kt

@@ -0,0 +1,47 @@
+package com.sduduzog.slimlauncher.adapters
+
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.sduduzog.slimlauncher.R
+import com.sduduzog.slimlauncher.data.model.HomeApp
+import com.sduduzog.slimlauncher.utils.OnLaunchAppListener
+
+
+class HomeAdapter(private val listener: OnLaunchAppListener)
+    : RecyclerView.Adapter<HomeAdapter.ViewHolder>() {
+
+    private var apps: List<HomeApp> = listOf()
+
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+        val view = LayoutInflater.from(parent.context)
+                .inflate(R.layout.main_fragment_list_item, parent, false)
+        return ViewHolder(view)
+    }
+
+    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
+        val item = apps.elementAt(position)
+        holder.mLabelView.text = item.appName
+        holder.mLabelView.setOnClickListener {
+            listener.onLaunch(item, it)
+        }
+    }
+
+    override fun getItemCount(): Int = apps.size
+
+    fun setItems(list: List<HomeApp>) {
+        this.apps = list
+        notifyDataSetChanged()
+    }
+
+
+    inner class ViewHolder(mView: View) : RecyclerView.ViewHolder(mView) {
+        val mLabelView: TextView = mView.findViewById(R.id.home_fragment_list_item_app_name)
+
+        override fun toString(): String {
+            return super.toString() + " '" + mLabelView.text + "'"
+        }
+    }
+}

+ 0 - 16
app/src/main/java/com/sduduzog/slimlauncher/data/App.kt

@@ -1,16 +0,0 @@
-package com.sduduzog.slimlauncher.data
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-
-@Entity(tableName = "apps")
-data class App(
-        @field:ColumnInfo(name = "app_name")
-        var appName: String,
-        @PrimaryKey
-        @field:ColumnInfo(name = "package_name")
-        var packageName: String,
-        @field:ColumnInfo(name = "activity_name")
-        var activityName: String
-)

+ 0 - 34
app/src/main/java/com/sduduzog/slimlauncher/data/AppDao.kt

@@ -1,34 +0,0 @@
-package com.sduduzog.slimlauncher.data
-
-import androidx.lifecycle.LiveData
-import androidx.room.*
-
-@Dao
-interface AppDao {
-
-
-    @get:Query("SELECT * FROM apps WHERE package_name NOT IN (SELECT apps.package_name from apps JOIN home_apps ON home_apps.package_name=apps.package_name) ORDER BY app_name ASC")
-    val apps: LiveData<List<App>>
-
-    @get:Query("SELECT * FROM home_apps ORDER BY sorting_index ASC")
-    val homeApps: LiveData<List<HomeApp>>
-
-    @Insert(onConflict = OnConflictStrategy.IGNORE)
-    fun insert(app: App)
-
-    @Insert(onConflict = OnConflictStrategy.REPLACE)
-    fun addHomeApp(app: HomeApp)
-
-    @Update(onConflict = OnConflictStrategy.REPLACE)
-    fun updateHomeApp(app: HomeApp)
-
-    @Query("DELETE FROM apps")
-    fun deleteAll()
-
-    @Query("DELETE FROM home_apps")
-    fun clearHomeApps()
-
-    @Delete
-    fun deleteHomeApp(app: HomeApp)
-
-}

+ 21 - 0
app/src/main/java/com/sduduzog/slimlauncher/data/BaseDao.kt

@@ -0,0 +1,21 @@
+package com.sduduzog.slimlauncher.data
+
+import androidx.lifecycle.LiveData
+import androidx.room.*
+import com.sduduzog.slimlauncher.data.model.HomeApp
+
+@Dao
+interface BaseDao {
+
+    @get:Query("SELECT * FROM home_apps ORDER BY sorting_index ASC")
+    val apps: LiveData<List<HomeApp>>
+
+    @Insert(onConflict = OnConflictStrategy.REPLACE)
+    fun add(app: HomeApp)
+
+    @Update(onConflict = OnConflictStrategy.REPLACE)
+    fun update(vararg apps: HomeApp)
+
+    @Delete
+    fun remove(vararg app: HomeApp)
+}

+ 84 - 0
app/src/main/java/com/sduduzog/slimlauncher/data/BaseDatabase.kt

@@ -0,0 +1,84 @@
+package com.sduduzog.slimlauncher.data
+
+import android.content.Context
+import androidx.room.Database
+import androidx.room.Room
+import androidx.room.RoomDatabase
+import androidx.room.migration.Migration
+import androidx.sqlite.db.SupportSQLiteDatabase
+import com.sduduzog.slimlauncher.data.model.HomeApp
+
+
+@Database(entities = [HomeApp::class], version = 6, exportSchema = false)
+abstract class BaseDatabase : RoomDatabase() {
+
+    abstract fun baseDao(): BaseDao
+
+    companion object {
+        @Volatile
+        @JvmStatic
+        private var INSTANCE: BaseDatabase? = null
+
+        fun getDatabase(context: Context): BaseDatabase? {
+            synchronized(BaseDatabase::class.java) {
+                if (INSTANCE == null) {
+                    INSTANCE = Room.databaseBuilder(context.applicationContext,
+                            BaseDatabase::class.java, "app_database")
+                            .addMigrations(
+                                    MIGRATION_1_2,
+                                    MIGRATION_2_3,
+                                    MIGRATION_3_4,
+                                    MIGRATION_4_5,
+                                    MIGRATION_5_6
+                            )
+                            .build()
+                }
+                return INSTANCE
+            }
+        }
+
+        private val MIGRATION_1_2 = object : Migration(1, 2) {
+            override fun migrate(database: SupportSQLiteDatabase) {
+                database.execSQL("ALTER TABLE `home_apps` ADD COLUMN `sorting_index` INTEGER NOT NULL DEFAULT 0")
+                val cursor = database.query("SELECT package_name FROM home_apps")
+                cursor.moveToFirst()
+                var index = 0
+                while (!cursor.isAfterLast) {
+                    val column = cursor.getString(cursor.getColumnIndex("package_name"))
+                    database.execSQL("UPDATE `home_apps` SET `sorting_index`=$index WHERE `package_name`='$column'")
+                    cursor.moveToNext()
+                    index++
+                }
+            }
+        }
+
+        private val MIGRATION_2_3 = object : Migration(2, 3) {
+            override fun migrate(database: SupportSQLiteDatabase) {
+                database.execSQL("CREATE TABLE IF NOT EXISTS `notes` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `title` TEXT, `body` TEXT NOT NULL, `edited` INTEGER NOT NULL)")
+            }
+        }
+
+        private val MIGRATION_3_4 = object : Migration(3, 4) {
+            override fun migrate(database: SupportSQLiteDatabase) {
+                database.execSQL("DROP TABLE IF EXISTS `apps`")
+                database.execSQL("CREATE TABLE IF NOT EXISTS `tasks` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `body` TEXT NOT NULL, `is_complete` INTEGER NOT NULL, `sorting_index` INTEGER NOT NULL)")
+            }
+        }
+
+        private val MIGRATION_4_5 = object : Migration(4, 5) {
+            override fun migrate(database: SupportSQLiteDatabase) {
+                database.execSQL("ALTER TABLE `notes` RENAME TO `notes_old`")
+                database.execSQL("CREATE TABLE IF NOT EXISTS `notes` (`id` INTEGER PRIMARY KEY NOT NULL, `body` TEXT NOT NULL, `title` TEXT, `edited` INTEGER NOT NULL)")
+                database.execSQL("INSERT INTO `notes` (`id`, `body`, `edited`, `title`) SELECT `id`, `body`, `edited`, `title` FROM `notes_old`")
+                database.execSQL("ALTER TABLE `notes` ADD COLUMN `type` INTEGER NOT NULL DEFAULT 0")
+                database.execSQL("ALTER TABLE `notes` ADD COLUMN `filename` TEXT")
+            }
+        }
+        private val MIGRATION_5_6 = object : Migration(5, 6) {
+            override fun migrate(database: SupportSQLiteDatabase) {
+                database.execSQL("DROP TABLE IF EXISTS `notes`")
+                database.execSQL("DROP TABLE IF EXISTS `tasks`")
+            }
+        }
+    }
+}

+ 0 - 163
app/src/main/java/com/sduduzog/slimlauncher/data/DataRepository.kt

@@ -1,163 +0,0 @@
-package com.sduduzog.slimlauncher.data
-
-import android.app.Application
-import android.content.Intent
-import android.content.pm.PackageManager
-import android.content.pm.ResolveInfo
-import android.os.AsyncTask
-import androidx.lifecycle.LiveData
-import java.util.*
-
-class DataRepository(application: Application) {
-
-    private val db: DataRoomDatabase = DataRoomDatabase.getDatabase(application)!!
-    private val appDao: AppDao = db.appDao()
-    private val noteDao: NoteDao = db.noteDao()
-    private var _apps: LiveData<List<App>> = appDao.apps
-    private var _homeApps: LiveData<List<HomeApp>> = appDao.homeApps
-    private var _notes: LiveData<List<Note>> = noteDao.notes
-
-    private var pm: PackageManager = application.packageManager
-
-    val homeApps: LiveData<List<HomeApp>>
-        get() = _homeApps
-
-    val apps: LiveData<List<App>>
-        get() = _apps
-
-    val notes: LiveData<List<Note>>
-        get() = _notes
-
-    fun insertHomeApp(app: HomeApp) {
-        InsertHomeAppAsyncTask(appDao).execute(app)
-    }
-
-    fun deleteHomeApp(app: HomeApp) {
-        DeleteHomeAppAsyncTask(appDao).execute(app)
-    }
-
-    fun clearHomeApps() {
-        ClearHomeAppsAsyncTask(appDao).execute()
-    }
-
-    fun updateApps(list: List<HomeApp>) {
-        for (app in list) {
-            UpdateAppsAsyncTask(appDao).execute(app)
-        }
-    }
-
-    fun refreshApps() {
-        RefreshAppsAsyncTask(appDao).execute(pm)
-    }
-
-    fun renameApp(app: HomeApp) {
-        UpdateAppsAsyncTask(appDao).execute(app)
-    }
-
-    fun saveNote(note: Note) {
-        SaveNoteAsyncTask(noteDao).execute(note)
-    }
-
-    fun updateNote(note: Note) {
-        UpdateNoteAsyncTask(noteDao).execute(note)
-    }
-
-    fun deleteNote(note: Note) {
-        DeleteNoteAsyncTask(noteDao).execute(note)
-    }
-
-    private class InsertHomeAppAsyncTask internal constructor(private val mAsyncTaskDao: AppDao) : AsyncTask<HomeApp, Void, Void>() {
-
-        override fun doInBackground(vararg params: HomeApp): Void? {
-            mAsyncTaskDao.addHomeApp(params[0])
-            return null
-        }
-    }
-
-    private class DeleteHomeAppAsyncTask internal constructor(private val mAsyncTaskDao: AppDao) : AsyncTask<HomeApp, Void, Void>() {
-
-        override fun doInBackground(vararg params: HomeApp): Void? {
-            mAsyncTaskDao.deleteHomeApp(params[0])
-            return null
-        }
-    }
-
-    private class ClearHomeAppsAsyncTask internal constructor(private val mAsyncTaskDao: AppDao) : AsyncTask<Void, Void, Void>() {
-
-        override fun doInBackground(vararg params: Void): Void? {
-            mAsyncTaskDao.clearHomeApps()
-            return null
-        }
-    }
-
-    private class UpdateAppsAsyncTask internal constructor(private val mAsyncTaskDao: AppDao) : AsyncTask<HomeApp, Void, Void>() {
-
-        override fun doInBackground(vararg params: HomeApp): Void? {
-            mAsyncTaskDao.updateHomeApp(params[0])
-            return null
-        }
-    }
-
-    private class RefreshAppsAsyncTask internal constructor(private val mAsyncTaskDao: AppDao) : AsyncTask<PackageManager, Void, Void>() {
-
-        override fun doInBackground(vararg params: PackageManager): Void? {
-            mAsyncTaskDao.deleteAll() // Need to find a less expensive way of doing this
-            val pm = params[0]
-            val main = Intent(Intent.ACTION_MAIN, null)
-            main.addCategory(Intent.CATEGORY_LAUNCHER)
-            val activitiesList = pm.queryIntentActivities(main, 0)
-            Collections.sort(activitiesList, ResolveInfo.DisplayNameComparator(pm))
-            for (i in activitiesList.indices) {
-                val item = activitiesList[i]
-                val activity = item.activityInfo
-                val app = App(activitiesList[i].loadLabel(pm).toString(), activity.applicationInfo.packageName, activity.name)
-                mAsyncTaskDao.insert(app)
-            }
-            return null
-        }
-    }
-
-    private class SaveNoteAsyncTask internal constructor(private val mAsyncTaskDao: NoteDao) : AsyncTask<Note, Void, Void>() {
-
-        override fun doInBackground(vararg params: Note): Void? {
-            val note = params[0]
-            mAsyncTaskDao.saveNote(note)
-            return null
-        }
-    }
-
-    private class UpdateNoteAsyncTask internal constructor(private val mAsyncTaskDao: NoteDao) : AsyncTask<Note, Void, Void>() {
-
-        override fun doInBackground(vararg params: Note): Void? {
-            val note = params[0]
-            mAsyncTaskDao.updateNote(note)
-            return null
-        }
-    }
-
-    private class DeleteNoteAsyncTask internal constructor(private val mAsyncTaskDao: NoteDao) : AsyncTask<Note, Void, Void>() {
-
-        override fun doInBackground(vararg params: Note): Void? {
-            val note = params[0]
-            mAsyncTaskDao.deleteNote(note)
-            return null
-        }
-    }
-
-
-    companion object {
-
-        @Volatile
-        @JvmStatic
-        private var INSTANCE: DataRepository? = null
-
-        fun getInstance(application: Application): DataRepository {
-            synchronized(DataRepository::class.java) {
-                if (INSTANCE == null) {
-                    INSTANCE = DataRepository(application)
-                }
-                return INSTANCE!!
-            }
-        }
-    }
-}

+ 0 - 64
app/src/main/java/com/sduduzog/slimlauncher/data/DataRoomDatabase.kt

@@ -1,64 +0,0 @@
-package com.sduduzog.slimlauncher.data
-
-import android.content.Context
-import androidx.room.Database
-import androidx.room.Room
-import androidx.room.RoomDatabase
-import androidx.room.migration.Migration
-import androidx.sqlite.db.SupportSQLiteDatabase
-
-
-@Database(entities = [App::class, HomeApp::class, Note::class], version = 3, exportSchema = false)
-abstract class DataRoomDatabase : RoomDatabase() {
-
-    abstract fun appDao(): AppDao
-
-    abstract fun noteDao(): NoteDao
-
-    companion object {
-        @Volatile
-        @JvmStatic
-        private var INSTANCE: DataRoomDatabase? = null
-
-        fun getDatabase(context: Context): DataRoomDatabase? {
-            synchronized(DataRoomDatabase::class.java) {
-                if (INSTANCE == null) {
-                    INSTANCE = Room.databaseBuilder(context.applicationContext,
-                            DataRoomDatabase::class.java, "app_database")
-                            .addCallback(object : Callback(){
-                                override fun onCreate(db: SupportSQLiteDatabase) {
-                                    super.onCreate(db)
-                                    val database = DataRoomDatabase.getDatabase(context)!!
-                                    val dao = database.noteDao()
-                                    PopulateDatabaseTask(dao).execute()
-                                }
-                            })
-                            .addMigrations(MIGRATION_1_2, MIGRATION_2_3)
-                            .build()
-                }
-                return INSTANCE
-            }
-        }
-
-        private val MIGRATION_1_2 = object : Migration(1, 2) {
-            override fun migrate(database: SupportSQLiteDatabase) {
-                database.execSQL("ALTER TABLE home_apps ADD COLUMN sorting_index INTEGER NOT NULL DEFAULT 0")
-                val cursor = database.query("SELECT package_name FROM home_apps")
-                cursor.moveToFirst()
-                var index = 0
-                while (!cursor.isAfterLast) {
-                    val column = cursor.getString(cursor.getColumnIndex("package_name"))
-                    database.execSQL("UPDATE home_apps SET sorting_index=$index WHERE package_name='$column'")
-                    cursor.moveToNext()
-                    index++
-                }
-            }
-        }
-
-        private val MIGRATION_2_3 = object : Migration(2, 3) {
-            override fun migrate(database: SupportSQLiteDatabase) {
-                database.execSQL("CREATE TABLE IF NOT EXISTS `notes` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `title` TEXT, `body` TEXT NOT NULL, `edited` INTEGER NOT NULL)")
-            }
-        }
-    }
-}

+ 37 - 0
app/src/main/java/com/sduduzog/slimlauncher/data/MainViewModel.kt

@@ -0,0 +1,37 @@
+package com.sduduzog.slimlauncher.data
+
+import android.app.Application
+import androidx.lifecycle.AndroidViewModel
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import com.sduduzog.slimlauncher.data.model.App
+import com.sduduzog.slimlauncher.data.model.HomeApp
+
+class MainViewModel(application: Application) : AndroidViewModel(application) {
+
+    private val _baseRepository = Repository(application)
+
+    private var _apps: LiveData<List<HomeApp>>
+
+    init {
+        _apps = _baseRepository.apps
+    }
+
+    val apps: LiveData<List<HomeApp>>
+        get() = _apps
+
+    val installedApps = MutableLiveData<List<App>>()
+
+    fun add(app: App) {
+        val index = _apps.value!!.size
+        _baseRepository.add(HomeApp.from(app, index))
+    }
+
+    fun update(vararg args: HomeApp) {
+        _baseRepository.update(*args)
+    }
+
+    fun remove(vararg app: HomeApp) {
+        _baseRepository.remove(*app)
+    }
+}

+ 0 - 21
app/src/main/java/com/sduduzog/slimlauncher/data/Note.kt

@@ -1,21 +0,0 @@
-package com.sduduzog.slimlauncher.data
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import java.io.Serializable
-
-
-@Entity(tableName = "notes")
-data class Note(
-        @field:ColumnInfo(name = "body")
-        var body: String,
-        @field:ColumnInfo(name = "edited")
-        var edited: Long
-) : Serializable {
-    @field:ColumnInfo(name = "id")
-    @PrimaryKey(autoGenerate = true)
-    var id: Int? = null
-    @field:ColumnInfo(name = "title")
-    var title: String? = null
-}

+ 0 - 20
app/src/main/java/com/sduduzog/slimlauncher/data/NoteDao.kt

@@ -1,20 +0,0 @@
-package com.sduduzog.slimlauncher.data
-
-import androidx.lifecycle.LiveData
-import androidx.room.*
-
-@Dao
-interface NoteDao {
-
-    @get:Query("SELECT * FROM notes ORDER BY id DESC")
-    val notes: LiveData<List<Note>>
-
-    @Insert(onConflict = OnConflictStrategy.REPLACE)
-    fun saveNote(note: Note)
-
-    @Update
-    fun updateNote(note: Note)
-
-    @Delete
-    fun deleteNote(note: Note)
-}

+ 0 - 38
app/src/main/java/com/sduduzog/slimlauncher/data/PopulateDatabaseTask.kt

@@ -1,38 +0,0 @@
-package com.sduduzog.slimlauncher.data
-
-import android.os.AsyncTask
-import java.util.*
-
-class PopulateDatabaseTask(private val dao: NoteDao) : AsyncTask<Void, Void, Void>() {
-    override fun doInBackground(vararg p0: Void?): Void? {
-        val demoNote = Note("""
-            Dear reader.
-
-            This is a demo note. Also a short summary to help you get started in how to use create, edit
-            or delete note items.
-
-            1. Creating a note: Pretty easy actually. Just tap the button with the pen icon and type away.
-            To save your note, press back and exit the editing screen. And done! the note is saved :)
-
-            2. Editing a note: When you open a note, like this one, it is on reader mode, double tap on this text to enter editor mode, and make your changes.
-
-            3. Deleting a note: I think you know this one. Go back, swipe this note away, and its gone.
-
-            That's it! You're ready to go. Remember to give us feedback on the app and on changes you might wanna see in the future.
-            And don't forget to give us 5 stars ;)
-
-            ## TO COME ##
-            - Tasks : Like a todo list or whatever
-            - Voice recorder/ voice note : I'd like to integrate this nicely with text notes. Like taking text notes, record sound all in one note.
-            - Insights : See which apps you use the most, see which apps you haven't used in a long time,
-            probably to suggest clearing some, and some informative usage patterns, All while we're offline :)
-
-            Remember! All you need is less.
-
-            Thanks for the support
-        """.trimIndent(), Date().time)
-        dao.saveNote(demoNote)
-        return null
-    }
-
-}

+ 54 - 0
app/src/main/java/com/sduduzog/slimlauncher/data/Repository.kt

@@ -0,0 +1,54 @@
+package com.sduduzog.slimlauncher.data
+
+import android.app.Application
+import android.os.AsyncTask
+import androidx.lifecycle.LiveData
+import com.sduduzog.slimlauncher.data.model.HomeApp
+
+class Repository(application: Application) {
+
+    private val database: BaseDatabase = BaseDatabase.getDatabase(application)!!
+
+    private val baseDao: BaseDao = database.baseDao()
+
+    private val _apps = baseDao.apps
+
+    val apps: LiveData<List<HomeApp>>
+        get() = _apps
+
+    fun add(app: HomeApp) {
+        AddAppAsyncTask(baseDao).execute(app)
+    }
+
+    fun update(vararg list: HomeApp) {
+        UpdateAppAsyncTask(baseDao).execute(*list)
+    }
+
+    fun remove(vararg app: HomeApp) {
+        RemoveAppAsyncTask(baseDao).execute(*app)
+    }
+
+    private class AddAppAsyncTask(private val mAsyncTaskDao: BaseDao) : AsyncTask<HomeApp, Void, Void>() {
+
+        override fun doInBackground(vararg params: HomeApp): Void? {
+            mAsyncTaskDao.add(params[0])
+            return null
+        }
+    }
+
+    private class UpdateAppAsyncTask(private val mAsyncTaskDao: BaseDao) : AsyncTask<HomeApp, Void, Void>() {
+
+        override fun doInBackground(vararg params: HomeApp): Void? {
+            mAsyncTaskDao.update(*params)
+            return null
+        }
+    }
+
+    private class RemoveAppAsyncTask(private val mAsyncTaskDao: BaseDao) : AsyncTask<HomeApp, Void, Void>() {
+
+        override fun doInBackground(vararg params: HomeApp): Void? {
+            mAsyncTaskDao.remove(*params)
+            return null
+        }
+    }
+}

+ 7 - 0
app/src/main/java/com/sduduzog/slimlauncher/data/model/App.kt

@@ -0,0 +1,7 @@
+package com.sduduzog.slimlauncher.data.model
+
+data class App(
+        var appName: String,
+        var packageName: String,
+        var activityName: String
+)

+ 8 - 2
app/src/main/java/com/sduduzog/slimlauncher/data/HomeApp.kt → app/src/main/java/com/sduduzog/slimlauncher/data/model/HomeApp.kt

@@ -1,4 +1,4 @@
-package com.sduduzog.slimlauncher.data
+package com.sduduzog.slimlauncher.data.model
 
 import androidx.room.ColumnInfo
 import androidx.room.Entity
@@ -15,4 +15,10 @@ data class HomeApp(
         var activityName: String,
         @field:ColumnInfo(name = "sorting_index")
         var sortingIndex: Int
-)
+) {
+    companion object {
+        fun from(app: App, sortingIndex: Int = 0): HomeApp {
+            return HomeApp(appName = app.appName, activityName = app.activityName, packageName = app.packageName, sortingIndex = sortingIndex)
+        }
+    }
+}

+ 9 - 8
app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/ThemeChooserDialog.kt → app/src/main/java/com/sduduzog/slimlauncher/dialogs/ChangeThemeDialog.kt

@@ -1,23 +1,24 @@
-package com.sduduzog.slimlauncher.ui.main.settings
+package com.sduduzog.slimlauncher.dialogs
 
+import android.app.AlertDialog
 import android.app.Dialog
 import android.content.Context.MODE_PRIVATE
 import android.content.SharedPreferences
 import android.os.Bundle
-import androidx.appcompat.app.AlertDialog
 import androidx.core.content.edit
 import androidx.fragment.app.DialogFragment
 import com.sduduzog.slimlauncher.R
 
-class ThemeChooserDialog : DialogFragment() {
+class ChangeThemeDialog : DialogFragment(){
 
     private lateinit var settings: SharedPreferences
 
     override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
         val builder = AlertDialog.Builder(context!!)
-        settings = context!!.getSharedPreferences(getString(R.string.prefs_settings), MODE_PRIVATE)
+        settings  = context!!.getSharedPreferences(getString(R.string.prefs_settings), MODE_PRIVATE)
+
         val active = settings.getInt(getString(R.string.prefs_settings_key_theme), 0)
-        builder.setTitle(R.string.theme_chooser_dialog_title)
+        builder.setTitle(R.string.choose_theme_dialog_title)
         builder.setSingleChoiceItems(R.array.themes_array, active) { dialogInterface, i ->
             dialogInterface.dismiss()
             settings.edit {
@@ -28,8 +29,8 @@ class ThemeChooserDialog : DialogFragment() {
     }
 
     companion object {
-        fun getThemeChooser(): ThemeChooserDialog {
-            return ThemeChooserDialog()
+        fun getThemeChooser(): ChangeThemeDialog{
+            return ChangeThemeDialog()
         }
     }
-}
+}

+ 40 - 0
app/src/main/java/com/sduduzog/slimlauncher/dialogs/ChooseTimeFormatDialog.kt

@@ -0,0 +1,40 @@
+package com.sduduzog.slimlauncher.dialogs
+
+import android.app.AlertDialog
+import android.app.Dialog
+import android.content.Context.MODE_PRIVATE
+import android.content.SharedPreferences
+import android.os.Bundle
+import androidx.core.content.edit
+import androidx.fragment.app.DialogFragment
+import com.sduduzog.slimlauncher.R
+
+class ChooseTimeFormatDialog : DialogFragment(){
+
+    private lateinit var settings: SharedPreferences
+
+    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
+        val builder = AlertDialog.Builder(context!!)
+        settings = context!!.getSharedPreferences(getString(R.string.prefs_settings), MODE_PRIVATE)
+
+        val is24Hour = settings.getBoolean(getString(R.string.prefs_settings_key_time_format), true)
+        val index = if (is24Hour) 1 else 0
+        builder.setTitle(R.string.choose_time_format_dialog_title)
+        builder.setSingleChoiceItems(R.array.time_format_array, index) {dialogInterface, i ->
+            dialogInterface.dismiss()
+            settings.edit {
+                val b = i != 0
+                putBoolean(getString(R.string.prefs_settings_key_time_format), b)
+            }
+
+        }
+        return builder.create()
+    }
+
+
+    companion object {
+        fun getInstance(): ChooseTimeFormatDialog{
+            return ChooseTimeFormatDialog()
+        }
+    }
+}

+ 57 - 0
app/src/main/java/com/sduduzog/slimlauncher/dialogs/RenameAppDialog.kt

@@ -0,0 +1,57 @@
+package com.sduduzog.slimlauncher.dialogs
+
+import android.app.Dialog
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.widget.EditText
+import android.widget.Toast
+import androidx.appcompat.app.AlertDialog
+import androidx.fragment.app.DialogFragment
+import com.sduduzog.slimlauncher.R
+import com.sduduzog.slimlauncher.data.MainViewModel
+import com.sduduzog.slimlauncher.data.model.HomeApp
+import kotlinx.android.synthetic.main.customise_apps_fragment.*
+
+class RenameAppDialog : DialogFragment() {
+
+    private lateinit var app: HomeApp
+    private lateinit var model: MainViewModel
+
+    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
+        val view = LayoutInflater.from(context).inflate(R.layout.rename_dialog_edit_text, customise_apps_fragment, false)
+        val editText: EditText = view.findViewById(R.id.rename_editText)
+        editText.text.append(app.appName)
+        val builder = AlertDialog.Builder(context!!)
+        builder.setTitle("Rename ${app.appName}")
+        builder.setView(view)
+        builder.setPositiveButton("DONE") { _, _ ->
+            val name = editText.text.toString()
+            updateApp(name)
+        }
+        editText.setOnEditorActionListener { v, _, _ ->
+            val name = v.text.toString()
+            updateApp(name)
+            this@RenameAppDialog.dismiss()
+            true
+        }
+        return builder.create()
+    }
+
+    private fun updateApp(newName: String) {
+        if (newName.isNotEmpty()) {
+            app.appName = newName
+            model.update(app)
+        } else {
+            Toast.makeText(context, "Couldn't save, App name shouldn't be empty", Toast.LENGTH_LONG).show()
+        }
+    }
+
+    companion object {
+        fun getInstance(app: HomeApp, model: MainViewModel): RenameAppDialog {
+            return RenameAppDialog().apply {
+                this.model = model
+                this.app = app
+            }
+        }
+    }
+}

+ 0 - 28
app/src/main/java/com/sduduzog/slimlauncher/ui/main/AboutFragment.kt

@@ -1,28 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main
-
-
-import android.os.Bundle
-import android.text.method.LinkMovementMethod
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.fragment.app.Fragment
-import com.sduduzog.slimlauncher.BuildConfig
-import com.sduduzog.slimlauncher.R
-import kotlinx.android.synthetic.main.about_fragment.*
-
-
-class AboutFragment : Fragment() {
-
-    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
-                              savedInstanceState: Bundle?): View? {
-        // Inflate the layout for this fragment
-        return inflater.inflate(R.layout.about_fragment, container, false)
-    }
-
-    override fun onActivityCreated(savedInstanceState: Bundle?) {
-        super.onActivityCreated(savedInstanceState)
-        aboutVersionText.text = getString(R.string.about_title, BuildConfig.VERSION_NAME)
-        aboutDescriptionText.movementMethod = LinkMovementMethod.getInstance()
-    }
-}

+ 0 - 25
app/src/main/java/com/sduduzog/slimlauncher/ui/main/DoubleClickListener.kt

@@ -1,25 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main
-
-import android.view.View
-
-abstract class DoubleClickListener : View.OnClickListener { // courtesy of Xar E Ahmer @ stackoverflow
-
-    private var lastTickTime: Long = 0
-
-    override fun onClick(view: View) {
-        val clickTime = System.currentTimeMillis()
-        if (clickTime - lastTickTime < DOUBLE_CLICK_TIME_DELTA) {
-            onDoubleClick(view)
-        } else {
-            onSingleClick(view)
-        }
-        lastTickTime = clickTime
-    }
-
-    abstract fun onDoubleClick(v: View)
-    abstract fun onSingleClick(v: View)
-
-    companion object {
-        const val DOUBLE_CLICK_TIME_DELTA = 300 // milliseconds
-    }
-}

+ 0 - 73
app/src/main/java/com/sduduzog/slimlauncher/ui/main/HomeAppsAdapter.kt

@@ -1,73 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main
-
-import android.content.ActivityNotFoundException
-import android.content.ComponentName
-import android.content.Intent
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.TextView
-import android.widget.Toast
-import androidx.core.app.ActivityOptionsCompat
-import androidx.lifecycle.Observer
-import androidx.lifecycle.ViewModelProviders
-import androidx.recyclerview.widget.RecyclerView
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.data.HomeApp
-
-
-class HomeAppsAdapter(private var fragment: MainFragment)
-    : RecyclerView.Adapter<HomeAppsAdapter.ViewHolder>() {
-
-    private var apps: List<HomeApp> = listOf()
-    private var viewModel = ViewModelProviders.of(fragment).get(MainViewModel::class.java)
-
-    init {
-        viewModel.homeApps.observe(fragment, Observer {
-            if (it != null) {
-                apps = it
-                notifyDataSetChanged()
-            }
-        })
-    }
-
-    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HomeAppsAdapter.ViewHolder {
-        val view = LayoutInflater.from(parent.context)
-                .inflate(R.layout.main_list_item, parent, false)
-        return ViewHolder(view)
-    }
-
-    override fun onBindViewHolder(holder: HomeAppsAdapter.ViewHolder, position: Int) {
-        val item = apps.elementAt(position)
-        holder.mLabelView.text = item.appName
-        holder.mLabelView.setOnClickListener {
-            val name = ComponentName(item.packageName, item.activityName)
-            val intent = Intent()
-            intent.action = Intent.ACTION_MAIN
-            intent.addCategory(Intent.CATEGORY_LAUNCHER)
-            intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
-            intent.component = name
-            try {
-                val left = 0
-                val top = 0
-                val width = it.measuredWidth
-                val height = it.measuredHeight
-                val opts = ActivityOptionsCompat.makeClipRevealAnimation(it, left, top, width, height)
-                fragment.startActivity(intent, opts.toBundle())
-            } catch (e: ActivityNotFoundException) {
-                Toast.makeText(fragment.context, "${item.appName} seems to be uninstalled, removing from list", Toast.LENGTH_LONG).show()
-                viewModel.deleteApp(item)
-            }
-        }
-    }
-
-    override fun getItemCount(): Int = apps.size
-
-    inner class ViewHolder(mView: View) : RecyclerView.ViewHolder(mView) {
-        val mLabelView: TextView = mView.findViewById(R.id.main_label)
-
-        override fun toString(): String {
-            return super.toString() + " '" + mLabelView.text + "'"
-        }
-    }
-}

+ 185 - 0
app/src/main/java/com/sduduzog/slimlauncher/ui/main/HomeFragment.kt

@@ -0,0 +1,185 @@
+package com.sduduzog.slimlauncher.ui.main
+
+import android.content.*
+import android.os.Build
+import android.os.Bundle
+import android.provider.AlarmClock
+import android.provider.MediaStore
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.navigation.Navigation
+import com.sduduzog.slimlauncher.R
+import com.sduduzog.slimlauncher.adapters.HomeAdapter
+import com.sduduzog.slimlauncher.data.MainViewModel
+import com.sduduzog.slimlauncher.data.model.HomeApp
+import com.sduduzog.slimlauncher.utils.BaseFragment
+import com.sduduzog.slimlauncher.utils.OnLaunchAppListener
+import kotlinx.android.synthetic.main.home_fragment.*
+import java.text.SimpleDateFormat
+import java.util.*
+
+
+class HomeFragment : BaseFragment(), OnLaunchAppListener {
+
+    private lateinit var receiver: BroadcastReceiver
+    private lateinit var viewModel: MainViewModel
+
+    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
+                              savedInstanceState: Bundle?): View {
+        return inflater.inflate(R.layout.home_fragment, container, false)
+    }
+
+    override fun onActivityCreated(savedInstanceState: Bundle?) {
+        super.onActivityCreated(savedInstanceState)
+        val adapter1 = HomeAdapter(this)
+        val adapter2 = HomeAdapter(this)
+        home_fragment_list.adapter = adapter1
+        home_fragment_list_exp.adapter = adapter2
+
+        activity?.let {
+            viewModel = ViewModelProviders.of(it).get(MainViewModel::class.java)
+        } ?: throw Error("Activity null, something here is fucked up")
+
+        viewModel.apps.observe(this, Observer { list ->
+            list?.let { apps ->
+                adapter1.setItems(apps.filter {
+                    it.sortingIndex < 4
+                })
+                adapter2.setItems(apps.filter {
+                    it.sortingIndex >= 4
+                })
+            }
+        })
+
+        setEventListeners()
+        home_fragment_options.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_homeFragment_to_optionsFragment))
+    }
+
+    override fun onStart() {
+        super.onStart()
+        receiver = ClockReceiver()
+        activity?.registerReceiver(receiver, IntentFilter(Intent.ACTION_TIME_TICK))
+    }
+
+    override fun getFragmentView(): ViewGroup {
+        return home_fragment
+    }
+
+    override fun onResume() {
+        super.onResume()
+        updateClock()
+    }
+
+    override fun onStop() {
+        super.onStop()
+        activity?.unregisterReceiver(receiver)
+    }
+
+    private fun setEventListeners() {
+
+        home_fragment_time.setOnClickListener { view ->
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+                try {
+                    val pm = context?.packageManager!!
+                    val intent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
+                    intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
+                    val componentName = intent.resolveActivity(pm)
+                    if (componentName == null) launchActivity(view, intent) else
+                        pm.getLaunchIntentForPackage(componentName.packageName)?.let {
+                            launchActivity(view, it)
+                        }
+                } catch (e: ActivityNotFoundException) {
+                    e.printStackTrace()
+                    // Do nothing, we've failed :(
+                }
+            }
+        }
+
+        home_fragment_date.setOnClickListener {
+            try {
+                val intent = Intent(Intent.ACTION_MAIN)
+                intent.addCategory(Intent.CATEGORY_APP_CALENDAR)
+                intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
+                launchActivity(it, intent)
+            } catch (e: ActivityNotFoundException) {
+                // Do nothing, we've failed :(
+            }
+        }
+
+        home_fragment_call.setOnClickListener { view ->
+            try {
+                val pm = context?.packageManager!!
+                val intent = Intent(Intent.ACTION_DIAL)
+                val componentName = intent.resolveActivity(pm)
+                if (componentName == null) launchActivity(view, intent) else
+                    pm.getLaunchIntentForPackage(componentName.packageName)?.let {
+                        launchActivity(view, it)
+                    }
+            } catch (e: Exception) {
+                // Do nothing
+            }
+        }
+
+        home_fragment_camera.setOnClickListener {
+            try {
+                val intent = Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA)
+                launchActivity(it, intent)
+            } catch (e: Exception) {
+                // Do nothing
+            }
+        }
+    }
+
+    fun updateClock() {
+        val twenty4Hour = context?.getSharedPreferences(getString(R.string.prefs_settings), Context.MODE_PRIVATE)
+                ?.getBoolean(getString(R.string.prefs_settings_key_time_format), true)
+        val date = Date()
+        if (twenty4Hour as Boolean) {
+            val fWatchTime = SimpleDateFormat("h:mm", Locale.ROOT)
+            val fWatchTimeAP = SimpleDateFormat("aa", Locale.ROOT)
+            home_fragment_time.text = fWatchTime.format(date)
+            home_fragment_time_format.text = fWatchTimeAP.format(date)
+            home_fragment_time_format.visibility = View.VISIBLE
+        } else {
+            val fWatchTime = SimpleDateFormat("H:mm", Locale.ROOT)
+            home_fragment_time.text = fWatchTime.format(date)
+            home_fragment_time_format.visibility = View.GONE
+        }
+        val fWatchDate = SimpleDateFormat("EEE, MMM dd", Locale.ROOT)
+        home_fragment_date.text = fWatchDate.format(date)
+    }
+
+    override fun onLaunch(app: HomeApp, view: View) {
+        try {
+            val intent = Intent()
+            val name = ComponentName(app.packageName, app.activityName)
+            intent.action = Intent.ACTION_MAIN
+            intent.addCategory(Intent.CATEGORY_LAUNCHER)
+            intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
+            intent.component = name
+            intent.resolveActivity(activity!!.packageManager)?.let {
+                launchActivity(view, intent)
+            }
+        } catch (e: Exception) {
+            // Do no shit yet
+        }
+    }
+
+    override fun onBack(): Boolean {
+        home_fragment.transitionToStart()
+        return true
+    }
+
+    override fun onHome() {
+        home_fragment.transitionToEnd()
+    }
+
+    inner class ClockReceiver : BroadcastReceiver() {
+        override fun onReceive(ctx: Context?, intent: Intent?) {
+            updateClock()
+        }
+    }
+}

+ 0 - 245
app/src/main/java/com/sduduzog/slimlauncher/ui/main/MainFragment.kt

@@ -1,245 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main
-
-import android.content.*
-import android.net.Uri
-import android.os.Build
-import android.os.Bundle
-import android.provider.AlarmClock
-import android.provider.MediaStore
-import android.provider.Settings
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.FrameLayout
-import androidx.core.app.ActivityOptionsCompat
-import androidx.navigation.Navigation
-import com.google.android.material.bottomsheet.BottomSheetBehavior
-import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_COLLAPSED
-import com.sduduzog.slimlauncher.MainActivity
-import com.sduduzog.slimlauncher.R
-import kotlinx.android.synthetic.main.main_bottom_sheet.*
-import kotlinx.android.synthetic.main.main_content.*
-import kotlinx.android.synthetic.main.main_fragment.*
-import java.text.SimpleDateFormat
-import java.util.*
-
-
-class MainFragment : StatusBarThemeFragment(), MainActivity.OnBackPressedListener {
-
-    private lateinit var receiver: BroadcastReceiver
-    private lateinit var sheetBehavior: BottomSheetBehavior<FrameLayout>
-
-    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
-                              savedInstanceState: Bundle?): View {
-        return inflater.inflate(R.layout.main_fragment, container, false)
-    }
-
-    override fun onActivityCreated(savedInstanceState: Bundle?) {
-        super.onActivityCreated(savedInstanceState)
-        mainAppsList.adapter = HomeAppsAdapter(this)
-        sheetBehavior = BottomSheetBehavior.from(bottomSheet)
-        optionsView.alpha = 0.0f
-        setEventListeners()
-        setupBottomSheet()
-    }
-
-    override fun onStart() {
-        super.onStart()
-        receiver = ClockReceiver()
-        activity?.registerReceiver(receiver, IntentFilter(Intent.ACTION_TIME_TICK))
-        sheetBehavior.state = STATE_COLLAPSED
-    }
-
-    override fun getFragmentView(): View {
-        return main
-    }
-
-    override fun onResume() {
-        super.onResume()
-        updateUi()
-    }
-
-    override fun onAttach(context: Context?) {
-        super.onAttach(context)
-        with(context as MainActivity) {
-            this.onBackPressedListener = this@MainFragment
-        }
-    }
-
-    override fun onDetach() {
-        super.onDetach()
-        with(context as MainActivity) {
-            this.onBackPressedListener = null
-        }
-    }
-
-    override fun onStop() {
-        super.onStop()
-        activity?.unregisterReceiver(receiver)
-    }
-
-    override fun onBackPress() {
-        sheetBehavior.state = STATE_COLLAPSED
-    }
-
-    override fun onBackPressed() {
-        // Do nothing
-    }
-
-    private fun setEventListeners() {
-
-
-        clockTextView.setOnClickListener {
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
-                try {
-                    val intent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
-                    intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
-                    val left = 0
-                    val top = 0
-                    val width = it.measuredWidth
-                    val height = it.measuredHeight
-                    val opts = ActivityOptionsCompat.makeClipRevealAnimation(it, left, top, width, height)
-                    if (intent.resolveActivity(context!!.packageManager) != null)
-                        startActivity(intent, opts.toBundle())
-                } catch (e: ActivityNotFoundException) {
-                    // Do nothing, we've failed :(
-                }
-            }
-        }
-
-        dateTextView.setOnClickListener {
-            try {
-                val intent = Intent(Intent.ACTION_MAIN)
-                intent.addCategory(Intent.CATEGORY_APP_CALENDAR)
-                intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
-                val left = 0
-                val top = 0
-                val width = it.measuredWidth
-                val height = it.measuredHeight
-                val opts = ActivityOptionsCompat.makeClipRevealAnimation(it, left, top, width, height)
-                startActivity(intent, opts.toBundle())
-            } catch (e: ActivityNotFoundException) {
-                // Do nothing, we've failed :(
-            }
-        }
-
-        ivCall.setOnClickListener {
-            try {
-                val intent = Intent(Intent.ACTION_DIAL)
-                val left = 0
-                val top = 0
-                val width = it.measuredWidth
-                val height = it.measuredHeight
-                val opts = ActivityOptionsCompat.makeClipRevealAnimation(it, left, top, width, height)
-                startActivity(intent, opts.toBundle())
-            } catch (e: Exception) {
-                // Do nothing
-            }
-        }
-        ivCall.setOnLongClickListener {
-            try {
-                val intent = Intent(Intent.ACTION_DIAL, null)
-                val left = 0
-                val top = 0
-                val width = it.measuredWidth
-                val height = it.measuredHeight
-                val opts = ActivityOptionsCompat.makeClipRevealAnimation(it, left, top, width, height)
-                startActivity(intent, opts.toBundle())
-            } catch (e: ActivityNotFoundException) {
-                // Do nothing
-            }
-            true
-        }
-
-        ivCamera.setOnClickListener {
-            try {
-                val intent = Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA)
-                val left = 0
-                val top = 0
-                val width = it.measuredWidth
-                val height = it.measuredHeight
-                val opts = ActivityOptionsCompat.makeClipRevealAnimation(it, left, top, width, height)
-                startActivity(intent, opts.toBundle())
-            } catch (e: Exception) {
-                // Do nothing
-            }
-        }
-    }
-
-    private fun setupBottomSheet() {
-        bottomSheet.setOnClickListener {
-            // Do nothing
-        }
-        sheetBehavior.setBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
-            override fun onSlide(p0: View, p1: Float) {
-                val multi = 3 * p1
-                optionsView.alpha = multi
-                optionsView.cardElevation = p1 * 8
-                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-                    optionsView.elevation = p1 * 8
-                }
-            }
-
-            override fun onStateChanged(bottomSheet: View, newState: Int) {
-                iconTray.visibility = View.GONE
-                if (newState == STATE_COLLAPSED) {
-                    iconTray.visibility = View.VISIBLE
-                }
-            }
-        })
-        textView12.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_mainFragment_to_notesListFragment))
-        settingsText.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_mainFragment_to_settingsFragment))
-
-        rateAppText.setOnClickListener {
-            val uri = Uri.parse("market://details?id=" + context?.packageName)
-            val intent = Intent(Intent.ACTION_VIEW, uri)
-            intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY or
-                    Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT)
-            }
-            try {
-                startActivity(intent)
-            } catch (e: ActivityNotFoundException) {
-                startActivity(Intent(Intent.ACTION_VIEW,
-                        Uri.parse("http://play.google.com/store/apps/details?id=" + context?.packageName)))
-            }
-        }
-        aboutText.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_mainFragment_to_aboutFragment))
-
-        deviceSettingsText.setOnClickListener {
-            startActivity(Intent(Settings.ACTION_SETTINGS))
-        }
-        changeLauncherText.setOnClickListener {
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-                startActivity(Intent(Settings.ACTION_HOME_SETTINGS))
-            }
-        }
-    }
-
-    fun updateUi() {
-        val twenty4Hour = context?.getSharedPreferences(getString(R.string.prefs_settings), Context.MODE_PRIVATE)
-                ?.getBoolean(getString(R.string.prefs_settings_key_clock_type), false)
-        val date = Date()
-        if (twenty4Hour as Boolean) {
-            val fWatchTime = SimpleDateFormat("HH:mm", Locale.ENGLISH)
-            clockTextView.text = fWatchTime.format(date)
-            clockAmPm.visibility = View.GONE
-        } else {
-            val fWatchTime = SimpleDateFormat("hh:mm", Locale.ENGLISH)
-            val fWatchTimeAP = SimpleDateFormat("aa", Locale.ENGLISH)
-            clockTextView.text = fWatchTime.format(date)
-            clockAmPm.text = fWatchTimeAP.format(date)
-            clockAmPm.visibility = View.VISIBLE
-        }
-        val fWatchDate = SimpleDateFormat("EEE, MMM dd", Locale.ENGLISH)
-        dateTextView.text = fWatchDate.format(date)
-    }
-
-
-    inner class ClockReceiver : BroadcastReceiver() {
-        override fun onReceive(ctx: Context?, intent: Intent?) {
-            updateUi()
-        }
-    }
-}

+ 0 - 57
app/src/main/java/com/sduduzog/slimlauncher/ui/main/MainViewModel.kt

@@ -1,57 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main
-
-import android.app.Application
-import androidx.lifecycle.AndroidViewModel
-import androidx.lifecycle.LiveData
-import com.sduduzog.slimlauncher.data.App
-import com.sduduzog.slimlauncher.data.DataRepository
-import com.sduduzog.slimlauncher.data.HomeApp
-
-class MainViewModel(application: Application) : AndroidViewModel(application) {
-    private var _repository: DataRepository = DataRepository.getInstance(application)
-    private var _homeApps: LiveData<List<HomeApp>>
-    private var _apps: LiveData<List<App>>
-
-    init {
-        _homeApps = _repository.homeApps
-        _apps = _repository.apps
-    }
-
-    val homeApps: LiveData<List<HomeApp>>
-        get() = _homeApps
-
-    val apps: LiveData<List<App>>
-        get() = _apps
-
-    fun deleteApp(app: HomeApp) {
-        _repository.deleteHomeApp(app)
-    }
-
-    fun updateApps(list: List<HomeApp>) {
-        _repository.updateApps(list)
-    }
-
-    fun refreshApps() {
-        _repository.refreshApps()
-    }
-
-    fun addToHomeScreen(app: HomeApp) {
-        _repository.insertHomeApp(app)
-    }
-
-    fun renameApp(app: HomeApp) {
-        _repository.renameApp(app)
-    }
-
-    fun clearHomeApps() {
-        _repository.clearHomeApps()
-    }
-
-    fun addToHomeScreen(apps: List<App>) {
-        for (i in apps.indices) {
-            val app = apps[i]
-            val home = HomeApp(app.appName, app.packageName, app.activityName, i)
-            _repository.insertHomeApp(home)
-        }
-    }
-}

+ 0 - 40
app/src/main/java/com/sduduzog/slimlauncher/ui/main/StatusBarThemeFragment.kt

@@ -1,40 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main
-
-import android.os.Build
-import android.util.TypedValue
-import android.view.View
-import androidx.appcompat.app.AppCompatActivity
-import androidx.fragment.app.Fragment
-import com.sduduzog.slimlauncher.R
-
-abstract class StatusBarThemeFragment : Fragment() {
-
-
-    /**
-     * @return [android.view.View] of the [androidx.fragment.app.Fragment] extending this class to apply flags to
-     */
-    abstract fun getFragmentView(): View
-
-
-    override fun onResume() {
-        super.onResume()
-        // When the Fragment resumes, check the theme and set the status bar color accordingly.
-        val settings = context!!.getSharedPreferences(getString(R.string.prefs_settings), AppCompatActivity.MODE_PRIVATE)
-        val active = settings.getInt(getString(R.string.prefs_settings_key_theme), 0)
-
-
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
-            when (active) {
-                0, 3, 5 -> {
-                    val flags = activity!!.window.decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
-                    getFragmentView().systemUiVisibility = flags
-                }
-
-            }
-            val value = TypedValue()
-            context!!.theme.resolveAttribute(R.attr.colorPrimary, value, true)
-            activity!!.window.statusBarColor = value.data
-        }
-    }
-
-}

+ 0 - 123
app/src/main/java/com/sduduzog/slimlauncher/ui/main/notes/NoteFragment.kt

@@ -1,123 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.notes
-
-
-import android.content.Context
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.view.inputmethod.InputMethodManager
-import androidx.fragment.app.Fragment
-import androidx.lifecycle.ViewModelProviders
-import com.sduduzog.slimlauncher.MainActivity
-import com.sduduzog.slimlauncher.Observer
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.data.Note
-import com.sduduzog.slimlauncher.ui.main.DoubleClickListener
-import kotlinx.android.synthetic.main.note_fragment.*
-import java.security.MessageDigest
-import java.util.*
-
-
-class NoteFragment : Fragment(), Observer {
-
-    private lateinit var note: Note
-    private lateinit var viewModel: NotesViewModel
-    private lateinit var initialDigest: String
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        arguments.let {
-            note = if (it !=null && it.containsKey("note")) {
-                it.get("note") as Note
-            } else {
-                Note("", -1L)
-            }
-        }
-        initialDigest = hash(note.title + note.body)
-        viewModel = ViewModelProviders.of(this).get(NotesViewModel::class.java)
-    }
-
-    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
-                              savedInstanceState: Bundle?): View? {
-        // Inflate the layout for this fragment
-        return inflater.inflate(R.layout.note_fragment, container, false)
-    }
-
-    override fun onActivityCreated(savedInstanceState: Bundle?) {
-        super.onActivityCreated(savedInstanceState)
-        if (note.edited == -1L) {
-            editBody()
-        } else {
-            bodyEditText.visibility = View.GONE
-            textBody.visibility = View.VISIBLE
-            textBody.text = note.body
-            titleEditText.setText(note.title.orEmpty())
-            bodyEditText.setText(note.body)
-            titleEditText.isEnabled = false
-        }
-        titleEditText.setOnEditorActionListener { _, _, _ ->
-            editBody()
-            true
-        }
-        textBody.setOnClickListener(object : DoubleClickListener() {
-            override fun onDoubleClick(v: View) {
-                titleEditText.isEnabled = true
-                editBody()
-            }
-
-            override fun onSingleClick(v: View) {
-                // Do nothing
-            }
-        })
-    }
-
-    override fun onAttach(context: Context?) {
-        super.onAttach(context)
-        with(context as MainActivity) {
-            this.dispatcher.attachObserver(this@NoteFragment)
-        }
-    }
-
-    override fun onDetach() {
-        super.onDetach()
-        with(context as MainActivity) {
-            this.dispatcher.detachObserver(this@NoteFragment)
-        }
-    }
-
-    override fun update(on: String) {
-        saveNote()
-    }
-
-    private fun editBody() {
-        textBody.visibility = View.GONE
-        bodyEditText.visibility = View.VISIBLE
-        if (bodyEditText.requestFocus()) {
-            val imm = activity!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
-            imm.showSoftInput(bodyEditText, InputMethodManager.SHOW_IMPLICIT)
-            bodyEditText.setSelection(note.body.length)
-        }
-    }
-
-    private fun saveNote() {
-        val body = bodyEditText.text.toString()
-        val title = titleEditText.text.toString()
-        val newNote = Note(body, Date().time)
-        newNote.title = if (title.isEmpty()) null else title
-        newNote.body = body.trim()
-        newNote.id = note.id
-        val currentDigest = hash(newNote.title + newNote.body)
-        if (body.isEmpty()) return
-        if (initialDigest == currentDigest) return
-        if (note.id == null) viewModel.saveNote(newNote) else viewModel.updateNote(newNote)
-
-    }
-
-    private fun hash(input: String): String {
-        val bytes = input.toByteArray(charset("UTF-8"))
-        val md = MessageDigest.getInstance("MD5")
-        md.update(bytes)
-        return String(md.digest())
-    }
-}

+ 0 - 97
app/src/main/java/com/sduduzog/slimlauncher/ui/main/notes/NotesListAdapter.kt

@@ -1,97 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.notes
-
-import android.graphics.Color
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.TextView
-import androidx.lifecycle.Observer
-import androidx.lifecycle.ViewModelProviders
-import androidx.navigation.Navigation
-import androidx.recyclerview.widget.RecyclerView
-import com.google.android.material.snackbar.Snackbar
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.data.Note
-import com.sduduzog.slimlauncher.ui.main.OnItemActionListener
-import java.text.SimpleDateFormat
-import java.util.*
-
-class NotesListAdapter(private val fragment: NotesListFragment) : RecyclerView.Adapter<NotesListAdapter.ViewHolder>(), OnItemActionListener {
-
-    private var deletedFrom = 0
-    private var notes: ArrayList<Note> = arrayListOf()
-    private var viewModel = ViewModelProviders.of(fragment).get(NotesViewModel::class.java)
-
-    init {
-        viewModel.notes.observe(fragment, Observer {
-            if (it != null) {
-                updateNotes(it.orEmpty())
-            }
-        })
-    }
-
-    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
-        val view = LayoutInflater.from(parent.context).inflate(R.layout.notes_list_item, parent, false)
-        return ViewHolder(view)
-    }
-
-    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
-        val note = notes[position]
-        with(note.title) {
-            if (this != null && this.isNotEmpty()) {
-                holder.title.text = this
-                holder.title.visibility = View.VISIBLE
-            } else {
-                holder.title.visibility = View.GONE
-            }
-        }
-        holder.body.text = note.body
-        val fWatchDate = SimpleDateFormat("HH:mm, MMMM dd, yyyy", Locale.US)
-        holder.edited.text = fragment.getString(R.string.notes_date_placeholder, fWatchDate.format(note.edited))
-        val bundle = Bundle()
-        bundle.putSerializable("note", note)
-        holder.itemView.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_openNoteFragment, bundle))
-    }
-
-    override fun getItemCount() = notes.size
-
-    override fun onViewMoved(oldPosition: Int, newPosition: Int): Boolean {
-        // Do nothing
-        return false
-    }
-
-    override fun onViewSwiped(position: Int) {
-        deletedFrom = position
-        if (position < notes.size) {
-            val note = notes[position]
-            viewModel.deleteNote(note)
-            Snackbar.make(fragment.view!!, "Note deleted successfully", Snackbar.LENGTH_LONG)
-                    .setActionTextColor(Color.WHITE)
-                    .setAction("UNDO") {
-                        viewModel.saveNote(note)
-                    }
-                    .show()
-        } else
-            notifyDataSetChanged()
-    }
-
-    override fun onViewIdle() {
-        // Do nothing
-    }
-
-    private fun updateNotes(newList: List<Note>) {
-        val size = notes.size
-        notes.clear()
-        notes.addAll(newList)
-        if (size > newList.size) {
-            notifyItemRemoved(deletedFrom)
-        } else notifyDataSetChanged()
-    }
-
-    inner class ViewHolder(mView: View) : RecyclerView.ViewHolder(mView) {
-        val title: TextView = mView.findViewById(R.id.item_note_title)
-        val body: TextView = mView.findViewById(R.id.item_note_body)
-        val edited: TextView = mView.findViewById(R.id.item_note_edited)
-    }
-}

+ 0 - 69
app/src/main/java/com/sduduzog/slimlauncher/ui/main/notes/NotesListFragment.kt

@@ -1,69 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.notes
-
-
-import android.os.Bundle
-import android.util.Log
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.fragment.app.Fragment
-import androidx.navigation.Navigation
-import androidx.recyclerview.widget.ItemTouchHelper
-import androidx.recyclerview.widget.RecyclerView
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.ui.main.OnItemActionListener
-import kotlinx.android.synthetic.main.notes_list_fragment.*
-
-
-class NotesListFragment : Fragment() {
-
-    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
-                              savedInstanceState: Bundle?): View? {
-        // Inflate the layout for this fragment
-        return inflater.inflate(R.layout.notes_list_fragment, container, false)
-    }
-
-    override fun onActivityCreated(savedInstanceState: Bundle?) {
-        super.onActivityCreated(savedInstanceState)
-        fab_add_note.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_openNoteFragment))
-        fab_add_note.setOnLongClickListener {
-            Log.d("NoteListFragment", "Long press")
-            true
-        }
-
-        val adapter = NotesListAdapter(this)
-
-        notesList.adapter = adapter
-
-        val listener: OnItemActionListener = adapter
-
-        val simpleItemTouchCallback = object : ItemTouchHelper.Callback() {
-
-            override fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int {
-                val swipeFlags = ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT
-                return makeMovementFlags(0, swipeFlags)
-            }
-
-            override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean {
-                // Do nothing
-                return true
-            }
-
-            override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
-                listener.onViewSwiped(viewHolder.adapterPosition)
-            }
-        }
-
-        val itemTouchHelper = ItemTouchHelper(simpleItemTouchCallback)
-
-        itemTouchHelper.attachToRecyclerView(notesList)
-        showFabAnimation(fab_add_note)
-    }
-
-    private fun showFabAnimation(targetView: View) {
-        targetView.scaleX = 0f
-        targetView.scaleY = 0f
-        targetView.animate().scaleY(1f).scaleX(1f).duration = 100
-        // Animate fab
-    }
-}

+ 0 - 32
app/src/main/java/com/sduduzog/slimlauncher/ui/main/notes/NotesViewModel.kt

@@ -1,32 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.notes
-
-import android.app.Application
-import androidx.lifecycle.AndroidViewModel
-import androidx.lifecycle.LiveData
-import com.sduduzog.slimlauncher.data.DataRepository
-import com.sduduzog.slimlauncher.data.Note
-
-class NotesViewModel(application: Application) : AndroidViewModel(application) {
-    private var _repository: DataRepository = DataRepository.getInstance(application)
-
-    private var _notes: LiveData<List<Note>>
-
-    init {
-        _notes = _repository.notes
-    }
-
-    val notes: LiveData<List<Note>>
-        get() = _notes
-
-    fun saveNote(note: Note) {
-        _repository.saveNote(note)
-    }
-
-    fun updateNote(note: Note) {
-        _repository.updateNote(note)
-    }
-
-    fun deleteNote(note: Note) {
-        _repository.deleteNote(note)
-    }
-}

+ 0 - 51
app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/AppsFragment.kt

@@ -1,51 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.settings
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.fragment.app.Fragment
-import androidx.lifecycle.ViewModelProviders
-import androidx.navigation.Navigation
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.ui.main.MainViewModel
-import kotlinx.android.synthetic.main.apps_fragment.*
-
-
-class AppsFragment : Fragment() {
-
-    private lateinit var viewModel: MainViewModel
-    private lateinit var mAdapter: AppsListAdapter
-    private var appIndex: Int = 0
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        arguments.apply {
-            appIndex = this!!.getInt("index")
-        }
-    }
-
-    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
-                              savedInstanceState: Bundle?): View? {
-        return inflater.inflate(R.layout.apps_fragment, container, false)
-    }
-
-    override fun onActivityCreated(savedInstanceState: Bundle?) {
-        super.onActivityCreated(savedInstanceState)
-        viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java)
-
-        mAdapter = AppsListAdapter(this, InteractionHandler(), appIndex)
-        appList.adapter = mAdapter
-    }
-
-    inner class InteractionHandler : OnAppsChooserListener {
-        override fun onAppChosen() {
-            val nav = Navigation.findNavController(appList)
-            nav.popBackStack()
-        }
-    }
-
-    interface OnAppsChooserListener {
-        fun onAppChosen()
-    }
-}

+ 0 - 67
app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/AppsListAdapter.kt

@@ -1,67 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.settings
-
-
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.TextView
-import androidx.fragment.app.Fragment
-import androidx.lifecycle.Observer
-import androidx.lifecycle.ViewModelProviders
-import androidx.recyclerview.widget.RecyclerView
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.data.App
-import com.sduduzog.slimlauncher.data.HomeApp
-import com.sduduzog.slimlauncher.ui.main.MainViewModel
-import com.sduduzog.slimlauncher.ui.main.settings.AppsFragment.OnAppsChooserListener
-import kotlinx.android.synthetic.main.apps_list_item.view.*
-
-
-class AppsListAdapter(fragment: Fragment,
-                      private val mListener: OnAppsChooserListener?,
-                      private val appIndex: Int)
-    : RecyclerView.Adapter<AppsListAdapter.ViewHolder>() {
-
-    private var mValues: List<App> = listOf()
-    private var viewModel: MainViewModel = ViewModelProviders.of(fragment).get(MainViewModel::class.java)
-
-    init {
-        viewModel.apps.observe(fragment, Observer {
-            if (it != null) {
-                mValues = it
-                notifyDataSetChanged()
-            }
-        })
-    }
-
-    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
-        val view = LayoutInflater.from(parent.context)
-                .inflate(R.layout.apps_list_item, parent, false)
-        return ViewHolder(view)
-    }
-
-    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
-        val item = mValues.elementAt(position)
-        holder.mLabelView.text = item.appName
-        with(holder.mView) {
-            tag = item
-            setOnClickListener {
-                val app = it.tag as App
-                val homeApp = HomeApp(app.appName, app.packageName, app.activityName, appIndex)
-                viewModel.addToHomeScreen(homeApp)
-                mListener?.onAppChosen()
-            }
-        }
-    }
-
-    override fun getItemCount(): Int = mValues.size
-
-
-    inner class ViewHolder(val mView: View) : RecyclerView.ViewHolder(mView) {
-        val mLabelView: TextView = mView.label
-
-        override fun toString(): String {
-            return super.toString() + " '" + mLabelView.text + "'"
-        }
-    }
-}

+ 0 - 41
app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/RenameAppDialog.kt

@@ -1,41 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.settings
-
-import android.app.Dialog
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.widget.EditText
-import androidx.appcompat.app.AlertDialog
-import androidx.fragment.app.DialogFragment
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.data.HomeApp
-import com.sduduzog.slimlauncher.ui.main.MainViewModel
-import kotlinx.android.synthetic.main.settings_fragment.*
-
-class RenameAppDialog : DialogFragment() {
-
-    private lateinit var app: HomeApp
-    private lateinit var model: MainViewModel
-
-    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
-        val view = LayoutInflater.from(context).inflate(R.layout.settings_rename_app, settingsAppList)
-        val editText = view.findViewById<EditText>(R.id.rename_editText)
-        editText.text.append(app.appName)
-        val builder = AlertDialog.Builder(context!!)
-        builder.setTitle("Rename ${app.appName}")
-        builder.setView(view)
-        builder.setPositiveButton("DONE") { _, _ ->
-            app.appName = editText.text.toString()
-            model.renameApp(app)
-        }
-        return builder.create()
-    }
-
-    companion object {
-        fun rename(app: HomeApp, model: MainViewModel): RenameAppDialog {
-            return RenameAppDialog().apply {
-                this.model = model
-                this.app = app
-            }
-        }
-    }
-}

+ 0 - 100
app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/SettingsFragment.kt

@@ -1,100 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.settings
-
-
-import android.content.Context.MODE_PRIVATE
-import android.graphics.Canvas
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.core.content.edit
-import androidx.recyclerview.widget.ItemTouchHelper
-import androidx.recyclerview.widget.RecyclerView
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.ui.main.OnItemActionListener
-import com.sduduzog.slimlauncher.ui.main.StatusBarThemeFragment
-import kotlinx.android.synthetic.main.settings_fragment.*
-
-
-class SettingsFragment : StatusBarThemeFragment() {
-
-    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
-                              savedInstanceState: Bundle?): View? {
-        return inflater.inflate(R.layout.settings_fragment, container, false)
-    }
-
-    override fun onActivityCreated(savedInstanceState: Bundle?) {
-        super.onActivityCreated(savedInstanceState)
-        val adapter = SettingsListAdapter(this)
-        settingsAppList.adapter = adapter
-        val listener: OnItemActionListener = adapter
-
-        val simpleItemTouchCallback = object : ItemTouchHelper.Callback() {
-
-            override fun onChildDraw(c: Canvas, recyclerView: RecyclerView,
-                                     viewHolder: RecyclerView.ViewHolder, dX: Float,
-                                     dY: Float, actionState: Int, isCurrentlyActive: Boolean) {
-                if (isCurrentlyActive) {
-                    viewHolder.itemView.alpha = 0.5f
-                } else {
-                    viewHolder.itemView.alpha = 1f
-                }
-                super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
-            }
-
-            override fun clearView(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder) {
-                super.clearView(recyclerView, viewHolder)
-                listener.onViewIdle()
-            }
-
-            override fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int {
-                val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN
-                val swipeFlags = ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT
-                return makeMovementFlags(dragFlags, swipeFlags)
-            }
-
-            override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder,
-                                target: RecyclerView.ViewHolder): Boolean {
-                return listener.onViewMoved(viewHolder.adapterPosition, target.adapterPosition)
-            }
-
-            override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
-                //adapter.deleteAppFromList(viewHolder.adapterPosition)
-                listener.onViewSwiped(viewHolder.adapterPosition)
-            }
-
-            override fun isLongPressDragEnabled() = false
-        }
-
-        val itemTouchHelper = ItemTouchHelper(simpleItemTouchCallback)
-
-        itemTouchHelper.attachToRecyclerView(settingsAppList)
-
-        adapter.setItemTouchHelper(itemTouchHelper)
-
-        buttonChangeTheme.setOnClickListener {
-            val themeChooserDialog = ThemeChooserDialog.getThemeChooser()
-            themeChooserDialog.showNow(fragmentManager, "THEME_CHOOSER")
-        }
-        initComponents()
-    }
-
-    override fun getFragmentView(): View = settings_fragment
-
-    private fun initComponents() {
-        val settings = context!!.getSharedPreferences(getString(R.string.prefs_settings), MODE_PRIVATE)
-        clockSwitch.isChecked = settings.getBoolean(getString(R.string.prefs_settings_key_clock_type), false)
-        clockSwitch.setOnCheckedChangeListener { _, b ->
-            settings.edit {
-                putBoolean(getString(R.string.prefs_settings_key_clock_type), b)
-            }
-        }
-
-        statusBarSwitch.isChecked = settings.getBoolean(getString(R.string.prefs_settings_key_hide_status_bar), false)
-        statusBarSwitch.setOnCheckedChangeListener { _, b ->
-            settings.edit {
-                putBoolean(getString(R.string.prefs_settings_key_hide_status_bar), b)
-            }
-        }
-    }
-}

+ 0 - 138
app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/SettingsListAdapter.kt

@@ -1,138 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.settings
-
-import android.annotation.SuppressLint
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.MotionEvent
-import android.view.View
-import android.view.ViewGroup
-import android.widget.Button
-import android.widget.ImageView
-import android.widget.TextView
-import androidx.fragment.app.Fragment
-import androidx.lifecycle.Observer
-import androidx.lifecycle.ViewModelProviders
-import androidx.navigation.Navigation
-import androidx.recyclerview.widget.ItemTouchHelper
-import androidx.recyclerview.widget.RecyclerView
-import com.google.android.material.snackbar.Snackbar
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.data.HomeApp
-import com.sduduzog.slimlauncher.ui.main.MainViewModel
-import com.sduduzog.slimlauncher.ui.main.OnItemActionListener
-
-class SettingsListAdapter(private val fragment: Fragment) : RecyclerView.Adapter<SettingsListAdapter.AppViewHolder>(), OnItemActionListener {
-
-    private var deletedFromIndex = 0
-    private var renamedOnIndex = -1
-    private lateinit var inflater: LayoutInflater
-    private var displayedApps: ArrayList<HomeApp> = arrayListOf()
-    private var viewModel: MainViewModel = ViewModelProviders.of(fragment).get(MainViewModel::class.java)
-
-    private lateinit var touchHelper: ItemTouchHelper
-
-    init {
-        viewModel.homeApps.observe(fragment, Observer {
-            updateApps(it.orEmpty())
-        })
-    }
-
-    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AppViewHolder {
-        inflater = LayoutInflater.from(parent.context)
-        val view = inflater.inflate(R.layout.settings_list_item, parent, false)
-        return AppViewHolder(view)
-    }
-
-    @SuppressLint("ClickableViewAccessibility")
-    override fun onBindViewHolder(holder: AppViewHolder, position: Int) {
-        if (position < displayedApps.size) {
-            val app = displayedApps[position]
-            with(app) {
-                holder.itemText.text = this.appName
-            }
-            holder.itemButton.visibility = View.GONE
-            holder.itemDragger.visibility = View.VISIBLE
-            holder.itemDragger.setOnTouchListener { _, motionEvent ->
-                if (motionEvent.actionMasked == MotionEvent.ACTION_DOWN) {
-                    touchHelper.startDrag(holder)
-                }
-                false
-            }
-
-            holder.itemView.setOnClickListener {
-                val snackbar = Snackbar.make(it, "You're still in preferences, silly. Go back to the home screen to start this app", Snackbar.LENGTH_LONG)
-                snackbar.show()
-            }
-
-            holder.itemView.setOnLongClickListener {
-                RenameAppDialog.rename(app, viewModel).show(fragment.childFragmentManager, "SettingsListAdapter")
-                renamedOnIndex = position
-                true
-            }
-        } else {
-            holder.itemText.text = fragment.getString(R.string.settings_list_item_text)
-            holder.itemText.alpha = .3f
-            holder.itemButton.visibility = View.VISIBLE
-            holder.itemDragger.visibility = View.GONE
-            val bundle = Bundle()
-            bundle.putInt("index", position)
-            holder.itemButton.setOnClickListener(
-                    Navigation.createNavigateOnClickListener(R.id.action_openAppsFragment, bundle))
-        }
-    }
-
-    override fun getItemCount() = if (displayedApps.size != 5) displayedApps.size + 1 else displayedApps.size
-
-
-    private fun updateApps(newList: List<HomeApp>) {
-        val size = displayedApps.size
-        displayedApps.clear()
-        displayedApps.addAll(newList)
-        when {
-            size > newList.size -> notifyItemRemoved(deletedFromIndex)
-            size < newList.size -> notifyItemRangeChanged(size, displayedApps.size - size)
-            renamedOnIndex != -1 -> {
-                notifyItemChanged(renamedOnIndex)
-                renamedOnIndex = -1
-            }
-        }
-    }
-
-    override fun onViewMoved(oldPosition: Int, newPosition: Int): Boolean {
-        if ((oldPosition < displayedApps.size) and (newPosition < displayedApps.size)) {
-            val app1 = displayedApps[oldPosition]
-            val app2 = displayedApps[newPosition]
-            app1.sortingIndex = newPosition
-            app2.sortingIndex = oldPosition
-
-            displayedApps[oldPosition] = app2
-            displayedApps[newPosition] = app1
-            notifyItemMoved(oldPosition, newPosition)
-            return true
-        }
-        return false
-    }
-
-    override fun onViewSwiped(position: Int) {
-        deletedFromIndex = position
-        if (position < displayedApps.size) {
-            viewModel.deleteApp(displayedApps[position])
-        } else
-            notifyDataSetChanged()
-    }
-
-    override fun onViewIdle() {
-        viewModel.updateApps(displayedApps)
-    }
-
-    fun setItemTouchHelper(touchHelper: ItemTouchHelper) {
-        this.touchHelper = touchHelper
-    }
-
-    inner class AppViewHolder(view: View)// Bind item views here
-        : RecyclerView.ViewHolder(view) {
-        val itemText: TextView = view.findViewById(R.id.item_text)
-        val itemButton: Button = view.findViewById(R.id.item_button)
-        val itemDragger: ImageView = view.findViewById(R.id.item_dragger)
-    }
-}

+ 0 - 82
app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/ChooseAppsDialog.kt

@@ -1,82 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.setup
-
-import android.app.AlertDialog
-import android.app.Dialog
-import android.content.Intent
-import android.content.pm.ResolveInfo
-import android.os.Bundle
-import android.widget.Toast
-import androidx.fragment.app.DialogFragment
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.data.App
-import java.util.*
-
-class ChooseAppsDialog : DialogFragment() {
-    private lateinit var listener: OnChooseAppsListener
-    private lateinit var apps: MutableList<App>
-    private lateinit var checkedItems: BooleanArray
-
-    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
-        val pm = activity!!.packageManager
-        val main = Intent(Intent.ACTION_MAIN, null)
-        main.addCategory(Intent.CATEGORY_LAUNCHER)
-        val launchables = pm.queryIntentActivities(main, 0)
-        Collections.sort(launchables,
-                ResolveInfo.DisplayNameComparator(pm))
-        apps = mutableListOf()
-        for (i in launchables.indices) {
-            val item = launchables[i]
-            val activity = item.activityInfo
-            val app = App(launchables[i].loadLabel(pm).toString(), activity.applicationInfo.packageName, activity.name)
-            apps.add(app)
-        }
-        val appNames = arrayOfNulls<String>(apps.size)
-        checkedItems = BooleanArray(apps.size)
-        for (i in apps.indices) {
-            appNames[i] = apps[i].appName
-        }
-
-        val builder = AlertDialog.Builder(context!!)
-        builder.setMultiChoiceItems(appNames, checkedItems) { _, i, b ->
-            checkedItems[i] = b
-            if (checkedItems.filter { it }.size == 5) {
-                setApps()
-                dismiss()
-            }
-
-        }
-        builder.setPositiveButton("Done") { _, _ ->
-            if (checkedItems.none { it }) {
-                Toast.makeText(context, getString(R.string.no_app_selected_toast_msg), Toast.LENGTH_SHORT).show()
-            } else {
-                setApps()
-            }
-        }
-        builder.setTitle(getString(R.string.choose_apps_title))
-
-        return builder.create()
-    }
-
-    private fun setApps() {
-        val list = mutableListOf<App>()
-        for (i in checkedItems.indices) {
-            if (checkedItems[i]) {
-                list.add(apps[i])
-            }
-        }
-        listener.onChooseApps(list)
-    }
-
-    companion object {
-
-        fun getInstance(listener: OnChooseAppsListener): ChooseAppsDialog {
-            return ChooseAppsDialog().apply {
-                this.listener = listener
-            }
-        }
-
-        interface OnChooseAppsListener {
-            fun onChooseApps(apps: List<App>)
-        }
-    }
-}

+ 0 - 5
app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/OnPagerListener.kt

@@ -1,5 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.setup
-
-interface OnPagerListener {
-    fun onPage(position: Int)
-}

+ 0 - 7
app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/PagerHelperFragment.kt

@@ -1,7 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.setup
-
-import androidx.fragment.app.Fragment
-
-abstract class PagerHelperFragment : Fragment() {
-    var listener: OnPagerListener? = null
-}

+ 0 - 72
app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/SetupFragment.kt

@@ -1,72 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.setup
-
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.fragment.app.Fragment
-import androidx.fragment.app.FragmentManager
-import androidx.fragment.app.FragmentPagerAdapter
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.ui.main.StatusBarThemeFragment
-import kotlinx.android.synthetic.main.setup_fragment.*
-
-
-class SetupFragment : StatusBarThemeFragment() {
-
-    private lateinit var onPagerListener: OnPagerListener
-    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
-                              savedInstanceState: Bundle?): View? {
-        // Inflate the layout for this fragment
-        return inflater.inflate(R.layout.setup_fragment, container, false)
-    }
-
-    override fun onActivityCreated(savedInstanceState: Bundle?) {
-        super.onActivityCreated(savedInstanceState)
-
-        setup_view_pager.adapter = SectionsPagerAdapter(childFragmentManager)
-
-        setup_view_pager.setOnTouchListener { _, _ -> true }
-    }
-
-    override fun onStart() {
-        super.onStart()
-        onPagerListener = object : OnPagerListener {
-            override fun onPage(position: Int) {
-                setup_view_pager.currentItem = position
-            }
-        }
-    }
-
-    override fun getFragmentView(): View = setup_view_pager
-
-    inner class SectionsPagerAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm) {
-
-        override fun getItem(position: Int): Fragment {
-            return when (position) {
-                1 -> ThemeSetupFragment.newInstance().apply {
-                    this.listener = onPagerListener
-                }
-                else -> SplashFragment.newInstance().apply {
-                    this.listener = onPagerListener
-                }
-            }
-        }
-
-        override fun getCount(): Int {
-            return 5
-        }
-
-        override fun getPageTitle(position: Int): CharSequence? {
-            when (position) {
-                0 -> return "Splash screen"
-                1 -> return "Home setup"
-                2 -> return "Clock setup"
-                3 -> return "Theme setup"
-                4 -> return "Dialer setup"
-            }
-            return null
-        }
-    }
-}

+ 0 - 49
app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/SplashFragment.kt

@@ -1,49 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.setup
-
-
-import android.content.Context.MODE_PRIVATE
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.lifecycle.ViewModelProviders
-import androidx.navigation.Navigation
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.data.App
-import com.sduduzog.slimlauncher.ui.main.MainViewModel
-import kotlinx.android.synthetic.main.splash_fragment.*
-
-class SplashFragment : PagerHelperFragment(), ChooseAppsDialog.Companion.OnChooseAppsListener {
-
-    private lateinit var viewModel: MainViewModel
-
-    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
-                              savedInstanceState: Bundle?): View? {
-        // Inflate the layout for this fragment
-        return inflater.inflate(R.layout.splash_fragment, container, false)
-    }
-
-    override fun onActivityCreated(savedInstanceState: Bundle?) {
-        super.onActivityCreated(savedInstanceState)
-        viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java)
-        setup_splash_button_start.setOnClickListener {
-                ChooseAppsDialog.getInstance(this).show(childFragmentManager, "HomeSetupFragment")
-        }
-        val settings = activity!!.getSharedPreferences(getString(R.string.prefs_settings), MODE_PRIVATE)
-        if (!settings.getBoolean(getString(R.string.prefs_settings_key_fresh_install_setup), true)) {
-            Navigation.findNavController(splash_fragment).navigate(R.id.action_setupFragment_to_mainFragment2)
-        }
-    }
-
-        override fun onChooseApps(apps: List<App>) {
-            viewModel.clearHomeApps()
-            viewModel.addToHomeScreen(apps)
-            listener?.onPage(1) // Move to next section
-        }
-
-
-    companion object {
-        @JvmStatic
-        fun newInstance() = SplashFragment()
-    }
-}

+ 0 - 62
app/src/main/java/com/sduduzog/slimlauncher/ui/main/setup/ThemeSetupFragment.kt

@@ -1,62 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main.setup
-
-
-import android.content.Context
-import android.content.Context.MODE_PRIVATE
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.core.content.edit
-import androidx.navigation.Navigation
-import com.sduduzog.slimlauncher.R
-import kotlinx.android.synthetic.main.theme_setup_fragment.*
-
-
-class ThemeSetupFragment : PagerHelperFragment(), View.OnClickListener {
-
-    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
-                              savedInstanceState: Bundle?): View? {
-        // Inflate the layout for this fragment
-        return inflater.inflate(R.layout.theme_setup_fragment, container, false)
-    }
-
-    override fun onActivityCreated(savedInstanceState: Bundle?) {
-        super.onActivityCreated(savedInstanceState)
-
-        setup_fab_candy.setOnClickListener(this)
-        setup_fab_dark.setOnClickListener(this)
-        setup_fab_default.setOnClickListener(this)
-        setup_fab_jupiter.setOnClickListener(this)
-        setup_fab_pastel.setOnClickListener(this)
-        setup_fab_teal.setOnClickListener(this)
-
-        theme_setup_button.setOnClickListener {
-            val settings = activity!!.getSharedPreferences(getString(R.string.prefs_settings), MODE_PRIVATE)
-            settings.edit {
-                putBoolean(getString(R.string.prefs_settings_key_fresh_install_setup), false)
-            }
-            Navigation.findNavController(theme_setup_fragment).navigate(R.id.action_setupFragment_to_mainFragment2)
-        }
-    }
-
-    override fun onClick(view: View) {
-        val index = when (view.id) {
-            R.id.setup_fab_dark -> 1
-            R.id.setup_fab_jupiter -> 2
-            R.id.setup_fab_teal -> 3
-            R.id.setup_fab_candy -> 4
-            R.id.setup_fab_pastel -> 5
-            else -> 0
-        }
-        val settings = activity!!.getSharedPreferences(getString(R.string.prefs_settings), Context.MODE_PRIVATE)
-        settings.edit {
-            putInt(getString(R.string.prefs_settings_key_theme), index)
-        }
-    }
-
-    companion object {
-        @JvmStatic
-        fun newInstance() = ThemeSetupFragment()
-    }
-}

+ 79 - 0
app/src/main/java/com/sduduzog/slimlauncher/ui/options/AddAppFragment.kt

@@ -0,0 +1,79 @@
+package com.sduduzog.slimlauncher.ui.options
+
+import android.os.Bundle
+import android.text.Editable
+import android.text.TextWatcher
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.navigation.Navigation
+import com.sduduzog.slimlauncher.R
+import com.sduduzog.slimlauncher.adapters.AddAppAdapter
+import com.sduduzog.slimlauncher.data.MainViewModel
+import com.sduduzog.slimlauncher.data.model.App
+import com.sduduzog.slimlauncher.utils.BaseFragment
+import com.sduduzog.slimlauncher.utils.LoadInstalledApps
+import com.sduduzog.slimlauncher.utils.OnAppClickedListener
+import kotlinx.android.synthetic.main.add_app_fragment.*
+
+class AddAppFragment : BaseFragment(), OnAppClickedListener {
+
+    override fun getFragmentView(): ViewGroup = add_app_fragment
+
+    private lateinit var viewModel: MainViewModel
+
+    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+        return inflater.inflate(R.layout.add_app_fragment, container, false)
+    }
+
+    override fun onActivityCreated(savedInstanceState: Bundle?) {
+        super.onActivityCreated(savedInstanceState)
+        val adapter = AddAppAdapter(this)
+
+        add_app_fragment_list.adapter = adapter
+
+        activity?.let {
+            viewModel = ViewModelProviders.of(it).get(MainViewModel::class.java)
+        } ?: throw Error("How the fuck is this fragment alive while there's no activity?")
+        viewModel.installedApps.observe(this, Observer {
+            val homeApps = viewModel.apps.value.orEmpty()
+            it?.let { apps ->
+                adapter.setItems(apps.filterNot { app -> homeApps.map { homeApp -> homeApp.packageName }.contains(app.packageName) })
+                add_app_fragment_progress_bar.visibility = View.GONE
+            } ?: run {
+                add_app_fragment_progress_bar.visibility = View.VISIBLE
+            }
+        })
+        add_app_fragment_edit_text.addTextChangedListener(onTextChangeListener)
+    }
+
+    override fun onDestroy() {
+        super.onDestroy()
+        add_app_fragment_edit_text?.removeTextChangedListener(onTextChangeListener)
+    }
+
+    private val onTextChangeListener: TextWatcher = object : TextWatcher {
+
+        override fun afterTextChanged(s: Editable?) {
+            // Do nothing
+        }
+
+        override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
+            // Do nothing
+        }
+
+        override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
+            s?.let {
+                LoadInstalledApps(viewModel, s.toString()).execute(context!!.packageManager)
+            }
+        }
+    }
+
+    override fun onAppClicked(app: App) {
+        viewModel.add(app)
+        Navigation.findNavController(add_app_fragment).popBackStack()
+    }
+
+}

+ 135 - 0
app/src/main/java/com/sduduzog/slimlauncher/ui/options/CustomiseAppsFragment.kt

@@ -0,0 +1,135 @@
+package com.sduduzog.slimlauncher.ui.options
+
+import android.graphics.Canvas
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.appcompat.widget.PopupMenu
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.navigation.Navigation
+import androidx.recyclerview.widget.ItemTouchHelper
+import androidx.recyclerview.widget.RecyclerView
+import com.sduduzog.slimlauncher.R
+import com.sduduzog.slimlauncher.adapters.CustomAppsAdapter
+import com.sduduzog.slimlauncher.data.MainViewModel
+import com.sduduzog.slimlauncher.data.model.HomeApp
+import com.sduduzog.slimlauncher.dialogs.RenameAppDialog
+import com.sduduzog.slimlauncher.utils.BaseFragment
+import com.sduduzog.slimlauncher.utils.LoadInstalledApps
+import com.sduduzog.slimlauncher.utils.OnItemActionListener
+import com.sduduzog.slimlauncher.utils.OnShitDoneToAppsListener
+import kotlinx.android.synthetic.main.customise_apps_fragment.*
+
+
+class CustomiseAppsFragment : BaseFragment(), OnShitDoneToAppsListener {
+
+    override fun getFragmentView(): ViewGroup = customise_apps_fragment
+
+    private lateinit var viewModel: MainViewModel
+
+    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+        return inflater.inflate(R.layout.customise_apps_fragment, container, false)
+    }
+
+    override fun onActivityCreated(savedInstanceState: Bundle?) {
+        super.onActivityCreated(savedInstanceState)
+
+        val adapter = CustomAppsAdapter(this)
+        activity?.let {
+            viewModel = ViewModelProviders.of(it).get(MainViewModel::class.java)
+        } ?: throw Error("Activity null, something here is fucked up")
+
+        viewModel.apps.observe(this, Observer {
+            it?.let { apps ->
+                adapter.setItems(apps)
+                when (apps.size) {
+                    in 0..6 -> {
+                        customise_apps_fragment_add.visibility = View.VISIBLE
+                    }
+                    else -> {
+                        customise_apps_fragment_add.visibility = View.GONE
+                    }
+                }
+            } ?: adapter.setItems(listOf())
+        })
+        customise_apps_fragment_remove_all.setOnClickListener {
+            viewModel.apps.value?.let {
+                viewModel.remove(*it.toTypedArray())
+            }
+        }
+        LoadInstalledApps(viewModel).execute(context!!.packageManager)
+
+        customise_apps_fragment_list.adapter = adapter
+        val listener: OnItemActionListener = adapter
+        val simpleItemTouchCallback = object : ItemTouchHelper.Callback() {
+
+            override fun onChildDraw(c: Canvas, recyclerView: RecyclerView,
+                                     viewHolder: RecyclerView.ViewHolder, dX: Float,
+                                     dY: Float, actionState: Int, isCurrentlyActive: Boolean) {
+                if (isCurrentlyActive) {
+                    viewHolder.itemView.alpha = 0.5f
+                } else {
+                    viewHolder.itemView.alpha = 1f
+                }
+                super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
+            }
+
+            override fun clearView(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder) {
+                super.clearView(recyclerView, viewHolder)
+                listener.onViewIdle()
+            }
+
+            override fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int {
+                val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN
+                val swipeFlags = 0
+                return makeMovementFlags(dragFlags, swipeFlags)
+            }
+
+            override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder,
+                                target: RecyclerView.ViewHolder): Boolean {
+                return listener.onViewMoved(viewHolder.adapterPosition, target.adapterPosition)
+            }
+
+            override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
+                listener.onViewSwiped(viewHolder.adapterPosition)
+            }
+
+            override fun isLongPressDragEnabled() = false
+        }
+
+        val itemTouchHelper = ItemTouchHelper(simpleItemTouchCallback)
+
+        itemTouchHelper.attachToRecyclerView(customise_apps_fragment_list)
+
+        adapter.setItemTouchHelper(itemTouchHelper)
+
+        customise_apps_fragment_add.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_customiseAppsFragment_to_addAppFragment))
+    }
+
+    private fun showPopupMenu(view: View): PopupMenu {
+        val popup = PopupMenu(context!!, view)
+        popup.menuInflater.inflate(R.menu.customise_apps_popup_menu, popup.menu)
+        popup.show()
+        return popup
+    }
+
+    override fun onAppsUpdated(list: List<HomeApp>) {
+        viewModel.update(*list.toTypedArray())
+    }
+
+    override fun onAppMenuClicked(view: View, app: HomeApp) {
+        showPopupMenu(view).setOnMenuItemClickListener {
+            when (it.itemId) {
+                R.id.ca_menu_rename -> {
+                    RenameAppDialog.getInstance(app, viewModel).show(childFragmentManager, "SettingsListAdapter")
+                }
+                R.id.ca_menu_remove -> {
+                    viewModel.remove(app)
+                }
+            }
+            true
+        }
+    }
+}

+ 61 - 0
app/src/main/java/com/sduduzog/slimlauncher/ui/options/OptionsFragment.kt

@@ -0,0 +1,61 @@
+package com.sduduzog.slimlauncher.ui.options
+
+import android.content.Context.MODE_PRIVATE
+import android.content.Intent
+import android.net.Uri
+import android.os.Build
+import android.os.Bundle
+import android.provider.Settings
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.core.content.edit
+import androidx.navigation.Navigation
+import com.sduduzog.slimlauncher.R
+import com.sduduzog.slimlauncher.dialogs.ChangeThemeDialog
+import com.sduduzog.slimlauncher.dialogs.ChooseTimeFormatDialog
+import com.sduduzog.slimlauncher.utils.BaseFragment
+import kotlinx.android.synthetic.main.options_fragment.*
+
+class OptionsFragment : BaseFragment() {
+    override fun getFragmentView(): ViewGroup = options_fragment
+
+    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+        return inflater.inflate(R.layout.options_fragment, container, false)
+    }
+
+    override fun onActivityCreated(savedInstanceState: Bundle?) {
+        super.onActivityCreated(savedInstanceState)
+        options_fragment_about_slim.setOnClickListener {
+            val intent = Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.slim_url)))
+            launchActivity(it, intent)
+        }
+        options_fragment_device_settings.setOnClickListener {
+            val intent = Intent(Settings.ACTION_SETTINGS)
+            launchActivity(it, intent)
+        }
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            options_fragment_device_settings.setOnLongClickListener {
+                val intent = Intent(Settings.ACTION_HOME_SETTINGS)
+                launchActivity(it, intent)
+                true
+            }
+        }
+        options_fragment_change_theme.setOnClickListener {
+            val changeThemeDialog = ChangeThemeDialog.getThemeChooser()
+            changeThemeDialog.showNow(fragmentManager, "THEME_CHOOSER")
+        }
+        options_fragment_choose_time_format.setOnClickListener {
+            val chooseTimeFormatDialog = ChooseTimeFormatDialog.getInstance()
+            chooseTimeFormatDialog.showNow(fragmentManager, "TIME_FORMAT_CHOOSER")
+        }
+        options_fragment_toggle_status_bar.setOnClickListener {
+            val settings = context!!.getSharedPreferences(getString(R.string.prefs_settings), MODE_PRIVATE)
+            val isHidden = settings.getBoolean(getString(R.string.prefs_settings_key_toggle_status_bar), false)
+            settings.edit {
+                putBoolean(getString(R.string.prefs_settings_key_toggle_status_bar), !isHidden)
+            }
+        }
+        options_fragment_customise_apps.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_optionsFragment_to_customiseAppsFragment))
+    }
+}

+ 65 - 0
app/src/main/java/com/sduduzog/slimlauncher/utils/BaseFragment.kt

@@ -0,0 +1,65 @@
+package com.sduduzog.slimlauncher.utils
+
+import android.content.Intent
+import android.os.Build
+import android.util.TypedValue
+import android.view.View
+import android.view.ViewGroup
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.app.ActivityOptionsCompat
+import androidx.fragment.app.Fragment
+import com.sduduzog.slimlauncher.MainActivity
+import com.sduduzog.slimlauncher.R
+
+abstract class BaseFragment : Fragment() {
+
+    abstract fun getFragmentView(): ViewGroup
+
+
+    override fun onResume() {
+        super.onResume()
+        val settings = context!!.getSharedPreferences(getString(R.string.prefs_settings), AppCompatActivity.MODE_PRIVATE)
+        val active = settings.getInt(getString(R.string.prefs_settings_key_theme), 0)
+
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            when (active) {
+                0, 3, 5 -> {
+                    val flags = activity!!.window.decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
+                    getFragmentView().systemUiVisibility = flags
+                }
+
+            }
+            val value = TypedValue()
+            context!!.theme.resolveAttribute(R.attr.colorPrimary, value, true)
+            activity!!.window.statusBarColor = value.data
+        }
+    }
+
+    override fun onStart() {
+        super.onStart()
+        with(activity as MainActivity) {
+            this.attachSubscriber(this@BaseFragment)
+        }
+    }
+
+    override fun onStop() {
+        super.onStop()
+        with(activity as MainActivity) {
+            this.detachSubscriber(this@BaseFragment)
+        }
+    }
+
+    protected fun launchActivity(view: View, intent: Intent) {
+        val left = 0
+        val top = 0
+        val width = view.measuredWidth
+        val height = view.measuredHeight
+        val opts = ActivityOptionsCompat.makeClipRevealAnimation(view, left, top, width, height)
+        startActivity(intent, opts.toBundle())
+    }
+
+    open fun onBack(): Boolean = false
+
+    open fun onHome() {}
+}

+ 45 - 0
app/src/main/java/com/sduduzog/slimlauncher/utils/HomeWatcher.kt

@@ -0,0 +1,45 @@
+package com.sduduzog.slimlauncher.utils
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.content.IntentFilter
+
+class HomeWatcher(private val context: Context) {
+
+    private var listener: OnHomePressedListener? = null
+    private var receiver: InnerReceiver? = null
+    private val filter = IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)
+
+    fun setOnHomePressedListener(listener: OnHomePressedListener) {
+        this.listener = listener
+        receiver = InnerReceiver()
+    }
+
+    fun startWatch() {
+        receiver?.let {
+            context.registerReceiver(it, filter)
+        }
+    }
+
+    fun stopWatch() {
+        receiver?.let {
+            context.unregisterReceiver(it)
+        }
+    }
+
+    inner class InnerReceiver : BroadcastReceiver() {
+
+        override fun onReceive(context: Context?, intent: Intent?) {
+            if (intent == null) return
+            if (intent.action != Intent.ACTION_CLOSE_SYSTEM_DIALOGS) return
+            val reason = intent.getStringExtra("reason") ?: return
+            if (reason != "homekey") return
+            listener?.onHomePressed()
+        }
+    }
+
+    interface OnHomePressedListener {
+        fun onHomePressed()
+    }
+}

+ 61 - 0
app/src/main/java/com/sduduzog/slimlauncher/utils/LoadInstalledApps.kt

@@ -0,0 +1,61 @@
+package com.sduduzog.slimlauncher.utils
+
+import android.content.Intent
+import android.content.pm.PackageManager
+import android.content.pm.ResolveInfo
+import android.os.AsyncTask
+import android.os.Build
+import android.provider.AlarmClock
+import android.provider.MediaStore
+import com.sduduzog.slimlauncher.BuildConfig
+import com.sduduzog.slimlauncher.data.MainViewModel
+import com.sduduzog.slimlauncher.data.model.App
+import java.util.*
+
+class LoadInstalledApps(private val viewModel: MainViewModel?, private val filterString: String = "") : AsyncTask<PackageManager, Unit, List<App>>() {
+
+    private lateinit var packageManager: PackageManager
+
+    override fun doInBackground(vararg params: PackageManager): List<App> {
+        val pm = params[0]
+        packageManager = pm
+        val list = mutableListOf<App>()
+        val main = Intent(Intent.ACTION_MAIN, null)
+        main.addCategory(Intent.CATEGORY_LAUNCHER)
+        val activitiesList = pm.queryIntentActivities(main, 0)
+        Collections.sort(activitiesList, ResolveInfo.DisplayNameComparator(pm))
+        for (i in activitiesList.indices) {
+            val item = activitiesList[i]
+            val activity = item.activityInfo
+            val app = App(activitiesList[i].loadLabel(pm).toString(), activity.applicationInfo.packageName, activity.name)
+            list.add(app)
+        }
+
+        val filter = mutableListOf<String>()
+
+        Intent(Intent.ACTION_DIAL).resolveActivity(packageManager)?.let {
+            filter.add(it.packageName)
+        }
+        Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_APP_CALENDAR).resolveActivity(packageManager)?.let {
+            filter.add(it.packageName)
+        }
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+            Intent(AlarmClock.ACTION_SHOW_ALARMS).resolveActivity(packageManager)?.let {
+                filter.add(it.packageName)
+            }
+        }
+
+        Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA).resolveActivity(packageManager)?.let {
+            filter.add(it.packageName)
+        }
+
+        filter.add(BuildConfig.APPLICATION_ID)
+
+        return list.filterNot { filter.contains(it.packageName) }
+    }
+
+    override fun onPostExecute(result: List<App>) {
+        viewModel?.installedApps?.value = result.filter { it.appName.contains(filterString, true) }
+    }
+}

+ 7 - 0
app/src/main/java/com/sduduzog/slimlauncher/utils/OnAppClickedListener.kt

@@ -0,0 +1,7 @@
+package com.sduduzog.slimlauncher.utils
+
+import com.sduduzog.slimlauncher.data.model.App
+
+interface OnAppClickedListener{
+    fun onAppClicked(app: App)
+}

+ 1 - 1
app/src/main/java/com/sduduzog/slimlauncher/ui/main/OnItemActionListener.kt → app/src/main/java/com/sduduzog/slimlauncher/utils/OnItemActionListener.kt

@@ -1,4 +1,4 @@
-package com.sduduzog.slimlauncher.ui.main
+package com.sduduzog.slimlauncher.utils
 
 interface OnItemActionListener {
     fun onViewMoved(oldPosition: Int, newPosition: Int): Boolean

+ 8 - 0
app/src/main/java/com/sduduzog/slimlauncher/utils/OnLaunchAppListener.kt

@@ -0,0 +1,8 @@
+package com.sduduzog.slimlauncher.utils
+
+import android.view.View
+import com.sduduzog.slimlauncher.data.model.HomeApp
+
+interface OnLaunchAppListener{
+    fun onLaunch(app: HomeApp, view: View)
+}

+ 9 - 0
app/src/main/java/com/sduduzog/slimlauncher/utils/OnShitDoneToAppsListener.kt

@@ -0,0 +1,9 @@
+package com.sduduzog.slimlauncher.utils
+
+import android.view.View
+import com.sduduzog.slimlauncher.data.model.HomeApp
+
+interface OnShitDoneToAppsListener {
+    fun onAppsUpdated(list: List<HomeApp>)
+    fun onAppMenuClicked(view: View, app: HomeApp)
+}

+ 0 - 9
app/src/main/res/drawable-v21/ic_call.xml

@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24.0"
-    android:viewportHeight="24.0">
-    <path
-        android:fillColor="?android:colorForeground"
-        android:pathData="M6.62,10.79c1.44,2.83 3.76,5.14 6.59,6.59l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1V20c0,0.55 -0.45,1 -1,1 -9.39,0 -17,-7.61 -17,-17 0,-0.55 0.45,-1 1,-1h3.5c0.55,0 1,0.45 1,1 0,1.25 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z" />
-</vector>

+ 0 - 9
app/src/main/res/drawable-v21/ic_drag_handle.xml

@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24.0"
-    android:viewportHeight="24.0">
-    <path
-        android:fillColor="?android:colorForeground"
-        android:pathData="M20,9H4v2h16V9zM4,15h16v-2H4v2z" />
-</vector>

+ 0 - 9
app/src/main/res/drawable-v21/ic_expand.xml

@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24.0"
-    android:viewportHeight="24.0">
-    <path
-        android:fillColor="?android:colorForeground"
-        android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z" />
-</vector>

+ 0 - 12
app/src/main/res/drawable-v21/ic_photo_camera.xml

@@ -1,12 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24.0"
-    android:viewportHeight="24.0">
-    <path
-        android:fillColor="?android:colorForeground"
-        android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
-    <path
-        android:fillColor="?android:colorForeground"
-        android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
-</vector>

+ 1 - 1
app/src/main/res/drawable/ic_call.xml

@@ -4,6 +4,6 @@
     android:viewportWidth="24.0"
     android:viewportHeight="24.0">
     <path
-        android:fillColor="@color/colorAccent"
+        android:fillColor="?attr/colorAccent"
         android:pathData="M6.62,10.79c1.44,2.83 3.76,5.14 6.59,6.59l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1V20c0,0.55 -0.45,1 -1,1 -9.39,0 -17,-7.61 -17,-17 0,-0.55 0.45,-1 1,-1h3.5c0.55,0 1,0.45 1,1 0,1.25 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z" />
 </vector>

+ 0 - 9
app/src/main/res/drawable/ic_drag_handle.xml

@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24.0"
-    android:viewportHeight="24.0">
-    <path
-        android:fillColor="?attr/colorAccent"
-        android:pathData="M20,9H4v2h16V9zM4,15h16v-2H4v2z" />
-</vector>

+ 0 - 9
app/src/main/res/drawable/ic_edit.xml

@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24.0"
-    android:viewportHeight="24.0">
-    <path
-        android:fillColor="#FFFFFFFF"
-        android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" />
-</vector>

+ 0 - 9
app/src/main/res/drawable/ic_expand.xml

@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24.0"
-    android:viewportHeight="24.0">
-    <path
-        android:fillColor="@color/colorAccent"
-        android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z" />
-</vector>

+ 9 - 0
app/src/main/res/drawable/ic_more_vert.xml

@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="?attr/colorAccent"
+        android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
+</vector>

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 3
app/src/main/res/drawable/ic_my_phone.xml


+ 2 - 2
app/src/main/res/drawable/ic_photo_camera.xml

@@ -4,9 +4,9 @@
     android:viewportWidth="24.0"
     android:viewportHeight="24.0">
     <path
-        android:fillColor="@color/colorAccent"
+        android:fillColor="?attr/colorAccent"
         android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
     <path
-        android:fillColor="@color/colorAccent"
+        android:fillColor="?attr/colorAccent"
         android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
 </vector>

+ 0 - 12
app/src/main/res/drawable/ic_slim.xml

@@ -1,12 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:width="200dp"
-    android:height="200dp"
-    android:viewportWidth="364.8"
-    android:viewportHeight="364.8">
-    <path
-        android:fillColor="#FF000000"
-        android:pathData="m173.79,343.55c-8.988,-0.539 -17.782,-1.74 -26.08,-3.562 -65.858,-14.457 -115.83,-67.785 -126.05,-134.52 -2.362,-15.418 -2.362,-33.222 0,-48.64 10.811,-70.572 65.882,-125.64 136.45,-136.45 15.418,-2.362 33.222,-2.362 48.64,0 70.572,10.811 125.64,65.882 136.45,136.45 1.242,8.109 1.73,14.964 1.73,24.32 0,9.356 -0.488,16.211 -1.73,24.32 -11.347,74.07 -71.37,130.67 -145.89,137.58 -6.66,0.617 -17.689,0.853 -23.52,0.504zM177.96,215.51c-10.277,-1.497 -18.477,-9.697 -19.974,-19.974 -0.192,-1.322 -0.29,1.516 -0.317,9.21l-0.039,11.12 11.12,-0.039c7.694,-0.027 10.531,-0.125 9.21,-0.317zM266.11,161.626v-54.24h-108.48l0.039,41.68c0.023,25.033 0.15,40.917 0.317,39.77 1.266,-8.695 7.378,-16.078 15.632,-18.886 12.379,-4.21 25.761,2.293 29.928,14.544 1.73,5.085 1.73,10.298 0,15.383 -2.807,8.254 -10.191,14.366 -18.886,15.632 -1.147,0.167 14.737,0.294 39.77,0.317l41.68,0.039z"
-        android:strokeWidth=".32"
-        tools:ignore="VectorPath" />
-</vector>

+ 0 - 9
app/src/main/res/drawable/ic_text_fields.xml

@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24.0"
-    android:viewportHeight="24.0">
-    <path
-        android:fillColor="#FF000000"
-        android:pathData="M2.5,4v3h5v12h3L10.5,7h5L15.5,4h-13zM21.5,9h-9v3h3v7h3v-7h3L21.5,9z" />
-</vector>

+ 0 - 14
app/src/main/res/drawable/note_item_background.xml

@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-    android:shape="rectangle">
-
-    <corners android:radius="8dp" />
-
-    <gradient
-        android:angle="45"
-        android:centerX="0"
-        android:centerY="0"
-        android:endColor="#10000000"
-        android:startColor="#18ffffff" />
-
-</shape>

+ 59 - 0
app/src/main/res/layout/add_app_fragment.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout 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/add_app_fragment"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".ui.options.AddAppFragment">
+
+    <EditText
+        android:id="@+id/add_app_fragment_edit_text"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="8dp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginTop="32dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginRight="8dp"
+        android:ems="10"
+        android:imeOptions="actionDone"
+        android:inputType="none|textNoSuggestions|textCapWords"
+        android:textSize="@dimen/_18ssp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        tools:ignore="Autofill,LabelFor"
+        android:hint="@string/add_apps_fragment_search_apps" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/add_app_fragment_list"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_marginStart="8dp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginRight="8dp"
+        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/add_app_fragment_edit_text"
+        tools:listitem="@layout/add_app_fragment_list_item" />
+
+    <ProgressBar
+        android:id="@+id/add_app_fragment_progress_bar"
+        style="?android:attr/progressBarStyle"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="8dp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginRight="8dp"
+        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.25" />
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 10 - 0
app/src/main/res/layout/add_app_fragment_list_item.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/aa_list_item_app_name"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:padding="6dp"
+    android:textAppearance="@style/TextAppearance.AppCompat"
+    android:textSize="@dimen/_18ssp">
+
+</TextView>

+ 0 - 11
app/src/main/res/layout/apps_fragment.xml

@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.recyclerview.widget.RecyclerView 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/appList"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layout_marginStart="16dp"
-    android:layout_marginEnd="16dp"
-    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
-    tools:listitem="@layout/apps_list_item" />

+ 0 - 13
app/src/main/res/layout/apps_list_item.xml

@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="horizontal">
-
-    <TextView
-        android:id="@+id/label"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_margin="8dp"
-        android:textSize="24sp" />
-</LinearLayout>

+ 66 - 0
app/src/main/res/layout/customise_apps_fragment.xml

@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout 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/customise_apps_fragment"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".ui.options.CustomiseAppsFragment">
+
+    <TextView
+        android:id="@+id/textView6"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/_16sdp"
+        android:layout_marginLeft="@dimen/_16sdp"
+        android:layout_marginTop="@dimen/_8sdp"
+        android:text="@string/options_fragment_customise_apps"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_36ssp"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/customise_apps_fragment_list"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_marginStart="8dp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginRight="8dp"
+        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/textView6"
+        app:layout_constraintBottom_toBottomOf="parent"
+        tools:itemCount="5"
+        tools:listitem="@layout/customise_apps_fragment_list_item" />
+
+    <TextView
+        android:id="@+id/customise_apps_fragment_add"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="8dp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginBottom="8dp"
+        android:padding="@dimen/_12sdp"
+        android:text="@string/customise_apps_fragment_add"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_16ssp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <TextView
+        android:id="@+id/customise_apps_fragment_remove_all"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="8dp"
+        android:layout_marginRight="8dp"
+        android:layout_marginBottom="8dp"
+        android:text="@string/customise_apps_fragment_remove_all"
+        android:padding="@dimen/_12sdp"
+        android:textSize="@dimen/_16ssp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent" />
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 53 - 0
app/src/main/res/layout/customise_apps_fragment_list_item.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginTop="6dp"
+    android:layout_marginBottom="6dp">
+
+    <TextView
+        android:id="@+id/ca_list_item_drag_handle"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="8dp"
+        android:paddingStart="12dp"
+        android:paddingLeft="12dp"
+        android:paddingEnd="12dp"
+        android:paddingRight="12dp"
+        android:text="="
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="24sp"
+        app:layout_constraintBottom_toBottomOf="@+id/ca_list_item_app_name"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/ca_list_item_app_name"
+        tools:ignore="HardcodedText" />
+
+    <TextView
+        android:id="@+id/ca_list_item_app_name"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="8dp"
+        android:layout_marginLeft="8dp"
+        android:ellipsize="end"
+        android:maxLines="1"
+        android:singleLine="true"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="24sp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toStartOf="@+id/ca_list_item_more_icon"
+        app:layout_constraintStart_toEndOf="@+id/ca_list_item_drag_handle"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageView
+        android:id="@+id/ca_list_item_more_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="8dp"
+        app:layout_constraintBottom_toBottomOf="@+id/ca_list_item_app_name"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/ca_list_item_app_name"
+        app:srcCompat="@drawable/ic_more_vert"
+        tools:ignore="ContentDescription" />
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 85 - 0
app/src/main/res/layout/home_fragment.xml

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.motion.widget.MotionLayout 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/home_fragment"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    app:layoutDescription="@xml/home_motion_scene">
+
+    <TextView
+        android:id="@+id/home_fragment_time"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/_64sdp"
+        android:text="@string/main_placeholder_clock"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_40ssp" />
+
+    <TextView
+        android:id="@+id/home_fragment_time_format"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_13sdp" />
+
+    <TextView
+        android:id="@+id/home_fragment_date"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="@dimen/_4sdp"
+        android:text="@string/main_placeholder_date"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_12sdp" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/home_fragment_list"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+        tools:itemCount="4"
+        tools:listitem="@layout/main_fragment_list_item" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/home_fragment_list_exp"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+        tools:itemCount="3"
+        tools:listitem="@layout/main_fragment_list_item" />
+
+    <TextView
+        android:id="@+id/home_fragment_options"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="@dimen/_8sdp"
+        android:text="@string/main_fragment_options"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_18ssp" />
+
+    <TextView
+        android:id="@+id/home_fragment_notes"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="8dp"
+        android:text="@string/main_fragment_notes"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_18ssp" />
+
+    <ImageView
+        android:id="@+id/home_fragment_call"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="@dimen/_8sdp"
+        app:srcCompat="@drawable/ic_call"
+        tools:ignore="ContentDescription" />
+
+    <ImageView
+        android:id="@+id/home_fragment_camera"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="@dimen/_8sdp"
+        app:srcCompat="@drawable/ic_photo_camera"
+        tools:ignore="ContentDescription" />
+
+</androidx.constraintlayout.motion.widget.MotionLayout>

+ 0 - 134
app/src/main/res/layout/main_bottom_sheet.xml

@@ -1,134 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout 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/bottomSheet"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    app:behavior_hideable="false"
-    app:behavior_peekHeight="60dp"
-    app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
-    tools:context="com.sduduzog.slimlauncher.ui.main.MainFragment">
-
-
-    <androidx.cardview.widget.CardView
-        android:id="@+id/optionsView"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        app:cardBackgroundColor="?android:attr/colorBackground"
-        app:cardCornerRadius="0dp"
-        app:cardElevation="4dp">
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:orientation="vertical">
-
-            <View
-                android:id="@+id/view"
-                android:layout_width="match_parent"
-                android:layout_height="1dp"
-                android:alpha="0.1"
-                android:background="?android:attr/colorForeground" />
-
-            <TextView
-                android:id="@+id/textView"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginStart="16dp"
-                android:layout_marginLeft="16dp"
-                android:layout_marginTop="24dp"
-                android:text="@string/main_slim_options"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent" />
-
-            <TextView
-                android:id="@+id/textView12"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_margin="8dp"
-                android:padding="8dp"
-                android:text="@string/main_options_text_notes"
-                android:textSize="24sp" />
-
-            <TextView
-                android:id="@+id/settingsText"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_margin="8dp"
-                android:padding="8dp"
-                android:text="@string/main_options_home_screen_apps"
-                android:textSize="24sp" />
-
-            <TextView
-                android:id="@+id/deviceSettingsText"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_margin="8dp"
-                android:padding="8dp"
-                android:text="@string/main_options_settings"
-                android:textSize="24sp" />
-
-            <TextView
-                android:id="@+id/changeLauncherText"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_margin="8dp"
-                android:padding="8dp"
-                android:text="@string/main_options_change_launcher"
-                android:textSize="24sp" />
-
-            <TextView
-                android:id="@+id/rateAppText"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_margin="8dp"
-                android:padding="8dp"
-                android:text="@string/main_options_feedback"
-                android:textSize="24sp" />
-
-            <TextView
-                android:id="@+id/aboutText"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_margin="8dp"
-                android:padding="8dp"
-                android:text="@string/main_options_about_slim"
-                android:textSize="24sp" />
-
-        </LinearLayout>
-    </androidx.cardview.widget.CardView>
-
-    <androidx.constraintlayout.widget.ConstraintLayout
-        android:id="@+id/iconTray"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:alpha="0.6">
-
-        <ImageView
-            android:id="@+id/ivCall"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="8dp"
-            android:contentDescription="@string/main_call_icon"
-            android:padding="16dp"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent"
-            app:srcCompat="@drawable/ic_call"
-            android:layout_marginLeft="8dp" />
-
-        <ImageView
-            android:id="@+id/ivCamera"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="8dp"
-            android:contentDescription="@string/main_photo_camera_icon"
-            android:padding="16dp"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintTop_toTopOf="parent"
-            app:srcCompat="@drawable/ic_photo_camera"
-            android:layout_marginRight="8dp" />
-    </androidx.constraintlayout.widget.ConstraintLayout>
-
-
-</FrameLayout>

+ 0 - 77
app/src/main/res/layout/main_content.xml

@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout 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/main_content"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:showIn="@layout/main_fragment">
-
-    <TextView
-        android:id="@+id/clockTextView"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/main_placeholder_clock"
-        android:layout_marginTop="@dimen/_64sdp"
-        android:textSize="@dimen/_40ssp"
-        app:layout_constraintBottom_toTopOf="@+id/dateTextView"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintVertical_chainStyle="spread" />
-
-    <TextView
-        android:id="@+id/clockAmPm"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="16dp"
-        android:textSize="@dimen/_13sdp"
-        app:layout_constraintStart_toEndOf="@+id/clockTextView"
-        app:layout_constraintTop_toTopOf="@+id/clockTextView" />
-
-    <TextView
-        android:id="@+id/dateTextView"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/main_placeholder_date"
-        android:textSize="@dimen/_12sdp"
-        app:layout_constraintBottom_toTopOf="@+id/guideline"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/clockTextView"
-        app:layout_constraintVertical_bias="1.0" />
-
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/mainAppsList"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="16dp"
-        android:layout_marginEnd="16dp"
-        android:layout_marginRight="16dp"
-        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
-        app:layout_constraintBottom_toTopOf="@+id/guideline2"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="@+id/guideline"
-        app:layout_constraintVertical_bias="0.5"
-        tools:itemCount="5"
-        tools:listitem="@layout/main_list_item" />
-
-    <androidx.constraintlayout.widget.Guideline
-        android:id="@+id/guideline"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        app:layout_constraintGuide_begin="@dimen/_140sdp" />
-
-    <androidx.constraintlayout.widget.Guideline
-        android:id="@+id/guideline2"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        app:layout_constraintGuide_end="@dimen/main_bottom_guide_end" />
-
-
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 13
app/src/main/res/layout/main_fragment.xml

@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/main"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context=".ui.main.MainFragment">
-
-    <include layout="@layout/main_content" />
-
-    <include layout="@layout/main_bottom_sheet" />
-
-</androidx.coordinatorlayout.widget.CoordinatorLayout>

+ 12 - 0
app/src/main/res/layout/main_fragment_list_item.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/home_fragment_list_item_app_name"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginTop="4dp"
+    android:layout_marginBottom="4dp"
+    android:padding="12dp"
+    android:textAppearance="@style/TextAppearance.AppCompat"
+    android:textSize="@dimen/_24ssp">
+
+</TextView>

+ 0 - 17
app/src/main/res/layout/main_list_item.xml

@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content">
-
-    <TextView
-        android:id="@+id/main_label"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_margin="@dimen/_10sdp"
-        android:textSize="@dimen/_26ssp"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 73
app/src/main/res/layout/note_fragment.xml

@@ -1,73 +0,0 @@
-<ScrollView 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/note_fragment"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    app:layout_constraintEnd_toEndOf="parent"
-    app:layout_constraintStart_toStartOf="parent"
-    app:layout_constraintTop_toTopOf="parent"
-    tools:context="com.sduduzog.slimlauncher.ui.main.notes.NoteFragment">
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingTop="20dp"
-        android:orientation="vertical">
-
-        <EditText
-            android:id="@+id/titleEditText"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:background="@android:color/transparent"
-            android:ems="10"
-            android:hint="@string/note_fragment_hint_title"
-            android:inputType="textPersonName"
-            android:padding="8dp"
-            android:textSize="24sp"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent"
-            tools:ignore="Autofill,LabelFor" />
-
-        <EditText
-            android:id="@+id/bodyEditText"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:background="@android:color/transparent"
-            android:ems="10"
-            android:gravity="top"
-            android:hint="@string/note_fragment_hint_body"
-            android:inputType="textCapSentences|textAutoCorrect|textAutoComplete|textMultiLine|textImeMultiLine"
-            android:minLines="2"
-            android:padding="8dp"
-            android:textSize="14sp"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@+id/titleEditText"
-            tools:ignore="Autofill,LabelFor" />
-
-        <TextView
-            android:id="@+id/textBody"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:padding="8dp"
-            android:text="@string/note_fragment_hint_body"
-            android:textSize="14sp"
-            android:visibility="gone"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintHorizontal_bias="1.0"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@+id/titleEditText" />
-    </LinearLayout>
-</ScrollView>
-

+ 0 - 38
app/src/main/res/layout/notes_list_fragment.xml

@@ -1,38 +0,0 @@
-<androidx.coordinatorlayout.widget.CoordinatorLayout 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/frameLayout2"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:fitsSystemWindows="false"
-    tools:context="com.sduduzog.slimlauncher.ui.main.notes.NotesListFragment">
-
-    <com.google.android.material.appbar.AppBarLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content">
-
-        <androidx.appcompat.widget.Toolbar
-            android:layout_height="?attr/actionBarSize"
-            android:layout_width="match_parent"
-            android:layout_marginTop="16dp"
-            app:title="Notes" />
-    </com.google.android.material.appbar.AppBarLayout>
-
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/notesList"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
-        app:layout_behavior="@string/appbar_scrolling_view_behavior"
-        tools:listitem="@layout/notes_list_item" />
-
-    <com.google.android.material.floatingactionbutton.FloatingActionButton
-        android:id="@+id/fab_add_note"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="bottom|end"
-        android:layout_margin="16dp"
-        app:layout_anchorGravity="bottom|end"
-        app:srcCompat="@drawable/ic_edit" />
-
-</androidx.coordinatorlayout.widget.CoordinatorLayout>

+ 0 - 35
app/src/main/res/layout/notes_list_item.xml

@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:layout_margin="4dp"
-    android:background="@drawable/note_item_background"
-    android:orientation="vertical"
-    android:padding="4dp">
-
-    <TextView
-        android:id="@+id/item_note_title"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:padding="4dp"
-        android:text="@string/note_fragment_hint_title"
-        android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
-
-    <TextView
-        android:id="@+id/item_note_body"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:ellipsize="end"
-        android:maxLines="4"
-        android:padding="4dp"
-        android:text="@string/note_fragment_hint_body" />
-
-    <TextView
-        android:id="@+id/item_note_edited"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:alpha="0.5"
-        android:padding="4dp"
-        android:text="@string/main_placeholder_clock"
-        android:textSize="12sp" />
-</LinearLayout>

+ 99 - 0
app/src/main/res/layout/options_fragment.xml

@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout 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/options_fragment"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".ui.options.OptionsFragment">
+
+    <TextView
+        android:id="@+id/textView5"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/_16sdp"
+        android:layout_marginLeft="@dimen/_16sdp"
+        android:layout_marginTop="@dimen/_8sdp"
+        android:text="@string/main_fragment_options"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_36ssp"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <TextView
+        android:id="@+id/options_fragment_about_slim"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="24dp"
+        android:layout_marginLeft="24dp"
+        android:layout_marginTop="32dp"
+        android:text="@string/options_fragment_about_slim"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_20ssp"
+        app:layout_constraintBottom_toTopOf="@+id/options_fragment_device_settings"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/textView5"
+        app:layout_constraintVertical_bias="0.17000002"
+        app:layout_constraintVertical_chainStyle="packed" />
+
+    <TextView
+        android:id="@+id/options_fragment_device_settings"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="32dp"
+        android:text="@string/options_fragment_device_settings"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_20ssp"
+        app:layout_constraintBottom_toTopOf="@+id/options_fragment_change_theme"
+        app:layout_constraintStart_toStartOf="@+id/options_fragment_about_slim"
+        app:layout_constraintTop_toBottomOf="@+id/options_fragment_about_slim" />
+
+    <TextView
+        android:id="@+id/options_fragment_change_theme"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="32dp"
+        android:text="@string/options_fragment_change_theme"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_20ssp"
+        app:layout_constraintBottom_toTopOf="@+id/options_fragment_choose_time_format"
+        app:layout_constraintStart_toStartOf="@+id/options_fragment_device_settings"
+        app:layout_constraintTop_toBottomOf="@+id/options_fragment_device_settings" />
+
+    <TextView
+        android:id="@+id/options_fragment_choose_time_format"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="32dp"
+        android:text="@string/options_fragment_choose_time_format"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_20ssp"
+        app:layout_constraintBottom_toTopOf="@+id/options_fragment_toggle_status_bar"
+        app:layout_constraintStart_toStartOf="@+id/options_fragment_change_theme"
+        app:layout_constraintTop_toBottomOf="@+id/options_fragment_change_theme" />
+
+    <TextView
+        android:id="@+id/options_fragment_toggle_status_bar"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="32dp"
+        android:text="@string/options_fragment_toggle_status_bar"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_20ssp"
+        app:layout_constraintBottom_toTopOf="@+id/options_fragment_customise_apps"
+        app:layout_constraintStart_toStartOf="@+id/options_fragment_choose_time_format"
+        app:layout_constraintTop_toBottomOf="@+id/options_fragment_choose_time_format" />
+
+    <TextView
+        android:id="@+id/options_fragment_customise_apps"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="32dp"
+        android:layout_marginBottom="32dp"
+        android:text="@string/options_fragment_customise_apps"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_20ssp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/options_fragment_toggle_status_bar"
+        app:layout_constraintTop_toBottomOf="@+id/options_fragment_toggle_status_bar" />
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 2 - 1
app/src/main/res/layout/settings_rename_app.xml → app/src/main/res/layout/rename_dialog_edit_text.xml

@@ -14,6 +14,7 @@
         android:layout_marginEnd="20dp"
         android:layout_marginBottom="0dp"
         android:ems="10"
-        android:inputType="textPersonName"
+        android:imeOptions="actionDone"
+        android:inputType="text|textCapWords"
         tools:ignore="Autofill,LabelFor" />
 </LinearLayout>

+ 0 - 193
app/src/main/res/layout/settings_fragment.xml

@@ -1,193 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout 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/settings_fragment"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context=".ui.main.settings.SettingsFragment">
-
-    <TextView
-        android:id="@+id/textView3"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="16dp"
-        android:layout_marginLeft="16dp"
-        android:layout_marginTop="24dp"
-        android:alpha="0.5"
-        android:text="@string/settings_title"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-
-    <View
-        android:id="@+id/divider4"
-        android:layout_width="0dp"
-        android:layout_height="1dp"
-        android:layout_marginStart="16dp"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="16dp"
-        android:background="?android:attr/listDivider"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textView3" />
-
-    <TextView
-        android:id="@+id/textView14"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="16dp"
-        android:layout_marginLeft="16dp"
-        android:text="@string/settings_hide_status_bar"
-        android:textAppearance="@style/TextAppearance.AppCompat"
-        android:textSize="18sp"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/divider4" />
-
-    <TextView
-        android:id="@+id/textView16"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="8dp"
-        android:layout_marginRight="8dp"
-        android:text="@string/settings_status_bar_when_switched"
-        app:layout_constraintEnd_toStartOf="@+id/statusBarSwitch"
-        app:layout_constraintStart_toStartOf="@+id/textView14"
-        app:layout_constraintTop_toBottomOf="@+id/textView14" />
-
-    <Switch
-        android:id="@+id/statusBarSwitch"
-        android:layout_width="wrap_content"
-        android:layout_height="48dp"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="24dp"
-        android:layout_marginRight="24dp"
-        android:layout_marginBottom="8dp"
-        android:padding="4dp"
-        app:layout_constraintBottom_toBottomOf="@+id/textView16"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="@+id/textView14" />
-
-    <TextView
-        android:id="@+id/textView2"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="16dp"
-        android:layout_marginLeft="16dp"
-        android:layout_marginTop="16dp"
-        android:text="@string/settings_text_use_24_hour_clock"
-        android:textAppearance="@style/TextAppearance.AppCompat"
-        android:textSize="18sp"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textView16" />
-
-    <TextView
-        android:id="@+id/textView4"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="8dp"
-        android:layout_marginRight="8dp"
-        android:text="@string/settings_text_tap_to_check_between_24_hour_or_12_hour"
-        app:layout_constraintEnd_toStartOf="@+id/clockSwitch"
-        app:layout_constraintStart_toStartOf="@+id/textView2"
-        app:layout_constraintTop_toBottomOf="@+id/textView2" />
-
-    <Switch
-        android:id="@+id/clockSwitch"
-        android:layout_width="wrap_content"
-        android:layout_height="48dp"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="24dp"
-        android:layout_marginRight="24dp"
-        android:layout_marginBottom="8dp"
-        android:padding="4dp"
-        app:layout_constraintBottom_toBottomOf="@+id/textView4"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="@+id/textView2" />
-
-    <TextView
-        android:id="@+id/changeThemeText"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="16dp"
-        android:layout_marginLeft="16dp"
-        android:layout_marginTop="16dp"
-        android:text="@string/main_options_change_theme"
-        android:textAppearance="@style/TextAppearance.AppCompat"
-        android:textSize="18sp"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textView4" />
-
-    <TextView
-        android:id="@+id/textView7"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/settings_text_tap_to_change_app_theme"
-        app:layout_constraintStart_toStartOf="@+id/changeThemeText"
-        app:layout_constraintTop_toBottomOf="@+id/changeThemeText" />
-
-    <TextView
-        android:id="@+id/textView8"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="16dp"
-        android:layout_marginLeft="16dp"
-        android:layout_marginTop="8dp"
-        android:alpha="0.5"
-        android:text="@string/settings_text_home_screen_apps"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textView7" />
-
-    <View
-        android:id="@+id/divider2"
-        android:layout_width="0dp"
-        android:layout_height="1dp"
-        android:layout_marginStart="16dp"
-        android:layout_marginEnd="16dp"
-        android:background="?android:attr/listDivider"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textView8" />
-
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/settingsAppList"
-        android:layout_width="0dp"
-        android:layout_height="0dp"
-        android:layout_marginStart="16dp"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="16dp"
-        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/divider2"
-        tools:itemCount="5"
-        tools:listitem="@layout/settings_list_item" />
-
-    <androidx.appcompat.widget.AppCompatCheckBox
-        android:id="@+id/clockTypeChecker"
-        style="@style/Widget.AppCompat.CompoundButton.CheckBox"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="24dp"
-        android:layout_marginRight="24dp"
-        android:textAppearance="@style/TextAppearance.AppCompat"
-        android:visibility="gone"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="@+id/textView2" />
-
-    <Button
-        android:id="@+id/buttonChangeTheme"
-        style="@style/Widget.AppCompat.Button.Borderless"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="16dp"
-        android:layout_marginRight="16dp"
-        android:layout_marginBottom="8dp"
-        android:text="@string/settings_button_change_theme"
-        app:layout_constraintBottom_toBottomOf="@+id/textView7"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="@+id/changeThemeText" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 67
app/src/main/res/layout/settings_list_item.xml

@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:id="@+id/settings_list_item"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:layout_margin="1dp">
-
-    <View
-        android:id="@+id/divider3"
-        android:layout_width="0dp"
-        android:layout_height="0dp"
-        android:alpha="0.2"
-        android:background="?android:attr/listDivider"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-
-    <TextView
-        android:id="@+id/item_text"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="16dp"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="8dp"
-        android:layout_marginBottom="8dp"
-        android:text="@string/settings_list_item_text"
-        android:textSize="24sp"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        android:layout_marginLeft="16dp"
-        android:layout_marginRight="8dp" />
-
-    <Button
-        android:id="@+id/item_button"
-        style="@style/Widget.AppCompat.Button.Borderless"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="8dp"
-        android:layout_marginBottom="8dp"
-        android:text="@string/settings_list_item_button_set_app"
-        app:layout_constraintBottom_toBottomOf="@+id/item_text"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="@+id/item_text"
-        android:layout_marginRight="8dp" />
-
-    <ImageView
-        android:id="@+id/item_dragger"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="8dp"
-        android:layout_marginBottom="8dp"
-        android:alpha="0.5"
-        android:contentDescription="@string/settings_item_icon_drag_handler"
-        android:padding="8dp"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:srcCompat="@drawable/ic_drag_handle"
-        android:layout_marginRight="8dp" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 6
app/src/main/res/layout/setup_fragment.xml

@@ -1,6 +0,0 @@
-<androidx.viewpager.widget.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/setup_view_pager"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-
-</androidx.viewpager.widget.ViewPager>

+ 0 - 77
app/src/main/res/layout/splash_fragment.xml

@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout 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/splash_fragment"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context=".ui.main.setup.SplashFragment">
-
-    <ImageView
-        android:id="@+id/imageView3"
-        android:layout_width="@dimen/_60sdp"
-        android:layout_height="@dimen/_60sdp"
-        android:layout_marginStart="8dp"
-        android:layout_marginLeft="8dp"
-        android:layout_marginTop="@dimen/_100sdp"
-        android:layout_marginEnd="8dp"
-        android:layout_marginRight="8dp"
-        android:contentDescription="@string/app_name"
-        android:scaleType="fitCenter"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:srcCompat="@drawable/ic_slim" />
-
-    <Button
-        android:id="@+id/setup_splash_button_start"
-        style="@style/Widget.AppCompat.Button.Borderless"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="16dp"
-        android:layout_marginRight="16dp"
-        android:layout_marginBottom="16dp"
-        android:text="@string/setup_button_start"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent" />
-
-    <TextView
-        android:id="@+id/textView13"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        android:layout_marginLeft="8dp"
-        android:layout_marginTop="@dimen/_16sdp"
-        android:layout_marginEnd="8dp"
-        android:layout_marginRight="8dp"
-        android:text="@string/setup_welcome"
-        android:textSize="@dimen/_24sdp"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/imageView3" />
-
-    <TextView
-        android:id="@+id/textView15"
-        android:layout_width="@dimen/_140sdp"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="@dimen/_110sdp"
-        android:layout_marginLeft="@dimen/_110sdp"
-        android:layout_marginTop="@dimen/_94sdp"
-        android:text="@string/setup_welcome2"
-        android:textSize="@dimen/_14sdp"
-        app:layout_constraintStart_toStartOf="@+id/imageView6"
-        app:layout_constraintTop_toTopOf="@+id/imageView6" />
-
-    <ImageView
-        android:id="@+id/imageView6"
-        android:layout_width="@dimen/_160sdp"
-        android:layout_height="@dimen/_134sdp"
-        android:layout_marginStart="@dimen/_4sdp"
-        android:layout_marginLeft="@dimen/_4sdp"
-        android:layout_marginTop="@dimen/_16sdp"
-        android:contentDescription="@string/content_description_my_phone"
-        android:scaleType="centerCrop"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textView13"
-        app:srcCompat="@drawable/ic_my_phone" />
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 188
app/src/main/res/layout/theme_setup_fragment.xml

@@ -1,188 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout 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/theme_setup_fragment"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context=".ui.main.setup.ThemeSetupFragment">
-
-    <TextView
-        android:id="@+id/textView18"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="32dp"
-        android:text="@string/setup_choose_theme"
-        android:textAppearance="@style/TextAppearance.AppCompat.Headline"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-
-    <com.google.android.material.floatingactionbutton.FloatingActionButton
-        android:id="@+id/setup_fab_default"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        android:layout_marginTop="32dp"
-        android:clickable="true"
-        android:focusable="true"
-        app:srcCompat="@drawable/ic_text_fields"
-        app:backgroundTint="@color/colorWhite"
-        app:fabSize="normal"
-        app:layout_constraintEnd_toStartOf="@+id/setup_fab_dark"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textView18"
-        android:contentDescription="@string/setup_text_default"
-        android:layout_marginLeft="8dp" />
-
-    <com.google.android.material.floatingactionbutton.FloatingActionButton
-        android:id="@+id/setup_fab_dark"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:clickable="true"
-        android:focusable="true"
-        app:srcCompat="@drawable/ic_text_fields"
-        android:contentDescription="@string/setup_text_dark"
-        android:tint="@color/inverseTextColor"
-        app:backgroundTint="@color/primaryDarkColor"
-        app:fabSize="normal"
-        app:layout_constraintEnd_toStartOf="@+id/setup_fab_jupiter"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toEndOf="@+id/setup_fab_default"
-        app:layout_constraintTop_toTopOf="@+id/setup_fab_default" />
-
-    <com.google.android.material.floatingactionbutton.FloatingActionButton
-        android:id="@+id/setup_fab_jupiter"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="8dp"
-        android:clickable="true"
-        android:contentDescription="@string/setup_text_jupiter"
-        android:focusable="true"
-        app:srcCompat="@drawable/ic_text_fields"
-        android:tint="@color/inverseTextColor"
-        app:backgroundTint="@color/colorBlueGrey"
-        app:fabSize="normal"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toEndOf="@+id/setup_fab_dark"
-        app:layout_constraintTop_toTopOf="@+id/setup_fab_dark"
-        android:layout_marginRight="8dp" />
-
-    <com.google.android.material.floatingactionbutton.FloatingActionButton
-        android:id="@+id/setup_fab_teal"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="32dp"
-        android:clickable="true"
-        android:focusable="true"
-        android:contentDescription="@string/setup_text_teal"
-        app:srcCompat="@drawable/ic_text_fields"
-        app:backgroundTint="@color/colorTeal"
-        app:fabSize="normal"
-        app:layout_constraintEnd_toStartOf="@+id/setup_fab_candy"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textView20" />
-
-    <com.google.android.material.floatingactionbutton.FloatingActionButton
-        android:id="@+id/setup_fab_candy"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:clickable="true"
-        android:contentDescription="@string/setup_text_candy"
-        android:focusable="true"
-        app:srcCompat="@drawable/ic_text_fields"
-        android:tint="@color/inverseTextColor"
-        app:backgroundTint="@color/colorCandy"
-        app:fabSize="normal"
-        app:layout_constraintEnd_toStartOf="@+id/setup_fab_pastel"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toEndOf="@+id/setup_fab_teal"
-        app:layout_constraintTop_toTopOf="@+id/setup_fab_teal" />
-
-    <com.google.android.material.floatingactionbutton.FloatingActionButton
-        android:id="@+id/setup_fab_pastel"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:clickable="true"
-        android:focusable="true"
-        app:srcCompat="@drawable/ic_text_fields"
-        app:backgroundTint="@color/colorPink"
-        app:fabSize="normal"
-        app:layout_constraintEnd_toEndOf="parent"
-        android:contentDescription="@string/setup_text_pastel"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toEndOf="@+id/setup_fab_candy"
-        app:layout_constraintTop_toTopOf="@+id/setup_fab_candy" />
-
-    <TextView
-        android:id="@+id/textView20"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="16dp"
-        android:text="@string/setup_text_default"
-        app:layout_constraintEnd_toEndOf="@+id/setup_fab_default"
-        app:layout_constraintStart_toStartOf="@+id/setup_fab_default"
-        app:layout_constraintTop_toBottomOf="@+id/setup_fab_default" />
-
-    <TextView
-        android:id="@+id/textView21"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/setup_text_dark"
-        app:layout_constraintEnd_toEndOf="@+id/setup_fab_dark"
-        app:layout_constraintStart_toStartOf="@+id/setup_fab_dark"
-        app:layout_constraintTop_toTopOf="@+id/textView20" />
-
-    <TextView
-        android:id="@+id/textView22"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/setup_text_jupiter"
-        app:layout_constraintEnd_toEndOf="@+id/setup_fab_jupiter"
-        app:layout_constraintStart_toStartOf="@+id/setup_fab_jupiter"
-        app:layout_constraintTop_toTopOf="@+id/textView21" />
-
-    <TextView
-        android:id="@+id/textView23"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="16dp"
-        android:text="@string/setup_text_teal"
-        app:layout_constraintEnd_toEndOf="@+id/setup_fab_teal"
-        app:layout_constraintStart_toStartOf="@+id/setup_fab_teal"
-        app:layout_constraintTop_toBottomOf="@+id/setup_fab_teal" />
-
-    <TextView
-        android:id="@+id/textView24"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/setup_text_candy"
-        app:layout_constraintEnd_toEndOf="@+id/setup_fab_candy"
-        app:layout_constraintStart_toStartOf="@+id/setup_fab_candy"
-        app:layout_constraintTop_toTopOf="@+id/textView23" />
-
-    <TextView
-        android:id="@+id/textView25"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/setup_text_pastel"
-        app:layout_constraintEnd_toEndOf="@+id/setup_fab_pastel"
-        app:layout_constraintStart_toStartOf="@+id/setup_fab_pastel"
-        app:layout_constraintTop_toTopOf="@+id/textView24" />
-
-    <Button
-        android:id="@+id/theme_setup_button"
-        style="@style/Widget.AppCompat.Button.Borderless"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="16dp"
-        android:layout_marginBottom="16dp"
-        android:text="@string/setup_button_finish"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        android:layout_marginRight="16dp" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 10 - 0
app/src/main/res/menu/customise_apps_popup_menu.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item
+        android:id="@+id/ca_menu_rename"
+        android:title="@string/menu_rename" />
+    <item
+        android:id="@+id/ca_menu_remove"
+        android:title="@string/menu_remove" />
+</menu>

+ 23 - 49
app/src/main/res/navigation/nav_graph.xml

@@ -3,65 +3,39 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/nav_graph"
-    app:startDestination="@id/setupFragment">
+    app:startDestination="@id/homeFragment">
 
     <fragment
-        android:id="@+id/mainFragment"
-        android:name="com.sduduzog.slimlauncher.ui.main.MainFragment"
-        android:label="main_fragment"
-        tools:layout="@layout/main_fragment">
+        android:id="@+id/homeFragment"
+        android:name="com.sduduzog.slimlauncher.ui.main.HomeFragment"
+        android:label="home_fragment"
+        tools:layout="@layout/home_fragment">
         <action
-            android:id="@+id/action_mainFragment_to_notesListFragment"
-            app:destination="@id/notesListFragment" />
-
-        <action
-            android:id="@+id/action_mainFragment_to_settingsFragment"
-            app:destination="@id/settingsFragment" />
-        <action
-            android:id="@+id/action_mainFragment_to_aboutFragment"
-            app:destination="@id/aboutFragment" />
-    </fragment>
-    <fragment
-        android:id="@+id/settingsFragment"
-        android:name="com.sduduzog.slimlauncher.ui.main.settings.SettingsFragment"
-        android:label="fragment_settings"
-        tools:layout="@layout/settings_fragment">
-        <action
-            android:id="@+id/action_openAppsFragment"
-            app:destination="@+id/appsFragment" />
+            android:id="@+id/action_homeFragment_to_optionsFragment"
+            app:destination="@id/optionsFragment" />
     </fragment>
     <fragment
-        android:id="@+id/appsFragment"
-        android:name="com.sduduzog.slimlauncher.ui.main.settings.AppsFragment"
-        android:label="fragment_apps_list"
-        tools:layout="@layout/apps_fragment" />
-    <fragment
-        android:id="@+id/aboutFragment"
-        android:name="com.sduduzog.slimlauncher.ui.main.AboutFragment"
-        android:label="fragment_about"
-        tools:layout="@layout/about_fragment" />
-    <fragment
-        android:id="@+id/setupFragment"
-        android:name="com.sduduzog.slimlauncher.ui.main.setup.SetupFragment"
-        android:label="setup_fragment"
-        tools:layout="@layout/setup_fragment">
+        android:id="@+id/optionsFragment"
+        android:name="com.sduduzog.slimlauncher.ui.options.OptionsFragment"
+        android:label="options_fragment"
+        tools:layout="@layout/options_fragment">
         <action
-            android:id="@+id/action_setupFragment_to_mainFragment2"
-            app:destination="@id/mainFragment" />
+            android:id="@+id/action_optionsFragment_to_customiseAppsFragment"
+            app:destination="@id/customiseAppsFragment" />
     </fragment>
     <fragment
-        android:id="@+id/notesListFragment"
-        android:name="com.sduduzog.slimlauncher.ui.main.notes.NotesListFragment"
-        android:label="notes_list_fragment"
-        tools:layout="@layout/notes_list_fragment">
+        android:id="@+id/customiseAppsFragment"
+        android:name="com.sduduzog.slimlauncher.ui.options.CustomiseAppsFragment"
+        android:label="customise_apps_fragment"
+        tools:layout="@layout/customise_apps_fragment">
         <action
-            android:id="@+id/action_openNoteFragment"
-            app:destination="@id/noteFragment" />
+            android:id="@+id/action_customiseAppsFragment_to_addAppFragment"
+            app:destination="@id/addAppFragment" />
     </fragment>
     <fragment
-        android:id="@+id/noteFragment"
-        android:name="com.sduduzog.slimlauncher.ui.main.notes.NoteFragment"
-        android:label="note_fragment"
-        tools:layout="@layout/note_fragment" />
+        android:id="@+id/addAppFragment"
+        android:name="com.sduduzog.slimlauncher.ui.options.AddAppFragment"
+        android:label="add_app_fragment"
+        tools:layout="@layout/add_app_fragment" />
 
 </navigation>

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff