Skip to content

Commit

Permalink
Enable Android linting on CI and fix a number of linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuester committed Jan 5, 2024
1 parent bbb939f commit 9b996a9
Show file tree
Hide file tree
Showing 26 changed files with 228 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/android_branch_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
- name: Lint Android
run: ./gradlew lint
- name: Build with Gradle
run: ./gradlew build
2 changes: 2 additions & 0 deletions .github/workflows/android_master_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
- name: Lint Android
run: ./gradlew lint
- name: Build with Gradle
run: ./gradlew build
- name: Build Signed APK
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/android_pr_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
- name: Lint Android
run: ./gradlew lint
- name: Build with Gradle
run: ./gradlew build
- name: Upload APK
Expand Down
5 changes: 5 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ android {
testOptions {
unitTests.isIncludeAndroidResources = true
}
lint {
warningsAsErrors = true
disable += "Typos"
disable += "VectorPath"
}
namespace = "com.sduduzog.slimlauncher"
applicationVariants.all{
outputs.all {
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@

<application
android:name=".App"
android:allowBackup="false"
android:configChanges="orientation|keyboardHidden|screenSize"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:allowBackup">
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sduduzog.slimlauncher.adapters

import android.annotation.SuppressLint
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -28,6 +29,7 @@ class AddAppAdapter(private val listener: OnAppClickedListener) : RecyclerView.A
return ViewHolder(view)
}

@SuppressLint("NotifyDataSetChanged")
fun setItems(apps: List<App>){
this.apps = apps
notifyDataSetChanged()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class CustomAppsAdapter(private val listener: OnShitDoneToAppsListener) : Recycl
}
}

@SuppressLint("NotifyDataSetChanged")
fun setItems(apps: List<HomeApp>) {
this.apps = sanitiseIndexes(apps) as MutableList<HomeApp>
notifyDataSetChanged()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sduduzog.slimlauncher.adapters

import android.annotation.SuppressLint
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -37,6 +38,7 @@ class HomeAdapter(

override fun getItemCount(): Int = apps.size

@SuppressLint("NotifyDataSetChanged")
fun setItems(list: List<HomeApp>) {
this.apps = list
notifyDataSetChanged()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class RenameAppDialog : DialogFragment() {
private lateinit var model: CustomiseAppsViewModel

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val view = LayoutInflater.from(context).inflate(R.layout.rename_dialog_edit_text, customise_apps_fragment, false)
val view = layoutInflater.inflate(R.layout.rename_dialog_edit_text, customise_apps_fragment, false)
val editText: EditText = view.findViewById(R.id.rename_editText)
val appName: String = app.appNickname ?: app.appName
editText.text.append(appName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class RenameAppDisplayNameDialog : DialogFragment() {
private lateinit var unlauncherAppsRepo: UnlauncherAppsRepository

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val view = LayoutInflater.from(context).inflate(R.layout.rename_dialog_edit_text, customise_apps_fragment, false)
val view = layoutInflater.inflate(R.layout.rename_dialog_edit_text, customise_apps_fragment, false)
val editText: EditText = view.findViewById(R.id.rename_editText)
val appName: String = app.displayName
editText.text.append(appName)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sduduzog.slimlauncher.ui.main

import android.annotation.SuppressLint
import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.BroadcastReceiver
Expand Down Expand Up @@ -371,6 +372,7 @@ class HomeFragment : BaseFragment(), OnLaunchAppListener {
}

inner class AppDrawerListener {
@SuppressLint("DiscouragedPrivateApi")
fun onAppLongClicked(app : UnlauncherApp, view: View) : Boolean {
val popupMenu = PopupMenu(context, view)
popupMenu.inflate(R.menu.app_long_press_menu)
Expand Down
204 changes: 204 additions & 0 deletions app/src/main/res/drawable/ic_launcher_monochrome.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/src/main/res/layout/main_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:layout_height="match_parent"
tools:context=".MainActivity">

<fragment xmlns:app="http://schemas.android.com/apk/res-auto"
<androidx.fragment.app.FragmentContainerView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_monochrome"/>
</adaptive-icon>
1 change: 1 addition & 0 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_monochrome"/>
</adaptive-icon>
2 changes: 0 additions & 2 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
<string name="options_fragment_customize_app_drawer">Appschublade</string>
<string name="options_fragment_customize_quick_buttons">Knöpfe einstellen</string>
<string name="options_fragment_device_settings">Geräteeinstellungen</string>
<string name="options_fragment_hide_status_bar">Statusleiste verstecken</string>
<string name="options_fragment_show_status_bar">Statusleiste zeigen</string>
<string name="options_fragment_toggle_status_bar">Statusleiste umschalten</string>
<string name="remove_all_apps_dialog_message">"Alle Apps bleiben installiert."
"Bitte das Leeren der Liste bestätigen."</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
<string name="options_fragment_choose_time_format">Format de l’Heure</string>
<string name="options_fragment_customise_apps">Applications Personnalisées</string>
<string name="options_fragment_device_settings">Paramètres Système</string>
<string name="options_fragment_hide_status_bar">Cacher la Barre de Statut</string>
<string name="options_fragment_show_status_bar">Afficher la Barre de Statut</string>
<string name="options_fragment_toggle_status_bar">Afficher/Cacher la Barre de Statut</string>
<string name="remove_all_apps_dialog_message">"Cette action ne supprimera aucune application de l’appareil."
"Il s’agit seulement de confirmer la purgation de la liste."</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,5 @@
<string name="options_fragment_customize_app_drawer">Elenco applicazioni</string>
<string name="options_fragment_customize_quick_buttons">Pulsanti rapidi</string>
<string name="options_fragment_device_settings">Impostazioni del dispositivo</string>
<string name="options_fragment_hide_status_bar">Nascondi la barra di stato</string>
<string name="options_fragment_show_status_bar">Mostra la barra di stato</string>
<string name="options_fragment_toggle_status_bar">Mostra/nascondi barra di stato</string>
</resources>
2 changes: 0 additions & 2 deletions app/src/main/res/values-nb/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
<string name="options_fragment_choose_time_format">Tidsformat</string>
<string name="options_fragment_customise_apps">Tilpass programmer</string>
<string name="options_fragment_device_settings">Enhetsinnstillinger</string>
<string name="options_fragment_hide_status_bar">Skjul statusfelt</string>
<string name="options_fragment_show_status_bar">Vis statusfelt</string>
<string name="options_fragment_toggle_status_bar">Statusfelt på/av</string>
<string name="remove_all_apps_dialog_message">"Programmene dine blir ikke avinstallert."
"Dette bekrefter kun at du fjerner listen med overlegg."</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,5 @@
<string name="options_fragment_choose_time_format">Kies de tijdopmaak</string>
<string name="options_fragment_customise_apps">Apps aanpassen</string>
<string name="options_fragment_device_settings">Systeeminstellingen</string>
<string name="options_fragment_hide_status_bar">Statusbalk verbergen</string>
<string name="options_fragment_show_status_bar">Statusbalk tonen</string>
<string name="options_fragment_toggle_status_bar">Statusbalk tonen/verbergen</string>
</resources>
2 changes: 0 additions & 2 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@
<string name="options_fragment_customize_app_drawer">Настроить выдвигающийся список</string>
<string name="options_fragment_customize_quick_buttons">Настроить кнопки быстрого запуска</string>
<string name="options_fragment_device_settings">Настройки устройства</string>
<string name="options_fragment_hide_status_bar">Скрыть строку состояния</string>
<string name="options_fragment_show_status_bar">Показать строку состояния</string>
<string name="options_fragment_toggle_status_bar">Скрыть/показать строку состояния</string>
<string name="remove_all_apps_dialog_message">"Это действие не удалит Ваши приложения."
"Это только для того чтобы подвтердить, что Вы делаете это осмысленно."</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@
<string name="options_fragment_choose_time_format">Обрати формат часу</string>
<string name="options_fragment_customise_apps">Налаштування програм</string>
<string name="options_fragment_device_settings">Налаштування пристрою</string>
<string name="options_fragment_hide_status_bar">Сховати рядок стану</string>
<string name="options_fragment_show_status_bar">Показати рядок стану</string>
<string name="options_fragment_toggle_status_bar">Вкл\\вимк смужку стану</string>
</resources>
3 changes: 0 additions & 3 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@
<string name="options_fragment_customize_app_drawer">自定义抽屉</string>
<string name="options_fragment_customize_quick_buttons">自定义快捷按钮</string>
<string name="options_fragment_device_settings">设备设置</string>
<string name="options_fragment_hide_status_bar">隐藏状态栏</string>
<string name="options_fragment_show_status_bar">显示状态栏</string>
<string name="options_fragment_toggle_status_bar">切换状态栏状态</string>
<string name="prefs_settings" translatable="false">settings</string>
<string name="remove_all_apps_dialog_message">"此操作不会卸载你的应用。"
"只想确认一下你是否有意清除这个列表。"</string>
<string name="remove_all_apps_dialog_title">删除全部应用</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
<string name="options_fragment_choose_time_format">選擇時間格式</string>
<string name="options_fragment_customise_apps">挑選應用程序</string>
<string name="options_fragment_device_settings">設備設置</string>
<string name="options_fragment_hide_status_bar">隱藏狀態欄</string>
<string name="options_fragment_show_status_bar">顯示狀態欄</string>
<string name="options_fragment_toggle_status_bar">顯示或隱藏狀態欄</string>
<string name="remove_all_apps_dialog_message">"這個選項不會卸載你的應用程序."
"這只是爲了確定你想清空這個清單."</string>
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/values/ic_launcher_background.xml

This file was deleted.

3 changes: 0 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<string name="prefs_settings_key_theme" translatable="false">key_theme</string>
<string name="prefs_settings_key_time_format" translatable="false">time_format</string>
<string name="prefs_settings_key_toggle_status_bar" translatable="false">hide_status_bar</string>
<string name="slim_url" translatable="false">https://github.com/jkuester/unlauncher</string>

<string-array name="alignment_format_array">
<item>left</item>
Expand Down Expand Up @@ -85,8 +84,6 @@
<string name="options_fragment_customize_app_drawer">Customise Drawer</string>
<string name="options_fragment_customize_quick_buttons">Customise Quick Buttons</string>
<string name="options_fragment_device_settings">Device Settings</string>
<string name="options_fragment_hide_status_bar">Hide Status Bar</string>
<string name="options_fragment_show_status_bar">Show Status Bar</string>
<string name="options_fragment_toggle_status_bar">Toggle Status Bar</string>
<string name="remove_all_apps_dialog_message">"This action will not uninstall your apps."
"It is just to confirm if you're clearing this list on purpose"</string>
Expand Down

0 comments on commit 9b996a9

Please sign in to comment.