crumbs
This commit is contained in:
parent
b4184fbf5e
commit
0137e8bedb
11 changed files with 372 additions and 18 deletions
|
|
@ -59,7 +59,7 @@ android {
|
|||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
debuggable false
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
|
|
@ -135,7 +135,6 @@ dependencies {
|
|||
implementation 'androidx.preference:preference:1.2.0'
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:$navVer"
|
||||
implementation "androidx.navigation:navigation-ui-ktx:$navVer"
|
||||
implementation "androidx.navigation:navigation-dynamic-features-fragment:$navVer"
|
||||
implementation 'androidx.core:core-ktx:1.9.0'
|
||||
implementation 'androidx.test.ext:junit-ktx:1.1.5'
|
||||
implementation 'androidx.benchmark:benchmark-macro:1.1.1'
|
||||
|
|
@ -143,7 +142,7 @@ dependencies {
|
|||
androidTestImplementation "junit:junit:$junitVer"
|
||||
androidTestImplementation "androidx.test.ext:junit:$androidJunitVer"
|
||||
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVer"
|
||||
androidTestImplementation "androidx.benchmark:benchmark-macro-junit4:1.2.0-alpha12"
|
||||
androidTestImplementation "androidx.benchmark:benchmark-macro-junit4:1.2.0-alpha13"
|
||||
androidTestImplementation "androidx.test:runner:1.5.2"
|
||||
androidTestImplementation "androidx.test:core:1.5.0"
|
||||
androidTestImplementation "androidx.test:rules:1.5.0"
|
||||
|
|
|
|||
4
app/proguard-rules.pro
vendored
4
app/proguard-rules.pro
vendored
|
|
@ -61,6 +61,4 @@
|
|||
public <init>(android.content.Context,androidx.work.WorkerParameters);
|
||||
}
|
||||
|
||||
-dontshrink
|
||||
-dontobfuscate
|
||||
-dontoptimize
|
||||
-dontobfuscate
|
||||
|
|
@ -172,11 +172,19 @@ class MainActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
fun disableBottomNavigation(){
|
||||
(navigationView as NavigationView).menu.forEach { it.isEnabled = false }
|
||||
if (navigationView is NavigationBarView){
|
||||
(navigationView as NavigationBarView).menu.forEach { it.isEnabled = false }
|
||||
}else{
|
||||
(navigationView as NavigationView).menu.forEach { it.isEnabled = false }
|
||||
}
|
||||
}
|
||||
|
||||
fun enableBottomNavigation(){
|
||||
(navigationView as NavigationView).menu.forEach { it.isEnabled = true }
|
||||
if (navigationView is NavigationBarView){
|
||||
(navigationView as NavigationBarView).menu.forEach { it.isEnabled = true }
|
||||
}else{
|
||||
(navigationView as NavigationView).menu.forEach { it.isEnabled = true }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
|
|
|||
|
|
@ -262,6 +262,10 @@ class DownloadViewModel(private val application: Application) : AndroidViewModel
|
|||
return list
|
||||
}
|
||||
|
||||
fun insert(item: DownloadItem) = viewModelScope.launch(Dispatchers.IO){
|
||||
repository.insert(item)
|
||||
}
|
||||
|
||||
fun deleteCancelled() = viewModelScope.launch(Dispatchers.IO) {
|
||||
repository.deleteCancelled()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import android.graphics.drawable.RippleDrawable
|
|||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.DisplayMetrics
|
||||
import android.util.Log
|
||||
import android.view.*
|
||||
import android.view.View.*
|
||||
|
|
|
|||
|
|
@ -194,7 +194,9 @@ class CancelledDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClic
|
|||
openFile.visibility = View.GONE
|
||||
|
||||
bottomSheet.show()
|
||||
bottomSheet.behavior.peekHeight = 512
|
||||
val displayMetrics = DisplayMetrics()
|
||||
requireActivity().windowManager.defaultDisplay.getMetrics(displayMetrics)
|
||||
bottomSheet.behavior.peekHeight = displayMetrics.heightPixels
|
||||
bottomSheet.window!!.setLayout(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
|
|
@ -225,12 +227,10 @@ class CancelledDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClic
|
|||
when (direction) {
|
||||
ItemTouchHelper.LEFT -> {
|
||||
val deletedItem = items[position]
|
||||
items.remove(deletedItem)
|
||||
cancelledDownloads.submitList(items.toList())
|
||||
downloadViewModel.deleteDownload(deletedItem)
|
||||
Snackbar.make(cancelledRecyclerView, getString(R.string.you_are_going_to_delete) + ": " + deletedItem.title, Snackbar.LENGTH_LONG)
|
||||
.setAction(getString(R.string.undo)) {
|
||||
items.add(position, deletedItem)
|
||||
cancelledDownloads.submitList(items.toList())
|
||||
downloadViewModel.insert(deletedItem)
|
||||
}.show()
|
||||
}
|
||||
ItemTouchHelper.RIGHT -> {
|
||||
|
|
|
|||
|
|
@ -194,7 +194,9 @@ class ErroredDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickL
|
|||
openFile.visibility = View.GONE
|
||||
|
||||
bottomSheet.show()
|
||||
bottomSheet.behavior.peekHeight = 512
|
||||
val displayMetrics = DisplayMetrics()
|
||||
requireActivity().windowManager.defaultDisplay.getMetrics(displayMetrics)
|
||||
bottomSheet.behavior.peekHeight = displayMetrics.heightPixels
|
||||
bottomSheet.window!!.setLayout(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
|
|
@ -228,12 +230,10 @@ class ErroredDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickL
|
|||
when (direction) {
|
||||
ItemTouchHelper.LEFT -> {
|
||||
val deletedItem = items[position]
|
||||
items.remove(deletedItem)
|
||||
erroredDownloads.submitList(items.toList())
|
||||
downloadViewModel.deleteDownload(deletedItem)
|
||||
Snackbar.make(erroredRecyclerView, getString(R.string.you_are_going_to_delete) + ": " + deletedItem.title, Snackbar.LENGTH_LONG)
|
||||
.setAction(getString(R.string.undo)) {
|
||||
items.add(position, deletedItem)
|
||||
erroredDownloads.submitList(items.toList())
|
||||
downloadViewModel.insert(deletedItem)
|
||||
}.show()
|
||||
}
|
||||
|
||||
|
|
|
|||
321
app/src/main/res/layout-sw1600dp-land/fragment_home.xml
Normal file
321
app/src/main/res/layout-sw1600dp-land/fragment_home.xml
Normal file
|
|
@ -0,0 +1,321 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/homecoordinator"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<com.google.android.material.search.SearchView
|
||||
android:id="@+id/search_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="@string/search_hint"
|
||||
app:layout_anchor="@id/search_bar">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/search_history_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/queries_constraint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/queries"
|
||||
android:layout_margin="10dp"
|
||||
app:chipSpacingVertical="-10dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintEnd_toStartOf="@+id/init_search_query"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:singleLine="false" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/init_search_query"
|
||||
style="?attr/materialIconButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
app:iconSize="20dp"
|
||||
app:cornerRadius="10dp"
|
||||
app:icon="@drawable/ic_search"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<include
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-10dp"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/link_you_copied"
|
||||
layout="@layout/search_suggestion_item"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/search_history_linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/search_suggestions_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:id="@+id/search_suggestions_linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.search.SearchView>
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/home_appbarlayout"
|
||||
app:liftOnScroll="true"
|
||||
android:background="@null"
|
||||
android:elevation="0dp"
|
||||
app:elevation="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.search.SearchBar
|
||||
android:id="@+id/search_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_gravity="end"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
android:hint="@string/search_hint"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/home_toolbar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:menu="@menu/main_menu" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/recyclerViewHome"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="100dp"
|
||||
app:spanCount="4"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
/>
|
||||
|
||||
|
||||
<com.facebook.shimmer.ShimmerFrameLayout
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/shimmer_results_framelayout"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/shimmer_linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:weightSum="4"
|
||||
android:layout_height="200dp">
|
||||
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:weightSum="4"
|
||||
android:layout_height="200dp">
|
||||
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:weightSum="4"
|
||||
android:layout_height="200dp">
|
||||
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:weightSum="4"
|
||||
android:layout_height="200dp">
|
||||
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</com.facebook.shimmer.ShimmerFrameLayout>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/home_fabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/download_all_coordinator"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/download_all_fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:text="@string/download_all"
|
||||
app:icon="@drawable/ic_down"/>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/download_selected_coordinator"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/download_selected_fab"
|
||||
app:elevation="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
app:icon="@drawable/ic_down"
|
||||
android:text="@string/download"
|
||||
app:srcCompat="@drawable/ic_music"/>
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
@ -225,6 +225,29 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:weightSum="3"
|
||||
android:layout_height="200dp">
|
||||
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
<include
|
||||
android:layout_weight="1"
|
||||
layout="@layout/result_card_shimmer"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue