random fixes

Fixed tablet ui made it appear on 600dpi and up and other tablet touchups
Fixed trending videos showing up when u try to update quick download item
Fixed json being unclikckable on old models when trying to restore. Now all files are clickable. U will just get a snackbar showing that it couldn't parse the file if its not correct
pull/134/head
deniscerri 3 years ago
parent 598f3e2ebe
commit ced16b234d
No known key found for this signature in database
GPG Key ID: 95C43D517D830350

@ -109,7 +109,6 @@
android:parentActivityName=".MainActivity"> android:parentActivityName=".MainActivity">
<intent-filter> <intent-filter>
<action android:name="ytdlnis.settings.SettingsActivity" /> <action android:name="ytdlnis.settings.SettingsActivity" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>

@ -141,9 +141,7 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, OnClickListene
requireActivity() requireActivity()
) )
recyclerView = view.findViewById(R.id.recyclerViewHome) recyclerView = view.findViewById(R.id.recyclerViewHome)
if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE && ! resources.getBoolean(R.bool.isTablet)){ recyclerView?.layoutManager = GridLayoutManager(context, resources.getInteger(R.integer.grid_size))
recyclerView?.layoutManager = GridLayoutManager(context, 2)
}
recyclerView?.adapter = homeAdapter recyclerView?.adapter = homeAdapter
resultViewModel = ViewModelProvider(this)[ResultViewModel::class.java] resultViewModel = ViewModelProvider(this)[ResultViewModel::class.java]
@ -195,7 +193,6 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, OnClickListene
if (arguments?.getString("url") != null){ if (arguments?.getString("url") != null){
val url = requireArguments().getString("url") val url = requireArguments().getString("url")
arguments?.remove("url")
if (inputQueries == null) inputQueries = mutableListOf() if (inputQueries == null) inputQueries = mutableListOf()
searchBar?.text = url searchBar?.text = url
inputQueries!!.add(url!!) inputQueries!!.add(url!!)
@ -221,7 +218,11 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, OnClickListene
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
resultViewModel.checkTrending() if(arguments?.getString("url") == null){
resultViewModel.checkTrending()
}else{
arguments?.remove("url")
}
if (searchView?.currentTransitionState == SearchView.TransitionState.SHOWN){ if (searchView?.currentTransitionState == SearchView.TransitionState.SHOWN){
updateSearchViewItems(searchView?.editText?.text, linkYouCopied) updateSearchViewItems(searchView?.editText?.text, linkYouCopied)
} }

@ -67,17 +67,7 @@ class ActiveDownloadsFragment() : Fragment(), ActiveDownloadAdapter.OnItemClickL
activeRecyclerView = view.findViewById(R.id.download_recyclerview) activeRecyclerView = view.findViewById(R.id.download_recyclerview)
activeRecyclerView.adapter = activeDownloads activeRecyclerView.adapter = activeDownloads
activeRecyclerView.layoutManager = GridLayoutManager(context, resources.getInteger(R.integer.grid_size))
val landScape = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
val displayMetrics: DisplayMetrics = requireContext().resources.displayMetrics
val dpWidth: Float = displayMetrics.widthPixels / displayMetrics.density
if (dpWidth >= 1600 && landScape) {
activeRecyclerView.layoutManager = GridLayoutManager(context, 4)
}else if (dpWidth > 1200 && landScape){
activeRecyclerView.layoutManager = GridLayoutManager(context, 3)
}else if (landScape || dpWidth >= 650){
activeRecyclerView.layoutManager = GridLayoutManager(context, 2)
}
downloadViewModel.activeDownloads.observe(viewLifecycleOwner) { downloadViewModel.activeDownloads.observe(viewLifecycleOwner) {
list = it list = it

@ -84,17 +84,8 @@ class CancelledDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClic
cancelledRecyclerView.adapter = cancelledDownloads cancelledRecyclerView.adapter = cancelledDownloads
val itemTouchHelper = ItemTouchHelper(simpleCallback) val itemTouchHelper = ItemTouchHelper(simpleCallback)
itemTouchHelper.attachToRecyclerView(cancelledRecyclerView) itemTouchHelper.attachToRecyclerView(cancelledRecyclerView)
cancelledRecyclerView.layoutManager = GridLayoutManager(context, resources.getInteger(R.integer.grid_size))
val landScape = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
val displayMetrics: DisplayMetrics = requireContext().resources.displayMetrics
val dpWidth: Float = displayMetrics.widthPixels / displayMetrics.density
if (dpWidth >= 1600 && landScape) {
cancelledRecyclerView.layoutManager = GridLayoutManager(context, 4)
}else if (dpWidth > 1200 && landScape){
cancelledRecyclerView.layoutManager = GridLayoutManager(context, 3)
}else if (landScape || dpWidth >= 650){
cancelledRecyclerView.layoutManager = GridLayoutManager(context, 2)
}
downloadViewModel.cancelledDownloads.observe(viewLifecycleOwner) { downloadViewModel.cancelledDownloads.observe(viewLifecycleOwner) {
items = it.toMutableList() items = it.toMutableList()

@ -86,17 +86,7 @@ class ErroredDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickL
erroredRecyclerView.adapter = erroredDownloads erroredRecyclerView.adapter = erroredDownloads
val itemTouchHelper = ItemTouchHelper(simpleCallback) val itemTouchHelper = ItemTouchHelper(simpleCallback)
itemTouchHelper.attachToRecyclerView(erroredRecyclerView) itemTouchHelper.attachToRecyclerView(erroredRecyclerView)
erroredRecyclerView.layoutManager = GridLayoutManager(context, resources.getInteger(R.integer.grid_size))
val landScape = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
val displayMetrics: DisplayMetrics = requireContext().resources.displayMetrics
val dpWidth: Float = displayMetrics.widthPixels / displayMetrics.density
if (dpWidth >= 1600 && landScape) {
erroredRecyclerView.layoutManager = GridLayoutManager(context, 4)
}else if (dpWidth > 1200 && landScape){
erroredRecyclerView.layoutManager = GridLayoutManager(context, 3)
}else if (landScape || dpWidth >= 650){
erroredRecyclerView.layoutManager = GridLayoutManager(context, 2)
}
downloadViewModel.erroredDownloads.observe(viewLifecycleOwner) { downloadViewModel.erroredDownloads.observe(viewLifecycleOwner) {
items = it.toMutableList() items = it.toMutableList()

@ -131,17 +131,7 @@ class HistoryFragment : Fragment(), HistoryAdapter.OnItemClickListener{
recyclerView?.adapter = historyAdapter recyclerView?.adapter = historyAdapter
val itemTouchHelper = ItemTouchHelper(simpleCallback) val itemTouchHelper = ItemTouchHelper(simpleCallback)
itemTouchHelper.attachToRecyclerView(recyclerView) itemTouchHelper.attachToRecyclerView(recyclerView)
recyclerView?.layoutManager = GridLayoutManager(context, resources.getInteger(R.integer.grid_size))
val landScape = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
val displayMetrics: DisplayMetrics = requireContext().resources.displayMetrics
val dpWidth: Float = displayMetrics.widthPixels / displayMetrics.density
if (dpWidth >= 1600 && landScape) {
recyclerView?.layoutManager = GridLayoutManager(context, 4)
}else if (dpWidth > 1200 && landScape){
recyclerView?.layoutManager = GridLayoutManager(context, 3)
}else if (landScape || dpWidth >= 650){
recyclerView?.layoutManager = GridLayoutManager(context, 2)
}
noResults?.visibility = GONE noResults?.visibility = GONE

@ -88,17 +88,7 @@ class QueuedDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickLi
queuedRecyclerView.adapter = queuedDownloads queuedRecyclerView.adapter = queuedDownloads
val itemTouchHelper = ItemTouchHelper(simpleCallback) val itemTouchHelper = ItemTouchHelper(simpleCallback)
itemTouchHelper.attachToRecyclerView(queuedRecyclerView) itemTouchHelper.attachToRecyclerView(queuedRecyclerView)
queuedRecyclerView.layoutManager = GridLayoutManager(context, resources.getInteger(R.integer.grid_size))
val landScape = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
val displayMetrics: DisplayMetrics = requireContext().resources.displayMetrics
val dpWidth: Float = displayMetrics.widthPixels / displayMetrics.density
if (dpWidth >= 1600 && landScape) {
queuedRecyclerView.layoutManager = GridLayoutManager(context, 4)
}else if (dpWidth > 1200 && landScape){
queuedRecyclerView.layoutManager = GridLayoutManager(context, 3)
}else if (landScape || dpWidth >= 650){
queuedRecyclerView.layoutManager = GridLayoutManager(context, 2)
}
downloadViewModel.queuedDownloads.observe(viewLifecycleOwner) { downloadViewModel.queuedDownloads.observe(viewLifecycleOwner) {
items = it.toMutableList() items = it.toMutableList()

@ -186,7 +186,7 @@ class MainSettingsFragment : PreferenceFragmentCompat() {
Preference.OnPreferenceClickListener { Preference.OnPreferenceClickListener {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply { val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE) addCategory(Intent.CATEGORY_OPENABLE)
type = "application/json" type = "*/*"
} }
appRestoreResultLauncher.launch(intent) appRestoreResultLauncher.launch(intent)
true true

@ -157,7 +157,8 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:weightSum="4" android:weightSum="4"
android:layout_height="200dp"> android:layout_height="200dp"
android:baselineAligned="false">
<include <include
android:layout_weight="1" android:layout_weight="1"

@ -0,0 +1,4 @@
<resources>
<integer name="grid_size">2</integer>
<bool name="isTablet">true</bool>
</resources>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="grid_size">3</integer>
</resources>

@ -1,3 +0,0 @@
<resources>
<bool name="isTablet">true</bool>
</resources>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="grid_size">4</integer>
</resources>

@ -1,4 +1,5 @@
<resources> <resources>
<integer name="grid_size">1</integer>
<bool name="isTablet">false</bool> <bool name="isTablet">false</bool>
<bool name="is_right_to_left">false</bool> <bool name="is_right_to_left">false</bool>
</resources> </resources>
Loading…
Cancel
Save