From 47d223840fbc6c8b8ed903083143cc6ac28ba2cd Mon Sep 17 00:00:00 2001 From: Jean-BaptisteC Date: Mon, 27 Nov 2023 21:46:49 +0100 Subject: [PATCH 1/2] Remove chip icon and add better layout on tablet --- .../fragments/appdetail/AppDetailFragment.kt | 2 - .../fragments/apps/AppsFragment.kt | 11 +- .../fragments/apps/model/AppsRVAdapter.kt | 16 +- .../trackerdetail/TrackerDetailFragment.kt | 11 +- .../fragments/trackers/TrackersFragment.kt | 11 +- .../exodusprivacy/objects/VersionReport.kt | 14 -- .../exodusprivacy/utils/CommonExtensions.kt | 21 --- app/src/main/res/drawable/ic_match.xml | 10 -- app/src/main/res/drawable/ic_mismatch.xml | 10 -- app/src/main/res/drawable/ic_unavailable.xml | 10 -- .../main/res/layout/fragment_app_detail.xml | 19 +- app/src/main/res/layout/fragment_apps.xml | 8 + .../res/layout/recycler_view_app_item.xml | 170 +++++++++--------- .../res/layout/shimmer_layout_app_item.xml | 13 -- app/src/main/res/values-fr/strings.xml | 5 +- app/src/main/res/values-pl/strings.xml | 3 +- app/src/main/res/values-ru/strings.xml | 3 +- app/src/main/res/values-tr/strings.xml | 3 +- app/src/main/res/values/strings.xml | 5 +- 19 files changed, 139 insertions(+), 206 deletions(-) delete mode 100644 app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/VersionReport.kt delete mode 100644 app/src/main/res/drawable/ic_match.xml delete mode 100644 app/src/main/res/drawable/ic_mismatch.xml delete mode 100644 app/src/main/res/drawable/ic_unavailable.xml diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/appdetail/AppDetailFragment.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/appdetail/AppDetailFragment.kt index 1b351450..03f07bd3 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/appdetail/AppDetailFragment.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/appdetail/AppDetailFragment.kt @@ -22,7 +22,6 @@ import org.eu.exodus_privacy.exodusprivacy.R import org.eu.exodus_privacy.exodusprivacy.databinding.FragmentAppDetailBinding import org.eu.exodus_privacy.exodusprivacy.fragments.appdetail.model.AppDetailVPAdapter import org.eu.exodus_privacy.exodusprivacy.utils.setExodusColor -import org.eu.exodus_privacy.exodusprivacy.utils.setVersionReport import javax.inject.Inject @AndroidEntryPoint @@ -172,7 +171,6 @@ class AppDetailFragment : Fragment(R.layout.fragment_app_detail) { text = permsNum.toString() setExodusColor(permsNum) } - versionChip.setVersionReport(app) sourceChip.text = app.source.name.lowercase().replaceFirstChar { it.uppercase() } diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/apps/AppsFragment.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/apps/AppsFragment.kt index 023eca73..0a78f996 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/apps/AppsFragment.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/apps/AppsFragment.kt @@ -2,6 +2,7 @@ package org.eu.exodus_privacy.exodusprivacy.fragments.apps import android.content.Context import android.content.Intent +import android.content.res.Configuration import android.os.Bundle import android.util.Log import android.view.LayoutInflater @@ -12,8 +13,8 @@ import androidx.core.view.isVisible import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import androidx.navigation.fragment.findNavController -import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.StaggeredGridLayoutManager import com.google.android.material.transition.MaterialFadeThrough import dagger.hilt.android.AndroidEntryPoint import org.eu.exodus_privacy.exodusprivacy.ExodusUpdateService @@ -67,7 +68,13 @@ class AppsFragment : Fragment(R.layout.fragment_apps) { val appsRVAdapter = AppsRVAdapter(findNavController().currentDestination!!.id) binding.appListRV.apply { adapter = appsRVAdapter - layoutManager = LinearLayoutManager(view.context) + val column: Int = + if (resources.configuration.smallestScreenWidthDp >= 600 && resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { + 2 + } else { + 1 + } + layoutManager = StaggeredGridLayoutManager(column, 1) addOnScrollListener( object : RecyclerView.OnScrollListener() { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/apps/model/AppsRVAdapter.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/apps/model/AppsRVAdapter.kt index 8e343aca..d92cef47 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/apps/model/AppsRVAdapter.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/apps/model/AppsRVAdapter.kt @@ -1,6 +1,7 @@ package org.eu.exodus_privacy.exodusprivacy.fragments.apps.model import android.view.LayoutInflater +import android.view.View import android.view.ViewGroup import androidx.core.graphics.drawable.toDrawable import androidx.navigation.findNavController @@ -12,7 +13,6 @@ import org.eu.exodus_privacy.exodusprivacy.fragments.apps.AppsFragmentDirections import org.eu.exodus_privacy.exodusprivacy.fragments.trackerdetail.TrackerDetailFragmentDirections import org.eu.exodus_privacy.exodusprivacy.manager.database.app.ExodusApplication import org.eu.exodus_privacy.exodusprivacy.utils.setExodusColor -import org.eu.exodus_privacy.exodusprivacy.utils.setVersionReport class AppsRVAdapter( private val currentDestinationId: Int @@ -48,7 +48,18 @@ class AppsRVAdapter( } appIconIV.background = app.icon.toDrawable(context.resources) appNameTV.text = app.name - appVersionTV.text = context.getString(R.string.app_version, app.versionName) + when (app.exodusVersionCode) { + 0L -> appVersionTV.apply { + text = context.resources.getString(R.string.version_unavailable) + visibility = View.VISIBLE + } + + app.versionCode -> appVersionTV.visibility = View.GONE + else -> appVersionTV.apply { + text = context.resources.getString(R.string.version_mismatch) + visibility = View.VISIBLE + } + } trackersChip.apply { val trackerNum = app.exodusTrackers.size text = if (app.exodusVersionCode == 0L) "?" else trackerNum.toString() @@ -59,7 +70,6 @@ class AppsRVAdapter( text = permsNum.toString() setExodusColor(permsNum) } - versionChip.setVersionReport(app) } } } diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/trackerdetail/TrackerDetailFragment.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/trackerdetail/TrackerDetailFragment.kt index d2ee72c9..b3b4d3a0 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/trackerdetail/TrackerDetailFragment.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/trackerdetail/TrackerDetailFragment.kt @@ -1,5 +1,6 @@ package org.eu.exodus_privacy.exodusprivacy.fragments.trackerdetail +import android.content.res.Configuration import android.net.Uri import android.os.Bundle import android.text.method.LinkMovementMethod @@ -11,7 +12,7 @@ import androidx.fragment.app.viewModels import androidx.navigation.findNavController import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.navArgs -import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.StaggeredGridLayoutManager import com.google.android.material.chip.Chip import com.google.android.material.chip.ChipDrawable import com.google.android.material.transition.MaterialFadeThrough @@ -129,7 +130,13 @@ class TrackerDetailFragment : Fragment(R.layout.fragment_tracker_detail) { binding.appsListRV.apply { visibility = View.VISIBLE adapter = appsRVAdapter - layoutManager = object : LinearLayoutManager(view.context) { + val column: Int = + if (resources.configuration.smallestScreenWidthDp >= 600 && resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { + 2 + } else { + 1 + } + layoutManager = object : StaggeredGridLayoutManager(column, 1) { override fun canScrollVertically(): Boolean { return false } diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/trackers/TrackersFragment.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/trackers/TrackersFragment.kt index c15fd440..42b7bc06 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/trackers/TrackersFragment.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/trackers/TrackersFragment.kt @@ -1,6 +1,7 @@ package org.eu.exodus_privacy.exodusprivacy.fragments.trackers import android.content.Intent +import android.content.res.Configuration import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -8,7 +9,7 @@ import androidx.core.view.doOnPreDraw import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import androidx.navigation.fragment.findNavController -import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.GridLayoutManager import com.google.android.material.transition.MaterialFadeThrough import dagger.hilt.android.AndroidEntryPoint import org.eu.exodus_privacy.exodusprivacy.ExodusUpdateService @@ -38,7 +39,13 @@ class TrackersFragment : Fragment(R.layout.fragment_trackers) { TrackersRVAdapter(false, findNavController().currentDestination!!.id) binding.trackersListRV.apply { adapter = trackersRVAdapter - layoutManager = LinearLayoutManager(view.context) + val column: Int = + if (resources.configuration.smallestScreenWidthDp >= 600 && resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { + 2 + } else { + 1 + } + layoutManager = GridLayoutManager(context, column) } // Setup Shimmer Layout diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/VersionReport.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/VersionReport.kt deleted file mode 100644 index 2871afeb..00000000 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/VersionReport.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.eu.exodus_privacy.exodusprivacy.objects - -import androidx.annotation.DrawableRes -import androidx.annotation.StringRes -import org.eu.exodus_privacy.exodusprivacy.R - -enum class VersionReport( - @DrawableRes val iconIdRes: Int, - @StringRes val stringIdRes: Int -) { - MATCH(R.drawable.ic_match, R.string.version_equals), - UNAVAILABLE(R.drawable.ic_unavailable, R.string.version_unavailable), - MISMATCH(R.drawable.ic_mismatch, R.string.version_mismatch); -} diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/utils/CommonExtensions.kt b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/utils/CommonExtensions.kt index f94a5edb..2ff34712 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/utils/CommonExtensions.kt +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/utils/CommonExtensions.kt @@ -4,12 +4,9 @@ import android.content.pm.PackageInfo import android.content.pm.PackageManager import android.content.res.ColorStateList import android.os.Build -import android.widget.Toast import androidx.core.content.ContextCompat import com.google.android.material.chip.Chip import org.eu.exodus_privacy.exodusprivacy.R -import org.eu.exodus_privacy.exodusprivacy.manager.database.app.ExodusApplication -import org.eu.exodus_privacy.exodusprivacy.objects.VersionReport import java.util.Locale fun Chip.setExodusColor(size: Int) { @@ -50,24 +47,6 @@ fun Chip.setExodusColor(size: Int) { } } -fun Chip.setVersionReport(app: ExodusApplication) { - val versionReport = when (app.exodusVersionCode) { - 0L -> VersionReport.UNAVAILABLE - app.versionCode -> VersionReport.MATCH - else -> VersionReport.MISMATCH - } - chipIcon = ContextCompat.getDrawable(context, versionReport.iconIdRes) - setOnClickListener { - Toast.makeText( - context, - context.getString( - versionReport.stringIdRes - ), - Toast.LENGTH_LONG - ).show() - } -} - fun getLanguage(): String { return Locale.getDefault().language } diff --git a/app/src/main/res/drawable/ic_match.xml b/app/src/main/res/drawable/ic_match.xml deleted file mode 100644 index 21fa0b82..00000000 --- a/app/src/main/res/drawable/ic_match.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_mismatch.xml b/app/src/main/res/drawable/ic_mismatch.xml deleted file mode 100644 index 84b37a48..00000000 --- a/app/src/main/res/drawable/ic_mismatch.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_unavailable.xml b/app/src/main/res/drawable/ic_unavailable.xml deleted file mode 100644 index 3ee7f93f..00000000 --- a/app/src/main/res/drawable/ic_unavailable.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/layout/fragment_app_detail.xml b/app/src/main/res/layout/fragment_app_detail.xml index 30df9e3f..61224531 100644 --- a/app/src/main/res/layout/fragment_app_detail.xml +++ b/app/src/main/res/layout/fragment_app_detail.xml @@ -81,26 +81,13 @@ style="@style/Theme.Exodus.Chip" android:layout_width="wrap_content" android:layout_height="wrap_content" - app:layout_constraintStart_toEndOf="@+id/permsChip" - app:layout_constraintEnd_toStartOf="@+id/versionChip" - app:layout_constraintTop_toBottomOf="@id/appNameTV" - android:layout_marginTop="20dp" android:layout_marginStart="5dp" + android:layout_marginTop="20dp" app:chipIcon="@drawable/ic_android" - tools:text="Google" /> - - + tools:text="Google" /> + - + + + + - - - - - - - - - - - - - + app:chipIcon="@drawable/ic_tracker" + app:layout_constraintHorizontal_bias="1" + app:layout_constraintStart_toEndOf="@id/appIconIV" + app:layout_constraintTop_toBottomOf="@id/appVersionTV" + app:layout_constraintVertical_bias="1" + tools:text="0" /> + diff --git a/app/src/main/res/layout/shimmer_layout_app_item.xml b/app/src/main/res/layout/shimmer_layout_app_item.xml index f3933f7d..c3d19909 100644 --- a/app/src/main/res/layout/shimmer_layout_app_item.xml +++ b/app/src/main/res/layout/shimmer_layout_app_item.xml @@ -74,17 +74,4 @@ app:layout_constraintStart_toEndOf="@id/trackersChip" app:layout_constraintTop_toBottomOf="@id/appVersionTV" /> - - diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index d9f17a8d..777e1305 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -4,9 +4,8 @@ Autorisations Aucune connexion Internet Paramètres - Version installée = Version analysée - Version installée <> Version analysée - Application jamais analysée + La version analysée est différente de la version installée. + Cette application n\’a pas encore été analysée par Exodus Privacy. Vous semblez n\'avoir aucune application installée par la source que nous recherchons (Google Play ou F-Droid). Cette app n\'a pas de paramètres Logo de l\'application %1 diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 1e1049db..aaef4c5c 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -4,8 +4,7 @@ Uprawnienia Brak połączenia z internetem Ustawienia - Wersja zainstalowana = wersja analizowana - Zainstalowana wersja <> Wersja analizowana + Zainstalowana wersja <> Wersja analizowana Aplikacja nigdy nie analizowana Wygląda na to, że nie masz zainstalowanych żadnych aplikacji z testowanego przez nas źródła (sklep Google Play lub F-Droid). Ta aplikacja nie ma ustawień diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 6b6023ce..d051b88f 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -4,8 +4,7 @@ Разрешений Нет подключения к интернету Настройки - Установленная версия = Проанализированной версией - Установленная версия <> Проанализированной версией + Установленная версия <> Проанализированной версией Приложение никогда не анализировалось Похоже, у вас нет приложений, установленных из источника, который мы тестируем (магазин Google Play или F-Droid). Это приложение не имеет настроек diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index feb8b3a0..b475c56f 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -4,8 +4,7 @@ İzinler Ağ bağlantısı yok Ayarlar - Yüklü Sürüm = Analiz Edilen Sürüm - Yüklü Sürüm <> Analiz Edilen Sürüm + Yüklü Sürüm <> Analiz Edilen Sürüm Uygulama hiç analiz edilmemiş Test ettiğimiz kaynaktan (Google Play Mağazası veya F-Droid) yüklü herhangi bir uygulamanız yok gibi görünüyor. Bu uygulamanın ayarları yok diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 79096b4e..0ff67ec6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,9 +6,8 @@ Permissions No Internet Connection Settings - Installed Version = Analyzed Version - Installed Version <> Analyzed Version - App never analyzed + Analyzed version is different that installed version. + This app hasn\'t been analysed by Exodus Privacy yet. It appears that you don\'t have any apps installed from the source we test (Google Play store or F-Droid). This app doesn\'t have settings %1 Application Logo From b1d3525cc334ee9aa6d52541ba922364523eb62f Mon Sep 17 00:00:00 2001 From: Jean-BaptisteC Date: Tue, 28 Nov 2023 19:14:20 +0100 Subject: [PATCH 2/2] Add about layout for tablet --- .../layout-sw600dp-land/fragment_about.xml | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 app/src/main/res/layout-sw600dp-land/fragment_about.xml diff --git a/app/src/main/res/layout-sw600dp-land/fragment_about.xml b/app/src/main/res/layout-sw600dp-land/fragment_about.xml new file mode 100644 index 00000000..c7011214 --- /dev/null +++ b/app/src/main/res/layout-sw600dp-land/fragment_about.xml @@ -0,0 +1,66 @@ + + + + + + + + +