ruined UI (#138)
* removed auto navbar hide * ruined rebel's fabulous UI
This commit is contained in:
parent
8142c966c0
commit
6b2ffdaf4f
6 changed files with 52 additions and 46 deletions
|
@ -4,7 +4,6 @@ import android.animation.ObjectAnimator
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.DatePickerDialog
|
import android.app.DatePickerDialog
|
||||||
import android.app.Notification
|
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
|
@ -160,22 +159,11 @@ fun initActivity(a: Activity) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a.hideStatusBar()
|
a.hideStatusBar()
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R &&
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && statusBarHeight == 0 && a.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
statusBarHeight == 0 &&
|
window.decorView.rootWindowInsets?.displayCutout?.apply {
|
||||||
a.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
|
if (boundingRects.size > 0) {
|
||||||
) {
|
statusBarHeight = min(boundingRects[0].width(), boundingRects[0].height())
|
||||||
window.setDecorFitsSystemWindows(false)
|
}
|
||||||
|
|
||||||
window.decorView.setOnApplyWindowInsetsListener { _, insets ->
|
|
||||||
statusBarHeight = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top
|
|
||||||
navBarHeight = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom
|
|
||||||
insets
|
|
||||||
}
|
|
||||||
|
|
||||||
window.insetsController?.let { controller ->
|
|
||||||
controller.systemBarsBehavior =
|
|
||||||
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
|
||||||
controller.hide(WindowInsetsCompat.Type.navigationBars())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -14,7 +14,6 @@ import android.provider.Settings
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.WindowManager
|
|
||||||
import android.view.animation.AnticipateInterpolator
|
import android.view.animation.AnticipateInterpolator
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.activity.addCallback
|
import androidx.activity.addCallback
|
||||||
|
@ -24,9 +23,7 @@ import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.animation.doOnEnd
|
import androidx.core.animation.doOnEnd
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.view.doOnAttach
|
import androidx.core.view.doOnAttach
|
||||||
import androidx.core.view.marginTop
|
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.core.view.updatePadding
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
|
@ -203,10 +200,9 @@ class MainActivity : AppCompatActivity() {
|
||||||
} else {
|
} else {
|
||||||
uiSettings.defaultStartUpTab
|
uiSettings.defaultStartUpTab
|
||||||
}
|
}
|
||||||
if (!uiSettings.immersiveMode) {
|
binding.includedNavbar.navbarContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
binding.includedNavbar.navbarContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
bottomMargin = navBarHeight
|
||||||
bottomMargin = navBarHeight
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val offline = getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
val offline = getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
|
|
|
@ -11,6 +11,7 @@ import ani.dantotsu.connections.anilist.api.FuzzyDate
|
||||||
import ani.dantotsu.connections.anilist.api.Page
|
import ani.dantotsu.connections.anilist.api.Page
|
||||||
import ani.dantotsu.connections.anilist.api.Query
|
import ani.dantotsu.connections.anilist.api.Query
|
||||||
import ani.dantotsu.currContext
|
import ani.dantotsu.currContext
|
||||||
|
import ani.dantotsu.isOnline
|
||||||
import ani.dantotsu.loadData
|
import ani.dantotsu.loadData
|
||||||
import ani.dantotsu.logError
|
import ani.dantotsu.logError
|
||||||
import ani.dantotsu.media.Author
|
import ani.dantotsu.media.Author
|
||||||
|
@ -240,7 +241,9 @@ class AnilistQueries {
|
||||||
else snackString(currContext()?.getString(R.string.what_did_you_open))
|
else snackString(currContext()?.getString(R.string.what_did_you_open))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
snackString(currContext()?.getString(R.string.error_getting_data))
|
if (currContext()?.let { isOnline(it) } == true) {
|
||||||
|
snackString(currContext()?.getString(R.string.error_getting_data))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val mal = async {
|
val mal = async {
|
||||||
|
|
|
@ -78,10 +78,9 @@ class NoInternet : AppCompatActivity() {
|
||||||
initActivity(this)
|
initActivity(this)
|
||||||
uiSettings = loadData("ui_settings") ?: uiSettings
|
uiSettings = loadData("ui_settings") ?: uiSettings
|
||||||
selectedOption = uiSettings.defaultStartUpTab
|
selectedOption = uiSettings.defaultStartUpTab
|
||||||
if (!uiSettings.immersiveMode) {
|
|
||||||
binding.includedNavbar.navbarContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
binding.includedNavbar.navbarContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
bottomMargin = navBarHeight
|
bottomMargin = navBarHeight
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val navbar = binding.includedNavbar.navbar
|
val navbar = binding.includedNavbar.navbar
|
||||||
|
|
|
@ -9,6 +9,24 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/tabLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
app:tabContentStart="32dp"
|
||||||
|
app:tabPaddingEnd="16dp"
|
||||||
|
app:tabPaddingStart="16dp"
|
||||||
|
app:tabTextAppearance="@style/NavBarText"
|
||||||
|
app:tabGravity="fill">
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Anime Queue(WIP)"/>
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Manga Queue(WIP)"/>
|
||||||
|
</com.google.android.material.tabs.TabLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
@ -47,8 +47,8 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/itemEpisodeImage"
|
android:id="@+id/itemEpisodeImage"
|
||||||
android:layout_width="140dp"
|
android:layout_width="164dp"
|
||||||
android:layout_height="85dp"
|
android:layout_height="109dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
@ -74,10 +74,9 @@
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
tools:text="12" />
|
tools:text="12" />
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/itemEpisodeProgressCont"
|
android:id="@+id/itemEpisodeProgressCont"
|
||||||
android:layout_width="140dp"
|
android:layout_width="164dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
|
@ -98,6 +97,17 @@
|
||||||
android:background="#80FFFFFF" />
|
android:background="#80FFFFFF" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/itemEpisodeViewed"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
app:srcCompat="@drawable/ic_round_remove_red_eye_24"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -106,7 +116,7 @@
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:minHeight="69dp"
|
android:minHeight="92dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -137,10 +147,11 @@
|
||||||
android:id="@+id/itemDownload"
|
android:id="@+id/itemDownload"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="5dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
app:tint="?attr/colorOnBackground"
|
app:tint="?attr/colorOnBackground"
|
||||||
app:srcCompat="@drawable/ic_round_download_24" />
|
app:srcCompat="@drawable/ic_round_download_24"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -178,14 +189,5 @@
|
||||||
android:background="?android:colorBackground"
|
android:background="?android:colorBackground"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/itemEpisodeViewed"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="end"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:srcCompat="@drawable/ic_round_remove_red_eye_24"
|
|
||||||
tools:ignore="ContentDescription" />
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
Loading…
Add table
Add a link
Reference in a new issue