lil tweaks (#140)
This commit is contained in:
parent
91b1f4775b
commit
8eadd20968
4 changed files with 49 additions and 70 deletions
|
@ -69,6 +69,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
private var downloads: List<OfflineAnimeModel> = listOf()
|
private var downloads: List<OfflineAnimeModel> = listOf()
|
||||||
private lateinit var gridView: GridView
|
private lateinit var gridView: GridView
|
||||||
private lateinit var adapter: OfflineAnimeAdapter
|
private lateinit var adapter: OfflineAnimeAdapter
|
||||||
|
private lateinit var total : TextView
|
||||||
private var uiSettings: UserInterfaceSettings =
|
private var uiSettings: UserInterfaceSettings =
|
||||||
loadData("ui_settings") ?: UserInterfaceSettings()
|
loadData("ui_settings") ?: UserInterfaceSettings()
|
||||||
|
|
||||||
|
@ -142,9 +143,6 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
?.putInt("offline_view", style!!)?.apply()
|
?.putInt("offline_view", style!!)?.apply()
|
||||||
gridView.visibility = View.GONE
|
gridView.visibility = View.GONE
|
||||||
gridView = view.findViewById(R.id.gridView)
|
gridView = view.findViewById(R.id.gridView)
|
||||||
gridView.adapter = adapter
|
|
||||||
gridView.scheduleLayoutAnimation()
|
|
||||||
gridView.visibility = View.VISIBLE
|
|
||||||
adapter.notifyNewGrid()
|
adapter.notifyNewGrid()
|
||||||
grid()
|
grid()
|
||||||
}
|
}
|
||||||
|
@ -156,37 +154,30 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
?.putInt("offline_view", style!!)?.apply()
|
?.putInt("offline_view", style!!)?.apply()
|
||||||
gridView.visibility = View.GONE
|
gridView.visibility = View.GONE
|
||||||
gridView = view.findViewById(R.id.gridView1)
|
gridView = view.findViewById(R.id.gridView1)
|
||||||
gridView.adapter = adapter
|
|
||||||
gridView.scheduleLayoutAnimation()
|
|
||||||
gridView.visibility = View.VISIBLE
|
|
||||||
adapter.notifyNewGrid()
|
adapter.notifyNewGrid()
|
||||||
grid()
|
grid()
|
||||||
}
|
}
|
||||||
|
|
||||||
gridView =
|
gridView = if (style == 0) view.findViewById(R.id.gridView) else view.findViewById(R.id.gridView1)
|
||||||
if (style == 0) view.findViewById(R.id.gridView) else view.findViewById(R.id.gridView1)
|
total = view.findViewById(R.id.total)
|
||||||
gridView.visibility = View.VISIBLE
|
|
||||||
getDownloads()
|
|
||||||
val fadeIn = AlphaAnimation(0f, 1f)
|
|
||||||
fadeIn.duration = 200 // animations pog
|
|
||||||
val animation = LayoutAnimationController(fadeIn)
|
|
||||||
gridView.layoutAnimation = animation
|
|
||||||
adapter = OfflineAnimeAdapter(requireContext(), downloads, this)
|
|
||||||
gridView.adapter = adapter
|
|
||||||
gridView.scheduleLayoutAnimation()
|
|
||||||
grid()
|
grid()
|
||||||
val total = view.findViewById<TextView>(R.id.total)
|
|
||||||
total.text = if (gridView.count > 0) "Anime (${gridView.count})" else "Empty List"
|
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(UnstableApi::class)
|
@OptIn(UnstableApi::class)
|
||||||
private fun grid() {
|
private fun grid() {
|
||||||
gridView.setOnItemClickListener { parent, view, position, id ->
|
gridView.visibility = View.VISIBLE
|
||||||
|
getDownloads()
|
||||||
|
val fadeIn = AlphaAnimation(0f, 1f)
|
||||||
|
fadeIn.duration = 300 // animations pog
|
||||||
|
gridView.layoutAnimation = LayoutAnimationController(fadeIn)
|
||||||
|
adapter = OfflineAnimeAdapter(requireContext(), downloads, this)
|
||||||
|
gridView.adapter = adapter
|
||||||
|
gridView.scheduleLayoutAnimation()
|
||||||
|
total.text = if (gridView.count > 0) "Anime (${gridView.count})" else "Empty List"
|
||||||
|
gridView.setOnItemClickListener { _, _, position, _ ->
|
||||||
// Get the OfflineAnimeModel that was clicked
|
// Get the OfflineAnimeModel that was clicked
|
||||||
val item = adapter.getItem(position) as OfflineAnimeModel
|
val item = adapter.getItem(position) as OfflineAnimeModel
|
||||||
val downloads = downloadManager.animeDownloadedTypes
|
|
||||||
val media =
|
val media =
|
||||||
downloadManager.animeDownloadedTypes.firstOrNull { it.title == item.title }
|
downloadManager.animeDownloadedTypes.firstOrNull { it.title == item.title }
|
||||||
media?.let {
|
media?.let {
|
||||||
|
@ -204,7 +195,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
snackString("no media found")
|
snackString("no media found")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gridView.setOnItemLongClickListener { parent, view, position, id ->
|
gridView.setOnItemLongClickListener { _, _, position, _ ->
|
||||||
// Get the OfflineAnimeModel that was clicked
|
// Get the OfflineAnimeModel that was clicked
|
||||||
val item = adapter.getItem(position) as OfflineAnimeModel
|
val item = adapter.getItem(position) as OfflineAnimeModel
|
||||||
val type: DownloadedType.Type =
|
val type: DownloadedType.Type =
|
||||||
|
@ -231,6 +222,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
}
|
}
|
||||||
getDownloads()
|
getDownloads()
|
||||||
adapter.setItems(downloads)
|
adapter.setItems(downloads)
|
||||||
|
total.text = if (gridView.count > 0) "Anime (${gridView.count})" else "Empty List"
|
||||||
}
|
}
|
||||||
builder.setNegativeButton("No") { _, _ ->
|
builder.setNegativeButton("No") { _, _ ->
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
|
|
@ -62,6 +62,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
private var downloads: List<OfflineMangaModel> = listOf()
|
private var downloads: List<OfflineMangaModel> = listOf()
|
||||||
private lateinit var gridView: GridView
|
private lateinit var gridView: GridView
|
||||||
private lateinit var adapter: OfflineMangaAdapter
|
private lateinit var adapter: OfflineMangaAdapter
|
||||||
|
private lateinit var total : TextView
|
||||||
private var uiSettings: UserInterfaceSettings =
|
private var uiSettings: UserInterfaceSettings =
|
||||||
loadData("ui_settings") ?: UserInterfaceSettings()
|
loadData("ui_settings") ?: UserInterfaceSettings()
|
||||||
|
|
||||||
|
@ -131,13 +132,9 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
layoutList.setOnClickListener {
|
layoutList.setOnClickListener {
|
||||||
selected(it as ImageView)
|
selected(it as ImageView)
|
||||||
style = 0
|
style = 0
|
||||||
context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.edit()
|
requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit().putInt("offline_view", style!!).apply()
|
||||||
?.putInt("offline_view", style!!)?.apply()
|
|
||||||
gridView.visibility = View.GONE
|
gridView.visibility = View.GONE
|
||||||
gridView = view.findViewById(R.id.gridView)
|
gridView = view.findViewById(R.id.gridView)
|
||||||
gridView.adapter = adapter
|
|
||||||
gridView.scheduleLayoutAnimation()
|
|
||||||
gridView.visibility = View.VISIBLE
|
|
||||||
adapter.notifyNewGrid()
|
adapter.notifyNewGrid()
|
||||||
grid()
|
grid()
|
||||||
|
|
||||||
|
@ -146,39 +143,29 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
layoutcompact.setOnClickListener {
|
layoutcompact.setOnClickListener {
|
||||||
selected(it as ImageView)
|
selected(it as ImageView)
|
||||||
style = 1
|
style = 1
|
||||||
context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.edit()
|
requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit().putInt("offline_view", style!!).apply()
|
||||||
?.putInt("offline_view", style!!)?.apply()
|
|
||||||
gridView.visibility = View.GONE
|
gridView.visibility = View.GONE
|
||||||
gridView = view.findViewById(R.id.gridView1)
|
gridView = view.findViewById(R.id.gridView1)
|
||||||
gridView.adapter = adapter
|
|
||||||
gridView.scheduleLayoutAnimation()
|
|
||||||
gridView.visibility = View.VISIBLE
|
|
||||||
adapter.notifyNewGrid()
|
adapter.notifyNewGrid()
|
||||||
grid()
|
grid()
|
||||||
}
|
}
|
||||||
gridView =
|
gridView = if (style == 0) view.findViewById(R.id.gridView) else view.findViewById(R.id.gridView1)
|
||||||
if (style == 0) view.findViewById(R.id.gridView) else view.findViewById(R.id.gridView1)
|
total = view.findViewById(R.id.total)
|
||||||
gridView.visibility = View.VISIBLE
|
|
||||||
getDownloads()
|
|
||||||
|
|
||||||
val fadeIn = AlphaAnimation(0f, 1f)
|
|
||||||
fadeIn.duration = 200 // animations pog
|
|
||||||
val animation = LayoutAnimationController(fadeIn)
|
|
||||||
|
|
||||||
gridView.layoutAnimation = animation
|
|
||||||
adapter = OfflineMangaAdapter(requireContext(), downloads, this)
|
|
||||||
gridView.adapter = adapter
|
|
||||||
gridView.scheduleLayoutAnimation()
|
|
||||||
grid()
|
grid()
|
||||||
val total = view.findViewById<TextView>(R.id.total)
|
|
||||||
total.text =
|
|
||||||
if (gridView.count > 0) "Manga and Novels (${gridView.count})" else "Empty List"
|
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun grid() {
|
private fun grid() {
|
||||||
gridView.setOnItemClickListener { parent, view, position, id ->
|
gridView.visibility = View.VISIBLE
|
||||||
|
getDownloads()
|
||||||
|
val fadeIn = AlphaAnimation(0f, 1f)
|
||||||
|
fadeIn.duration = 300 // animations pog
|
||||||
|
gridView.layoutAnimation = LayoutAnimationController(fadeIn)
|
||||||
|
adapter = OfflineMangaAdapter(requireContext(), downloads, this)
|
||||||
|
gridView.adapter = adapter
|
||||||
|
gridView.scheduleLayoutAnimation()
|
||||||
|
total.text = if (gridView.count > 0) "Manga and Novels (${gridView.count})" else "Empty List"
|
||||||
|
gridView.setOnItemClickListener { _, _, position, _ ->
|
||||||
// Get the OfflineMangaModel that was clicked
|
// Get the OfflineMangaModel that was clicked
|
||||||
val item = adapter.getItem(position) as OfflineMangaModel
|
val item = adapter.getItem(position) as OfflineMangaModel
|
||||||
val media =
|
val media =
|
||||||
|
@ -195,7 +182,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gridView.setOnItemLongClickListener { parent, view, position, id ->
|
gridView.setOnItemLongClickListener { _, _, position, _ ->
|
||||||
// Get the OfflineMangaModel that was clicked
|
// Get the OfflineMangaModel that was clicked
|
||||||
val item = adapter.getItem(position) as OfflineMangaModel
|
val item = adapter.getItem(position) as OfflineMangaModel
|
||||||
val type: DownloadedType.Type =
|
val type: DownloadedType.Type =
|
||||||
|
@ -213,6 +200,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
downloadManager.removeMedia(item.title, type)
|
downloadManager.removeMedia(item.title, type)
|
||||||
getDownloads()
|
getDownloads()
|
||||||
adapter.setItems(downloads)
|
adapter.setItems(downloads)
|
||||||
|
total.text = if (gridView.count > 0) "Manga and Novels (${gridView.count})" else "Empty List"
|
||||||
}
|
}
|
||||||
builder.setNegativeButton("No") { _, _ ->
|
builder.setNegativeButton("No") { _, _ ->
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
|
|
@ -275,22 +275,21 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:cardBackgroundColor="@color/nav_bg_inv"
|
|
||||||
app:cardCornerRadius="16dp"
|
|
||||||
app:cardElevation="0dp">
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/animeWebViewTop"
|
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/animeWebViewTop"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_gravity="center|center_horizontal"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
app:srcCompat="@drawable/ic_internet"
|
app:srcCompat="@drawable/ic_internet"
|
||||||
app:tint="?attr/colorOnBackground"
|
app:tint="?attr/colorOnBackground"
|
||||||
tools:ignore="ContentDescription,ImageContrastCheck" />
|
tools:ignore="ContentDescription,ImageContrastCheck" />
|
||||||
</androidx.cardview.widget.CardView>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -304,10 +304,10 @@
|
||||||
<color name="md_theme_light_5_onTertiary">#00FF00</color>
|
<color name="md_theme_light_5_onTertiary">#00FF00</color>
|
||||||
<color name="md_theme_light_5_tertiaryContainer">#00FF00</color>
|
<color name="md_theme_light_5_tertiaryContainer">#00FF00</color>
|
||||||
<color name="md_theme_light_5_onTertiaryContainer">#00FF00</color>
|
<color name="md_theme_light_5_onTertiaryContainer">#00FF00</color>
|
||||||
<color name="md_theme_light_5_error">#00FF00</color>
|
<color name="md_theme_light_5_error">#BA1A1A</color>
|
||||||
<color name="md_theme_light_5_errorContainer">#00FF00</color>
|
<color name="md_theme_light_5_errorContainer">#FFDAD6</color>
|
||||||
<color name="md_theme_light_5_onError">#00FF00</color>
|
<color name="md_theme_light_5_onError">#FFFFFF</color>
|
||||||
<color name="md_theme_light_5_onErrorContainer">#00FF00</color>
|
<color name="md_theme_light_5_onErrorContainer">#410002</color>
|
||||||
<color name="md_theme_light_5_background">#EEEEEE</color>
|
<color name="md_theme_light_5_background">#EEEEEE</color>
|
||||||
<color name="md_theme_light_5_onBackground">#000000</color>
|
<color name="md_theme_light_5_onBackground">#000000</color>
|
||||||
<color name="md_theme_light_5_surface">#EEEEEE</color>
|
<color name="md_theme_light_5_surface">#EEEEEE</color>
|
||||||
|
@ -338,10 +338,10 @@
|
||||||
<color name="md_theme_dark_5_onTertiary">#00FF00</color>
|
<color name="md_theme_dark_5_onTertiary">#00FF00</color>
|
||||||
<color name="md_theme_dark_5_tertiaryContainer">#00FF00</color>
|
<color name="md_theme_dark_5_tertiaryContainer">#00FF00</color>
|
||||||
<color name="md_theme_dark_5_onTertiaryContainer">#00FF00</color>
|
<color name="md_theme_dark_5_onTertiaryContainer">#00FF00</color>
|
||||||
<color name="md_theme_dark_5_error">#00FF00</color>
|
<color name="md_theme_dark_5_error">#FFB4AB</color>
|
||||||
<color name="md_theme_dark_5_errorContainer">#00FF00</color>
|
<color name="md_theme_dark_5_errorContainer">#93000A</color>
|
||||||
<color name="md_theme_dark_5_onError">#00FF00</color>
|
<color name="md_theme_dark_5_onError">#690005</color>
|
||||||
<color name="md_theme_dark_5_onErrorContainer">#00FF00</color>
|
<color name="md_theme_dark_5_onErrorContainer">#FFDAD6</color>
|
||||||
<color name="md_theme_dark_5_background">#1C1B1E</color>
|
<color name="md_theme_dark_5_background">#1C1B1E</color>
|
||||||
<color name="md_theme_dark_5_onBackground">#EEEEEE</color>
|
<color name="md_theme_dark_5_onBackground">#EEEEEE</color>
|
||||||
<color name="md_theme_dark_5_surface">#1C1B20</color>
|
<color name="md_theme_dark_5_surface">#1C1B20</color>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue