Skip to content

Commit

Permalink
ruined UI (#138)
Browse files Browse the repository at this point in the history
* removed auto navbar hide

* ruined rebel's fabulous UI
  • Loading branch information
aayush2622 authored Jan 18, 2024
1 parent 8142c96 commit 6b2ffda
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 46 deletions.
22 changes: 5 additions & 17 deletions app/src/main/java/ani/dantotsu/Functions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.app.Activity
import android.app.DatePickerDialog
import android.app.Notification
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.ClipData
Expand Down Expand Up @@ -160,22 +159,11 @@ fun initActivity(a: Activity) {
}
}
a.hideStatusBar()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R &&
statusBarHeight == 0 &&
a.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
) {
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())
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && statusBarHeight == 0 && a.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
window.decorView.rootWindowInsets?.displayCutout?.apply {
if (boundingRects.size > 0) {
statusBarHeight = min(boundingRects[0].width(), boundingRects[0].height())
}
}
}
} else
Expand Down
10 changes: 3 additions & 7 deletions app/src/main/java/ani/dantotsu/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import android.provider.Settings
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.view.animation.AnticipateInterpolator
import android.widget.TextView
import androidx.activity.addCallback
Expand All @@ -24,9 +23,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.animation.doOnEnd
import androidx.core.content.ContextCompat
import androidx.core.view.doOnAttach
import androidx.core.view.marginTop
import androidx.core.view.updateLayoutParams
import androidx.core.view.updatePadding
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
Expand Down Expand Up @@ -203,10 +200,9 @@ class MainActivity : AppCompatActivity() {
} else {
uiSettings.defaultStartUpTab
}
if (!uiSettings.immersiveMode) {
binding.includedNavbar.navbarContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = navBarHeight
}
binding.includedNavbar.navbarContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = navBarHeight

}
}
val offline = getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ani.dantotsu.connections.anilist.api.FuzzyDate
import ani.dantotsu.connections.anilist.api.Page
import ani.dantotsu.connections.anilist.api.Query
import ani.dantotsu.currContext
import ani.dantotsu.isOnline
import ani.dantotsu.loadData
import ani.dantotsu.logError
import ani.dantotsu.media.Author
Expand Down Expand Up @@ -240,7 +241,9 @@ class AnilistQueries {
else snackString(currContext()?.getString(R.string.what_did_you_open))
}
} 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 {
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/java/ani/dantotsu/home/NoInternet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ class NoInternet : AppCompatActivity() {
initActivity(this)
uiSettings = loadData("ui_settings") ?: uiSettings
selectedOption = uiSettings.defaultStartUpTab
if (!uiSettings.immersiveMode) {
binding.includedNavbar.navbarContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = navBarHeight
}

binding.includedNavbar.navbarContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = navBarHeight
}
}
val navbar = binding.includedNavbar.navbar
Expand Down
20 changes: 19 additions & 1 deletion app/src/main/res/layout/fragment_offline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,25 @@
android:id="@+id/refreshContainer"
android:layout_width="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
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
34 changes: 18 additions & 16 deletions app/src/main/res/layout/item_episode_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@

<ImageView
android:id="@+id/itemEpisodeImage"
android:layout_width="140dp"
android:layout_height="85dp"
android:layout_width="164dp"
android:layout_height="109dp"
android:layout_gravity="center"
android:scaleType="centerCrop"
tools:ignore="ContentDescription" />
Expand All @@ -74,10 +74,9 @@
android:textSize="20sp"
tools:text="12" />
</androidx.cardview.widget.CardView>

<LinearLayout
android:id="@+id/itemEpisodeProgressCont"
android:layout_width="140dp"
android:layout_width="164dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal"
Expand All @@ -98,6 +97,17 @@
android:background="#80FFFFFF" />

</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>

<LinearLayout
Expand All @@ -106,7 +116,7 @@
android:layout_margin="8dp"
android:layout_weight="1"
android:gravity="center"
android:minHeight="69dp"
android:minHeight="92dp"
android:orientation="vertical">

<TextView
Expand Down Expand Up @@ -137,10 +147,11 @@
android:id="@+id/itemDownload"
android:layout_width="24dp"
android:layout_height="48dp"
android:layout_marginEnd="8dp"
android:layout_marginEnd="5dp"
android:background="?android:attr/selectableItemBackground"
app:tint="?attr/colorOnBackground"
app:srcCompat="@drawable/ic_round_download_24" />
app:srcCompat="@drawable/ic_round_download_24"
tools:ignore="ContentDescription" />

</LinearLayout>

Expand Down Expand Up @@ -178,14 +189,5 @@
android:background="?android:colorBackground"
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>

0 comments on commit 6b2ffda

Please sign in to comment.