sduduzog vor 7 Jahren
Ursprung
Commit
68700d5640
30 geänderte Dateien mit 419 neuen und 483 gelöschten Zeilen
  1. 1 0
      app/build.gradle
  2. 0 3
      app/src/main/AndroidManifest.xml
  3. 1 1
      app/src/main/java/com/sduduzog/slimlauncher/MainActivity.kt
  4. 2 2
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/AboutFragment.kt
  5. 0 118
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/DummyActivity.kt
  6. 69 0
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/HomeAppsAdapter.kt
  7. 71 0
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/HomeFragment.kt
  8. 0 43
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/MainAppsAdapter.kt
  9. 33 88
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/MainFragment.kt
  10. 4 1
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/model/AppDao.kt
  11. 34 3
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/model/AppRepository.kt
  12. 7 3
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/model/MainViewModel.kt
  13. 7 0
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/OnItemActionListener.kt
  14. 46 1
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/SettingsFragment.kt
  15. 51 24
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/SettingsListAdapter.kt
  16. 0 55
      app/src/main/res/layout-sw600dp/main_content.xml
  17. 0 13
      app/src/main/res/layout-sw600dp/main_fragment.xml
  18. 12 2
      app/src/main/res/layout-v21/settings_fragment.xml
  19. 0 0
      app/src/main/res/layout/about_fragment.xml
  20. 0 6
      app/src/main/res/layout/activity_dummy.xml
  21. 0 22
      app/src/main/res/layout/fragment_dummy.xml
  22. 49 8
      app/src/main/res/layout/home_framgent.xml
  23. 4 52
      app/src/main/res/layout/main_content.xml
  24. 12 2
      app/src/main/res/layout/settings_fragment.xml
  25. 6 14
      app/src/main/res/layout/settings_list_item.xml
  26. 0 11
      app/src/main/res/menu/menu_dummy.xml
  27. 1 1
      app/src/main/res/navigation/nav_graph.xml
  28. 1 1
      app/src/main/res/values-w820dp/dimens.xml
  29. 2 2
      app/src/main/res/values/dimens.xml
  30. 6 7
      app/src/main/res/values/strings.xml

+ 1 - 0
app/build.gradle

@@ -68,4 +68,5 @@ dependencies {
     androidTestImplementation "androidx.arch.core:core-testing:2.0.0"
     androidTestImplementation "androidx.arch.core:core-testing:2.0.0"
     androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
     androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
     androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.2'
     androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.2'
+    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
 }
 }

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

@@ -28,9 +28,6 @@
                 <category android:name="android.intent.category.LAUNCHER" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
             </intent-filter>
         </activity>
         </activity>
-        <activity
-            android:name=".ui.main.DummyActivity"
-            android:label="@string/title_activity_dummy" />
     </application>
     </application>
 
 
 </manifest>
 </manifest>

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

@@ -32,7 +32,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
 
 
     override fun onStart() {
     override fun onStart() {
         super.onStart()
         super.onStart()
-        viewModel.updateApps()
+        viewModel.refreshApps()
     }
     }
 
 
     override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, s: String?) {
     override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, s: String?) {

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

@@ -8,7 +8,7 @@ import android.view.LayoutInflater
 import android.view.View
 import android.view.View
 import android.view.ViewGroup
 import android.view.ViewGroup
 import com.sduduzog.slimlauncher.R
 import com.sduduzog.slimlauncher.R
-import kotlinx.android.synthetic.main.fragment_about.*
+import kotlinx.android.synthetic.main.about_fragment.*
 
 
 
 
 class AboutFragment : Fragment() {
 class AboutFragment : Fragment() {
@@ -16,7 +16,7 @@ class AboutFragment : Fragment() {
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                               savedInstanceState: Bundle?): View? {
                               savedInstanceState: Bundle?): View? {
         // Inflate the layout for this fragment
         // Inflate the layout for this fragment
-        return inflater.inflate(R.layout.fragment_about, container, false)
+        return inflater.inflate(R.layout.about_fragment, container, false)
     }
     }
 
 
     override fun onActivityCreated(savedInstanceState: Bundle?) {
     override fun onActivityCreated(savedInstanceState: Bundle?) {

+ 0 - 118
app/src/main/java/com/sduduzog/slimlauncher/ui/main/DummyActivity.kt

@@ -1,118 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main
-
-import android.os.Bundle
-import android.view.*
-import androidx.appcompat.app.AppCompatActivity
-import androidx.fragment.app.Fragment
-import androidx.fragment.app.FragmentManager
-import androidx.fragment.app.FragmentPagerAdapter
-import com.sduduzog.slimlauncher.R
-import kotlinx.android.synthetic.main.activity_dummy.*
-import kotlinx.android.synthetic.main.fragment_dummy.view.*
-
-class DummyActivity : AppCompatActivity() {
-
-    /**
-     * The [androidx.viewpager.widget.PagerAdapter] that will provide
-     * fragments for each of the sections. We use a
-     * {@link FragmentPagerAdapter} derivative, which will keep every
-     * loaded fragment in memory. If this becomes too memory intensive, it
-     * may be best to switch to a
-     * androidx.fragment.app.FragmentStatePagerAdapter.
-     */
-    private var mSectionsPagerAdapter: SectionsPagerAdapter? = null
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        setContentView(R.layout.activity_dummy)
-        // Create the adapter that will return a fragment for each of the three
-        // primary sections of the activity.
-        mSectionsPagerAdapter = SectionsPagerAdapter(supportFragmentManager)
-
-        // Set up the ViewPager with the sections adapter.
-        container.adapter = mSectionsPagerAdapter
-
-
-    }
-
-
-    override fun onCreateOptionsMenu(menu: Menu): Boolean {
-        // Inflate the menu; this adds items to the action bar if it is present.
-        menuInflater.inflate(R.menu.menu_dummy, menu)
-        return true
-    }
-
-    override fun onOptionsItemSelected(item: MenuItem): Boolean {
-        // Handle action bar item clicks here. The action bar will
-        // automatically handle clicks on the Home/Up button, so long
-        // as you specify a parent activity in AndroidManifest.xml.
-        val id = item.itemId
-
-        if (id == R.id.action_settings) {
-            return true
-        }
-
-        return super.onOptionsItemSelected(item)
-    }
-
-
-    /**
-     * A [FragmentPagerAdapter] that returns a fragment corresponding to
-     * one of the sections/tabs/pages.
-     */
-    inner class SectionsPagerAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm) {
-
-        override fun getItem(position: Int): Fragment {
-            // getItem is called to instantiate the fragment for the given page.
-            // Return a PlaceholderFragment (defined as a static inner class below).
-            return PlaceholderFragment.newInstance(position + 1)
-        }
-
-        override fun getCount(): Int {
-            // Show 3 total pages.
-            return 3
-        }
-
-        override fun getPageTitle(position: Int): CharSequence? {
-            when (position) {
-                0 -> return "SECTION 1"
-                1 -> return "SECTION 2"
-                2 -> return "SECTION 3"
-            }
-            return null
-        }
-    }
-
-    /**
-     * A placeholder fragment containing a simple view.
-     */
-    class PlaceholderFragment : Fragment() {
-
-        override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
-                                  savedInstanceState: Bundle?): View? {
-            val rootView = inflater.inflate(R.layout.fragment_dummy, container, false)
-            rootView.section_label.text = getString(R.string.section_format, arguments?.getInt(ARG_SECTION_NUMBER))
-            return rootView
-        }
-
-        companion object {
-            /**
-             * The fragment argument representing the section number for this
-             * fragment.
-             */
-            private val ARG_SECTION_NUMBER = "section_number"
-
-            /**
-             * Returns a new instance of this fragment for the given section
-             * number.
-             */
-            fun newInstance(sectionNumber: Int): PlaceholderFragment {
-                val fragment = PlaceholderFragment()
-                val args = Bundle()
-                args.putInt(ARG_SECTION_NUMBER, sectionNumber)
-                fragment.arguments = args
-                return fragment
-            }
-        }
-    }
-}

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

@@ -0,0 +1,69 @@
+package com.sduduzog.slimlauncher.ui.main
+
+import android.content.ActivityNotFoundException
+import android.content.ComponentName
+import android.content.Intent
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import android.widget.Toast
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProviders
+import androidx.recyclerview.widget.RecyclerView
+import com.sduduzog.slimlauncher.R
+import com.sduduzog.slimlauncher.ui.main.model.HomeApp
+import com.sduduzog.slimlauncher.ui.main.model.MainViewModel
+
+class HomeAppsAdapter(private var fragment: HomeFragment)
+    : RecyclerView.Adapter<HomeAppsAdapter.ViewHolder>() {
+
+    private var apps: List<HomeApp> = listOf()
+    private var viewModel = ViewModelProviders.of(fragment).get(MainViewModel::class.java)
+
+    init {
+        Log.d("HomeAppsAdapter", "onCreateView")
+        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 {
+                fragment.startActivity(intent)
+            } 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 + "'"
+        }
+    }
+}

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

@@ -1,21 +1,92 @@
 package com.sduduzog.slimlauncher.ui.main
 package com.sduduzog.slimlauncher.ui.main
 
 
 
 
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.content.IntentFilter
+import android.os.Build
 import android.os.Bundle
 import android.os.Bundle
+import android.util.Log
 import android.view.LayoutInflater
 import android.view.LayoutInflater
 import android.view.View
 import android.view.View
 import android.view.ViewGroup
 import android.view.ViewGroup
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.Fragment
 import com.sduduzog.slimlauncher.R
 import com.sduduzog.slimlauncher.R
+import kotlinx.android.synthetic.main.home_framgent.*
+import java.text.SimpleDateFormat
+import java.util.*
 
 
 class HomeFragment : Fragment() {
 class HomeFragment : Fragment() {
 
 
+    @Suppress("PropertyName")
+    val TAG: String = "HomeFragment"
+
+    private lateinit var adapter: HomeAppsAdapter
+    private lateinit var receiver: BroadcastReceiver
 
 
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                               savedInstanceState: Bundle?): View? {
                               savedInstanceState: Bundle?): View? {
+        Log.d(TAG, "onCreateView")
         return inflater.inflate(R.layout.home_framgent, container, false)
         return inflater.inflate(R.layout.home_framgent, container, false)
     }
     }
 
 
+    override fun onActivityCreated(savedInstanceState: Bundle?) {
+        super.onActivityCreated(savedInstanceState)
+        Log.d(TAG, "onActivityCreated")
+        clockTextView.setOnClickListener {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+                val intent = Intent(android.provider.AlarmClock.ACTION_SHOW_ALARMS)
+                intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
+                startActivity(intent)
+            }
+        }
+        adapter = HomeAppsAdapter(this)
+        mainAppsList.adapter = adapter
+    }
+
+    override fun onStart() {
+        super.onStart()
+        Log.d(TAG, "onStart")
+        receiver = ClockReceiver()
+        activity?.registerReceiver(receiver, IntentFilter(Intent.ACTION_TIME_TICK))
+    }
+
+    override fun onResume() {
+        super.onResume()
+        Log.d(TAG, "onResume")
+        updateUi()
+    }
+
+    override fun onStop() {
+        super.onStop()
+        activity?.unregisterReceiver(receiver)
+    }
+
+    inner class ClockReceiver : BroadcastReceiver() {
+        override fun onReceive(ctx: Context?, intent: Intent?) {
+            updateUi()
+        }
+    }
+
+    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)
+    }
 
 
     companion object {
     companion object {
         @JvmStatic
         @JvmStatic

+ 0 - 43
app/src/main/java/com/sduduzog/slimlauncher/ui/main/MainAppsAdapter.kt

@@ -1,43 +0,0 @@
-package com.sduduzog.slimlauncher.ui.main
-
-import androidx.recyclerview.widget.RecyclerView
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.TextView
-import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.ui.main.model.HomeApp
-
-class MainAppsAdapter(private var mValues: MutableSet<HomeApp>,
-                      private val mListener: MainFragment.OnListFragmentInteractionListener?)
-    : RecyclerView.Adapter<MainAppsAdapter.ViewHolder>() {
-
-    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MainAppsAdapter.ViewHolder {
-        val view = LayoutInflater.from(parent.context)
-                .inflate(R.layout.main_list_item, parent, false)
-        return ViewHolder(view)
-    }
-
-    override fun onBindViewHolder(holder: MainAppsAdapter.ViewHolder, position: Int) {
-        val item = mValues.elementAt(position)
-        holder.mLabelView.text = item.appName
-        holder.mLabelView.setOnClickListener {
-            mListener?.onLaunch(item)
-        }
-    }
-
-    override fun getItemCount(): Int = mValues.size
-    fun setApps(it: List<HomeApp>) {
-        mValues = mutableSetOf()
-        mValues.addAll(it)
-        notifyDataSetChanged()
-    }
-
-    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 + "'"
-        }
-    }
-}

+ 33 - 88
app/src/main/java/com/sduduzog/slimlauncher/ui/main/MainFragment.kt

@@ -1,21 +1,22 @@
 package com.sduduzog.slimlauncher.ui.main
 package com.sduduzog.slimlauncher.ui.main
 
 
 import android.animation.ObjectAnimator
 import android.animation.ObjectAnimator
-import android.content.*
-import android.content.Context.MODE_PRIVATE
+import android.content.ActivityNotFoundException
+import android.content.Context
+import android.content.Intent
 import android.net.Uri
 import android.net.Uri
 import android.os.Build
 import android.os.Build
 import android.os.Bundle
 import android.os.Bundle
 import android.provider.MediaStore
 import android.provider.MediaStore
+import android.provider.Settings
 import android.util.Log
 import android.util.Log
 import android.view.LayoutInflater
 import android.view.LayoutInflater
 import android.view.View
 import android.view.View
 import android.view.ViewGroup
 import android.view.ViewGroup
 import android.widget.FrameLayout
 import android.widget.FrameLayout
-import android.widget.Toast
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.Fragment
-import androidx.lifecycle.Observer
-import androidx.lifecycle.ViewModelProviders
+import androidx.fragment.app.FragmentManager
+import androidx.fragment.app.FragmentPagerAdapter
 import androidx.navigation.Navigation
 import androidx.navigation.Navigation
 import com.daasuu.ei.Ease
 import com.daasuu.ei.Ease
 import com.daasuu.ei.EasingInterpolator
 import com.daasuu.ei.EasingInterpolator
@@ -24,24 +25,19 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_COLLAPS
 import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_HALF_EXPANDED
 import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_HALF_EXPANDED
 import com.sduduzog.slimlauncher.MainActivity
 import com.sduduzog.slimlauncher.MainActivity
 import com.sduduzog.slimlauncher.R
 import com.sduduzog.slimlauncher.R
-import com.sduduzog.slimlauncher.ui.main.model.HomeApp
-import com.sduduzog.slimlauncher.ui.main.model.MainViewModel
 import kotlinx.android.synthetic.main.main_bottom_sheet.*
 import kotlinx.android.synthetic.main.main_bottom_sheet.*
 import kotlinx.android.synthetic.main.main_content.*
 import kotlinx.android.synthetic.main.main_content.*
-import java.text.SimpleDateFormat
-import java.util.*
 
 
 
 
 class MainFragment : Fragment() {
 class MainFragment : Fragment() {
 
 
-    private lateinit var viewModel: MainViewModel
-    private lateinit var receiver: BroadcastReceiver
-    private lateinit var adapter: MainAppsAdapter
     private lateinit var sheetBehavior: BottomSheetBehavior<FrameLayout>
     private lateinit var sheetBehavior: BottomSheetBehavior<FrameLayout>
+    private var mSectionsPagerAdapter: SectionsPagerAdapter? = null
 
 
     @Suppress("PropertyName")
     @Suppress("PropertyName")
     val TAG: String = "MainFragment"
     val TAG: String = "MainFragment"
 
 
+
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                               savedInstanceState: Bundle?): View {
                               savedInstanceState: Bundle?): View {
         return inflater.inflate(R.layout.main_fragment, container, false)
         return inflater.inflate(R.layout.main_fragment, container, false)
@@ -49,35 +45,20 @@ class MainFragment : Fragment() {
 
 
     override fun onActivityCreated(savedInstanceState: Bundle?) {
     override fun onActivityCreated(savedInstanceState: Bundle?) {
         super.onActivityCreated(savedInstanceState)
         super.onActivityCreated(savedInstanceState)
+        Log.d(TAG, "onActivityCreated")
+        mSectionsPagerAdapter = SectionsPagerAdapter(childFragmentManager)
+        container.adapter = mSectionsPagerAdapter
         sheetBehavior = BottomSheetBehavior.from(bottomSheet)
         sheetBehavior = BottomSheetBehavior.from(bottomSheet)
         optionsView.alpha = 0.0f
         optionsView.alpha = 0.0f
-        viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java)
-        adapter = MainAppsAdapter(mutableSetOf(), InteractionHandler())
-        mainAppsList.adapter = adapter
-        viewModel.homeApps.observe(this, Observer {
-            if (it != null) {
-                adapter.setApps(it)
-            }
-        })
         setEventListeners()
         setEventListeners()
     }
     }
 
 
     override fun onStart() {
     override fun onStart() {
         super.onStart()
         super.onStart()
-        receiver = ClockReceiver()
-        activity?.registerReceiver(receiver, IntentFilter(Intent.ACTION_TIME_TICK))
+        Log.d(TAG, "onStart")
         doBounceAnimation(ivExpand)
         doBounceAnimation(ivExpand)
         sheetBehavior.state = STATE_COLLAPSED
         sheetBehavior.state = STATE_COLLAPSED
-    }
-
-    override fun onResume() {
-        super.onResume()
-        updateUi()
-    }
-
-    override fun onStop() {
-        super.onStop()
-        activity?.unregisterReceiver(receiver)
+        mSectionsPagerAdapter?.notifyDataSetChanged()
     }
     }
 
 
     override fun onAttach(context: Context?) {
     override fun onAttach(context: Context?) {
@@ -91,54 +72,6 @@ class MainFragment : Fragment() {
         }
         }
     }
     }
 
 
-    inner class ClockReceiver : BroadcastReceiver() {
-        override fun onReceive(ctx: Context?, intent: Intent?) {
-            updateUi()
-            doBounceAnimation(ivExpand)
-        }
-    }
-
-    fun updateUi() {
-        val twenty4Hour = context?.getSharedPreferences(getString(R.string.prefs_settings), 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 InteractionHandler : OnListFragmentInteractionListener {
-        override fun onLaunch(item: HomeApp) {
-            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 {
-                startActivity(intent)
-            } catch (e: ActivityNotFoundException) {
-                Log.e(TAG, e.message)
-                Toast.makeText(activity, "${item.appName} seems to be uninstalled, removing from list", Toast.LENGTH_LONG).show()
-                viewModel.deleteApp(item)
-            }
-        }
-    }
-
-    interface OnListFragmentInteractionListener {
-        fun onLaunch(item: HomeApp)
-    }
-
     private fun doBounceAnimation(targetView: View) {
     private fun doBounceAnimation(targetView: View) {
         val animator = ObjectAnimator.ofFloat(targetView, "translationY", 0f, -20f, 0f)
         val animator = ObjectAnimator.ofFloat(targetView, "translationY", 0f, -20f, 0f)
         animator.interpolator = EasingInterpolator(Ease.QUINT_OUT)
         animator.interpolator = EasingInterpolator(Ease.QUINT_OUT)
@@ -170,13 +103,6 @@ class MainFragment : Fragment() {
     }
     }
 
 
     private fun setEventListeners() {
     private fun setEventListeners() {
-        clockTextView.setOnClickListener {
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
-                val intent = Intent(android.provider.AlarmClock.ACTION_SHOW_ALARMS)
-                intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
-                startActivity(intent)
-            }
-        }
         bottomSheet.setOnClickListener {
         bottomSheet.setOnClickListener {
 
 
         }
         }
@@ -202,7 +128,7 @@ class MainFragment : Fragment() {
         rateAppText.setOnClickListener { rateApp() }
         rateAppText.setOnClickListener { rateApp() }
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
             changeLauncherText.setOnClickListener {
             changeLauncherText.setOnClickListener {
-                startActivity(Intent(android.provider.Settings.ACTION_HOME_SETTINGS))
+                startActivity(Intent(Settings.ACTION_HOME_SETTINGS))
             }
             }
         } else changeLauncherText.visibility = View.GONE
         } else changeLauncherText.visibility = View.GONE
         aboutText.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_openAboutFragment))
         aboutText.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_openAboutFragment))
@@ -227,4 +153,23 @@ class MainFragment : Fragment() {
             if (sheetBehavior.state == STATE_COLLAPSED) sheetBehavior.state = STATE_HALF_EXPANDED
             if (sheetBehavior.state == STATE_COLLAPSED) sheetBehavior.state = STATE_HALF_EXPANDED
         }
         }
     }
     }
+
+    inner class SectionsPagerAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm) {
+
+        override fun getItem(position: Int): Fragment {
+            return HomeFragment.newInstance()
+        }
+
+        override fun getCount(): Int {
+            // Show 3 total pages.
+            return 1
+        }
+
+        override fun getPageTitle(position: Int): CharSequence? {
+            when (position) {
+                0 -> return "Home"
+            }
+            return null
+        }
+    }
 }
 }

+ 4 - 1
app/src/main/java/com/sduduzog/slimlauncher/ui/main/model/AppDao.kt

@@ -10,7 +10,7 @@ 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")
     @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>>
     val apps: LiveData<List<App>>
 
 
-    @get:Query("SELECT * FROM home_apps ORDER BY app_name ASC")
+    @get:Query("SELECT * FROM home_apps ORDER BY sorting_index ASC")
     val homeApps: LiveData<List<HomeApp>>
     val homeApps: LiveData<List<HomeApp>>
 
 
     @Insert(onConflict = OnConflictStrategy.IGNORE)
     @Insert(onConflict = OnConflictStrategy.IGNORE)
@@ -19,6 +19,9 @@ interface AppDao {
     @Insert
     @Insert
     fun addHomeApp(app: HomeApp)
     fun addHomeApp(app: HomeApp)
 
 
+    @Update
+    fun updateHomeApp(app: HomeApp)
+
     @Query("DELETE FROM apps")
     @Query("DELETE FROM apps")
     fun deleteAll()
     fun deleteAll()
 
 

+ 34 - 3
app/src/main/java/com/sduduzog/slimlauncher/ui/main/model/AppRepository.kt

@@ -31,8 +31,14 @@ class AppRepository(application: Application) {
         DeleteAsyncTask(appDao).execute(app)
         DeleteAsyncTask(appDao).execute(app)
     }
     }
 
 
-    fun updateApps() {
-        UpdateAppsAsyncTask(appDao).execute(pm)
+    fun updateApps(list: List<HomeApp>) {
+        for (app in list) {
+            UpdateAppsAsyncTask(appDao).execute(app)
+        }
+    }
+
+    fun refreshApps() {
+        RefreshAppsAsyncTask(appDao).execute(pm)
     }
     }
 
 
     private class InsertAsyncTask internal constructor(private val mAsyncTaskDao: AppDao) : AsyncTask<HomeApp, Void, Void>() {
     private class InsertAsyncTask internal constructor(private val mAsyncTaskDao: AppDao) : AsyncTask<HomeApp, Void, Void>() {
@@ -51,7 +57,15 @@ class AppRepository(application: Application) {
         }
         }
     }
     }
 
 
-    private class UpdateAppsAsyncTask internal constructor(private val mAsyncTaskDao: AppDao) : AsyncTask<PackageManager, Void, Void>() {
+    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? {
         override fun doInBackground(vararg params: PackageManager): Void? {
             val pm = params[0]
             val pm = params[0]
@@ -72,4 +86,21 @@ class AppRepository(application: Application) {
             return null
             return null
         }
         }
     }
     }
+
+
+    companion object {
+
+        @Volatile
+        @JvmStatic
+        private var INSTANCE: AppRepository? = null
+
+        fun getInstance(application: Application): AppRepository {
+            synchronized(AppRepository::class.java) {
+                if (INSTANCE == null) {
+                    INSTANCE = AppRepository(application)
+                }
+                return INSTANCE!!
+            }
+        }
+    }
 }
 }

+ 7 - 3
app/src/main/java/com/sduduzog/slimlauncher/ui/main/model/MainViewModel.kt

@@ -5,7 +5,7 @@ import androidx.lifecycle.AndroidViewModel
 import androidx.lifecycle.LiveData
 import androidx.lifecycle.LiveData
 
 
 class MainViewModel(application: Application) : AndroidViewModel(application) {
 class MainViewModel(application: Application) : AndroidViewModel(application) {
-    private var _repository: AppRepository = AppRepository(application)
+    private var _repository: AppRepository = AppRepository.getInstance(application)
     private var _homeApps: LiveData<List<HomeApp>>
     private var _homeApps: LiveData<List<HomeApp>>
     private var _apps: LiveData<List<App>>
     private var _apps: LiveData<List<App>>
 
 
@@ -24,8 +24,12 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
         _repository.delete(app)
         _repository.delete(app)
     }
     }
 
 
-    fun updateApps() {
-        _repository.updateApps()
+    fun updateApps(list: List<HomeApp>) {
+        _repository.updateApps(list)
+    }
+
+    fun refreshApps() {
+        _repository.refreshApps()
     }
     }
 
 
     fun addToHomeScreen(app: HomeApp) {
     fun addToHomeScreen(app: HomeApp) {

+ 7 - 0
app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/OnItemActionListener.kt

@@ -0,0 +1,7 @@
+package com.sduduzog.slimlauncher.ui.main.settings
+
+interface OnItemActionListener {
+    fun onViewMoved(oldPosition: Int, newPosition: Int): Boolean
+    fun onViewSwiped(position: Int)
+    fun onViewIdle()
+}

+ 46 - 1
app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/SettingsFragment.kt

@@ -1,14 +1,18 @@
 package com.sduduzog.slimlauncher.ui.main.settings
 package com.sduduzog.slimlauncher.ui.main.settings
 
 
 
 
+import android.content.Context
 import android.content.Context.MODE_PRIVATE
 import android.content.Context.MODE_PRIVATE
+import android.graphics.Canvas
 import android.os.Bundle
 import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.LayoutInflater
 import android.view.View
 import android.view.View
 import android.view.ViewGroup
 import android.view.ViewGroup
 import androidx.core.content.edit
 import androidx.core.content.edit
 import androidx.fragment.app.Fragment
 import androidx.fragment.app.Fragment
+import androidx.recyclerview.widget.ItemTouchHelper
 import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
 import com.sduduzog.slimlauncher.R
 import com.sduduzog.slimlauncher.R
 import kotlinx.android.synthetic.main.settings_fragment.*
 import kotlinx.android.synthetic.main.settings_fragment.*
 
 
@@ -26,7 +30,48 @@ class SettingsFragment : Fragment() {
         super.onActivityCreated(savedInstanceState)
         super.onActivityCreated(savedInstanceState)
         adapter = SettingsListAdapter(this)
         adapter = SettingsListAdapter(this)
         settingsAppList.adapter = adapter
         settingsAppList.adapter = adapter
-        settingsAppList.layoutManager = LinearLayoutManager(activity)
+        settingsAppList.layoutManager = LinearLayoutManager((activity as Context))
+        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)
+            }
+        }
+
+        val itemTouchHelper = ItemTouchHelper(simpleItemTouchCallback)
+
+        itemTouchHelper.attachToRecyclerView(settingsAppList)
+
         buttonChangeTheme.setOnClickListener {
         buttonChangeTheme.setOnClickListener {
             val themeChooserDialog = ThemeChooserDialog.getThemeChooser()
             val themeChooserDialog = ThemeChooserDialog.getThemeChooser()
             themeChooserDialog.showNow(fragmentManager, "THEME_CHOOSER")
             themeChooserDialog.showNow(fragmentManager, "THEME_CHOOSER")

+ 51 - 24
app/src/main/java/com/sduduzog/slimlauncher/ui/main/settings/SettingsListAdapter.kt

@@ -15,18 +15,16 @@ import com.sduduzog.slimlauncher.R
 import com.sduduzog.slimlauncher.ui.main.model.HomeApp
 import com.sduduzog.slimlauncher.ui.main.model.HomeApp
 import com.sduduzog.slimlauncher.ui.main.model.MainViewModel
 import com.sduduzog.slimlauncher.ui.main.model.MainViewModel
 
 
-class SettingsListAdapter(private val fragment: Fragment) : RecyclerView.Adapter<SettingsListAdapter.AppViewHolder>() {
+class SettingsListAdapter(private val fragment: Fragment) : RecyclerView.Adapter<SettingsListAdapter.AppViewHolder>(), OnItemActionListener {
 
 
+    private var deletedFrom = 0
     private lateinit var inflater: LayoutInflater
     private lateinit var inflater: LayoutInflater
-    private var apps: List<HomeApp> = listOf()
+    private var displayedApps: ArrayList<HomeApp> = arrayListOf()
     private var viewModel: MainViewModel = ViewModelProviders.of(fragment).get(MainViewModel::class.java)
     private var viewModel: MainViewModel = ViewModelProviders.of(fragment).get(MainViewModel::class.java)
 
 
     init {
     init {
         viewModel.homeApps.observe(fragment, Observer {
         viewModel.homeApps.observe(fragment, Observer {
-            if (it != null) {
-                apps = it
-                notifyDataSetChanged()
-            }
+            updateApps(it.orEmpty())
         })
         })
     }
     }
 
 
@@ -37,20 +35,14 @@ class SettingsListAdapter(private val fragment: Fragment) : RecyclerView.Adapter
     }
     }
 
 
     override fun onBindViewHolder(holder: AppViewHolder, position: Int) {
     override fun onBindViewHolder(holder: AppViewHolder, position: Int) {
-
-        val app = apps.singleOrNull {
-            it.sortingIndex == position
-        }
-
-        if (app != null) {
+        if (position < displayedApps.size) {
+            val app = displayedApps[position]
             with(app) {
             with(app) {
                 holder.itemText.text = this.appName
                 holder.itemText.text = this.appName
             }
             }
-            holder.itemSubtext.visibility = View.VISIBLE
             holder.itemButton.visibility = View.GONE
             holder.itemButton.visibility = View.GONE
         } else {
         } else {
-            holder.itemText.text = fragment.getString(R.string.settings_list_item_text, getNthString(position))
-            holder.itemSubtext.visibility = View.INVISIBLE
+            holder.itemText.text = fragment.getString(R.string.settings_list_item_text)
             holder.itemButton.visibility = View.VISIBLE
             holder.itemButton.visibility = View.VISIBLE
             val bundle = Bundle()
             val bundle = Bundle()
             bundle.putInt("index", position)
             bundle.putInt("index", position)
@@ -59,22 +51,57 @@ class SettingsListAdapter(private val fragment: Fragment) : RecyclerView.Adapter
         }
         }
     }
     }
 
 
-    override fun getItemCount() = if (apps.size != 5) apps.size + 1 else apps.size
+    override fun getItemCount() = if (displayedApps.size != 5) displayedApps.size + 1 else displayedApps.size
+
+//    fun deleteAppFromList(position: Int) {
+//        deletedFrom = position
+//        if (position < displayedApps.size) {
+//            viewModel.deleteApp(displayedApps[position])
+//        } else
+//            notifyDataSetChanged()
+//    }
+
+    private fun updateApps(newList: List<HomeApp>) {
+        val size = displayedApps.size
+        displayedApps.clear()
+        displayedApps.addAll(newList)
+        if (size > newList.size) {
+            notifyItemRemoved(deletedFrom)
+        }
+        else if (size < newList.size) notifyItemRangeChanged(size, displayedApps.size - size)
+
+    }
+
+    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
 
 
-    private fun getNthString(index: Int): String {
-        val i = index + 1
-        return when (i) {
-            1 -> "${i}st"
-            2 -> "${i}nd"
-            3 -> "${i}rd"
-            else -> "${i}th"
+            displayedApps[oldPosition] = app2
+            displayedApps[newPosition] = app1
+            notifyItemMoved(oldPosition, newPosition)
+            return true
         }
         }
+        return false
+    }
+
+    override fun onViewSwiped(position: Int) {
+        deletedFrom = position
+        if (position < displayedApps.size) {
+            viewModel.deleteApp(displayedApps[position])
+        } else
+            notifyDataSetChanged()
+    }
+
+    override fun onViewIdle() {
+        viewModel.updateApps(displayedApps)
     }
     }
 
 
     inner class AppViewHolder(view: View)// Bind item views here
     inner class AppViewHolder(view: View)// Bind item views here
         : RecyclerView.ViewHolder(view) {
         : RecyclerView.ViewHolder(view) {
         val itemText: TextView = view.findViewById(R.id.item_text)
         val itemText: TextView = view.findViewById(R.id.item_text)
-        val itemSubtext: TextView = view.findViewById(R.id.item_subtext)
         val itemButton: Button = view.findViewById(R.id.item_button)
         val itemButton: Button = view.findViewById(R.id.item_button)
     }
     }
 }
 }

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

@@ -1,55 +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">
-
-    <TextView
-        android:id="@+id/clockTextView"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="32dp"
-        android:text="@string/main_placeholder_clock"
-        android:textSize="64sp"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-
-    <TextView
-        android:id="@+id/dateTextView"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/main_placeholder_date"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/clockTextView" />
-
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/mainAppsList"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="32dp"
-        android:layout_marginLeft="32dp"
-        android:layout_marginTop="32dp"
-        android:layout_marginEnd="32dp"
-        android:layout_marginRight="32dp"
-        android:layout_marginBottom="32dp"
-        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/dateTextView"
-        tools:listitem="@layout/main_list_item" />
-
-    <TextView
-        android:id="@+id/clockAmPm"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="16dp"
-        android:textSize="18sp"
-        app:layout_constraintStart_toEndOf="@+id/clockTextView"
-        app:layout_constraintTop_toTopOf="@+id/clockTextView" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 13
app/src/main/res/layout-sw600dp/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 - 2
app/src/main/res/layout-v21/settings_fragment.xml

@@ -23,13 +23,12 @@
         android:layout_height="0dp"
         android:layout_height="0dp"
         android:layout_marginStart="16dp"
         android:layout_marginStart="16dp"
         android:layout_marginLeft="16dp"
         android:layout_marginLeft="16dp"
-        android:layout_marginTop="16dp"
         android:layout_marginEnd="16dp"
         android:layout_marginEnd="16dp"
         android:layout_marginRight="16dp"
         android:layout_marginRight="16dp"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textView8"
+        app:layout_constraintTop_toBottomOf="@+id/textView9"
         tools:listitem="@layout/settings_list_item" />
         tools:listitem="@layout/settings_list_item" />
 
 
     <TextView
     <TextView
@@ -117,6 +116,7 @@
         android:layout_width="wrap_content"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginStart="24dp"
         android:layout_marginStart="24dp"
+        android:layout_marginTop="8dp"
         android:text="@string/settings_text_home_screen_apps"
         android:text="@string/settings_text_home_screen_apps"
         android:textAppearance="@style/TextAppearance.AppCompat"
         android:textAppearance="@style/TextAppearance.AppCompat"
         android:textSize="24sp"
         android:textSize="24sp"
@@ -134,4 +134,14 @@
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/divider" />
         app:layout_constraintTop_toBottomOf="@+id/divider" />
 
 
+    <TextView
+        android:id="@+id/textView9"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="8dp"
+        android:text="@string/settings_list_item_subtext"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/textView8"
+        app:layout_constraintTop_toBottomOf="@+id/textView8" />
+
 </androidx.constraintlayout.widget.ConstraintLayout>
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 0
app/src/main/res/layout/fragment_about.xml → app/src/main/res/layout/about_fragment.xml


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

@@ -1,6 +0,0 @@
-<androidx.viewpager.widget.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/container"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context="com.sduduzog.slimlauncher.ui.main.DummyActivity" />

+ 0 - 22
app/src/main/res/layout/fragment_dummy.xml

@@ -1,22 +0,0 @@
-<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/constraintLayout"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context="com.sduduzog.slimlauncher.ui.main.DummyActivity$PlaceholderFragment">
-
-    <TextView
-        android:id="@+id/section_label"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="@dimen/activity_horizontal_margin"
-        android:layout_marginTop="@dimen/activity_vertical_margin"
-        android:layout_marginEnd="@dimen/activity_horizontal_margin"
-        android:layout_marginBottom="@dimen/activity_vertical_margin"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintTop_toTopOf="@+id/constraintLayout"
-        tools:layout_constraintLeft_creator="1"
-        tools:layout_constraintTop_creator="1" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 49 - 8
app/src/main/res/layout/home_framgent.xml

@@ -1,13 +1,54 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<?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"
     xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/main_content"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context="com.sduduzog.slimlauncher.ui.main.HomeFragment">
+    android:layout_height="match_parent">
 
 
-    <!-- TODO: Update blank fragment layout -->
     <TextView
     <TextView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:text="@string/hello_blank_fragment" />
+        android:id="@+id/clockTextView"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="32dp"
+        android:text="@string/main_placeholder_clock"
+        android:textSize="64sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 
-</FrameLayout>
+    <TextView
+        android:id="@+id/dateTextView"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/main_placeholder_date"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/clockTextView" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/mainAppsList"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginTop="32dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginRight="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_toTopOf="parent"
+        tools:listitem="@layout/main_list_item" />
+
+    <TextView
+        android:id="@+id/clockAmPm"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="16dp"
+        android:textSize="18sp"
+        app:layout_constraintStart_toEndOf="@+id/clockTextView"
+        app:layout_constraintTop_toTopOf="@+id/clockTextView" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 4 - 52
app/src/main/res/layout/main_content.xml

@@ -1,54 +1,6 @@
-<?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"
+<androidx.viewpager.widget.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/main_content"
+    android:id="@+id/container"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
-
-    <TextView
-        android:id="@+id/clockTextView"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="32dp"
-        android:text="@string/main_placeholder_clock"
-        android:textSize="64sp"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-
-    <TextView
-        android:id="@+id/dateTextView"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/main_placeholder_date"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/clockTextView" />
-
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/mainAppsList"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="16dp"
-        android:layout_marginLeft="16dp"
-        android:layout_marginTop="32dp"
-        android:layout_marginEnd="16dp"
-        android:layout_marginRight="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_toTopOf="parent"
-        tools:listitem="@layout/main_list_item" />
-
-    <TextView
-        android:id="@+id/clockAmPm"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="16dp"
-        android:textSize="18sp"
-        app:layout_constraintStart_toEndOf="@+id/clockTextView"
-        app:layout_constraintTop_toTopOf="@+id/clockTextView" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>
+    android:layout_height="match_parent"
+    tools:context="com.sduduzog.slimlauncher.ui.main.MainFragment" />

+ 12 - 2
app/src/main/res/layout/settings_fragment.xml

@@ -24,13 +24,12 @@
         android:layout_height="0dp"
         android:layout_height="0dp"
         android:layout_marginStart="16dp"
         android:layout_marginStart="16dp"
         android:layout_marginLeft="16dp"
         android:layout_marginLeft="16dp"
-        android:layout_marginTop="16dp"
         android:layout_marginEnd="16dp"
         android:layout_marginEnd="16dp"
         android:layout_marginRight="16dp"
         android:layout_marginRight="16dp"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textView8"
+        app:layout_constraintTop_toBottomOf="@+id/textView6"
         tools:listitem="@layout/settings_list_item" />
         tools:listitem="@layout/settings_list_item" />
 
 
     <TextView
     <TextView
@@ -139,4 +138,15 @@
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/divider" />
         app:layout_constraintTop_toBottomOf="@+id/divider" />
 
 
+    <TextView
+        android:id="@+id/textView6"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="8dp"
+        android:layout_marginRight="8dp"
+        android:text="@string/settings_list_item_subtext"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/textView8"
+        app:layout_constraintTop_toBottomOf="@+id/textView8" />
+
 </androidx.constraintlayout.widget.ConstraintLayout>
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 6 - 14
app/src/main/res/layout/settings_list_item.xml

@@ -3,6 +3,7 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/settings_list_item"
     android:id="@+id/settings_list_item"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
+    android:background="?android:attr/colorBackground"
     android:layout_height="wrap_content">
     android:layout_height="wrap_content">
 
 
     <TextView
     <TextView
@@ -14,33 +15,24 @@
         android:layout_marginTop="8dp"
         android:layout_marginTop="8dp"
         android:layout_marginEnd="8dp"
         android:layout_marginEnd="8dp"
         android:layout_marginRight="8dp"
         android:layout_marginRight="8dp"
+        android:layout_marginBottom="8dp"
         android:text="@string/settings_list_item_text"
         android:text="@string/settings_list_item_text"
-        android:textSize="24sp"
+        android:textSize="32sp"
+        app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
         app:layout_constraintTop_toTopOf="parent" />
 
 
-    <TextView
-        android:id="@+id/item_subtext"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="8dp"
-        android:layout_marginRight="8dp"
-        android:layout_marginBottom="8dp"
-        android:text="@string/settings_list_item_subtext"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="@+id/item_text"
-        app:layout_constraintTop_toBottomOf="@+id/item_text" />
-
     <Button
     <Button
         android:id="@+id/item_button"
         android:id="@+id/item_button"
         style="@style/Widget.AppCompat.Button.Borderless"
         style="@style/Widget.AppCompat.Button.Borderless"
         android:layout_width="wrap_content"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_height="wrap_content"
+        android:layout_marginTop="8dp"
         android:layout_marginEnd="8dp"
         android:layout_marginEnd="8dp"
         android:layout_marginRight="8dp"
         android:layout_marginRight="8dp"
         android:text="@string/settings_list_item_button_set_app"
         android:text="@string/settings_list_item_button_set_app"
+        app:layout_constraintBottom_toBottomOf="@+id/item_text"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toTopOf="@+id/item_text" />
         app:layout_constraintTop_toTopOf="@+id/item_text" />
 
 

+ 0 - 11
app/src/main/res/menu/menu_dummy.xml

@@ -1,11 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    tools:context="com.sduduzog.slimlauncher.ui.main.DummyActivity">
-    <item
-        android:id="@+id/action_settings"
-        android:orderInCategory="100"
-        app:showAsAction="never"
-        android:title="@string/action_settings" />
-</menu>
-

+ 1 - 1
app/src/main/res/navigation/nav_graph.xml

@@ -35,7 +35,7 @@
         android:id="@+id/aboutFragment"
         android:id="@+id/aboutFragment"
         android:name="com.sduduzog.slimlauncher.ui.main.AboutFragment"
         android:name="com.sduduzog.slimlauncher.ui.main.AboutFragment"
         android:label="fragment_about"
         android:label="fragment_about"
-        tools:layout="@layout/fragment_about" />
+        tools:layout="@layout/about_fragment" />
     <fragment
     <fragment
         android:id="@+id/setupFragment"
         android:id="@+id/setupFragment"
         android:name="com.sduduzog.slimlauncher.ui.main.setup.SetupFragment"
         android:name="com.sduduzog.slimlauncher.ui.main.setup.SetupFragment"

+ 1 - 1
app/src/main/res/values-w820dp/dimens.xml

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

+ 2 - 2
app/src/main/res/values/dimens.xml

@@ -3,6 +3,6 @@
 
 
 
 
     <!-- Default screen margins, per the Android Design guidelines. -->
     <!-- Default screen margins, per the Android Design guidelines. -->
-    <dimen name="activity_horizontal_margin">16dp</dimen>
-    <dimen name="activity_vertical_margin">16dp</dimen>
+    <!--<dimen name="activity_horizontal_margin">16dp</dimen>-->
+    <!--<dimen name="activity_vertical_margin">16dp</dimen>-->
 </resources>
 </resources>

+ 6 - 7
app/src/main/res/values/strings.xml

@@ -32,12 +32,12 @@
     <string name="settings_text_tap_to_check_between_24_hour_or_12_hour">Tap to check between 24 hour or 12 hour</string>
     <string name="settings_text_tap_to_check_between_24_hour_or_12_hour">Tap to check between 24 hour or 12 hour</string>
     <string name="settings_text_tap_to_change_app_theme">Choose from a variety of themes</string>
     <string name="settings_text_tap_to_change_app_theme">Choose from a variety of themes</string>
     <string name="settings_text_home_screen_apps">Home screen apps</string>
     <string name="settings_text_home_screen_apps">Home screen apps</string>
-    <string name="settings_item_button_remove">remove</string>
+    <!--<string name="settings_item_button_remove">remove</string>-->
     <string name="settings_title">Preferences</string>
     <string name="settings_title">Preferences</string>
 
 
     <string name="settings_list_item_button_set_app">Set app</string>
     <string name="settings_list_item_button_set_app">Set app</string>
-    <string name="settings_list_item_text">%s app goes here</string>
-    <string name="settings_list_item_subtext">Swipe to remove or drag up/down to reorder</string>
+    <string name="settings_list_item_text">Slot empty</string>
+    <string name="settings_list_item_subtext">Swipe left/right to remove an app or long press to drag up/down to reorder</string>
     <string name="settings_button_change_theme">Change</string>
     <string name="settings_button_change_theme">Change</string>
     <string name="about_title">Slim launcher</string>
     <string name="about_title">Slim launcher</string>
     <string name="about_text">
     <string name="about_text">
@@ -89,11 +89,10 @@
 
 
     <string name="no_app_selected_toast_msg">Choose at least one app</string>
     <string name="no_app_selected_toast_msg">Choose at least one app</string>
     <string name="choose_apps_title">Choose Apps</string>
     <string name="choose_apps_title">Choose Apps</string>
-    <string name="title_activity_dummy">DummyActivity</string>
-    <string name="action_settings">Settings</string>
-    <string name="section_format">Hello World from section: %1$d</string>
+    <!--<string name="action_settings">Settings</string>-->
+    <!--<string name="section_format">Hello World from section: %1$d</string>-->
 
 
     <!-- TODO: Remove or change this placeholder text -->
     <!-- TODO: Remove or change this placeholder text -->
-    <string name="hello_blank_fragment">Hello blank fragment</string>
+    <!--<string name="hello_blank_fragment">Hello blank fragment</string>-->
 
 
 </resources>
 </resources>