From 01f9e864751c0b22e5f762449f307a34cd37a07c Mon Sep 17 00:00:00 2001 From: aayush262 <99584765+aayush2622@users.noreply.github.com> Date: Tue, 9 Jan 2024 09:41:00 +0530 Subject: [PATCH] minor tweaks (#115) * Added telegram link * Removed UPI (rebel not indian) * minor changes * Shows number of manga/Ln downloaded * fixed list name overlapping with notch * wrong index selection in language fixed * novel icon * Emerald theme name changed to Ocean * forgot to remove * why was these still there --- app/src/debug/res/values/strings.xml | 2 +- .../main/java/ani/dantotsu/MainActivity.kt | 1 + .../download/manga/OfflineMangaAdapter.kt | 2 + .../download/manga/OfflineMangaFragment.kt | 8 +- .../java/ani/dantotsu/home/LoginFragment.kt | 1 + .../ani/dantotsu/media/CalendarActivity.kt | 8 ++ .../dantotsu/media/MediaDetailsActivity.kt | 9 +- .../dantotsu/media/anime/AnimeWatchAdapter.kt | 2 +- .../dantotsu/media/manga/MangaReadAdapter.kt | 2 +- .../ani/dantotsu/media/user/ListActivity.kt | 12 +- .../dantotsu/settings/ExtensionsActivity.kt | 6 +- .../ani/dantotsu/settings/SettingsActivity.kt | 11 +- .../java/ani/dantotsu/themes/ThemeManager.kt | 4 +- .../main/res/drawable/ic_round_book_24.xml | 10 ++ .../main/res/drawable/ic_round_filter_24.xml | 10 +- .../main/res/layout/activity_extensions.xml | 6 +- app/src/main/res/layout/activity_list.xml | 78 ++++++------- app/src/main/res/layout/activity_settings.xml | 22 ++-- app/src/main/res/layout/fragment_login.xml | 9 ++ .../res/layout/fragment_manga_offline.xml | 9 +- .../main/res/menu/launguage_selector_menu.xml | 103 ------------------ app/src/main/res/menu/novel_menu_detail.xml | 15 +++ app/src/main/res/values-night/themes.xml | 5 +- app/src/main/res/values/strings.xml | 2 +- app/src/main/res/values/themes.xml | 2 +- 25 files changed, 149 insertions(+), 190 deletions(-) create mode 100644 app/src/main/res/drawable/ic_round_book_24.xml delete mode 100644 app/src/main/res/menu/launguage_selector_menu.xml create mode 100644 app/src/main/res/menu/novel_menu_detail.xml diff --git a/app/src/debug/res/values/strings.xml b/app/src/debug/res/values/strings.xml index ef58c36a6e..92f0ffec67 100644 --- a/app/src/debug/res/values/strings.xml +++ b/app/src/debug/res/values/strings.xml @@ -1,4 +1,4 @@ - Dantotsu ß + Dantotsu β \ No newline at end of file diff --git a/app/src/main/java/ani/dantotsu/MainActivity.kt b/app/src/main/java/ani/dantotsu/MainActivity.kt index 3b8c4bbaeb..39544ed7b9 100644 --- a/app/src/main/java/ani/dantotsu/MainActivity.kt +++ b/app/src/main/java/ani/dantotsu/MainActivity.kt @@ -236,6 +236,7 @@ class MainActivity : AppCompatActivity() { .setData(Uri.parse("package:$packageName")) ) } + dismiss() } }.show(supportFragmentManager, "dialog") } diff --git a/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaAdapter.kt b/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaAdapter.kt index 87dfebed27..3093b0c453 100644 --- a/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaAdapter.kt +++ b/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaAdapter.kt @@ -51,6 +51,7 @@ class OfflineMangaAdapter( val itemScoreBG = view.findViewById(R.id.itemCompactScoreBG) val ongoing = view.findViewById(R.id.itemCompactOngoing) val totalchapter = view.findViewById(R.id.itemCompactTotal) + val typeimage = view.findViewById(R.id.itemCompactTypeImage) val type = view.findViewById(R.id.itemCompactRelation) val typeView = view.findViewById(R.id.itemCompactType) @@ -69,6 +70,7 @@ class OfflineMangaAdapter( } // Bind item data to the views + typeimage.setImageResource(if (item.type == "Novel" ) R.drawable.ic_round_book_24 else R.drawable.ic_round_import_contacts_24) type.text = item.type typeView.visibility = View.VISIBLE imageView.setImageURI(item.image) diff --git a/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt b/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt index 116c1267f6..ea1812dc22 100644 --- a/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt +++ b/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt @@ -1,6 +1,7 @@ package ani.dantotsu.download.manga import android.animation.ObjectAnimator +import android.annotation.SuppressLint import android.content.Context import android.content.Intent import android.net.Uri @@ -20,6 +21,7 @@ import android.widget.AbsListView import android.widget.AutoCompleteTextView import android.widget.GridView import android.widget.ImageView +import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import androidx.cardview.widget.CardView import androidx.fragment.app.Fragment @@ -57,6 +59,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener { private lateinit var gridView: GridView private lateinit var adapter: OfflineMangaAdapter + @SuppressLint("SetTextI18n") override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -177,7 +180,8 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener { snackString("no media found") } } - + val total = view.findViewById(R.id.total) + total.text = if (gridView.count > 0) "Manga and Novels (${gridView.count})" else "Empty List" gridView.setOnItemLongClickListener { parent, view, position, id -> // Get the OfflineMangaModel that was clicked val item = adapter.getItem(position) as OfflineMangaModel @@ -194,6 +198,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener { downloadManager.removeMedia(item.title, type) getDownloads() adapter.setItems(downloads) + } builder.setNegativeButton("No") { _, _ -> // Do nothing @@ -202,7 +207,6 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener { dialog.window?.setDimAmount(0.8f) true } - return view } diff --git a/app/src/main/java/ani/dantotsu/home/LoginFragment.kt b/app/src/main/java/ani/dantotsu/home/LoginFragment.kt index d314423731..58bb2fc905 100644 --- a/app/src/main/java/ani/dantotsu/home/LoginFragment.kt +++ b/app/src/main/java/ani/dantotsu/home/LoginFragment.kt @@ -28,5 +28,6 @@ class LoginFragment : Fragment() { binding.loginButton.setOnClickListener { Anilist.loginIntent(requireActivity()) } binding.loginDiscord.setOnClickListener { openLinkInBrowser(getString(R.string.discord)) } binding.loginGithub.setOnClickListener { openLinkInBrowser(getString(R.string.github)) } + binding.loginTelegram.setOnClickListener { openLinkInBrowser(getString(R.string.telegram)) } } } \ No newline at end of file diff --git a/app/src/main/java/ani/dantotsu/media/CalendarActivity.kt b/app/src/main/java/ani/dantotsu/media/CalendarActivity.kt index d6428a38e3..77035416c4 100644 --- a/app/src/main/java/ani/dantotsu/media/CalendarActivity.kt +++ b/app/src/main/java/ani/dantotsu/media/CalendarActivity.kt @@ -4,11 +4,13 @@ import android.annotation.SuppressLint import android.os.Bundle import android.util.TypedValue import android.view.View +import android.view.ViewGroup import android.view.Window import android.view.WindowManager import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat +import androidx.core.view.updateLayoutParams import androidx.lifecycle.MutableLiveData import androidx.lifecycle.lifecycleScope import ani.dantotsu.R @@ -16,8 +18,10 @@ import ani.dantotsu.Refresh import ani.dantotsu.databinding.ActivityListBinding import ani.dantotsu.loadData import ani.dantotsu.media.user.ListViewPagerAdapter +import ani.dantotsu.navBarHeight import ani.dantotsu.others.LangSet import ani.dantotsu.settings.UserInterfaceSettings +import ani.dantotsu.statusBarHeight import ani.dantotsu.themes.ThemeManager import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayoutMediator @@ -76,6 +80,10 @@ class CalendarActivity : AppCompatActivity() { WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ) + binding.settingsContainer.updateLayoutParams { + topMargin = statusBarHeight + bottomMargin = navBarHeight + } } setContentView(binding.root) diff --git a/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt b/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt index a902a1cf43..0d64ccad04 100644 --- a/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt +++ b/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt @@ -305,7 +305,6 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi } adult = media.isAdult - tabLayout.menu.clear() if (media.anime != null) { viewPager.adapter = @@ -317,7 +316,12 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi lifecycle, if (media.format == "NOVEL") SupportedMedia.NOVEL else SupportedMedia.MANGA ) - tabLayout.inflateMenu(R.menu.manga_menu_detail) + if (media.format == "NOVEL") { + tabLayout.inflateMenu(R.menu.novel_menu_detail) + } + else { + tabLayout.inflateMenu(R.menu.manga_menu_detail) + } anime = false } @@ -361,7 +365,6 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi R.id.info -> { selected = 0 } - R.id.watch, R.id.read -> { selected = 1 } diff --git a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt index 2c4244ab82..d91c294148 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt @@ -386,7 +386,7 @@ class AnimeWatchAdapter( ext.sourceLanguage = lang } try { - binding?.animeSourceLanguage?.setText(parser.extension.sources[lang].lang) + binding?.animeSourceLanguage?.setText(parser.extension.sources.sortedBy { it.lang }[lang].lang) } catch (e: IndexOutOfBoundsException) { binding?.animeSourceLanguage?.setText( parser.extension.sources.firstOrNull()?.lang ?: "Unknown" diff --git a/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt b/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt index 9237c6b9e2..1f91ed0910 100644 --- a/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt +++ b/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt @@ -416,7 +416,7 @@ class MangaReadAdapter( ext.sourceLanguage = lang } try { - binding?.animeSourceLanguage?.setText(parser.extension.sources[lang].lang) + binding?.animeSourceLanguage?.setText(parser.extension.sources.sortedBy { it.lang }[lang].lang) } catch (e: IndexOutOfBoundsException) { binding?.animeSourceLanguage?.setText( parser.extension.sources.firstOrNull()?.lang ?: "Unknown" diff --git a/app/src/main/java/ani/dantotsu/media/user/ListActivity.kt b/app/src/main/java/ani/dantotsu/media/user/ListActivity.kt index 8793015677..b64c8cdb97 100644 --- a/app/src/main/java/ani/dantotsu/media/user/ListActivity.kt +++ b/app/src/main/java/ani/dantotsu/media/user/ListActivity.kt @@ -5,12 +5,14 @@ import android.content.Context import android.os.Bundle import android.util.TypedValue import android.view.View +import android.view.ViewGroup import android.view.Window import android.view.WindowManager import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.PopupMenu import androidx.core.content.ContextCompat +import androidx.core.view.updateLayoutParams import androidx.lifecycle.MutableLiveData import androidx.lifecycle.lifecycleScope import ani.dantotsu.R @@ -18,9 +20,11 @@ import ani.dantotsu.Refresh import ani.dantotsu.currContext import ani.dantotsu.databinding.ActivityListBinding import ani.dantotsu.loadData +import ani.dantotsu.navBarHeight import ani.dantotsu.others.LangSet import ani.dantotsu.saveData import ani.dantotsu.settings.UserInterfaceSettings +import ani.dantotsu.statusBarHeight import ani.dantotsu.themes.ThemeManager import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayoutMediator @@ -77,12 +81,16 @@ class ListActivity : AppCompatActivity() { WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ) + binding.settingsContainer.updateLayoutParams { + topMargin = statusBarHeight + bottomMargin = navBarHeight + } } setContentView(binding.root) val anime = intent.getBooleanExtra("anime", true) - binding.listTitle.text = (if (anime) "Anime" else "Manga") + " List" - + binding.listTitle.text = + intent.getStringExtra("username") + "'s " + (if (anime) "Anime" else "Manga") + " List" binding.listTabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { override fun onTabSelected(tab: TabLayout.Tab?) { this@ListActivity.selectedTabIdx = tab?.position ?: 0 diff --git a/app/src/main/java/ani/dantotsu/settings/ExtensionsActivity.kt b/app/src/main/java/ani/dantotsu/settings/ExtensionsActivity.kt index 32e3a7e7f5..93cecdcd08 100644 --- a/app/src/main/java/ani/dantotsu/settings/ExtensionsActivity.kt +++ b/app/src/main/java/ani/dantotsu/settings/ExtensionsActivity.kt @@ -6,6 +6,7 @@ import android.os.Build.VERSION.* import android.os.Bundle import android.text.Editable import android.text.TextWatcher +import android.view.View import android.view.ViewGroup import android.widget.AutoCompleteTextView import androidx.activity.OnBackPressedCallback @@ -23,12 +24,8 @@ import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayoutMediator class ExtensionsActivity : AppCompatActivity() { - private val restartMainActivity = object : OnBackPressedCallback(false) { - override fun handleOnBackPressed() = startMainActivity(this@ExtensionsActivity) - } lateinit var binding: ActivityExtensionsBinding - @SuppressLint("SetTextI18n") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -119,6 +116,7 @@ class ExtensionsActivity : AppCompatActivity() { initActivity(this) + binding.languageselect.visibility = View.GONE /* TODO binding.languageselect.setOnClickListener { val popup = PopupMenu(this, it) diff --git a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt index 953cc61744..d20afc3998 100644 --- a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt +++ b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt @@ -508,10 +508,6 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListen lifecycleScope.launch { binding.settingBuyMeCoffee.pop() } - binding.settingUPI.visibility = if (checkCountry(this)) View.VISIBLE else View.GONE - lifecycleScope.launch { - binding.settingUPI.pop() - } binding.loginDiscord.setOnClickListener { openLinkInBrowser(getString(R.string.discord)) @@ -519,7 +515,9 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListen binding.loginGithub.setOnClickListener { openLinkInBrowser(getString(R.string.github)) } - + binding.loginTelegram.setOnClickListener { + openLinkInBrowser(getString(R.string.telegram)) + } binding.settingsUi.setOnClickListener { startActivity(Intent(this, UserInterfaceSettingsActivity::class.java)) } @@ -757,8 +755,7 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListen } setPositiveButton("denote :)") { - if (binding.settingUPI.visibility == View.VISIBLE) binding.settingUPI.performClick() - else binding.settingBuyMeCoffee.performClick() + binding.settingBuyMeCoffee.performClick() dismiss() } show(supportFragmentManager, "dialog") diff --git a/app/src/main/java/ani/dantotsu/themes/ThemeManager.kt b/app/src/main/java/ani/dantotsu/themes/ThemeManager.kt index 8ee3f62dfc..076277fd56 100644 --- a/app/src/main/java/ani/dantotsu/themes/ThemeManager.kt +++ b/app/src/main/java/ani/dantotsu/themes/ThemeManager.kt @@ -49,7 +49,7 @@ class ThemeManager(private val context: Context) { "SAIKOU" -> if (useOLED) R.style.Theme_Dantotsu_SaikouOLED else R.style.Theme_Dantotsu_Saikou "RED" -> if (useOLED) R.style.Theme_Dantotsu_RedOLED else R.style.Theme_Dantotsu_Red "LAVENDER" -> if (useOLED) R.style.Theme_Dantotsu_LavenderOLED else R.style.Theme_Dantotsu_Lavender - "EMERALD" -> if (useOLED) R.style.Theme_Dantotsu_EmeraldOLED else R.style.Theme_Dantotsu_Emerald + "OCEAN" -> if (useOLED) R.style.Theme_Dantotsu_OceanOLED else R.style.Theme_Dantotsu_Ocean "MONOCHROME (BETA)" -> if (useOLED) R.style.Theme_Dantotsu_MonochromeOLED else R.style.Theme_Dantotsu_Monochrome else -> if (useOLED) R.style.Theme_Dantotsu_PurpleOLED else R.style.Theme_Dantotsu_Purple } @@ -117,7 +117,7 @@ class ThemeManager(private val context: Context) { SAIKOU("SAIKOU"), RED("RED"), LAVENDER("LAVENDER"), - EMERALD("EMERALD"), + OCEAN("OCEAN"), MONOCHROME("MONOCHROME (BETA)"); companion object { diff --git a/app/src/main/res/drawable/ic_round_book_24.xml b/app/src/main/res/drawable/ic_round_book_24.xml new file mode 100644 index 0000000000..3ab0b826ac --- /dev/null +++ b/app/src/main/res/drawable/ic_round_book_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_round_filter_24.xml b/app/src/main/res/drawable/ic_round_filter_24.xml index c5b854847d..103f077195 100644 --- a/app/src/main/res/drawable/ic_round_filter_24.xml +++ b/app/src/main/res/drawable/ic_round_filter_24.xml @@ -1,4 +1,12 @@ - + + + diff --git a/app/src/main/res/layout/activity_extensions.xml b/app/src/main/res/layout/activity_extensions.xml index 728236ba89..f4611599ad 100644 --- a/app/src/main/res/layout/activity_extensions.xml +++ b/app/src/main/res/layout/activity_extensions.xml @@ -80,9 +80,7 @@ app:tabPaddingEnd="16dp" app:tabPaddingStart="16dp" app:tabTextAppearance="@style/NavBarText" - app:tabGravity="fill"> - - + app:tabGravity="fill"/> diff --git a/app/src/main/res/layout/activity_list.xml b/app/src/main/res/layout/activity_list.xml index 395c1e92c5..3b48c58732 100644 --- a/app/src/main/res/layout/activity_list.xml +++ b/app/src/main/res/layout/activity_list.xml @@ -4,8 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".media.user.ListActivity" - android:fitsSystemWindows="true"> + tools:context=".media.user.ListActivity"> - + android:orientation="vertical"> + - + - + - + + - + tools:ignore="SpeakableTextPresentCheck"/> - - - - - - + diff --git a/app/src/main/res/layout/fragment_login.xml b/app/src/main/res/layout/fragment_login.xml index 5d906baf9e..c93d5700d0 100644 --- a/app/src/main/res/layout/fragment_login.xml +++ b/app/src/main/res/layout/fragment_login.xml @@ -76,6 +76,15 @@ android:src="@drawable/ic_github" app:tint="?attr/colorOutline" tools:ignore="ContentDescription" /> + diff --git a/app/src/main/res/layout/fragment_manga_offline.xml b/app/src/main/res/layout/fragment_manga_offline.xml index f829fe32a4..307a2f49ac 100644 --- a/app/src/main/res/layout/fragment_manga_offline.xml +++ b/app/src/main/res/layout/fragment_manga_offline.xml @@ -87,15 +87,16 @@ android:orientation="horizontal"> + tools:ignore="HardcodedText,RtlSymmetry" /> - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/menu/novel_menu_detail.xml b/app/src/main/res/menu/novel_menu_detail.xml new file mode 100644 index 0000000000..94b4ec7e46 --- /dev/null +++ b/app/src/main/res/menu/novel_menu_detail.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index fbda070994..d5466d50a8 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -209,7 +209,7 @@ @color/md_theme_dark_7_inversePrimary - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 23e646c500..c8bc28c093 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -11,7 +11,7 @@ https://discord.gg/4HPZ5nAWwM https://github.com/rebelonion/Dantotsu - + https://t.me/+gzBCQExtLQo1YTNh Home Anime Browse Anime diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 5b89373732..691ac4aef6 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -285,7 +285,7 @@ @color/md_theme_light_7_inversePrimary -