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">
<intent-filter>
<action android:name="ytdlnis.settings.SettingsActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

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

@ -67,17 +67,7 @@ class ActiveDownloadsFragment() : Fragment(), ActiveDownloadAdapter.OnItemClickL
activeRecyclerView = view.findViewById(R.id.download_recyclerview)
activeRecyclerView.adapter = activeDownloads
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)
}
activeRecyclerView.layoutManager = GridLayoutManager(context, resources.getInteger(R.integer.grid_size))
downloadViewModel.activeDownloads.observe(viewLifecycleOwner) {
list = it

@ -84,17 +84,8 @@ class CancelledDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClic
cancelledRecyclerView.adapter = cancelledDownloads
val itemTouchHelper = ItemTouchHelper(simpleCallback)
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) {
items = it.toMutableList()

@ -86,17 +86,7 @@ class ErroredDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickL
erroredRecyclerView.adapter = erroredDownloads
val itemTouchHelper = ItemTouchHelper(simpleCallback)
itemTouchHelper.attachToRecyclerView(erroredRecyclerView)
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)
}
erroredRecyclerView.layoutManager = GridLayoutManager(context, resources.getInteger(R.integer.grid_size))
downloadViewModel.erroredDownloads.observe(viewLifecycleOwner) {
items = it.toMutableList()

@ -131,17 +131,7 @@ class HistoryFragment : Fragment(), HistoryAdapter.OnItemClickListener{
recyclerView?.adapter = historyAdapter
val itemTouchHelper = ItemTouchHelper(simpleCallback)
itemTouchHelper.attachToRecyclerView(recyclerView)
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)
}
recyclerView?.layoutManager = GridLayoutManager(context, resources.getInteger(R.integer.grid_size))
noResults?.visibility = GONE

@ -88,17 +88,7 @@ class QueuedDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickLi
queuedRecyclerView.adapter = queuedDownloads
val itemTouchHelper = ItemTouchHelper(simpleCallback)
itemTouchHelper.attachToRecyclerView(queuedRecyclerView)
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)
}
queuedRecyclerView.layoutManager = GridLayoutManager(context, resources.getInteger(R.integer.grid_size))
downloadViewModel.queuedDownloads.observe(viewLifecycleOwner) {
items = it.toMutableList()

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

@ -157,7 +157,8 @@
<LinearLayout
android:layout_width="match_parent"
android:weightSum="4"
android:layout_height="200dp">
android:layout_height="200dp"
android:baselineAligned="false">
<include
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>
<integer name="grid_size">1</integer>
<bool name="isTablet">false</bool>
<bool name="is_right_to_left">false</bool>
</resources>
Loading…
Cancel
Save