widget outline

This commit is contained in:
Finnley Somdahl 2023-12-09 14:09:24 -06:00
parent 82bc215da5
commit b6be7075b0
23 changed files with 681 additions and 21 deletions

View file

@ -795,7 +795,7 @@ class MangaReaderActivity : AppCompatActivity() {
private fun progress(runnable: Runnable) { private fun progress(runnable: Runnable) {
if (maxChapterPage - currentChapterPage <= 1 && Anilist.userid != null) { if (maxChapterPage - currentChapterPage <= 1 && Anilist.userid != null) {
if (showProgressDialog) { if (showProgressDialog) {
val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null) val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null)
val checkbox = dialogView.findViewById<CheckBox>(R.id.dialog_checkbox) val checkbox = dialogView.findViewById<CheckBox>(R.id.dialog_checkbox)
checkbox.text = getString(R.string.dont_ask_again, media.userPreferredName) checkbox.text = getString(R.string.dont_ask_again, media.userPreferredName)
@ -810,7 +810,7 @@ class MangaReaderActivity : AppCompatActivity() {
.setCancelable(false) .setCancelable(false)
.setPositiveButton(getString(R.string.yes)) { dialog, _ -> .setPositiveButton(getString(R.string.yes)) { dialog, _ ->
saveData("${media.id}_save_progress", true) saveData("${media.id}_save_progress", true)
updateProgress( updateProgress(
media, media,
MangaNameAdapter.findChapterNumber(media.manga!!.selectedChapter!!) MangaNameAdapter.findChapterNumber(media.manga!!.selectedChapter!!)
.toString() .toString()

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()
}

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

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

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

@ -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_outlineVariant">#504349</color>
<color name="md_theme_dark_4_scrim">#000000</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_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_onPrimary">#EEEEEE
<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> <!-- good but shared with anime and manga list headers -->
<color name="md_theme_light_5_onPrimaryContainer">#FF007F</color> <!-- good (login button text, "#EEEEEE" also works) --> <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_secondary">#91A6FF</color>
<color name="md_theme_light_5_onSecondary">#EEEEEE</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_onSecondaryContainer">#EEEEEE</color>
<color name="md_theme_light_5_tertiary">#91A6FF</color> <color name="md_theme_light_5_tertiary">#91A6FF</color>
<color name="md_theme_light_5_onTertiary">#00FF00</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_outlineVariant">#00FF00</color>
<color name="md_theme_light_5_scrim">#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_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_onPrimary">#EEEEEE
<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> <!-- good but shared with anime and manga list headers -->
<color name="md_theme_dark_5_onPrimaryContainer">#FF5DAE</color> <!-- good (login button text, "#000000" also works) --> <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_secondary">#91A6FF</color>
<color name="md_theme_dark_5_onSecondary">#EEEEEE</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_onSecondaryContainer">#EEEEEE</color>
<color name="md_theme_dark_5_tertiary">#91A6FF</color> <color name="md_theme_dark_5_tertiary">#91A6FF</color>
<color name="md_theme_dark_5_onTertiary">#00FF00</color> <color name="md_theme_dark_5_onTertiary">#00FF00</color>
@ -463,4 +472,8 @@
<color name="CustomColor2">#68AF86</color> <color name="CustomColor2">#68AF86</color>
<color name="CustomColor3">#0096AE</color> <color name="CustomColor3">#0096AE</color>
<color name="CustomColor4">#000000</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> </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" <resources xmlns:tools="http://schemas.android.com/tools" tools:locale="en-rUS">
tools:locale="en-rUS">
<string name="repo">rebelonion/Dantotsu</string> <string name="repo">rebelonion/Dantotsu</string>
<string name="preference_file_key" translatable="false">dantotsuprefs</string> <string name="preference_file_key" translatable="false">dantotsuprefs</string>
@ -506,9 +505,9 @@
<string name="yes">Yes</string> <string name="yes">Yes</string>
<string name="no">No</string> <string name="no">No</string>
<string name="close">Close</string> <string name="close">Close</string>
<string name= "no_chapter">No Chapter</string> <string name="no_chapter">No Chapter</string>
<string name= "content_18">Turn on 18+ Content from your Anilist Settings</string> <string name="content_18">Turn on 18+ Content from your Anilist Settings</string>
<string name= "available">Available</string> <string name="available">Available</string>
<string name="lets_go">Let\'s Go</string> <string name="lets_go">Let\'s Go</string>
<string name="cope">Cope</string> <string name="cope">Cope</string>
@ -598,7 +597,7 @@
<string name="question_17">Some useful tips and tricks</string> <string name="question_17">Some useful tips and tricks</string>
<string name="answer_17">The following presents some tips and tricks you may or may not know about - \n \n \n - By hold pressing the Dantotsu logo in settings, you can check if there are any new updates manually. \n \n - Hold pressing an error message/tag/synonym or title will copy it. \n \n - You can open an episode with other apps by hold pressing any server for that episode. This helps in streaming the episode using other video players or download the episode using download managers. \n \n - You can set up custom lists using this [link](https://anilist.co/settings/lists). (you need to be signed in) \n \n - If your episode/chapter is not being progressed automatically after you finish watching/reading it, then hold press the status bar(planning/repeating/watching button) of that anime/manga. The next time you start a chapter/finish an episode, you will stumble upon a popup. Press yes there. </string> <string name="answer_17">The following presents some tips and tricks you may or may not know about - \n \n \n - By hold pressing the Dantotsu logo in settings, you can check if there are any new updates manually. \n \n - Hold pressing an error message/tag/synonym or title will copy it. \n \n - You can open an episode with other apps by hold pressing any server for that episode. This helps in streaming the episode using other video players or download the episode using download managers. \n \n - You can set up custom lists using this [link](https://anilist.co/settings/lists). (you need to be signed in) \n \n - If your episode/chapter is not being progressed automatically after you finish watching/reading it, then hold press the status bar(planning/repeating/watching button) of that anime/manga. The next time you start a chapter/finish an episode, you will stumble upon a popup. Press yes there. </string>
<string name="subscribed_notification">Subscribed! Receiving notifications, when new episodes are released on %1$s.</string> <string name="subscribed_notification">Subscribed! Receiving notifications, when new episodes are released on %1$s.</string>
@ -643,5 +642,10 @@
<string name="color_picker">Color Picker</string> <string name="color_picker">Color Picker</string>
<string name="random_selection">Random Selection</string> <string name="random_selection">Random Selection</string>
<string name="incognito_mode">Incognito Mode</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> </resources>

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"> <resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.Base" parent="Theme.Material3.DayNight"> <style name="Theme.Base" parent="Theme.Material3.DayNight">
<item name="android:statusBarColor">@android:color/transparent</item> <item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">?android:colorBackground</item> <item name="android:navigationBarColor">?android:colorBackground</item>
@ -12,16 +13,21 @@
<item name="android:ambientShadowAlpha">0.08</item> <item name="android:ambientShadowAlpha">0.08</item>
<item name="android:spotShadowAlpha">0.08</item> <item name="android:spotShadowAlpha">0.08</item>
<item name="snackbarStyle">@style/MySnackbar</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="snackbarTextViewStyle">@string/MySnackBarText</item>
<item name="popupMenuStyle">@style/MyPopup</item> <item name="popupMenuStyle">@style/MyPopup</item>
<item name="android:windowSplashScreenAnimationDuration" tools:targetApi="s">1000</item> <item name="android:windowSplashScreenAnimationDuration" tools:targetApi="s">1000</item>
<item name="android:windowSplashScreenAnimatedIcon" tools:targetApi="s">@drawable/anim_splash</item> <item name="android:windowSplashScreenAnimatedIcon" tools:targetApi="s">
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges</item> @drawable/anim_splash
</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges
</item>
</style> </style>
<style name="Theme.Dantotsu" parent="Theme.Base"> <style name="Theme.Dantotsu" parent="Theme.Base">
<item name="android:windowLightStatusBar" >true</item> <item name="android:windowLightStatusBar">true</item>
</style> </style>
<style name="Theme.Dantotsu.NoActionBar"> <style name="Theme.Dantotsu.NoActionBar">
@ -30,6 +36,7 @@
</style> </style>
<style name="Theme.Dantotsu.AppBarOverlay" parent="Theme.Dantotsu" /> <style name="Theme.Dantotsu.AppBarOverlay" parent="Theme.Dantotsu" />
<style name="Theme.Dantotsu.PopupOverlay" parent="Theme.Dantotsu" /> <style name="Theme.Dantotsu.PopupOverlay" parent="Theme.Dantotsu" />
<style name="Theme.Dantotsu.NeverCutout" parent="@style/Theme.Dantotsu.NoActionBar"> <style name="Theme.Dantotsu.NeverCutout" parent="@style/Theme.Dantotsu.NoActionBar">
@ -307,4 +314,19 @@
<item name="colorPrimaryInverse">@color/md_theme_light_5_inversePrimary</item> <item name="colorPrimaryInverse">@color/md_theme_light_5_inversePrimary</item>
</style> </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> </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>