Prechádzať zdrojové kódy

Cleaned Lint results

sduduzog 7 rokov pred
rodič
commit
bdbd43909b

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

@@ -36,7 +36,7 @@ class DBTest {
     @Test
     @Throws(InterruptedException::class)
     fun testInsertLiveDataApps() {
-        val app = TestUtil.createApp("TestApp", "com.test.testapp", "TestMainActivity")
+        val app = TestUtil.createApp("TestApp", "com.test.test.app", "TestMainActivity")
         mAppDao!!.insert(app)
         val appsInstalled = LiveDataTestUtil.getValue(mAppDao!!.apps)
         assertThat(appsInstalled.size, equalTo(1))

+ 1 - 5
app/src/androidTest/java/com/sduduzog/slimlauncher/TestUtil.kt

@@ -5,10 +5,6 @@ import com.sduduzog.slimlauncher.ui.main.model.App
 internal object TestUtil {
 
     fun createApp(appName: String, packageName: String, activityName: String): App {
-        val app = App()
-        app.appName = appName
-        app.packageName = packageName
-        app.activityName = activityName
-        return app
+        return App(appName, packageName, activityName)
     }
 }

+ 1 - 3
app/src/main/java/com/sduduzog/slimlauncher/ui/main/AppsFragment.kt

@@ -10,7 +10,6 @@ import androidx.fragment.app.Fragment
 import androidx.lifecycle.Observer
 import androidx.lifecycle.ViewModelProviders
 import androidx.navigation.Navigation
-import androidx.recyclerview.widget.RecyclerView
 import com.sduduzog.slimlauncher.R
 import com.sduduzog.slimlauncher.ui.main.model.App
 import com.sduduzog.slimlauncher.ui.main.model.MainViewModel
@@ -23,7 +22,6 @@ class AppsFragment : Fragment() {
     private var apps: MutableList<App> = mutableListOf()
     private lateinit var viewModel: MainViewModel
     private lateinit var mAdapter: AppsListAdapter
-    private lateinit var layout: RecyclerView
 
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                               savedInstanceState: Bundle?): View? {
@@ -59,7 +57,7 @@ class AppsFragment : Fragment() {
     inner class InteractionHandler : OnListFragmentInteractionListener {
         override fun onListFragmentInteraction(app: App) {
             viewModel.addToHomeScreen(app)
-            val nav = Navigation.findNavController(layout)
+            val nav = Navigation.findNavController(appList)
             nav.popBackStack()
         }
     }

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

@@ -23,8 +23,6 @@ class SettingsFragment : Fragment() {
     private lateinit var viewModel: MainViewModel
     private lateinit var adapter: SettingsListAdapter
 
-    private val TAG: String = "SettingsFragment"
-
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                               savedInstanceState: Bundle?): View? {
         return inflater.inflate(R.layout.settings_fragment, container, false)
@@ -51,7 +49,7 @@ class SettingsFragment : Fragment() {
         addButton.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_openAppsFragment))
         changeThemeText.setOnClickListener {
             val themeChooserDialog = ThemeChooserDialog.getThemeChooser()
-            themeChooserDialog.showNow(fragmentManager, TAG)
+            themeChooserDialog.showNow(fragmentManager, "THEME_CHOOSER")
         }
         val settings = context!!.getSharedPreferences(getString(R.string.prefs_settings), MODE_PRIVATE)
         clockTypeChecker.isChecked = settings.getBoolean(getString(R.string.prefs_settings_key_clock_type), false)

+ 0 - 2
app/src/main/java/com/sduduzog/slimlauncher/ui/main/model/AppRepository.kt

@@ -15,8 +15,6 @@ class AppRepository(application: Application) {
     private var _apps: LiveData<List<App>> = appDao.apps
     private var _homeApps: LiveData<List<HomeApp>> = appDao.homeApps
 
-    private val TAG: String = "REPO"
-
     private var pm: PackageManager = application.packageManager
 
     val homeApps: LiveData<List<HomeApp>>

+ 2 - 0
app/src/main/java/com/sduduzog/slimlauncher/ui/main/model/AppRoomDatabase.java

@@ -9,6 +9,7 @@ import android.content.Context;
 public abstract class AppRoomDatabase extends RoomDatabase {
     private static volatile AppRoomDatabase INSTANCE;
 
+    @SuppressWarnings("UnusedReturnValue")
     public static AppRoomDatabase getDatabase(final Context context) {
         if (INSTANCE == null) {
             synchronized (AppRoomDatabase.class) {
@@ -22,5 +23,6 @@ public abstract class AppRoomDatabase extends RoomDatabase {
         return INSTANCE;
     }
 
+    @SuppressWarnings("UnusedReturnValue")
     public abstract AppDao appDao();
 }

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

@@ -3,9 +3,6 @@ package com.sduduzog.slimlauncher.ui.main.model
 import android.app.Application
 import androidx.lifecycle.AndroidViewModel
 import androidx.lifecycle.LiveData
-import com.sduduzog.slimlauncher.ui.main.model.App
-import com.sduduzog.slimlauncher.ui.main.model.AppRepository
-import com.sduduzog.slimlauncher.ui.main.model.HomeApp
 
 class MainViewModel(application: Application) : AndroidViewModel(application) {
     private var _repository: AppRepository = AppRepository(application)

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

@@ -95,7 +95,7 @@ class SetupFragment : Fragment(), DialogInteractionListener {
         textViewLets.alpha = 0f
         setupButton.alpha = 0f
         tvWelcome.alpha = 0f
-        cvIton.alpha = 0f
+        cvIcon.alpha = 0f
     }
 
     private fun revealUI(level: Int) {
@@ -103,7 +103,7 @@ class SetupFragment : Fragment(), DialogInteractionListener {
         when (level) {
             0 -> {
                 tvWelcome.animate().alpha(1f).duration = 1000
-                cvIton.animate().alpha(1f).duration = 1500
+                cvIcon.animate().alpha(1f).duration = 1500
                 textViewLets.animate().alpha(1f).duration = 1000
                 opt1Text.animate().setStartDelay(1000).alpha(1f).duration = 500
                 opt1Number.animate().setStartDelay(1000).alpha(1f).duration = 500

+ 1 - 2
app/src/main/res/layout-sw600dp/main_content.xml

@@ -4,8 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/main_content"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="?android:attr/colorBackground">
+    android:layout_height="match_parent">
 
     <TextView
         android:id="@+id/clockTextView"

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

@@ -0,0 +1,139 @@
+<?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/frameLayout"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".ui.main.SettingsFragment">
+
+    <TextView
+        android:id="@+id/textView3"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
+        android:layout_marginTop="32dp"
+        android:text="@string/settings_title"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <Button
+        android:id="@+id/addButton"
+        style="@style/Widget.AppCompat.Button.Borderless"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="8dp"
+        android:text="@string/settings_button_add"
+        app:layout_constraintBottom_toBottomOf="@+id/textView8"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/textView8"
+        app:layout_constraintVertical_bias="0.31" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/settingsAppList"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_marginStart="16dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginTop="24dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginRight="16dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/textView8"
+        tools:listitem="@layout/settings_apps_list_item" />
+
+    <TextView
+        android:id="@+id/textView2"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="24dp"
+        android:layout_marginTop="24dp"
+        android:text="@string/settings_text_use_24_hour_clock"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="24sp"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/textView3" />
+
+    <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:buttonTint="?android:colorForeground"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/textView2" />
+
+    <TextView
+        android:id="@+id/textView4"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/settings_text_tap_to_check_between_24_hour_or_12_hour"
+        app:layout_constraintStart_toStartOf="@+id/textView2"
+        app:layout_constraintTop_toBottomOf="@+id/textView2" />
+
+    <View
+        android:id="@+id/divider"
+        android:layout_width="0dp"
+        android:layout_height="1dp"
+        android:layout_marginStart="16dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginTop="16dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginRight="16dp"
+        android:background="?android:attr/listDivider"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/textView4" />
+
+    <TextView
+        android:id="@+id/changeThemeText"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="24dp"
+        android:layout_marginTop="8dp"
+        android:text="@string/main_options_change_theme"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="24sp"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/divider" />
+
+    <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" />
+
+    <View
+        android:id="@+id/divider2"
+        android:layout_width="0dp"
+        android:layout_height="1dp"
+        android:layout_marginStart="16dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginTop="16dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginRight="16dp"
+        android:background="?android:attr/listDivider"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/textView7" />
+
+    <TextView
+        android:id="@+id/textView8"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="24dp"
+        android:layout_marginTop="16dp"
+        android:text="@string/settings_text_home_screen_apps"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="24sp"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/divider2" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 2
app/src/main/res/layout/main_content.xml

@@ -4,8 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/main_content"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="?android:attr/colorBackground">
+    android:layout_height="match_parent">
 
     <TextView
         android:id="@+id/clockTextView"

+ 4 - 6
app/src/main/res/layout/settings_fragment.xml

@@ -5,7 +5,6 @@
     android:id="@+id/frameLayout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="?android:attr/colorBackground"
     tools:context=".ui.main.SettingsFragment">
 
     <TextView
@@ -54,7 +53,7 @@
         android:layout_marginStart="24dp"
         android:layout_marginLeft="24dp"
         android:layout_marginTop="24dp"
-        android:text="Use 24 hour clock"
+        android:text="@string/settings_text_use_24_hour_clock"
         android:textAppearance="@style/TextAppearance.AppCompat"
         android:textSize="24sp"
         app:layout_constraintStart_toStartOf="parent"
@@ -68,7 +67,6 @@
         android:layout_marginTop="8dp"
         android:layout_marginEnd="24dp"
         android:layout_marginRight="24dp"
-        android:buttonTint="?android:colorForeground"
         android:textAppearance="@style/TextAppearance.AppCompat"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toTopOf="@+id/textView2" />
@@ -77,7 +75,7 @@
         android:id="@+id/textView4"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:text="Tap to check between 24 hour or 12 hour"
+        android:text="@string/settings_text_tap_to_check_between_24_hour_or_12_hour"
         app:layout_constraintStart_toStartOf="@+id/textView2"
         app:layout_constraintTop_toBottomOf="@+id/textView2" />
 
@@ -112,7 +110,7 @@
         android:id="@+id/textView7"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:text="Tap to change app theme"
+        android:text="@string/settings_text_tap_to_change_app_theme"
         app:layout_constraintStart_toStartOf="@+id/changeThemeText"
         app:layout_constraintTop_toBottomOf="@+id/changeThemeText" />
 
@@ -137,7 +135,7 @@
         android:layout_marginStart="24dp"
         android:layout_marginLeft="24dp"
         android:layout_marginTop="16dp"
-        android:text="Home screen apps"
+        android:text="@string/settings_text_home_screen_apps"
         android:textAppearance="@style/TextAppearance.AppCompat"
         android:textSize="24sp"
         app:layout_constraintStart_toStartOf="parent"

+ 2 - 2
app/src/main/res/layout/setup_fragment.xml

@@ -7,7 +7,7 @@
     tools:context="com.sduduzog.slimlauncher.ui.main.setup.SetupFragment">
 
     <androidx.cardview.widget.CardView
-        android:id="@+id/cvIton"
+        android:id="@+id/cvIcon"
         android:layout_width="100dp"
         android:layout_height="100dp"
         android:layout_marginStart="32dp"
@@ -68,7 +68,7 @@
         android:textSize="32sp"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/cvIton" />
+        app:layout_constraintTop_toBottomOf="@+id/cvIcon" />
 
     <TextView
         android:id="@+id/textViewLets"

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

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

+ 0 - 10
app/src/main/res/values/colors.xml

@@ -5,16 +5,6 @@
     <color name="primaryColor">#212121</color>
     <color name="primaryDarkColor">#000000</color>
 
-
-    <color name="primaryGrey">#263238</color>
-    <color name="darkGrey">#000a12</color>
-
-    <color name="primaryTeal">#b2dfdb</color>
-    <color name="darkTeal">#82ada9</color>
-
-    <color name="primaryPink">#fce4ec</color>
-    <color name="darkPink">#c9b2ba</color>
-
     <color name="colorBlueGrey">#607d8b</color>
     <color name="colorBlueGreyDark">#455a64</color>
 

+ 0 - 3
app/src/main/res/values/dimens.xml

@@ -1,7 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <!-- Default screen margins, per the Android Design guidelines. -->
-    <dimen name="activity_horizontal_margin">16dp</dimen>
-    <dimen name="activity_vertical_margin">16dp</dimen>
 </resources>

+ 4 - 4
app/src/main/res/values/strings.xml

@@ -28,7 +28,6 @@
     <string name="settings_item_button_remove">remove</string>
     <string name="settings_title">Home screen settings</string>
     <string name="settings_button_add">Add</string>
-    <string name="settings_option_why">Why can\'t I add more?</string>
     <string name="about_title">Slim launcher</string>
     <string name="about_text">
         Created by : Beautus S Gumede\n
@@ -60,7 +59,6 @@
         OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
         DEALINGS IN THE SOFTWARE.
     </string>
-    <string name="content_description_expand_up">Expand up icon</string>
     <string name="theme_chooser_dialog_title">Change theme</string>
     <string name="main_call_icon">call icon</string>
     <string name="main_photo_camera_icon">photo camera icon</string>
@@ -72,12 +70,14 @@
     <string name="setup_text_lets_get_you_set_up">Lets get you set up!</string>
     <string name="setup_text_choose_apps">Choose apps that will appear on your home screen</string>
     <string name="setup_text_choose_your_preferred_clock">Choose your preferred clock type</string>
-    <string name="setup_text_set_the_theme">Set the theme of your choice</string>
     <string name="icon_check">Icon check</string>
     <string name="setup_button_next">next</string>
     <string name="setup_button_finish">Finish</string>
     <string name="setup_text_1">1.</string>
     <string name="setup_text_2">2.</string>
-    <string name="setup_text_3">3.</string>
+    <string name="settings_text_use_24_hour_clock">Use 24 hour clock</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">Tap to change app theme</string>
+    <string name="settings_text_home_screen_apps">Home screen apps</string>
 
 </resources>

+ 0 - 4
app/src/test/java/com/sduduzog/slimlauncher/MethodTestUtils.kt

@@ -1,4 +0,0 @@
-package com.sduduzog.slimlauncher
-
-class MethodTestUtils {
-}