Skip to content

Commit

Permalink
fuck android IV
Browse files Browse the repository at this point in the history
  • Loading branch information
LagradOst committed May 29, 2021
1 parent 9953ab8 commit 15161fc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.lagradost.quicknovel"
minSdkVersion 23
targetSdkVersion 30
versionCode 16
versionName "1.4.6"
versionCode 17
versionName "1.4.7"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.google.android.material.button.MaterialButton
import com.lagradost.quicknovel.*
import com.lagradost.quicknovel.mvvm.observe
import kotlinx.android.synthetic.main.fragment_mainpage.*
import kotlinx.android.synthetic.main.fragment_search.*
import kotlin.concurrent.thread


Expand Down Expand Up @@ -84,6 +85,23 @@ class MainPageFragment : Fragment() {
var defOrderBy: Int? = null
var defTag: Int? = null

fun setupGridView() {
val compactView = MainActivity.getGridIsCompact()
val spanCountLandscape = if (compactView) 2 else 6
val spanCountPortrait = if (compactView) 1 else 3
val orientation = resources.configuration.orientation
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
mainpage_list.spanCount = spanCountLandscape
} else {
mainpage_list.spanCount = spanCountPortrait
}
}

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
setupGridView()
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
viewModel = ViewModelProviders.of(this).get(MainPageViewModel::class.java)
arguments?.getString("apiName")?.let {
Expand Down Expand Up @@ -167,15 +185,7 @@ class MainPageFragment : Fragment() {
minOf(0f, mainpage_toolbar.translationY - statush - dy)) + statush
// mainpage_list.setPadding() = mainpage_toolbar.translationY
}*/
val compactView = MainActivity.getGridIsCompact()
val spanCountLandscape = if (compactView) 2 else 6
val spanCountPortrait = if (compactView) 1 else 3
val orientation = resources.configuration.orientation
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
mainpage_list.spanCount = spanCountLandscape
} else {
mainpage_list.spanCount = spanCountPortrait
}
setupGridView()

val adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>? = context?.let {
MainAdapter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SearchFragment : Fragment() {
val searchDowloads = ArrayList<DownloadFragment.DownloadData>()
}

fun setupGridView() {
private fun setupGridView() {
val compactView = MainActivity.getGridIsCompact()
val spanCountLandscape = if (compactView) 2 else 6
val spanCountPortrait = if (compactView) 1 else 3
Expand Down

0 comments on commit 15161fc

Please sign in to comment.