Merge branch 'dev' into main

This commit is contained in:
rebel onion 2023-12-18 17:17:24 -06:00 committed by GitHub
commit 74328cf4cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 973 additions and 225 deletions

View file

@ -28,11 +28,17 @@ jobs:
java-version: 17
cache: gradle
- name: Decode Keystore File
run: echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > $GITHUB_WORKSPACE/key.keystore
- name: List files in the directory
run: ls -l
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew assembleDebug
run: ./gradlew assembleDebug -Pandroid.injected.signing.store.file=$GITHUB_WORKSPACE/key.keystore -Pandroid.injected.signing.store.password=${{ secrets.KEYSTORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.KEY_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.KEY_PASSWORD }}
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.0.0

View file

@ -100,7 +100,7 @@ dependencies {
implementation 'com.alexvasilkov:gesture-views:2.8.3'
implementation 'com.github.VipulOG:ebook-reader:0.1.6'
implementation 'androidx.paging:paging-runtime-ktx:3.2.1'
implementation "com.github.skydoves:colorpickerview:2.3.0"
implementation 'com.github.eltos:simpledialogfragments:v3.7'
// string matching
implementation 'me.xdrop:fuzzywuzzy:1.4.0'

View file

@ -17,25 +17,22 @@
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<!-- For background jobs -->
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" /> <!-- For background jobs -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<!-- For managing extensions -->
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> <!-- For managing extensions -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.UPDATE_PACKAGES_WITHOUT_USER_ACTION" />
<!-- To view extension packages in API 30+ -->
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
<uses-permission android:name="android.permission.UPDATE_PACKAGES_WITHOUT_USER_ACTION" /> <!-- To view extension packages in API 30+ -->
<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<uses-permission android:name="android.permission.READ_APP_SPECIFIC_LOCALES"
<uses-permission
android:name="android.permission.READ_APP_SPECIFIC_LOCALES"
tools:ignore="ProtectedPermissions" />
<queries>
@ -48,6 +45,7 @@
<application
android:name=".App"
android:allowBackup="true"
android:banner="@drawable/ic_banner_foreground"
android:icon="${icon_placeholder}"
android:label="@string/app_name"
android:largeHeap="true"
@ -56,14 +54,26 @@
android:supportsRtl="true"
android:theme="@style/Theme.Dantotsu"
android:usesCleartextTraffic="true"
tools:ignore="AllowBackup"
android:banner="@drawable/ic_banner_foreground">
tools:ignore="AllowBackup">
<receiver
android:name=".widgets.CurrentlyAiringWidget"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/currently_airing_widget_info" />
</receiver>
<activity
android:name="ani.dantotsu.media.novel.novelreader.NovelReaderActivity"
android:name=".media.novel.novelreader.NovelReaderActivity"
android:configChanges="orientation|screenSize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/epub+zip" />
@ -71,13 +81,11 @@
<data android:mimeType="application/vnd.amazon.ebook" />
<data android:mimeType="application/fb2+zip" />
<data android:mimeType="application/vnd.comicbook+zip" />
<data android:pathPattern=".*\\.epub" />
<data android:pathPattern=".*\\.mobi" />
<data android:pathPattern=".*\\.kf8" />
<data android:pathPattern=".*\\.fb2" />
<data android:pathPattern=".*\\.cbz" />
<data android:scheme="content" />
<data android:scheme="file" />
</intent-filter>
@ -103,9 +111,9 @@
<activity
android:name=".media.CalendarActivity"
android:parentActivityName=".MainActivity" />
<activity android:name="ani.dantotsu.media.user.ListActivity" />
<activity android:name=".media.user.ListActivity" />
<activity
android:name="ani.dantotsu.media.manga.mangareader.MangaReaderActivity"
android:name=".media.manga.mangareader.MangaReaderActivity"
android:excludeFromRecents="true"
android:exported="true"
android:label="@string/manga"
@ -118,7 +126,7 @@
<activity android:name=".media.CharacterDetailsActivity" />
<activity android:name=".home.NoInternet" />
<activity
android:name="ani.dantotsu.media.anime.ExoplayerView"
android:name=".media.anime.ExoplayerView"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
android:excludeFromRecents="true"
android:exported="true"
@ -127,7 +135,7 @@
android:supportsPictureInPicture="true"
tools:targetApi="n" />
<activity
android:name="ani.dantotsu.connections.anilist.Login"
android:name=".connections.anilist.Login"
android:configChanges="orientation|screenSize|layoutDirection"
android:excludeFromRecents="true"
android:exported="true"
@ -144,7 +152,7 @@
</intent-filter>
</activity>
<activity
android:name="ani.dantotsu.connections.mal.Login"
android:name=".connections.mal.Login"
android:configChanges="orientation|screenSize|layoutDirection"
android:excludeFromRecents="true"
android:exported="true"
@ -160,8 +168,8 @@
android:scheme="dantotsu" />
</intent-filter>
</activity>
<activity android:name="ani.dantotsu.connections.discord.Login"
<activity
android:name=".connections.discord.Login"
android:configChanges="orientation|screenSize|layoutDirection"
android:excludeFromRecents="true"
android:exported="true"
@ -178,9 +186,8 @@
<data android:host="discord.dantotsu.com" />
</intent-filter>
</activity>
<activity
android:name="ani.dantotsu.connections.anilist.UrlMedia"
android:name=".connections.anilist.UrlMedia"
android:configChanges="orientation|screenSize|layoutDirection"
android:excludeFromRecents="true"
android:exported="true"
@ -216,23 +223,24 @@
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.Main" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".download.DownloadContainerActivity" />
<activity
android:name="eu.kanade.tachiyomi.extension.manga.util.MangaExtensionInstallActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="false" />
android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name="eu.kanade.tachiyomi.extension.anime.util.AnimeExtensionInstallActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="false" />
android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<receiver
android:name=".subcriptions.AlarmReceiver"
@ -258,30 +266,37 @@
android:resource="@xml/provider_paths" />
</provider>
<service android:name=".download.video.MyDownloadService"
<service
android:name=".widgets.CurrentlyAiringRemoteViewsService"
android:permission="android.permission.BIND_REMOTEVIEWS"
android:exported="true" />
<service
android:name=".download.video.MyDownloadService"
android:exported="false">
<intent-filter>
<action android:name="androidx.media3.exoplayer.downloadService.action.RESTART" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="eu.kanade.tachiyomi.extension.manga.util.MangaExtensionInstallService"
android:foregroundServiceType="dataSync"
android:exported="false" />
<service android:name="eu.kanade.tachiyomi.extension.anime.util.AnimeExtensionInstallService"
android:foregroundServiceType="dataSync"
android:exported="false" />
<service android:name=".download.manga.MangaDownloaderService"
<service
android:name="eu.kanade.tachiyomi.extension.manga.util.MangaExtensionInstallService"
android:exported="false"
android:foregroundServiceType="dataSync" />
<service android:name=".download.novel.NovelDownloaderService"
<service
android:name="eu.kanade.tachiyomi.extension.anime.util.AnimeExtensionInstallService"
android:exported="false"
android:foregroundServiceType="dataSync" />
<service android:name=".connections.discord.DiscordService"
<service
android:name=".download.manga.MangaDownloaderService"
android:exported="false"
android:foregroundServiceType="dataSync" />
<service
android:name=".download.novel.NovelDownloaderService"
android:exported="false"
android:foregroundServiceType="dataSync" />
<service
android:name=".connections.discord.DiscordService"
android:exported="false"
android:foregroundServiceType="dataSync" />
</application>

View file

@ -75,6 +75,12 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
textInputLayout.boxBackgroundColor = (color and 0x00FFFFFF) or 0x28000000.toInt()
materialCardView.setCardBackgroundColor((color and 0x00FFFFFF) or 0x28000000.toInt())
}
val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
if(incognito) {
binding.incognitoTextView.visibility = View.VISIBLE
binding.incognitoView.visibility = View.VISIBLE
}
binding.animeTitleContainer.updatePadding(top = statusBarHeight)

View file

@ -1,6 +1,8 @@
package ani.dantotsu.home
import android.animation.ObjectAnimator
import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import android.graphics.drawable.Animatable
import android.os.Build
@ -19,6 +21,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import ani.dantotsu.App
import ani.dantotsu.R
import ani.dantotsu.Refresh
import ani.dantotsu.bottomBar
@ -71,6 +74,7 @@ class HomeFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val scope = lifecycleScope
var uiSettings = loadData<UserInterfaceSettings>("ui_settings") ?: UserInterfaceSettings()
fun load() {
if (activity != null && _binding != null) lifecycleScope.launch(Dispatchers.Main) {
binding.homeUserName.text = Anilist.username
@ -111,7 +115,12 @@ class HomeFragment : Fragment() {
snackString(currContext()?.getString(R.string.please_reload))
}
}
val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
if(incognito) {
binding.incognitoTextView.visibility = View.VISIBLE
binding.incognitoView.visibility = View.VISIBLE
}
binding.homeUserAvatarContainer.setSafeOnClickListener {
val dialogFragment =
SettingsDialogFragment.newInstance(SettingsDialogFragment.Companion.PageType.HOME)

View file

@ -75,6 +75,13 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
materialCardView.setCardBackgroundColor((color and 0x00FFFFFF) or 0x28000000.toInt())
}
val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
if(incognito) {
binding.incognitoTextView.visibility = View.VISIBLE
binding.incognitoView.visibility = View.VISIBLE
}
binding.mangaTitleContainer.updatePadding(top = statusBarHeight)
if (uiSettings.smallView) binding.mangaTrendingContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {

View file

@ -1101,7 +1101,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
if (settings.cursedSpeeds)
arrayOf(1f, 1.25f, 1.5f, 1.75f, 2f, 2.5f, 3f, 4f, 5f, 10f, 25f, 50f)
else
arrayOf(0.25f, 0.33f, 0.5f, 0.66f, 0.75f, 1f, 1.25f, 1.33f, 1.5f, 1.66f, 1.75f, 2f)
arrayOf(0.25f, 0.33f, 0.5f, 0.66f, 0.75f, 1f, 1.15f, 1.25f, 1.33f, 1.5f, 1.66f, 1.75f, 2f)
val speedsName = speeds.map { "${it}x" }.toTypedArray()
var curSpeed = loadData("${media.id}_speed", this) ?: settings.defaultSpeed
@ -1156,14 +1156,18 @@ class ExoplayerView : AppCompatActivity(), Player.Listener {
}
preloading = false
val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
val showProgressDialog =
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog")
?: true else false
if (showProgressDialog && Anilist.userid != null && if (media.isAdult) settings.updateForH else true)
AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.auto_update, media.userPreferredName))
.setMessage(getString(R.string.incognito_will_not_update))
.apply {
if (incognito) {
setMessage(getString(R.string.incognito_will_not_update))
}
setOnCancelListener { hideSystemBars() }
setCancelable(false)
setPositiveButton(getString(R.string.yes)) { dialog, _ ->

View file

@ -3,6 +3,7 @@ package ani.dantotsu.media.manga.mangareader
import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.graphics.Bitmap
@ -796,6 +797,7 @@ class MangaReaderActivity : AppCompatActivity() {
private fun progress(runnable: Runnable) {
if (maxChapterPage - currentChapterPage <= 1 && Anilist.userid != null) {
if (showProgressDialog) {
val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null)
val checkbox = dialogView.findViewById<CheckBox>(R.id.dialog_checkbox)
checkbox.text = getString(R.string.dont_ask_again, media.userPreferredName)
@ -803,9 +805,15 @@ class MangaReaderActivity : AppCompatActivity() {
saveData("${media.id}_progressDialog", isChecked)
showProgressDialog = !isChecked
}
val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.title_update_progress))
.apply {
if (incognito) {
setMessage(getString(R.string.incognito_will_not_update))
}
}
.setView(dialogView)
.setCancelable(false)
.setPositiveButton(getString(R.string.yes)) { dialog, _ ->

View file

@ -62,7 +62,7 @@ class ListActivity : AppCompatActivity() {
binding.listTabLayout.setTabTextColors(secondaryTextColor, primaryTextColor)
binding.listTabLayout.setSelectedTabIndicatorColor(primaryTextColor)
val uiSettings = loadData<UserInterfaceSettings>("ui_settings") ?: UserInterfaceSettings()
if (!uiSettings.immersiveMode) {
if (!uiSettings.immersiveModeList) {
this.window.statusBarColor =
ContextCompat.getColor(this, R.color.nav_bg_inv)
binding.root.fitsSystemWindows = true

View file

@ -2,3 +2,4 @@ package ani.dantotsu.others
const val DisabledReports = false
//Setting this to false, will allow sending crash reports to Dantotsu's Firebase Crashlytics
//if you want a custom build without crash reporting, set this to true

View file

@ -97,7 +97,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
val speeds =
arrayOf(0.25f, 0.33f, 0.5f, 0.66f, 0.75f, 1f, 1.25f, 1.33f, 1.5f, 1.66f, 1.75f, 2f)
arrayOf(0.25f, 0.33f, 0.5f, 0.66f, 0.75f, 1f, 1.15f, 1.25f, 1.33f, 1.5f, 1.66f, 1.75f, 2f)
val cursedSpeeds = arrayOf(1f, 1.25f, 1.5f, 1.75f, 2f, 2.5f, 3f, 4f, 5f, 10f, 25f, 50f)
var curSpeedArr = if (settings.cursedSpeeds) cursedSpeeds else speeds
var speedsName = curSpeedArr.map { "${it}x" }.toTypedArray()

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.Animatable
import android.os.Build.*
import android.os.Build.VERSION.*
@ -11,7 +12,6 @@ import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.Toast
import androidx.activity.OnBackPressedCallback
@ -37,7 +37,9 @@ import ani.dantotsu.subcriptions.Subscription.Companion.timeMinutes
import ani.dantotsu.themes.ThemeManager
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.textfield.TextInputEditText
import com.skydoves.colorpickerview.listeners.ColorListener
import eltos.simpledialogfragment.SimpleDialog
import eltos.simpledialogfragment.SimpleDialog.OnDialogResultListener.BUTTON_POSITIVE
import eltos.simpledialogfragment.color.SimpleColorDialog
import eu.kanade.domain.base.BasePreferences
import eu.kanade.tachiyomi.network.NetworkPreferences
import io.noties.markwon.Markwon
@ -50,7 +52,7 @@ import uy.kohesive.injekt.api.get
import kotlin.random.Random
class SettingsActivity : AppCompatActivity() {
class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListener {
private val restartMainActivity = object : OnBackPressedCallback(false) {
override fun handleOnBackPressed() = startMainActivity(this@SettingsActivity)
}
@ -176,31 +178,21 @@ class SettingsActivity : AppCompatActivity() {
binding.customTheme.setOnClickListener {
var passedColor: Int = 0
val dialogView = layoutInflater.inflate(R.layout.dialog_color_picker, null)
val alertDialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle("Custom Theme")
.setView(dialogView)
.setPositiveButton("OK") { dialog, _ ->
getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit()
.putInt("custom_theme_int", passedColor).apply()
logger("Custom Theme: $passedColor")
dialog.dismiss()
restartApp()
}
.setNegativeButton("Cancel") { dialog, _ ->
dialog.dismiss()
}
.create()
val colorPickerView =
dialogView.findViewById<com.skydoves.colorpickerview.ColorPickerView>(R.id.colorPickerView)
colorPickerView.setColorListener(ColorListener { color, fromUser ->
val linearLayout = dialogView.findViewById<LinearLayout>(R.id.linear)
passedColor = color
linearLayout.setBackgroundColor(color)
})
alertDialog.show()
alertDialog.window?.setDimAmount(0.8f)
val originalColor = getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).getInt(
"custom_theme_int",
Color.parseColor("#6200EE")
)
val tag = "colorPicker"
SimpleColorDialog.build()
.title("Custom Theme")
.colorPreset(originalColor)
.colors(this, SimpleColorDialog.BEIGE_COLOR_PALLET)
.allowCustom(true)
.showOutline(0x46000000)
.gridNumColumn(5)
.choiceMode(SimpleColorDialog.SINGLE_CHOICE)
.neg()
.show(this, tag)
}
//val animeSource = loadData<Int>("settings_def_anime_source_s")?.let { if (it >= AnimeSources.names.size) 0 else it } ?: 0
@ -416,6 +408,7 @@ class SettingsActivity : AppCompatActivity() {
binding.settingsIncognito.setOnCheckedChangeListener { _, isChecked ->
getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit()
.putBoolean("incognito", isChecked).apply()
restartApp()
}
var previousStart: View = when (uiSettings.defaultStartUpTab) {
@ -770,6 +763,18 @@ class SettingsActivity : AppCompatActivity() {
}
}
override fun onResult(dialogTag: String, which: Int, extras: Bundle): Boolean {
if (which == BUTTON_POSITIVE) {
if (dialogTag == "colorPicker") {
val color = extras.getInt(SimpleColorDialog.COLOR)
getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit()
.putInt("custom_theme_int", color).apply()
logger("Custom Theme: $color")
}
}
return true
}
private fun restartApp() {
Snackbar.make(
binding.root,

View file

@ -113,19 +113,9 @@ class SettingsDialogFragment() : BottomSheetDialogFragment() {
}
PageType.HOME -> {
try {
val arrayOfFiles =
ContextCompat.getExternalFilesDirs(requireContext(), null)
startActivity(
if (loadData<Boolean>("sd_dl") == true && arrayOfFiles.size > 1 && arrayOfFiles[0] != null && arrayOfFiles[1] != null) {
val parentDirectory = arrayOfFiles[1].toString()
val intent = Intent(Intent.ACTION_VIEW)
intent.setDataAndType(Uri.parse(parentDirectory), "resource/folder")
} else Intent(DownloadManager.ACTION_VIEW_DOWNLOADS)
)
} catch (e: ActivityNotFoundException) {
toast(getString(R.string.file_manager_not_found))
}
val intent = Intent(activity, DownloadContainerActivity::class.java)
intent.putExtra("FRAGMENT_CLASS_NAME", OfflineMangaFragment::class.java.name)
startActivity(intent)
}
}

View file

@ -10,6 +10,7 @@ data class UserInterfaceSettings(
//App
var immersiveMode: Boolean = false,
var immersiveModeList: Boolean = false,
var smallView: Boolean = true,
var defaultStartUpTab: Int = 1,
var homeLayoutShow: MutableList<Boolean> = mutableListOf(

View file

@ -68,6 +68,12 @@ class UserInterfaceSettingsActivity : AppCompatActivity() {
saveData(ui, settings)
restartApp()
}
binding.uiSettingsImmersiveList.isChecked = settings.immersiveModeList
binding.uiSettingsImmersiveList.setOnCheckedChangeListener { _, isChecked ->
settings.immersiveModeList = isChecked
saveData(ui, settings)
restartApp()
}
binding.uiSettingsBannerAnimation.isChecked = settings.bannerAnimations
binding.uiSettingsBannerAnimation.setOnCheckedChangeListener { _, isChecked ->

View file

@ -0,0 +1,106 @@
package ani.dantotsu.widgets
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
import android.widget.RemoteViews
import android.widget.RemoteViewsService
import androidx.core.net.toUri
import ani.dantotsu.R
import ani.dantotsu.logger
import java.io.InputStream
import java.net.HttpURLConnection
import java.net.URL
class CurrentlyAiringRemoteViewsFactory(private val context: Context, intent: Intent) : RemoteViewsService.RemoteViewsFactory {
private var widgetItems = mutableListOf<WidgetItem>()
override fun onCreate() {
// 4 items for testing
widgetItems.clear()
logger("CurrentlyAiringRemoteViewsFactory onCreate")
widgetItems = List(4) {
WidgetItem("Show $it", "$it days $it hours $it minutes", "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx14741-alxqoP4yx6WF.jpg")
}.toMutableList()
}
override fun onDataSetChanged() {
// 4 items for testing
logger("CurrentlyAiringRemoteViewsFactory onDataSetChanged")
widgetItems.clear()
widgetItems.add(WidgetItem("Show 1", "1 day 2 hours 3 minutes", "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx14741-alxqoP4yx6WF.jpg"))
widgetItems.add(WidgetItem("Show 2", "2 days 3 hours 4 minutes", "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx14741-alxqoP4yx6WF.jpg"))
widgetItems.add(WidgetItem("Show 3", "3 days 4 hours 5 minutes", "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx14741-alxqoP4yx6WF.jpg"))
widgetItems.add(WidgetItem("Show 4", "4 days 5 hours 6 minutes", "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx14741-alxqoP4yx6WF.jpg"))
widgetItems.add(WidgetItem("Show 5", "5 days 6 hours 7 minutes", "https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx14741-alxqoP4yx6WF.jpg"))
}
override fun onDestroy() {
widgetItems.clear()
}
override fun getCount(): Int {
return widgetItems.size
}
override fun getViewAt(position: Int): RemoteViews {
logger("CurrentlyAiringRemoteViewsFactory getViewAt")
val item = widgetItems[position]
val rv = RemoteViews(context.packageName, R.layout.item_currently_airing_widget).apply {
setTextViewText(R.id.text_show_title, item.title)
setTextViewText(R.id.text_show_countdown, item.countdown)
val bitmap = downloadImageAsBitmap(item.image)
//setImageViewUri(R.id.image_show_icon, Uri.parse(item.image))
setImageViewBitmap(R.id.image_show_icon, bitmap)
}
return rv
}
private fun downloadImageAsBitmap(imageUrl: String): Bitmap? {
var bitmap: Bitmap? = null
var inputStream: InputStream? = null
var urlConnection: HttpURLConnection? = null
try {
val url = URL(imageUrl)
urlConnection = url.openConnection() as HttpURLConnection
urlConnection.requestMethod = "GET"
urlConnection.connect()
if (urlConnection.responseCode == HttpURLConnection.HTTP_OK) {
inputStream = urlConnection.inputStream
bitmap = BitmapFactory.decodeStream(inputStream)
}
} catch (e: Exception) {
e.printStackTrace()
// Handle the error according to your needs
} finally {
// Clean up resources
inputStream?.close()
urlConnection?.disconnect()
}
return bitmap
}
override fun getLoadingView(): RemoteViews {
return RemoteViews(context.packageName, R.layout.item_currently_airing_widget)
}
override fun getViewTypeCount(): Int {
return 1
}
override fun getItemId(p0: Int): Long {
return p0.toLong()
}
override fun hasStableIds(): Boolean {
return true
}
}
data class WidgetItem(val title: String, val countdown: String, val image: String)

View file

@ -0,0 +1,11 @@
package ani.dantotsu.widgets
import android.content.Intent
import android.widget.RemoteViewsService
import ani.dantotsu.logger
class CurrentlyAiringRemoteViewsService : RemoteViewsService() {
override fun onGetViewFactory(intent: Intent): RemoteViewsFactory {
logger("CurrentlyAiringRemoteViewsFactory onGetViewFactory")
return CurrentlyAiringRemoteViewsFactory(applicationContext, intent)
}
}

View file

@ -0,0 +1,101 @@
package ani.dantotsu.widgets
import android.app.PendingIntent
import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.net.Uri
import android.widget.RemoteViews
import androidx.core.content.res.ResourcesCompat
import ani.dantotsu.R
/**
* Implementation of App Widget functionality.
* App Widget Configuration implemented in [CurrentlyAiringWidgetConfigureActivity]
*/
class CurrentlyAiringWidget : AppWidgetProvider() {
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
appWidgetIds.forEach { appWidgetId ->
val intent = Intent(context, CurrentlyAiringRemoteViewsService::class.java).apply {
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
data = Uri.parse(toUri(Intent.URI_INTENT_SCHEME))
}
val rv = RemoteViews(context.packageName, R.layout.currently_airing_widget).apply {
setRemoteAdapter(R.id.widgetListView, intent)
setEmptyView(R.id.widgetListView, R.id.empty_view)
}
appWidgetManager.updateAppWidget(appWidgetId, rv)
}
super.onUpdate(context, appWidgetManager, appWidgetIds)
}
override fun onDeleted(context: Context, appWidgetIds: IntArray) {
// When the user deletes the widget, delete the preference associated with it.
for (appWidgetId in appWidgetIds) {
deleteTitlePref(context, appWidgetId)
}
super.onDeleted(context, appWidgetIds)
}
override fun onEnabled(context: Context) {
super.onEnabled(context)
}
override fun onDisabled(context: Context) {
super.onDisabled(context)
}
companion object {
fun updateAppWidget(
context: Context,
appWidgetManager: AppWidgetManager,
appWidgetId: Int,
color: Int
) {
// Create an intent to launch the configuration activity when the widget is clicked
val intent = Intent(context, CurrentlyAiringWidgetConfigureActivity::class.java)
val pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE)
// Get the gradient drawable resource and update its start color with the user-selected color
val gradientDrawable = ResourcesCompat.getDrawable(context.resources, R.drawable.gradient_background, null) as GradientDrawable
gradientDrawable.colors = intArrayOf(color, Color.GRAY) // End color is gray.
// Create the RemoteViews object and set the background
val views = RemoteViews(context.packageName, R.layout.currently_airing_widget).apply {
//setImageViewBitmap(R.id.backgroundView, convertDrawableToBitmap(gradientDrawable))
//setOnClickPendingIntent(R.id.backgroundView, pendingIntent)
}
// Instruct the widget manager to update the widget
appWidgetManager.updateAppWidget(appWidgetId, views)
}
private fun convertDrawableToBitmap(drawable: Drawable): Bitmap {
val bitmap = Bitmap.createBitmap(100, 300, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
drawable.setBounds(0, 0, canvas.width, canvas.height)
drawable.draw(canvas)
return bitmap
}
}
}
internal fun updateAppWidget(
context: Context,
appWidgetManager: AppWidgetManager,
appWidgetId: Int
) {
val widgetText = loadTitlePref(context, appWidgetId)
// Construct the RemoteViews object
val views = RemoteViews(context.packageName, R.layout.currently_airing_widget)
views.setTextViewText(R.id.appwidget_text, widgetText)
// Instruct the widget manager to update the widget
appWidgetManager.updateAppWidget(appWidgetId, views)
}

View file

@ -0,0 +1,111 @@
package ani.dantotsu.widgets
import android.app.Activity
import android.appwidget.AppWidgetManager
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.EditText
import ani.dantotsu.R
import ani.dantotsu.databinding.CurrentlyAiringWidgetConfigureBinding
import ani.dantotsu.others.LangSet
import ani.dantotsu.themes.ThemeManager
/**
* The configuration screen for the [CurrentlyAiringWidget] AppWidget.
*/
class CurrentlyAiringWidgetConfigureActivity : Activity() {
private var appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID
private lateinit var appWidgetText: EditText
private var onClickListener = View.OnClickListener {
val context = this@CurrentlyAiringWidgetConfigureActivity
// When the button is clicked, store the string locally
val widgetText = appWidgetText.text.toString()
saveTitlePref(context, appWidgetId, widgetText)
// It is the responsibility of the configuration activity to update the app widget
val appWidgetManager = AppWidgetManager.getInstance(context)
//updateAppWidget(context, appWidgetManager, appWidgetId)
CurrentlyAiringWidget.updateAppWidget(
context,
appWidgetManager,
appWidgetId,
-1
)
// Make sure we pass back the original appWidgetId
val resultValue = Intent()
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
setResult(RESULT_OK, resultValue)
finish()
}
private lateinit var binding: CurrentlyAiringWidgetConfigureBinding
public override fun onCreate(icicle: Bundle?) {
LangSet.setLocale(this)
ThemeManager(this).applyTheme()
super.onCreate(icicle)
// Set the result to CANCELED. This will cause the widget host to cancel
// out of the widget placement if the user presses the back button.
setResult(RESULT_CANCELED)
binding = CurrentlyAiringWidgetConfigureBinding.inflate(layoutInflater)
setContentView(binding.root)
appWidgetText = binding.appwidgetText as EditText
binding.addButton.setOnClickListener(onClickListener)
// Find the widget id from the intent.
val intent = intent
val extras = intent.extras
if (extras != null) {
appWidgetId = extras.getInt(
AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID
)
}
// If this activity was started with an intent without an app widget ID, finish with an error.
if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
finish()
return
}
appWidgetText.setText(
loadTitlePref(
this@CurrentlyAiringWidgetConfigureActivity,
appWidgetId
)
)
}
}
private const val PREFS_NAME = "ani.dantotsu.parsers.CurrentlyAiringWidget"
private const val PREF_PREFIX_KEY = "appwidget_"
// Write the prefix to the SharedPreferences object for this widget
internal fun saveTitlePref(context: Context, appWidgetId: Int, text: String) {
val prefs = context.getSharedPreferences(PREFS_NAME, 0).edit()
prefs.putString(PREF_PREFIX_KEY + appWidgetId, text)
prefs.apply()
}
// Read the prefix from the SharedPreferences object for this widget.
// If there is no preference saved, get the default from a resource
internal fun loadTitlePref(context: Context, appWidgetId: Int): String {
val prefs = context.getSharedPreferences(PREFS_NAME, 0)
val titleValue = prefs.getString(PREF_PREFIX_KEY + appWidgetId, null)
return titleValue ?: context.getString(R.string.appwidget_text)
}
internal fun deleteTitlePref(context: Context, appWidgetId: Int) {
val prefs = context.getSharedPreferences(PREFS_NAME, 0).edit()
prefs.remove(PREF_PREFIX_KEY + appWidgetId)
prefs.apply()
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?><!--
Background for widgets to make the rounded corners based on the
appWidgetRadius attribute value
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="?attr/appWidgetRadius" />
<solid android:color="?android:attr/colorBackground" />
</shape>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?><!--
Background for views inside widgets to make the rounded corners based on the
appWidgetInnerRadius attribute value
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="?attr/appWidgetInnerRadius" />
<solid android:color="?android:attr/colorAccent" />
</shape>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:endColor="@color/grey_20"
android:startColor="#B313DC" />
</shape>

View file

@ -0,0 +1,42 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="768dp"
android:height="768dp"
android:viewportWidth="768"
android:viewportHeight="768">
<group>
<clip-path
android:pathData="M128,384a256,255.96 0,1 0,512 0a256,255.96 0,1 0,-512 0z"/>
<path
android:pathData="M128,128h512v511.96h-512z"
android:strokeWidth="0"
android:fillColor="#ff00f4"/>
<path
android:pathData="m128,128v335.26c23.32,3.7 47.23,5.63 71.58,5.63 211.59,0 389.34,-144.9 439.43,-340.89H128Z"
android:strokeWidth="0"
android:fillColor="#7000b8"/>
<path
android:pathData="M384,384m-172.26,0a172.26,172.26 0,1 1,344.52 0a172.26,172.26 0,1 1,-344.52 0"
android:strokeWidth="0"
android:fillColor="#d300e5"/>
<path
android:pathData="m384,211.74c-95.13,0 -172.26,77.12 -172.26,172.26 0,24.51 5.13,47.83 14.37,68.93 89.21,-7.3 172.93,-33.96 246.97,-75.77 24.85,-18.81 47.7,-40.12 68.18,-63.56 -26.92,-60.04 -87.2,-101.86 -157.25,-101.86Z"
android:strokeWidth="0"
android:fillColor="#9000d1"/>
<path
android:pathData="m539.28,128c-35.57,189.07 -201.56,332.12 -400.97,332.12 -3.45,0 -6.89,-0.06 -10.31,-0.14v5.75c40.23,10.46 82.43,16.05 125.93,16.05 155.6,0 294.55,-71.23 386.07,-182.84v-170.93h-100.72Z"
android:strokeWidth="0"
android:fillColor="#a800d9"/>
<path
android:pathData="m44.26,128c0,46.25 37.49,83.74 83.74,83.74h256c95.13,0 172.26,77.12 172.26,172.26h0c0,95.13 -77.12,172.26 -172.26,172.26H128c-46.24,0 -83.72,37.47 -83.74,83.71h723.74V128H44.26Z"
android:strokeWidth="0"
android:fillColor="#1f1f30"/>
<path
android:pathData="m481.82,384h0c0,54.03 -43.8,97.82 -97.82,97.82H0v-195.64h384c54.02,0 97.82,43.8 97.82,97.82Z"
android:strokeWidth="0"
android:fillColor="#1f1f30"/>
<path
android:pathData="m442,366.7l-76.02,-43.89c-13.32,-7.69 -29.96,1.92 -29.96,17.3v87.78c0,15.38 16.65,24.99 29.96,17.3l76.02,-43.89c13.32,-7.69 13.32,-26.91 0,-34.6Z"
android:strokeWidth="0"
android:fillColor="#efe7ff"/>
</group>
</vector>

View file

@ -1,4 +1,4 @@
<vector android:height="24dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
android:viewportWidth="24" android:width="24dp" android:tint="?attr/colorControlNormal" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#000000" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
</vector>

View file

@ -28,21 +28,19 @@
<TextView
android:id="@+id/listTitle"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:layout_marginStart="32dp"
android:fontFamily="@font/poppins_bold"
android:gravity="center"
android:gravity="center|start"
android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"
android:textSize="16sp"
android:singleLine="true"
android:textColor="?attr/colorOnBackground"
android:ellipsize="end"
tools:text="@string/app_name" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageButton
android:id="@+id/random"
android:layout_width="48dp"

View file

@ -121,6 +121,28 @@
</com.google.android.material.materialswitch.MaterialSwitch>
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/uiSettingsImmersiveList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:checked="true"
android:drawableStart="@drawable/ic_round_fullscreen_24"
android:drawablePadding="16dp"
app:drawableTint="?attr/colorPrimary"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:text="@string/immersive_modelist"
android:textAlignment="viewStart"
android:textColor="?attr/colorOnBackground"
app:cornerRadius="0dp"
app:showText="false"
app:thumbTint="@color/button_switch_track">
</com.google.android.material.switchmaterial.SwitchMaterial>
<View
android:layout_width="match_parent"
android:layout_height="1dp"

View file

@ -0,0 +1,57 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/Theme.Dantotsu.AppWidgetContainer">
<ImageView
android:id="@+id/backgroundView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/gradient_background" />
<RelativeLayout
android:id="@+id/widgetContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<ImageView
android:id="@+id/logoView"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:foregroundGravity="center_vertical"
android:src="@drawable/ic_dantotsu_round" />
<TextView
android:id="@+id/widgetTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="0dp"
android:layout_toEndOf="@+id/logoView"
android:gravity="center_vertical"
android:text="Currently Airing"
android:textSize="18sp"
android:textStyle="bold" />
<ListView
android:id="@+id/widgetListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/widgetTitle"/>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/empty_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="#ffffff"
android:textStyle="bold"
android:text="No shows to display"
android:textSize="20sp" />
</RelativeLayout>
</RelativeLayout>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:labelFor="@id/appwidget_text"
android:text="@string/configure" />
<EditText
android:id="@+id/appwidget_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
<Button
android:id="@+id/add_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/add_widget" />
</LinearLayout>

View file

@ -1,16 +0,0 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/linear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<com.skydoves.colorpickerview.ColorPickerView
android:id="@+id/colorPickerView"
app:initialColor="?attr/colorPrimary"
app:debounceDuration="200"
android:layout_width="300dp"
android:layout_height="300dp" />
</LinearLayout>

View file

@ -12,17 +12,34 @@
android:id="@+id/homeScroll"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/homeContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/incognitoView"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:orientation="horizontal"
android:visibility="gone"/>
<TextView
android:id="@+id/incognitoTextView"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Incognito Mode"
android:fontFamily="@font/poppins_bold"
android:textSize="11sp"
android:textColor="#4f2dbd"
android:layout_gravity="bottom|center_horizontal"
android:background="#00FFFFFF"
android:padding="8dp"
android:visibility="gone"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.flaviofaria.kenburnsview.KenBurnsView
android:id="@+id/homeUserBg"
android:layout_width="match_parent"

View file

@ -8,7 +8,26 @@
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/incognitoView"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:orientation="horizontal"
android:background="?attr/colorPrimary"
android:visibility="gone"/>
<TextView
android:id="@+id/incognitoTextView"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Incognito Mode"
android:fontFamily="@font/poppins_bold"
android:textSize="11sp"
android:textColor="#4f2dbd"
android:layout_gravity="bottom|center_horizontal"
android:background="#00FFFFFF"
android:padding="8dp"
android:visibility="gone"/>
<FrameLayout
android:id="@+id/animeTrendingContainer"
android:layout_width="match_parent"

View file

@ -30,10 +30,9 @@
android:text="@string/play_yt"
android:textColor="@color/bg_white"
android:fontFamily="@font/poppins_bold"
android:visibility="gone"
app:cornerRadius="12dp"
app:icon="@drawable/ic_round_play_circle_24"
app:iconTint="?attr/colorOnSecondaryContainer"
app:iconTint="@color/bg_white"
tools:ignore="TextContrastCheck" />
<TextView

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -8,60 +8,60 @@
android:background="@drawable/card_outline"
app:cardCornerRadius="12dp">
<LinearLayout
android:layout_width="312dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
android:gravity="center_vertical"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/listAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurface"
android:theme="@style/Theme.Dantotsu.AppBarOverlay">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:fontFamily="@font/poppins_bold"
android:singleLine="true"
android:text=""
android:textSize="14dp"
tools:ignore="SpUsage" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_bold"
android:text=""
android:textSize="14dp"
tools:ignore="SpUsage" />
android:layout_width="match_parent"
android:layout_height="65dp"
android:orientation="horizontal"
android:gravity="center">
<TextView
android:id="@+id/itemChapterNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="48dp"
android:layout_marginStart="10dp"
android:fontFamily="@font/poppins_bold"
android:maxWidth="250dp"
android:paddingEnd="8dp"
android:gravity="center|start"
android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"
android:textSize="16sp"
android:singleLine="true"
android:textSize="14dp"
tools:ignore="SpUsage"
android:textColor="?attr/colorOnBackground"
android:ellipsize="end"
tools:text="1" />
</LinearLayout>
<ImageButton
android:id="@+id/itemEpisodeViewed"
android:layout_width="24dp"
android:layout_height="48dp"
android:layout_marginEnd="5dp"
android:background="?android:attr/selectableItemBackground"
app:tint="?attr/colorOnBackground"
app:srcCompat="@drawable/ic_round_remove_red_eye_24" />
<ImageButton
android:id="@+id/itemDownload"
android:layout_width="24dp"
android:layout_height="48dp"
android:layout_marginEnd="5dp"
android:background="?android:attr/selectableItemBackground"
app:tint="?attr/colorOnBackground"
app:srcCompat="@drawable/ic_round_download_24" />
</LinearLayout>
<TextView
android:id="@+id/itemChapterTitle"
android:layout_width="312dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="-10dp"
android:layout_marginBottom="10dp"
android:alpha="0.66"
android:ellipsize="end"
android:fontFamily="@font/poppins_bold"
@ -69,17 +69,7 @@
android:textSize="14dp"
android:visibility="gone"
tools:ignore="SpUsage" />
</LinearLayout>
<ImageView
android:id="@+id/itemDownload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="8dp"
app:srcCompat="@drawable/ic_round_download_24"
tools:ignore="ContentDescription" />
</com.google.android.material.appbar.AppBarLayout>
<View
android:id="@+id/itemEpisodeViewedCover"
@ -89,13 +79,4 @@
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|center_vertical"
android:layout_marginEnd="40dp"
app:srcCompat="@drawable/ic_round_remove_red_eye_24"
tools:ignore="ContentDescription" />
</androidx.cardview.widget.CardView>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/image_show_icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/ic_launcher_foreground"
android:contentDescription="@string/airing_image" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:layout_marginStart="8dp">
<TextView
android:id="@+id/text_show_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="@color/bg_white"
android:text="Placeholder Title"
android:fontFamily="@font/poppins_bold" />
<TextView
android:id="@+id/text_show_countdown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@color/grey_60"
android:text="Placeholder Countdown"
android:fontFamily="@font/poppins" />
</LinearLayout>
</LinearLayout>

View file

@ -6,15 +6,6 @@
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/dialog_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/incognito_will_not_update"
android:paddingBottom="16dp"
android:textSize="12sp"
android:fontFamily="@font/poppins_bold"/>
<CheckBox
android:id="@+id/dialog_checkbox"
android:layout_width="match_parent"

View file

@ -8,7 +8,26 @@
android:layout_marginStart="-16dp"
android:layout_marginEnd="-16dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/incognitoView"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:orientation="horizontal"
android:background="?attr/colorPrimary"
android:visibility="gone"/>
<TextView
android:id="@+id/incognitoTextView"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Incognito Mode"
android:fontFamily="@font/poppins_bold"
android:textSize="11sp"
android:textColor="#4f2dbd"
android:layout_gravity="bottom|center_horizontal"
android:background="#00FFFFFF"
android:padding="8dp"
android:visibility="gone"/>
<FrameLayout
android:id="@+id/mangaTrendingContainer"
android:layout_width="match_parent"

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Having themes.xml for night-v31 because of the priority order of the resource qualifiers.
-->
<style name="Theme.Dantotsu.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault.DayNight">
<item name="appWidgetRadius">@android:dimen/system_app_widget_background_radius</item>
<item name="appWidgetInnerRadius">@android:dimen/system_app_widget_inner_radius</item>
</style>
</resources>

View file

@ -0,0 +1,14 @@
<resources>
<style name="Widget.Dantotsu.AppWidget.Container" parent="android:Widget">
<item name="android:id">@android:id/background</item>
<item name="android:padding">?attr/appWidgetPadding</item>
<item name="android:background">@drawable/app_widget_background</item>
</style>
<style name="Widget.Dantotsu.AppWidget.InnerView" parent="android:Widget">
<item name="android:padding">?attr/appWidgetPadding</item>
<item name="android:background">@drawable/app_widget_inner_view_background</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
</resources>

View file

@ -0,0 +1,16 @@
<resources>
<style name="Widget.Dantotsu.AppWidget.Container" parent="android:Widget">
<item name="android:id">@android:id/background</item>
<item name="android:padding">?attr/appWidgetPadding</item>
<item name="android:background">@drawable/app_widget_background</item>
<item name="android:clipToOutline">true</item>
</style>
<style name="Widget.Dantotsu.AppWidget.InnerView" parent="android:Widget">
<item name="android:padding">?attr/appWidgetPadding</item>
<item name="android:background">@drawable/app_widget_inner_view_background</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:clipToOutline">true</item>
</style>
</resources>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Having themes.xml for v31 variant because @android:dimen/system_app_widget_background_radius
and @android:dimen/system_app_widget_internal_padding requires API level 31
-->
<style name="Theme.Dantotsu.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault.DayNight">
<item name="appWidgetRadius">@android:dimen/system_app_widget_background_radius</item>
<item name="appWidgetInnerRadius">@android:dimen/system_app_widget_inner_radius</item>
</style>
</resources>

View file

@ -0,0 +1,7 @@
<resources>
<declare-styleable name="AppWidgetAttrs">
<attr name="appWidgetPadding" format="dimension" />
<attr name="appWidgetInnerRadius" format="dimension" />
<attr name="appWidgetRadius" format="dimension" />
</declare-styleable>
</resources>

View file

@ -274,14 +274,19 @@
<color name="md_theme_dark_4_outlineVariant">#504349</color>
<color name="md_theme_dark_4_scrim">#000000</color>
<color name="seed_7">#FF007F</color> <!-- if there are any issues with Saikou theme message @Wai What to get it fixed, unallocated colors are also set to "#00FF00" as they are not yet being used-->
<color name="seed_7">#FF007F
</color> <!-- if there are any issues with Saikou theme message @Wai What to get it fixed, unallocated colors are also set to "#00FF00" as they are not yet being used-->
<color name="md_theme_light_5_primary">#FF007F</color>
<color name="md_theme_light_5_onPrimary">#EEEEEE</color> <!-- good but shared with anime and manga list headers -->
<color name="md_theme_light_5_primaryContainer">#000000</color> <!-- good-ish, it's shared with slider colors so I've had to set it to "#000000" instead of "#78757C" -->
<color name="md_theme_light_5_onPrimaryContainer">#FF007F</color> <!-- good (login button text, "#EEEEEE" also works) -->
<color name="md_theme_light_5_onPrimary">#EEEEEE
</color> <!-- good but shared with anime and manga list headers -->
<color name="md_theme_light_5_primaryContainer">#000000
</color> <!-- good-ish, it's shared with slider colors so I've had to set it to "#000000" instead of "#78757C" -->
<color name="md_theme_light_5_onPrimaryContainer">#FF007F
</color> <!-- good (login button text, "#EEEEEE" also works) -->
<color name="md_theme_light_5_secondary">#91A6FF</color>
<color name="md_theme_light_5_onSecondary">#EEEEEE</color>
<color name="md_theme_light_5_secondaryContainer">#91A6FF</color> <!-- good but shared with youtube play -->
<color name="md_theme_light_5_secondaryContainer">#91A6FF
</color> <!-- good but shared with youtube play -->
<color name="md_theme_light_5_onSecondaryContainer">#EEEEEE</color>
<color name="md_theme_light_5_tertiary">#91A6FF</color>
<color name="md_theme_light_5_onTertiary">#00FF00</color>
@ -306,12 +311,16 @@
<color name="md_theme_light_5_outlineVariant">#00FF00</color>
<color name="md_theme_light_5_scrim">#00FF00</color>
<color name="md_theme_dark_5_primary">#FF5DAE</color>
<color name="md_theme_dark_5_onPrimary">#EEEEEE</color> <!-- good but shared with anime and manga list headers -->
<color name="md_theme_dark_5_primaryContainer">#EEEEEE</color> <!-- good-ish, it's shared with slider colors so I've had to set it to "#EEEEEE" instead of "#928F98" -->
<color name="md_theme_dark_5_onPrimaryContainer">#FF5DAE</color> <!-- good (login button text, "#000000" also works) -->
<color name="md_theme_dark_5_onPrimary">#EEEEEE
</color> <!-- good but shared with anime and manga list headers -->
<color name="md_theme_dark_5_primaryContainer">#EEEEEE
</color> <!-- good-ish, it's shared with slider colors so I've had to set it to "#EEEEEE" instead of "#928F98" -->
<color name="md_theme_dark_5_onPrimaryContainer">#FF5DAE
</color> <!-- good (login button text, "#000000" also works) -->
<color name="md_theme_dark_5_secondary">#91A6FF</color>
<color name="md_theme_dark_5_onSecondary">#EEEEEE</color>
<color name="md_theme_dark_5_secondaryContainer">#91A6FF</color> <!-- good but shared with youtube play -->
<color name="md_theme_dark_5_secondaryContainer">#91A6FF
</color> <!-- good but shared with youtube play -->
<color name="md_theme_dark_5_onSecondaryContainer">#EEEEEE</color>
<color name="md_theme_dark_5_tertiary">#91A6FF</color>
<color name="md_theme_dark_5_onTertiary">#00FF00</color>
@ -463,4 +472,8 @@
<color name="CustomColor2">#68AF86</color>
<color name="CustomColor3">#0096AE</color>
<color name="CustomColor4">#000000</color>
<color name="light_blue_50">#FFE1F5FE</color>
<color name="light_blue_200">#FF81D4FA</color>
<color name="light_blue_600">#FF039BE5</color>
<color name="light_blue_900">#FF01579B</color>
</resources>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Refer to App Widget Documentation for margin information
http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
-->
<dimen name="widget_margin">0dp</dimen>
</resources>

View file

@ -1,5 +1,4 @@
<resources xmlns:tools="http://schemas.android.com/tools"
tools:locale="en-rUS">
<resources xmlns:tools="http://schemas.android.com/tools" tools:locale="en-rUS">
<string name="repo">rebelonion/Dantotsu</string>
<string name="preference_file_key" translatable="false">dantotsuprefs</string>
@ -268,6 +267,7 @@
<string name="app">App</string>
<string name="immersive_mode">Hide Status Bar</string>
<string name="immersive_modelist">Hide Status Bar for list</string>
<string name="immersive_mode_info">Requires App restart to fully apply.</string>
<string name="home_layout_show">Show/Hide Layouts on Home</string>
<string-array name="home_layouts">
@ -643,5 +643,10 @@
<string name="color_picker">Color Picker</string>
<string name="random_selection">Random Selection</string>
<string name="incognito_mode">Incognito Mode</string>
<string name="appwidget_text">EXAMPLE</string>
<string name="configure">Configure</string>
<string name="add_widget">Add widget</string>
<string name="app_widget_description">This is an app widget description</string>
<string name="airing_image">Airing Image</string>
</resources>

View file

@ -67,7 +67,6 @@
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:textSize">14sp</item>
</style>
<style name="BottomNavBar" parent="">

View file

@ -0,0 +1,12 @@
<resources>
<style name="Widget.Dantotsu.AppWidget.Container" parent="android:Widget">
<item name="android:id">@android:id/background</item>
<item name="android:background">?android:attr/colorBackground</item>
</style>
<style name="Widget.Dantotsu.AppWidget.InnerView" parent="android:Widget">
<item name="android:background">?android:attr/colorBackground</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
</resources>

View file

@ -1,4 +1,5 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.Base" parent="Theme.Material3.DayNight">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">?android:colorBackground</item>
@ -12,12 +13,17 @@
<item name="android:ambientShadowAlpha">0.08</item>
<item name="android:spotShadowAlpha">0.08</item>
<item name="snackbarStyle">@style/MySnackbar</item>
<item name="snackbarButtonStyle">@style/Widget.MaterialComponents.Button.TextButton.Snackbar</item>
<item name="snackbarButtonStyle">
@style/Widget.MaterialComponents.Button.TextButton.Snackbar
</item>
<item name="snackbarTextViewStyle">@string/MySnackBarText</item>
<item name="popupMenuStyle">@style/MyPopup</item>
<item name="android:windowSplashScreenAnimationDuration" tools:targetApi="s">1000</item>
<item name="android:windowSplashScreenAnimatedIcon" tools:targetApi="s">@drawable/anim_splash</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges</item>
<item name="android:windowSplashScreenAnimatedIcon" tools:targetApi="s">
@drawable/anim_splash
</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges
</item>
</style>
<style name="Theme.Dantotsu" parent="Theme.Base">
@ -30,6 +36,7 @@
</style>
<style name="Theme.Dantotsu.AppBarOverlay" parent="Theme.Dantotsu" />
<style name="Theme.Dantotsu.PopupOverlay" parent="Theme.Dantotsu" />
<style name="Theme.Dantotsu.NeverCutout" parent="@style/Theme.Dantotsu.NoActionBar">
@ -307,4 +314,19 @@
<item name="colorPrimaryInverse">@color/md_theme_light_5_inversePrimary</item>
</style>
<style name="Theme.Dantotsu.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault">
<!-- Radius of the outer bound of widgets to make the rounded corners -->
<item name="appWidgetRadius">16dp</item>
<!--
Radius of the inner view's bound of widgets to make the rounded corners.
It needs to be 8dp or less than the value of appWidgetRadius
-->
<item name="appWidgetInnerRadius">8dp</item>
</style>
<style name="Theme.Dantotsu.AppWidgetContainer" parent="Theme.Dantotsu.AppWidgetContainerParent">
<!-- Apply padding to avoid the content of the widget colliding with the rounded corners -->
<item name="appWidgetPadding">16dp</item>
</style>
</resources>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/app_widget_description"
android:initialKeyguardLayout="@layout/currently_airing_widget"
android:initialLayout="@layout/currently_airing_widget"
android:minWidth="160dp"
android:minHeight="160dp"
android:previewImage="@drawable/example_appwidget_preview"
android:previewLayout="@layout/currently_airing_widget"
android:resizeMode="horizontal|vertical"
android:targetCellWidth="1"
android:targetCellHeight="1"
android:updatePeriodMillis="86400000"
android:widgetCategory="home_screen">
</appwidget-provider>