Removed redundant material components

This commit is contained in:
Arty Bishop committed 2021-11-09 14:56:05 +01:00
1 parent 04029d50db
commit 1d0716d47f
19 files changed
+74 -72

No files matched your search

+3 -1
View File
@@ -53,11 +53,13 @@ android {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
packagingOptions {
resources.excludes += "DebugProbesKt.bin"
}
}
dependencies {
implementation project(':core')
implementation "com.google.android.material:material:$material_version"
implementation "androidx.core:core-splashscreen:$splash_screen_version"
implementation "androidx.constraintlayout:constraintlayout:$constraint_layout_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
+2 -1
View File
@@ -10,7 +10,8 @@
android:name=".presentation.Look4SatApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
android:label="@string/app_name"
android:theme="@style/Theme.Look4Sat.Main">
<activity
android:name=".presentation.Look4SatActivity"
android:exported="true"
@@ -36,12 +36,6 @@ import java.util.*
import java.util.concurrent.TimeUnit
import java.util.regex.Pattern
fun View.showSnack(message: String, isAnchored: Boolean = true) {
Snackbar.make(this, message, Snackbar.LENGTH_SHORT).apply {
if (isAnchored) setAnchorView(R.id.main_nav_bottom)
}.show()
}
fun NavController.navigateSafe(
@IdRes resId: Int,
args: Bundle? = null,
@@ -19,13 +19,15 @@ package com.rtbishop.look4sat.presentation.entriesScreen
import android.os.Bundle
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.SimpleItemAnimator
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar
import com.rtbishop.look4sat.R
import com.rtbishop.look4sat.databinding.FragmentEntriesBinding
import com.rtbishop.look4sat.domain.model.SatItem
@@ -33,7 +35,6 @@ import com.rtbishop.look4sat.domain.model.DataState
import com.rtbishop.look4sat.presentation.ItemDivider
import com.rtbishop.look4sat.presentation.getNavResult
import com.rtbishop.look4sat.presentation.navigateSafe
import com.rtbishop.look4sat.presentation.showSnack
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
@@ -67,6 +68,7 @@ class EntriesFragment : Fragment(R.layout.fragment_entries) {
entriesSelectMode.setOnClickListener { showModesDialog() }
entriesSelectAll.setOnClickListener { viewModel.selectCurrentItems() }
entriesSearchBar.setOnQueryTextListener(viewModel)
entriesSearchBar.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
}
viewModel.satData.observe(viewLifecycleOwner, { satData ->
handleSatData(satData, binding, entriesAdapter)
@@ -94,7 +96,8 @@ class EntriesFragment : Fragment(R.layout.fragment_entries) {
is DataState.Error -> {
binding.entriesProgress.visibility = View.INVISIBLE
binding.entriesRecycler.visibility = View.VISIBLE
requireView().showSnack(getString(R.string.entries_update_error))
val message = getString(R.string.entries_update_error)
Snackbar.make(requireView(), message, Snackbar.LENGTH_SHORT).show()
}
else -> {
}
@@ -112,7 +115,7 @@ class EntriesFragment : Fragment(R.layout.fragment_entries) {
val savedModes = BooleanArray(modes.size)
val selectedModes = viewModel.loadSelectedModes().toMutableList()
selectedModes.forEach { savedModes[modes.indexOf(it)] = true }
val dialogBuilder = MaterialAlertDialogBuilder(requireContext()).apply {
AlertDialog.Builder(requireContext()).apply {
setTitle(context.getString(R.string.modes_title))
setMultiChoiceItems(modes, savedModes) { _, which, isChecked ->
when {
@@ -126,7 +129,7 @@ class EntriesFragment : Fragment(R.layout.fragment_entries) {
setNeutralButton(context.getString(android.R.string.cancel)) { dialog, _ ->
dialog.dismiss()
}
create().show()
}
dialogBuilder.create().show()
}
}
@@ -119,8 +119,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
}
private fun showSnack(message: String) {
Snackbar.make(requireView(), message, Snackbar.LENGTH_SHORT).apply {
setAnchorView(R.id.main_nav_bottom)
}.show()
Snackbar.make(requireView(), message, Snackbar.LENGTH_SHORT).show()
}
}
@@ -60,8 +60,8 @@ class SourcesAdapter(private val sources: MutableList<Source> = mutableListOf())
fun bind(source: Source) {
binding.sourceUrl.setText(source.sourceUrl)
binding.sourceUrl.doOnTextChanged { text, _, _, _ -> source.sourceUrl = text.toString() }
binding.sourceInput.setEndIconOnClickListener {
binding.sourceUrl.doOnTextChanged { txt, _, _, _ -> source.sourceUrl = txt.toString() }
binding.sourceBtn.setOnClickListener {
sources.remove(source)
notifyItemRemoved(adapterPosition)
}
+1 -2
View File
@@ -21,8 +21,7 @@
android:id="@+id/main_nav_bottom"
android:layout_width="match_parent"
android:layout_height="48dp"
app:elevation="1dp"
app:itemRippleColor="@android:color/transparent"
app:itemBackground="@color/greySurface"
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
+7 -4
View File
@@ -11,11 +11,12 @@
android:id="@+id/sources_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="6dp"
android:text="@string/sources_title"
android:textSize="16sp"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="@+id/sources_recycler"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
@@ -26,7 +27,7 @@
android:gravity="center"
android:text="@string/sources_https"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="@+id/sources_recycler"
app:layout_constraintStart_toStartOf="@+id/sources_title"
app:layout_constraintTop_toBottomOf="@+id/sources_title" />
<ImageButton
@@ -58,26 +59,28 @@
android:id="@+id/sources_btn_neg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:backgroundTint="@color/greySurface"
android:text="@string/btn_cancel"
android:textAllCaps="false"
android:textColor="@color/themeLight"
app:layout_constraintBaseline_toBaselineOf="@+id/sources_btn_pos"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="@+id/sources_recycler" />
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/sources_btn_pos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="4dp"
android:backgroundTint="@color/greySurface"
android:text="@string/btn_update"
android:textAllCaps="false"
android:textColor="@color/themeLight"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/sources_recycler"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sources_recycler" />
</androidx.constraintlayout.widget.ConstraintLayout>
+1 -1
View File
@@ -17,7 +17,7 @@
android:id="@+id/entries_import_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginStart="12dp"
android:elevation="4dp"
android:text="@string/entries_update"
android:textSize="18sp"
+9 -3
View File
@@ -63,9 +63,11 @@
<Button
android:id="@+id/info_btn_github"
style="@style/InfoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:drawableStart="@drawable/ic_github"
android:text="@string/info_github"
app:icon="@drawable/ic_github"
app:layout_constraintEnd_toStartOf="@+id/info_btn_fdroid"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/info_subtitle" />
@@ -73,8 +75,10 @@
<Button
android:id="@+id/info_btn_fdroid"
style="@style/InfoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_fdroid"
android:text="@string/info_fdroid"
app:icon="@drawable/ic_fdroid"
app:layout_constraintBaseline_toBaselineOf="@+id/info_btn_github"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/info_btn_github" />
@@ -82,9 +86,11 @@
<Button
android:id="@+id/info_btn_donate"
style="@style/InfoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:drawableStart="@drawable/ic_bmc"
android:text="@string/info_bmc"
app:icon="@drawable/ic_bmc"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/info_btn_github" />
+2 -1
View File
@@ -7,7 +7,7 @@
android:layout_height="match_parent"
android:keepScreenOn="true">
<com.google.android.material.card.MaterialCardView
<androidx.cardview.widget.CardView
android:id="@+id/radar_bar"
style="@style/TopBar"
app:layout_constraintEnd_toEndOf="parent"
@@ -110,6 +110,7 @@
android:id="@+id/radar_recycler"
android:layout_width="0dp"
android:layout_height="0dp"
android:overScrollMode="never"
android:padding="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
+8 -9
View File
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/entry_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/greyDark"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
@@ -16,8 +17,8 @@
android:id="@+id/entry_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="8dp"
android:ellipsize="end"
android:maxLines="1"
@@ -25,25 +26,23 @@
android:textColor="@color/greyLight"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/entry_checkbox"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toEndOf="@+id/entry_checkbox"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/entry_checkbox"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="4dp"
android:clickable="false"
android:minWidth="0dp"
android:minHeight="0dp"
app:layout_constraintBottom_toBottomOf="@+id/entry_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/entry_name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/entry_name" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.cardview.widget.CardView>
+2 -2
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/pass_geo_card"
android:layout_width="match_parent"
@@ -81,4 +81,4 @@
app:layout_constraintStart_toEndOf="@+id/pass_geo_az" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.cardview.widget.CardView>
+2 -2
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/pass_leo_card"
android:layout_width="match_parent"
@@ -116,4 +116,4 @@
app:layout_constraintTop_toBottomOf="@+id/pass_leo_elev" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.cardview.widget.CardView>
+13 -6
View File
@@ -1,7 +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"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/source_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -14,10 +13,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/sources_hint"
app:endIconDrawable="@drawable/ic_map_sat"
app:endIconMode="custom"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/source_btn"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
@@ -26,8 +23,18 @@
android:id="@+id/source_url"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textUri"
tools:ignore="TextContrastCheck" />
android:inputType="textUri" />
</com.google.android.material.textfield.TextInputLayout>
<ImageButton
android:id="@+id/source_btn"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:backgroundTint="@color/greyDark"
android:contentDescription="@string/placeholder"
android:src="@drawable/ic_map_sat"
app:layout_constraintBottom_toBottomOf="@+id/source_input"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/source_input" />
</androidx.constraintlayout.widget.ConstraintLayout>
+3 -2
View File
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/trans_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/greySurface"
app:cardCornerRadius="0dp">
<androidx.constraintlayout.widget.ConstraintLayout
@@ -107,4 +108,4 @@
app:layout_constraintStart_toEndOf="@+id/trans_mode" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.cardview.widget.CardView>
+1 -1
View File
@@ -10,7 +10,7 @@
<string name="menu_entries">Satellites</string>
<string name="menu_passes">Passes</string>
<string name="menu_map">World Map</string>
<string name="menu_map">Map</string>
<string name="menu_prefs">Settings</string>
<string name="menu_about">Info</string>
+9 -20
View File
@@ -1,36 +1,26 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<style name="Theme.Look4Sat.SplashScreen" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/greyDark</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_splash_drawable</item>
<item name="postSplashScreenTheme">@style/Theme.Look4Sat.Main</item>
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
</style>
<style name="Theme.Look4Sat.Main" parent="Theme.MaterialComponents.NoActionBar">
<style name="Theme.Look4Sat.Main" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/themeLight</item>
<item name="colorSecondary">@color/themeLight</item>
<item name="colorPrimaryVariant">@color/themeDark</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="colorAccent">@color/themeLight</item>
<item name="snackbarStyle">@style/Snackbar</item>
<item name="snackbarTextViewStyle">@style/Snackbar.Text</item>
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
</style>
<style name="Snackbar" parent="@style/Widget.MaterialComponents.Snackbar">
<item name="backgroundTint">@color/greySurface</item>
</style>
<style name="Snackbar.Text" parent="@style/Widget.MaterialComponents.Snackbar.TextView">
<item name="android:textColor">@color/themeLight</item>
<item name="android:gravity">center</item>
<item name="android:textAlignment">center</item>
<item name="android:textColorPrimary">@color/greyLight</item>
<item name="android:statusBarColor">@color/greyDark</item>
<item name="android:windowBackground">@color/greyDark</item>
<item name="android:navigationBarColor">@color/greyDark</item>
</style>
<style name="TopBar">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">48dp</item>
<item name="cardBackgroundColor">@color/greySurface</item>
<item name="cardCornerRadius">0dp</item>
</style>
@@ -38,8 +28,7 @@
<item name="android:backgroundTint">@color/greySurface</item>
<item name="android:textColor">@color/themeLight</item>
<item name="android:textSize">16sp</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:drawablePadding">4dp</item>
<item name="iconTint">@color/themeLight</item>
<item name="textAllCaps">false</item>
</style>
-1
View File
@@ -3,7 +3,6 @@ buildscript {
gradle_version = '7.0.3'
kotlin_version = '1.5.31'
coroutines_version = '1.5.2-native-mt'
material_version = '1.4.0'
splash_screen_version = '1.0.0-alpha01'
constraint_layout_version = '2.1.1'
lifecycle_version = '2.4.0'