mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-24 01:51:01 +00:00
Merge branch 'dev' into zephyr
This commit is contained in:
@@ -49,31 +49,38 @@
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:banner="@mipmap/ic_banner_foreground"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
android:icon="${icon_placeholder}"
|
||||
android:label="@string/app_name"
|
||||
android:largeHeap="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
android:roundIcon="${icon_placeholder_round}"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Dantotsu"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:ignore="AllowBackup"
|
||||
tools:targetApi="tiramisu">
|
||||
|
||||
<receiver
|
||||
android:name=".widgets.CurrentlyAiringWidget"
|
||||
android:exported="false">
|
||||
android:name=".widgets.upcoming.UpcomingWidget"
|
||||
android:exported="true">
|
||||
<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" />
|
||||
android:resource="@xml/upcoming_widget_info" />
|
||||
</receiver>
|
||||
<activity
|
||||
android:name=".widgets.upcoming.UpcomingWidgetConfigureActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<receiver android:name=".notifications.IncognitoNotificationClickReceiver" />
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".media.novel.novelreader.NovelReaderActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
@@ -106,27 +113,25 @@
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity
|
||||
android:name=".settings.ExtensionsActivity"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
android:parentActivityName=".MainActivity"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden" />
|
||||
<activity
|
||||
android:name=".profile.ProfileActivity"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
android:parentActivityName=".MainActivity"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden" />
|
||||
<activity
|
||||
android:name=".profile.FollowActivity"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
android:parentActivityName=".MainActivity"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden" />
|
||||
<activity
|
||||
android:name=".profile.activity.FeedActivity"
|
||||
android:label="Inbox Activity"
|
||||
android:configChanges="orientation|screenSize|screenLayout"
|
||||
android:parentActivityName=".MainActivity" >
|
||||
</activity>
|
||||
android:label="Inbox Activity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity
|
||||
android:name=".profile.activity.NotificationActivity"
|
||||
android:label="Inbox Activity"
|
||||
android:parentActivityName=".MainActivity" >
|
||||
</activity>
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity
|
||||
android:name=".others.imagesearch.ImageSearchActivity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
@@ -139,8 +144,9 @@
|
||||
android:name=".media.CalendarActivity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity android:name=".media.user.ListActivity" />
|
||||
<activity android:name=".profile.SingleStatActivity"
|
||||
android:parentActivityName=".profile.ProfileActivity"/>
|
||||
<activity
|
||||
android:name=".profile.SingleStatActivity"
|
||||
android:parentActivityName=".profile.ProfileActivity" />
|
||||
<activity
|
||||
android:name=".media.manga.mangareader.MangaReaderActivity"
|
||||
android:excludeFromRecents="true"
|
||||
@@ -152,7 +158,7 @@
|
||||
android:name=".media.MediaDetailsActivity"
|
||||
android:parentActivityName=".MainActivity"
|
||||
android:theme="@style/Theme.Dantotsu.NeverCutout"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"/>
|
||||
android:windowSoftInputMode="adjustResize|stateHidden" />
|
||||
<activity android:name=".media.CharacterDetailsActivity" />
|
||||
<activity android:name=".home.NoInternet" />
|
||||
<activity
|
||||
@@ -234,7 +240,6 @@
|
||||
<data android:host="discord.dantotsu.com" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".connections.anilist.UrlMedia"
|
||||
android:configChanges="orientation|screenSize|layoutDirection"
|
||||
@@ -293,7 +298,9 @@
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="content" />
|
||||
<data android:mimeType="*/*" />
|
||||
<data android:pathPattern=".*\\.ani" />
|
||||
@@ -306,22 +313,23 @@
|
||||
android:exported="false"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
|
||||
|
||||
<receiver android:name=".notifications.AlarmPermissionStateReceiver"
|
||||
<receiver
|
||||
android:name=".notifications.AlarmPermissionStateReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.app.action.SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".notifications.BootCompletedReceiver"
|
||||
<receiver
|
||||
android:name=".notifications.BootCompletedReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".notifications.anilist.AnilistNotificationReceiver"/>
|
||||
<receiver android:name=".notifications.comment.CommentNotificationReceiver"/>
|
||||
<receiver android:name=".notifications.subscription.SubscriptionNotificationReceiver"/>
|
||||
<receiver android:name=".notifications.anilist.AnilistNotificationReceiver" />
|
||||
<receiver android:name=".notifications.comment.CommentNotificationReceiver" />
|
||||
<receiver android:name=".notifications.subscription.SubscriptionNotificationReceiver" />
|
||||
|
||||
<meta-data
|
||||
android:name="preloaded_fonts"
|
||||
@@ -339,7 +347,7 @@
|
||||
</provider>
|
||||
|
||||
<service
|
||||
android:name=".widgets.CurrentlyAiringRemoteViewsService"
|
||||
android:name=".widgets.upcoming.UpcomingRemoteViewsService"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_REMOTEVIEWS" />
|
||||
<service
|
||||
|
||||
@@ -154,6 +154,7 @@ class App : MultiDexApplication() {
|
||||
|
||||
companion object {
|
||||
private var instance: App? = null
|
||||
|
||||
/** Reference to the application context.
|
||||
*
|
||||
* USE WITH EXTREME CAUTION!**/
|
||||
|
||||
@@ -270,6 +270,29 @@ fun Activity.setNavigationTheme() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets clipToPadding false and sets the combined height of navigation bars as bottom padding.
|
||||
*
|
||||
* When nesting multiple scrolling views, only call this method on the inner most scrolling view.
|
||||
*/
|
||||
fun ViewGroup.setBaseline(navBar: AnimatedBottomBar) {
|
||||
navBar.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
|
||||
clipToPadding = false
|
||||
setPadding(paddingLeft, paddingTop, paddingRight, navBarHeight + navBar.measuredHeight)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets clipToPadding false and sets the combined height of navigation bars as bottom padding.
|
||||
*
|
||||
* When nesting multiple scrolling views, only call this method on the inner most scrolling view.
|
||||
*/
|
||||
fun ViewGroup.setBaseline(navBar: AnimatedBottomBar, overlayView: View) {
|
||||
navBar.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
|
||||
overlayView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
|
||||
clipToPadding = false
|
||||
setPadding(paddingLeft, paddingTop, paddingRight, navBarHeight + navBar.measuredHeight + overlayView.measuredHeight)
|
||||
}
|
||||
|
||||
fun Activity.reloadActivity() {
|
||||
Refresh.all()
|
||||
finish()
|
||||
|
||||
@@ -1430,6 +1430,24 @@ Page(page:$page,perPage:50) {
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun getUpcomingAnime(id: String): List<Media> {
|
||||
val res = executeQuery<Query.MediaListCollection>(
|
||||
"""{MediaListCollection(userId:$id,type:ANIME){lists{name entries{media{id,isFavourite,title{userPreferred,romaji}coverImage{medium}nextAiringEpisode{timeUntilAiring}}}}}}""",
|
||||
force = true
|
||||
)
|
||||
val list = mutableListOf<Media>()
|
||||
res?.data?.mediaListCollection?.lists?.forEach { listEntry ->
|
||||
listEntry.entries?.forEach { entry ->
|
||||
entry.media?.nextAiringEpisode?.timeUntilAiring?.let {
|
||||
list.add(Media(entry.media!!))
|
||||
}
|
||||
}
|
||||
}
|
||||
return list.sortedBy { it.timeUntilAiring }
|
||||
.distinctBy { it.id }
|
||||
.filter { it.timeUntilAiring != null }
|
||||
}
|
||||
|
||||
suspend fun isUserFav(favType: AnilistMutations.FavType, id: Int): Boolean { //anilist isFavourite is broken, so we need to check it manually
|
||||
val res = getUserProfile(Anilist.userid?: return false)
|
||||
return when (favType) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Intent
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.TypedValue
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -96,6 +97,7 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
|
||||
}
|
||||
trendingBinding.userAvatar.setOnLongClickListener { view ->
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
||||
ContextCompat.startActivity(
|
||||
view.context,
|
||||
Intent(view.context, ProfileActivity::class.java)
|
||||
@@ -167,7 +169,6 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||
trendingBinding.trendingViewPager.offscreenPageLimit = 3
|
||||
trendingBinding.trendingViewPager.getChildAt(0).overScrollMode = RecyclerView.OVER_SCROLL_NEVER
|
||||
trendingBinding.trendingViewPager.setPageTransformer(MediaPageTransformer())
|
||||
|
||||
trendHandler = Handler(Looper.getMainLooper())
|
||||
trendRun = Runnable {
|
||||
trendingBinding.trendingViewPager.currentItem += 1
|
||||
@@ -176,8 +177,10 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||
object : ViewPager2.OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
super.onPageSelected(position)
|
||||
trendHandler!!.removeCallbacks(trendRun)
|
||||
trendHandler!!.postDelayed(trendRun, 4000)
|
||||
trendHandler?.removeCallbacks(trendRun)
|
||||
if (PrefManager.getVal(PrefName.TrendingScroller)) {
|
||||
trendHandler!!.postDelayed(trendRun, 4000)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Intent
|
||||
import android.graphics.drawable.Animatable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -124,6 +125,7 @@ class HomeFragment : Fragment() {
|
||||
)
|
||||
}
|
||||
binding.homeUserAvatarContainer.setOnLongClickListener {
|
||||
it.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
||||
ContextCompat.startActivity(
|
||||
requireContext(), Intent(requireContext(), ProfileActivity::class.java)
|
||||
.putExtra("userId", Anilist.userid),null
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Intent
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.TypedValue
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -96,6 +97,7 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
||||
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
|
||||
}
|
||||
trendingBinding.userAvatar.setOnLongClickListener { view ->
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
||||
ContextCompat.startActivity(
|
||||
view.context,
|
||||
Intent(view.context, ProfileActivity::class.java)
|
||||
@@ -164,8 +166,9 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
||||
object : ViewPager2.OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
super.onPageSelected(position)
|
||||
trendHandler!!.removeCallbacks(trendRun)
|
||||
trendHandler!!.postDelayed(trendRun, 4000)
|
||||
trendHandler?.removeCallbacks(trendRun)
|
||||
if (PrefManager.getVal(PrefName.TrendingScroller))
|
||||
trendHandler!!.postDelayed(trendRun, 4000)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -58,6 +58,8 @@ data class Media(
|
||||
var endDate: FuzzyDate? = null,
|
||||
var popularity: Int? = null,
|
||||
|
||||
var timeUntilAiring: Long? = null,
|
||||
|
||||
var characters: ArrayList<Character>? = null,
|
||||
var staff: ArrayList<Author>? = null,
|
||||
var prequel: Media? = null,
|
||||
@@ -84,7 +86,7 @@ data class Media(
|
||||
name = apiMedia.title!!.english,
|
||||
nameRomaji = apiMedia.title!!.romaji,
|
||||
userPreferredName = apiMedia.title!!.userPreferred,
|
||||
cover = apiMedia.coverImage?.large,
|
||||
cover = apiMedia.coverImage?.large ?: apiMedia.coverImage?.medium,
|
||||
banner = apiMedia.bannerImage,
|
||||
status = apiMedia.status.toString(),
|
||||
isFav = apiMedia.isFavourite!!,
|
||||
@@ -97,6 +99,7 @@ data class Media(
|
||||
startDate = apiMedia.startDate,
|
||||
endDate = apiMedia.endDate,
|
||||
favourites = apiMedia.favourites,
|
||||
timeUntilAiring = apiMedia.nextAiringEpisode?.timeUntilAiring?.let { it.toLong() * 1000},
|
||||
anime = if (apiMedia.type == MediaType.ANIME) Anime(
|
||||
totalEpisodes = apiMedia.episodes,
|
||||
nextAiringEpisode = apiMedia.nextAiringEpisode?.episode?.minus(1)
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.isVisible
|
||||
@@ -156,7 +157,10 @@ class SearchActivity : AppCompatActivity() {
|
||||
} else
|
||||
headerAdaptor.requestFocus?.run()
|
||||
|
||||
if (intent.getBooleanExtra("search", false)) search()
|
||||
if (intent.getBooleanExtra("search", false)) {
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED)
|
||||
search()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import ani.dantotsu.connections.comments.CommentsAPI
|
||||
import ani.dantotsu.databinding.FragmentCommentsBinding
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.media.MediaDetailsActivity
|
||||
import ani.dantotsu.setBaseline
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
@@ -73,6 +74,9 @@ class CommentsFragment : Fragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
activity = requireActivity() as MediaDetailsActivity
|
||||
|
||||
binding.commentsList.setBaseline(activity.navBar, activity.binding.commentInputLayout)
|
||||
|
||||
//get the media id from the intent
|
||||
val mediaId = arguments?.getInt("mediaId") ?: -1
|
||||
mediaName = arguments?.getString("mediaName") ?: "unknown"
|
||||
@@ -366,6 +370,7 @@ class CommentsFragment : Fragment() {
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
tag = null
|
||||
binding.commentsList.setBaseline(activity.navBar, activity.binding.commentInputLayout)
|
||||
section.groups.forEach {
|
||||
if (it is CommentItem && it.containsGif()) {
|
||||
it.notifyChanged()
|
||||
|
||||
@@ -37,7 +37,7 @@ class ChapterLoaderDialog : BottomSheetDialogFragment() {
|
||||
binding.selectorAutoListContainer.visibility = View.VISIBLE
|
||||
binding.selectorListContainer.visibility = View.GONE
|
||||
|
||||
binding.selectorTitle.text = getString(R.string.loading_next_chap)
|
||||
binding.selectorTitle.text = getString(R.string.loading_chap_number, chp.number)
|
||||
binding.selectorCancel.setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ import kotlin.math.abs
|
||||
class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListener {
|
||||
lateinit var binding: ActivityProfileBinding
|
||||
private var selected: Int = 0
|
||||
private lateinit var navBar: AnimatedBottomBar
|
||||
lateinit var navBar: AnimatedBottomBar
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@@ -30,6 +30,7 @@ import ani.dantotsu.media.CharacterAdapter
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaAdaptor
|
||||
import ani.dantotsu.media.user.ListActivity
|
||||
import ani.dantotsu.setBaseline
|
||||
import ani.dantotsu.setSlideIn
|
||||
import ani.dantotsu.setSlideUp
|
||||
import ani.dantotsu.util.AniMarkdown.Companion.getFullAniHTML
|
||||
@@ -59,6 +60,8 @@ class ProfileFragment : Fragment() {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
activity = requireActivity() as ProfileActivity
|
||||
|
||||
binding.root.setBaseline(activity.navBar)
|
||||
|
||||
user = arguments?.getSerializableCompat<Query.UserProfile>("user") as Query.UserProfile
|
||||
viewLifecycleOwner.lifecycleScope.launch(Dispatchers.IO) {
|
||||
model.setData(user.id)
|
||||
@@ -144,6 +147,7 @@ class ProfileFragment : Fragment() {
|
||||
super.onResume()
|
||||
if (this::binding.isInitialized) {
|
||||
binding.root.requestLayout()
|
||||
binding.root.setBaseline(activity.navBar)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import ani.dantotsu.profile.ChartBuilder.Companion.ChartPacket
|
||||
import ani.dantotsu.profile.ChartBuilder.Companion.ChartType
|
||||
import ani.dantotsu.profile.ChartBuilder.Companion.MediaType
|
||||
import ani.dantotsu.profile.ChartBuilder.Companion.StatType
|
||||
import ani.dantotsu.setBaseline
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartType
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
@@ -49,8 +50,11 @@ class StatsFragment :
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
activity = requireActivity() as ProfileActivity
|
||||
|
||||
user = arguments?.getSerializableCompat<Query.UserProfile>("user") as Query.UserProfile
|
||||
|
||||
binding.statisticList.setBaseline(activity.navBar)
|
||||
|
||||
binding.statisticList.adapter = adapter
|
||||
binding.statisticList.recycledViewPool.setMaxRecycledViews(0, 0)
|
||||
binding.statisticList.isNestedScrollingEnabled = true
|
||||
@@ -114,6 +118,7 @@ class StatsFragment :
|
||||
super.onResume()
|
||||
if (this::binding.isInitialized) {
|
||||
binding.statisticList.visibility = View.VISIBLE
|
||||
binding.statisticList.setBaseline(activity.navBar)
|
||||
binding.root.requestLayout()
|
||||
if (!loadedFirstTime) {
|
||||
activity.lifecycleScope.launch {
|
||||
|
||||
@@ -18,6 +18,7 @@ import ani.dantotsu.connections.anilist.api.Activity
|
||||
import ani.dantotsu.databinding.FragmentFeedBinding
|
||||
import ani.dantotsu.media.MediaDetailsActivity
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.setBaseline
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.util.Logger
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
@@ -48,6 +49,9 @@ class FeedFragment : Fragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
activity = requireActivity()
|
||||
|
||||
binding.listRecyclerView.setBaseline((activity as ProfileActivity).navBar)
|
||||
|
||||
binding.listRecyclerView.adapter = adapter
|
||||
binding.listRecyclerView.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
@@ -63,6 +67,7 @@ class FeedFragment : Fragment() {
|
||||
super.onResume()
|
||||
if (this::binding.isInitialized) {
|
||||
binding.root.requestLayout()
|
||||
binding.listRecyclerView.setBaseline((activity as ProfileActivity).navBar)
|
||||
if (!loadedFirstTime) {
|
||||
activity.lifecycleScope.launch(Dispatchers.IO) {
|
||||
val nulledId = if (activityId == -1) null else activityId
|
||||
|
||||
@@ -77,6 +77,11 @@ class UserInterfaceSettingsActivity : AppCompatActivity() {
|
||||
restartApp(binding.root)
|
||||
}
|
||||
|
||||
binding.uiSettingsTrendingScroller.isChecked = PrefManager.getVal(PrefName.TrendingScroller)
|
||||
binding.uiSettingsTrendingScroller.setOnCheckedChangeListener { _, isChecked ->
|
||||
PrefManager.setVal(PrefName.TrendingScroller, isChecked)
|
||||
}
|
||||
|
||||
val map = mapOf(
|
||||
2f to 0.5f,
|
||||
1.75f to 0.625f,
|
||||
|
||||
@@ -68,6 +68,7 @@ enum class PrefName(val data: Pref) { //TODO: Split this into multiple files
|
||||
),
|
||||
BannerAnimations(Pref(Location.UI, Boolean::class, true)),
|
||||
LayoutAnimations(Pref(Location.UI, Boolean::class, true)),
|
||||
TrendingScroller(Pref(Location.UI, Boolean::class, true)),
|
||||
AnimationSpeed(Pref(Location.UI, Float::class, 1f)),
|
||||
ListGrid(Pref(Location.UI, Boolean::class, true)),
|
||||
PopularMangaList(Pref(Location.UI, Boolean::class, true)),
|
||||
|
||||
33
app/src/main/java/ani/dantotsu/util/BitmapUtil.kt
Normal file
33
app/src/main/java/ani/dantotsu/util/BitmapUtil.kt
Normal file
@@ -0,0 +1,33 @@
|
||||
package ani.dantotsu.util
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapShader
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import android.graphics.RectF
|
||||
import android.graphics.Shader
|
||||
import android.graphics.drawable.Drawable
|
||||
|
||||
class BitmapUtil {
|
||||
companion object {
|
||||
fun roundCorners(bitmap: Bitmap, cornerRadius: Float = 20f): Bitmap {
|
||||
val output = Bitmap.createBitmap(bitmap.width, bitmap.height, Bitmap.Config.ARGB_8888)
|
||||
val canvas = Canvas(output)
|
||||
val paint = Paint()
|
||||
paint.isAntiAlias = true
|
||||
paint.shader = BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP)
|
||||
val rect = RectF(0f, 0f, bitmap.width.toFloat(), bitmap.height.toFloat())
|
||||
canvas.drawRoundRect(rect, cornerRadius, cornerRadius, paint)
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
fun convertDrawableToBitmap(drawable: Drawable, width: Int, height: Int): Bitmap {
|
||||
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
||||
val canvas = Canvas(bitmap)
|
||||
drawable.setBounds(0, 0, canvas.width, canvas.height)
|
||||
drawable.draw(canvas)
|
||||
return bitmap
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
package ani.dantotsu.widgets
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.widget.RemoteViews
|
||||
import android.widget.RemoteViewsService
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.util.Logger
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class CurrentlyAiringRemoteViewsFactory(private val context: Context) :
|
||||
RemoteViewsService.RemoteViewsFactory {
|
||||
private var widgetItems = mutableListOf<WidgetItem>()
|
||||
|
||||
override fun onCreate() {
|
||||
// 4 items for testing
|
||||
widgetItems.clear()
|
||||
Logger.log("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.log("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.log("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)
|
||||
@@ -1,12 +0,0 @@
|
||||
package ani.dantotsu.widgets
|
||||
|
||||
import android.content.Intent
|
||||
import android.widget.RemoteViewsService
|
||||
import ani.dantotsu.util.Logger
|
||||
|
||||
class CurrentlyAiringRemoteViewsService : RemoteViewsService() {
|
||||
override fun onGetViewFactory(intent: Intent): RemoteViewsFactory {
|
||||
Logger.log("CurrentlyAiringRemoteViewsFactory onGetViewFactory")
|
||||
return CurrentlyAiringRemoteViewsFactory(applicationContext)
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
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)
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
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.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?) {
|
||||
|
||||
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
|
||||
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()
|
||||
}
|
||||
40
app/src/main/java/ani/dantotsu/widgets/WidgetSizeProvider.kt
Normal file
40
app/src/main/java/ani/dantotsu/widgets/WidgetSizeProvider.kt
Normal file
@@ -0,0 +1,40 @@
|
||||
package ani.dantotsu.widgets
|
||||
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.Context
|
||||
|
||||
class WidgetSizeProvider(
|
||||
private val context: Context // Do not pass Application context
|
||||
) {
|
||||
|
||||
private val appWidgetManager = AppWidgetManager.getInstance(context)
|
||||
|
||||
fun getWidgetsSize(widgetId: Int): Pair<Int, Int> {
|
||||
val isPortrait = context.resources.configuration.orientation == 1
|
||||
val width = getWidgetWidth(isPortrait, widgetId)
|
||||
val height = getWidgetHeight(isPortrait, widgetId)
|
||||
val widthInPx = context.dip(width)
|
||||
val heightInPx = context.dip(height)
|
||||
return widthInPx to heightInPx
|
||||
}
|
||||
|
||||
private fun getWidgetWidth(isPortrait: Boolean, widgetId: Int): Int =
|
||||
if (isPortrait) {
|
||||
getWidgetSizeInDp(widgetId, AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH)
|
||||
} else {
|
||||
getWidgetSizeInDp(widgetId, AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH)
|
||||
}
|
||||
|
||||
private fun getWidgetHeight(isPortrait: Boolean, widgetId: Int): Int =
|
||||
if (isPortrait) {
|
||||
getWidgetSizeInDp(widgetId, AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT)
|
||||
} else {
|
||||
getWidgetSizeInDp(widgetId, AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT)
|
||||
}
|
||||
|
||||
private fun getWidgetSizeInDp(widgetId: Int, key: String): Int =
|
||||
appWidgetManager.getAppWidgetOptions(widgetId).getInt(key, 0)
|
||||
|
||||
private fun Context.dip(value: Int): Int = (value * resources.displayMetrics.density).toInt()
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package ani.dantotsu.widgets.upcoming
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Color
|
||||
import android.widget.RemoteViews
|
||||
import android.widget.RemoteViewsService
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.util.BitmapUtil.Companion.roundCorners
|
||||
import ani.dantotsu.util.Logger
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class UpcomingRemoteViewsFactory(private val context: Context) :
|
||||
RemoteViewsService.RemoteViewsFactory {
|
||||
private var widgetItems = mutableListOf<WidgetItem>()
|
||||
private var refreshing = false
|
||||
private val prefs =
|
||||
context.getSharedPreferences(UpcomingWidget.PREFS_NAME, Context.MODE_PRIVATE)
|
||||
|
||||
override fun onCreate() {
|
||||
Logger.log("UpcomingRemoteViewsFactory onCreate")
|
||||
fillWidgetItems()
|
||||
}
|
||||
|
||||
private fun timeUntil(timeUntil: Long): String {
|
||||
val days = timeUntil / (1000 * 60 * 60 * 24)
|
||||
val hours = (timeUntil % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
|
||||
val minutes = ((timeUntil % (1000 * 60 * 60 * 24)) % (1000 * 60 * 60)) / (1000 * 60)
|
||||
return "$days days $hours hours $minutes minutes"
|
||||
}
|
||||
|
||||
override fun onDataSetChanged() {
|
||||
if (refreshing) return
|
||||
Logger.log("UpcomingRemoteViewsFactory onDataSetChanged")
|
||||
widgetItems.clear()
|
||||
fillWidgetItems()
|
||||
|
||||
}
|
||||
|
||||
private fun fillWidgetItems() {
|
||||
refreshing = true
|
||||
val userId = PrefManager.getVal<String>(PrefName.AnilistUserId)
|
||||
runBlocking(Dispatchers.IO) {
|
||||
val upcoming = Anilist.query.getUpcomingAnime(userId)
|
||||
upcoming.forEach {
|
||||
widgetItems.add(
|
||||
WidgetItem(
|
||||
it.userPreferredName,
|
||||
timeUntil(it.timeUntilAiring ?: 0),
|
||||
it.cover ?: "",
|
||||
it.id
|
||||
)
|
||||
)
|
||||
}
|
||||
refreshing = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
widgetItems.clear()
|
||||
}
|
||||
|
||||
override fun getCount(): Int {
|
||||
return widgetItems.size
|
||||
}
|
||||
|
||||
override fun getViewAt(position: Int): RemoteViews {
|
||||
Logger.log("UpcomingRemoteViewsFactory getViewAt")
|
||||
val item = widgetItems[position]
|
||||
val titleTextColor = prefs.getInt(UpcomingWidget.PREF_TITLE_TEXT_COLOR, Color.WHITE)
|
||||
val countdownTextColor =
|
||||
prefs.getInt(UpcomingWidget.PREF_COUNTDOWN_TEXT_COLOR, Color.WHITE)
|
||||
val rv = RemoteViews(context.packageName, R.layout.item_upcoming_widget).apply {
|
||||
setTextViewText(R.id.text_show_title, item.title)
|
||||
setTextViewText(R.id.text_show_countdown, item.countdown)
|
||||
setTextColor(R.id.text_show_title, titleTextColor)
|
||||
setTextColor(R.id.text_show_countdown, countdownTextColor)
|
||||
val bitmap = downloadImageAsBitmap(item.image)
|
||||
setImageViewBitmap(R.id.image_show_icon, bitmap)
|
||||
val fillInIntent = Intent().apply {
|
||||
putExtra("mediaId", item.id)
|
||||
}
|
||||
setOnClickFillInIntent(R.id.widget_item, fillInIntent)
|
||||
}
|
||||
|
||||
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()
|
||||
} finally {
|
||||
inputStream?.close()
|
||||
urlConnection?.disconnect()
|
||||
}
|
||||
return bitmap?.let { roundCorners(it) }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
override fun getLoadingView(): RemoteViews {
|
||||
return RemoteViews(context.packageName, R.layout.item_upcoming_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, val id: Int)
|
||||
@@ -0,0 +1,12 @@
|
||||
package ani.dantotsu.widgets.upcoming
|
||||
|
||||
import android.content.Intent
|
||||
import android.widget.RemoteViewsService
|
||||
import ani.dantotsu.util.Logger
|
||||
|
||||
class UpcomingRemoteViewsService : RemoteViewsService() {
|
||||
override fun onGetViewFactory(intent: Intent): RemoteViewsFactory {
|
||||
Logger.log("UpcomingRemoteViewsFactory onGetViewFactory")
|
||||
return UpcomingRemoteViewsFactory(applicationContext)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package ani.dantotsu.widgets.upcoming
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.appwidget.AppWidgetProvider
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.widget.RemoteViews
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import ani.dantotsu.MainActivity
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.util.BitmapUtil.Companion.convertDrawableToBitmap
|
||||
import ani.dantotsu.widgets.WidgetSizeProvider
|
||||
|
||||
/**
|
||||
* Implementation of App Widget functionality.
|
||||
* App Widget Configuration implemented in [UpcomingWidgetConfigureActivity]
|
||||
*/
|
||||
class UpcomingWidget : AppWidgetProvider() {
|
||||
override fun onUpdate(
|
||||
context: Context,
|
||||
appWidgetManager: AppWidgetManager,
|
||||
appWidgetIds: IntArray
|
||||
) {
|
||||
appWidgetIds.forEach { appWidgetId ->
|
||||
val rv = updateAppWidget(context, appWidgetId)
|
||||
appWidgetManager.updateAppWidget(appWidgetId, rv)
|
||||
}
|
||||
super.onUpdate(context, appWidgetManager, appWidgetIds)
|
||||
}
|
||||
|
||||
override fun onDeleted(context: Context, appWidgetIds: IntArray) {
|
||||
for (appWidgetId in appWidgetIds) {
|
||||
context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE).edit().clear().apply()
|
||||
}
|
||||
super.onDeleted(context, appWidgetIds)
|
||||
}
|
||||
|
||||
override fun onEnabled(context: Context) {
|
||||
super.onEnabled(context)
|
||||
}
|
||||
|
||||
override fun onDisabled(context: Context) {
|
||||
super.onDisabled(context)
|
||||
}
|
||||
|
||||
override fun onAppWidgetOptionsChanged(
|
||||
context: Context?,
|
||||
appWidgetManager: AppWidgetManager?,
|
||||
appWidgetId: Int,
|
||||
newOptions: Bundle?
|
||||
) {
|
||||
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions)
|
||||
if (context != null && appWidgetManager != null) {
|
||||
val views = updateAppWidget(context, appWidgetId)
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun updateAppWidget(
|
||||
context: Context,
|
||||
appWidgetId: Int,
|
||||
): RemoteViews {
|
||||
val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
||||
val backgroundColor =
|
||||
prefs.getInt(PREF_BACKGROUND_COLOR, ContextCompat.getColor(context, R.color.theme))
|
||||
val backgroundFade = prefs.getInt(PREF_BACKGROUND_FADE, Color.GRAY)
|
||||
val titleTextColor = prefs.getInt(PREF_TITLE_TEXT_COLOR, Color.WHITE)
|
||||
val countdownTextColor = prefs.getInt(PREF_COUNTDOWN_TEXT_COLOR, Color.WHITE)
|
||||
|
||||
val intent = Intent(context, UpcomingRemoteViewsService::class.java).apply {
|
||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
|
||||
data = Uri.parse(toUri(Intent.URI_INTENT_SCHEME))
|
||||
}
|
||||
val gradientDrawable = ResourcesCompat.getDrawable(
|
||||
context.resources,
|
||||
R.drawable.gradient_background,
|
||||
null
|
||||
) as GradientDrawable
|
||||
gradientDrawable.colors = intArrayOf(backgroundColor, backgroundFade)
|
||||
val widgetSizeProvider = WidgetSizeProvider(context)
|
||||
var (width, height) = widgetSizeProvider.getWidgetsSize(appWidgetId)
|
||||
if (width > 0 && height > 0) {
|
||||
gradientDrawable.cornerRadius = 50f
|
||||
} else {
|
||||
width = 300
|
||||
height = 300
|
||||
}
|
||||
|
||||
val intentTemplate = Intent(context, MainActivity::class.java)
|
||||
intentTemplate.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
intentTemplate.putExtra("fromWidget", true)
|
||||
|
||||
val views = RemoteViews(context.packageName, R.layout.upcoming_widget).apply {
|
||||
setImageViewBitmap(R.id.backgroundView, convertDrawableToBitmap(gradientDrawable, width, height))
|
||||
setTextColor(R.id.text_show_title, titleTextColor)
|
||||
setTextColor(R.id.text_show_countdown, countdownTextColor)
|
||||
setTextColor(R.id.widgetTitle, titleTextColor)
|
||||
setRemoteAdapter(R.id.widgetListView, intent)
|
||||
setEmptyView(R.id.widgetListView, R.id.empty_view)
|
||||
setPendingIntentTemplate(
|
||||
R.id.widgetListView,
|
||||
PendingIntent.getActivity(
|
||||
context,
|
||||
0,
|
||||
intentTemplate,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
|
||||
)
|
||||
)
|
||||
setOnClickPendingIntent(
|
||||
R.id.logoView,
|
||||
PendingIntent.getActivity(
|
||||
context,
|
||||
1,
|
||||
Intent(context, UpcomingWidgetConfigureActivity::class.java).apply {
|
||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
|
||||
},
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
)
|
||||
}
|
||||
return views
|
||||
}
|
||||
|
||||
const val PREFS_NAME = "ani.dantotsu.widgets.UpcomingWidget"
|
||||
const val PREF_BACKGROUND_COLOR = "background_color"
|
||||
const val PREF_BACKGROUND_FADE = "background_fade"
|
||||
const val PREF_TITLE_TEXT_COLOR = "title_text_color"
|
||||
const val PREF_COUNTDOWN_TEXT_COLOR = "countdown_text_color"
|
||||
}
|
||||
}
|
||||
|
||||
internal fun updateAppWidget(
|
||||
context: Context,
|
||||
appWidgetManager: AppWidgetManager,
|
||||
appWidgetId: Int
|
||||
) {
|
||||
val views = UpcomingWidget.updateAppWidget(context, appWidgetId)
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views)
|
||||
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.widgetListView)
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package ani.dantotsu.widgets.upcoming
|
||||
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.databinding.UpcomingWidgetConfigureBinding
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import eltos.simpledialogfragment.SimpleDialog
|
||||
import eltos.simpledialogfragment.color.SimpleColorDialog
|
||||
|
||||
/**
|
||||
* The configuration screen for the [UpcomingWidget] AppWidget.
|
||||
*/
|
||||
class UpcomingWidgetConfigureActivity : AppCompatActivity(),
|
||||
SimpleDialog.OnDialogResultListener {
|
||||
private var appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID
|
||||
|
||||
private var onClickListener = View.OnClickListener {
|
||||
val context = this@UpcomingWidgetConfigureActivity
|
||||
val appWidgetManager = AppWidgetManager.getInstance(context)
|
||||
|
||||
updateAppWidget(
|
||||
context,
|
||||
appWidgetManager,
|
||||
appWidgetId,
|
||||
)
|
||||
|
||||
val resultValue = Intent()
|
||||
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
|
||||
setResult(RESULT_OK, resultValue)
|
||||
finish()
|
||||
}
|
||||
private lateinit var binding: UpcomingWidgetConfigureBinding
|
||||
|
||||
public override fun onCreate(icicle: Bundle?) {
|
||||
ThemeManager(this).applyTheme()
|
||||
super.onCreate(icicle)
|
||||
setResult(RESULT_CANCELED)
|
||||
|
||||
binding = UpcomingWidgetConfigureBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
val prefs = getSharedPreferences(UpcomingWidget.PREFS_NAME, Context.MODE_PRIVATE)
|
||||
|
||||
binding.topBackgroundButton.setOnClickListener {
|
||||
val tag = UpcomingWidget.PREF_BACKGROUND_COLOR
|
||||
SimpleColorDialog().title(R.string.custom_theme)
|
||||
.colorPreset(
|
||||
prefs.getInt(
|
||||
UpcomingWidget.PREF_BACKGROUND_COLOR,
|
||||
ContextCompat.getColor(this, R.color.theme)
|
||||
)
|
||||
)
|
||||
.colors(
|
||||
this@UpcomingWidgetConfigureActivity,
|
||||
SimpleColorDialog.MATERIAL_COLOR_PALLET
|
||||
)
|
||||
.setupColorWheelAlpha(true)
|
||||
.allowCustom(true)
|
||||
.showOutline(0x46000000)
|
||||
.gridNumColumn(5)
|
||||
.choiceMode(SimpleColorDialog.SINGLE_CHOICE)
|
||||
.neg()
|
||||
.show(this@UpcomingWidgetConfigureActivity, tag)
|
||||
}
|
||||
binding.bottomBackgroundButton.setOnClickListener {
|
||||
val tag = UpcomingWidget.PREF_BACKGROUND_FADE
|
||||
SimpleColorDialog().title(R.string.custom_theme)
|
||||
.colorPreset(prefs.getInt(UpcomingWidget.PREF_BACKGROUND_FADE, Color.GRAY))
|
||||
.colors(
|
||||
this@UpcomingWidgetConfigureActivity,
|
||||
SimpleColorDialog.MATERIAL_COLOR_PALLET
|
||||
)
|
||||
.setupColorWheelAlpha(true)
|
||||
.allowCustom(true)
|
||||
.showOutline(0x46000000)
|
||||
.gridNumColumn(5)
|
||||
.choiceMode(SimpleColorDialog.SINGLE_CHOICE)
|
||||
.neg()
|
||||
.show(this@UpcomingWidgetConfigureActivity, tag)
|
||||
}
|
||||
binding.titleColorButton.setOnClickListener {
|
||||
val tag = UpcomingWidget.PREF_TITLE_TEXT_COLOR
|
||||
SimpleColorDialog().title(R.string.custom_theme)
|
||||
.colorPreset(prefs.getInt(UpcomingWidget.PREF_TITLE_TEXT_COLOR, Color.WHITE))
|
||||
.colors(
|
||||
this@UpcomingWidgetConfigureActivity,
|
||||
SimpleColorDialog.MATERIAL_COLOR_PALLET
|
||||
)
|
||||
.allowCustom(true)
|
||||
.showOutline(0x46000000)
|
||||
.gridNumColumn(5)
|
||||
.choiceMode(SimpleColorDialog.SINGLE_CHOICE)
|
||||
.neg()
|
||||
.show(this@UpcomingWidgetConfigureActivity, tag)
|
||||
}
|
||||
binding.countdownColorButton.setOnClickListener {
|
||||
val tag = UpcomingWidget.PREF_COUNTDOWN_TEXT_COLOR
|
||||
SimpleColorDialog().title(R.string.custom_theme)
|
||||
.colorPreset(
|
||||
prefs.getInt(
|
||||
UpcomingWidget.PREF_COUNTDOWN_TEXT_COLOR,
|
||||
Color.WHITE
|
||||
)
|
||||
)
|
||||
.colors(
|
||||
this@UpcomingWidgetConfigureActivity,
|
||||
SimpleColorDialog.MATERIAL_COLOR_PALLET
|
||||
)
|
||||
.allowCustom(true)
|
||||
.showOutline(0x46000000)
|
||||
.gridNumColumn(5)
|
||||
.choiceMode(SimpleColorDialog.SINGLE_CHOICE)
|
||||
.neg()
|
||||
.show(this@UpcomingWidgetConfigureActivity, tag)
|
||||
}
|
||||
|
||||
binding.addButton.setOnClickListener(onClickListener)
|
||||
|
||||
val intent = intent
|
||||
val extras = intent.extras
|
||||
if (extras != null) {
|
||||
appWidgetId = extras.getInt(
|
||||
AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID
|
||||
)
|
||||
}
|
||||
|
||||
if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResult(dialogTag: String, which: Int, extras: Bundle): Boolean {
|
||||
if (which == SimpleDialog.OnDialogResultListener.BUTTON_POSITIVE) {
|
||||
when (dialogTag) {
|
||||
UpcomingWidget.PREF_BACKGROUND_COLOR -> {
|
||||
getSharedPreferences(
|
||||
UpcomingWidget.PREFS_NAME,
|
||||
Context.MODE_PRIVATE
|
||||
).edit()
|
||||
.putInt(
|
||||
UpcomingWidget.PREF_BACKGROUND_COLOR,
|
||||
extras.getInt(SimpleColorDialog.COLOR)
|
||||
)
|
||||
.apply()
|
||||
}
|
||||
|
||||
UpcomingWidget.PREF_BACKGROUND_FADE -> {
|
||||
getSharedPreferences(
|
||||
UpcomingWidget.PREFS_NAME,
|
||||
Context.MODE_PRIVATE
|
||||
).edit()
|
||||
.putInt(
|
||||
UpcomingWidget.PREF_BACKGROUND_FADE,
|
||||
extras.getInt(SimpleColorDialog.COLOR)
|
||||
)
|
||||
.apply()
|
||||
}
|
||||
|
||||
UpcomingWidget.PREF_TITLE_TEXT_COLOR -> {
|
||||
getSharedPreferences(
|
||||
UpcomingWidget.PREFS_NAME,
|
||||
Context.MODE_PRIVATE
|
||||
).edit()
|
||||
.putInt(
|
||||
UpcomingWidget.PREF_TITLE_TEXT_COLOR,
|
||||
extras.getInt(SimpleColorDialog.COLOR)
|
||||
)
|
||||
.apply()
|
||||
}
|
||||
|
||||
UpcomingWidget.PREF_COUNTDOWN_TEXT_COLOR -> {
|
||||
getSharedPreferences(
|
||||
UpcomingWidget.PREFS_NAME,
|
||||
Context.MODE_PRIVATE
|
||||
).edit()
|
||||
.putInt(
|
||||
UpcomingWidget.PREF_COUNTDOWN_TEXT_COLOR,
|
||||
extras.getInt(SimpleColorDialog.COLOR)
|
||||
)
|
||||
.apply()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,5 +4,5 @@
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="@color/grey_20"
|
||||
android:startColor="#B313DC" />
|
||||
android:startColor="@color/theme"/>
|
||||
</shape>
|
||||
|
||||
@@ -141,11 +141,11 @@
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginTop="210dp"
|
||||
android:layout_marginTop="200dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:backgroundTint="?attr/colorSurfaceVariant"
|
||||
android:baselineAligned="false"
|
||||
app:cardCornerRadius="16dp">
|
||||
app:cardCornerRadius="24dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -224,7 +224,6 @@
|
||||
</LinearLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -245,7 +244,6 @@
|
||||
android:layout_gravity="center|bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/commentMessageContainer"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
tools:visibility="visible">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="false"
|
||||
@@ -136,11 +135,11 @@
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginTop="210dp"
|
||||
android:layout_marginTop="200dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:backgroundTint="?attr/colorSurfaceVariant"
|
||||
android:baselineAligned="false"
|
||||
app:cardCornerRadius="16dp">
|
||||
app:cardCornerRadius="24dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -216,7 +216,6 @@
|
||||
android:id="@+id/uiSettingsLayoutAnimation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:checked="true"
|
||||
android:drawableStart="@drawable/ic_round_animation_24"
|
||||
android:drawablePadding="16dp"
|
||||
@@ -235,6 +234,29 @@
|
||||
|
||||
</com.google.android.material.materialswitch.MaterialSwitch>
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/uiSettingsTrendingScroller"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:checked="true"
|
||||
android:drawableStart="@drawable/ic_round_animation_24"
|
||||
android:drawablePadding="16dp"
|
||||
android:elegantTextHeight="true"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:minHeight="64dp"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:text="@string/trending_scroller"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="?attr/colorOnBackground"
|
||||
app:cornerRadius="0dp"
|
||||
app:drawableTint="?attr/colorPrimary"
|
||||
app:showText="false"
|
||||
app:thumbTint="@color/button_switch_track">
|
||||
|
||||
</com.google.android.material.materialswitch.MaterialSwitch>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.core.widget.NestedScrollView
|
||||
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:id="@+id/commentsLayout"
|
||||
@@ -8,12 +9,10 @@
|
||||
android:background="?android:colorBackground"
|
||||
android:fillViewport="true">
|
||||
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/commentsRefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="58dp"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false">
|
||||
|
||||
@@ -56,7 +55,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_marginTop="64dp" />
|
||||
android:layout_marginTop="64dp"
|
||||
tools:visibility="gone"/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -82,5 +82,4 @@
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.core.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:scrollbars="none"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
android:id="@+id/commentsCardView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="4dp">
|
||||
|
||||
|
||||
@@ -153,103 +153,101 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:maxLines="8"
|
||||
android:scrollHorizontally="false"
|
||||
android:text="@string/slogan"
|
||||
android:textSize="12sp"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintEnd_toStartOf="@+id/linearLayout7"
|
||||
|
||||
app:layout_constraintHeight_max="200dp"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/linearLayout5"
|
||||
app:layout_constraintEnd_toStartOf="@+id/linearLayout7"
|
||||
app:layout_constraintTop_toBottomOf="@+id/commentUserDetailsLayout" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentReply"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@+id/linearLayout5"
|
||||
app:layout_constraintTop_toBottomOf="@+id/commentText"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:alpha="0.6"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:text="Reply"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintStart_toEndOf="@+id/linearLayout5"
|
||||
app:layout_constraintTop_toBottomOf="@+id/commentText"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentEdit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@+id/commentReply"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/commentReply"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:alpha="0.6"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:text="Edit"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/commentReply"
|
||||
app:layout_constraintStart_toEndOf="@+id/commentReply"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentDelete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@+id/commentEdit"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/commentEdit"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:alpha="0.6"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:text="Delete"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/commentEdit"
|
||||
app:layout_constraintStart_toEndOf="@+id/commentEdit"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@+id/commentDelete"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/commentDelete"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:alpha="0.6"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:text="Report"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/commentDelete"
|
||||
app:layout_constraintStart_toEndOf="@+id/commentDelete"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentBanUser"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@+id/commentReport"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/commentReport"
|
||||
android:alpha="0.6"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:paddingTop="1dp"
|
||||
android:text="Ban User"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/commentReport"
|
||||
app:layout_constraintStart_toEndOf="@+id/commentReport"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
@@ -287,38 +285,37 @@
|
||||
android:id="@+id/commentRepliesDivider"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="3dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/commentReply"
|
||||
app:layout_constraintStart_toEndOf="@+id/linearLayout5"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="@color/nav_tab" />
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@color/nav_tab"
|
||||
app:layout_constraintStart_toEndOf="@+id/linearLayout5"
|
||||
app:layout_constraintTop_toBottomOf="@+id/commentReply" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentTotalReplies"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@+id/commentRepliesDivider"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/commentRepliesDivider"
|
||||
app:layout_constraintStart_toEndOf="@+id/commentRepliesDivider"
|
||||
android:layout_marginStart="4dp"
|
||||
android:alpha="0.8"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:text="View replies"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/commentRepliesDivider"
|
||||
app:layout_constraintStart_toEndOf="@+id/commentRepliesDivider"
|
||||
app:layout_constraintTop_toTopOf="@+id/commentRepliesDivider"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/commentRepliesList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/commentRepliesDivider"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:paddingStart="16dp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintTop_toBottomOf="@+id/commentRepliesDivider"
|
||||
tools:ignore="RtlSymmetry"
|
||||
android:nestedScrollingEnabled="false"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,17 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/widget_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp">
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_show_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:contentDescription="@string/airing_image"
|
||||
android:src="@drawable/ic_launcher_foreground" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:shapeAppearanceOverlay="@style/roundedImageView"
|
||||
android:contentDescription="@string/airing_image"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
@@ -25,8 +29,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:text="Placeholder Title"
|
||||
android:text=""
|
||||
android:textColor="@color/bg_white"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
@@ -34,8 +40,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/poppins"
|
||||
android:text="Placeholder Countdown"
|
||||
android:textColor="@color/grey_60"
|
||||
android:text=""
|
||||
android:textColor="@color/bg_white"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
android:id="@+id/widgetContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp">
|
||||
android:padding="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logoView"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:foregroundGravity="center_vertical"
|
||||
@@ -31,20 +31,24 @@
|
||||
<TextView
|
||||
android:id="@+id/widgetTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_toEndOf="@+id/logoView"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/currently_airing"
|
||||
android:textSize="18sp"
|
||||
android:gravity="center_vertical|start"
|
||||
android:textAlignment="viewStart"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="none"
|
||||
android:text="@string/upcoming"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/widgetListView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none"
|
||||
android:layout_below="@id/widgetTitle" />
|
||||
|
||||
<TextView
|
||||
@@ -52,6 +56,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/no_shows_to_display"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="20sp"
|
||||
118
app/src/main/res/layout/upcoming_widget_configure.xml
Normal file
118
app/src/main/res/layout/upcoming_widget_configure.xml
Normal file
@@ -0,0 +1,118 @@
|
||||
<?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"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/configure" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/topBackgroundButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="-31dp"
|
||||
android:layout_marginEnd="-31dp"
|
||||
android:background="@drawable/ui_bg"
|
||||
android:backgroundTint="?attr/colorSecondary"
|
||||
android:backgroundTintMode="src_atop"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:paddingStart="31dp"
|
||||
android:paddingEnd="31dp"
|
||||
android:text="@string/top_background_color"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="?attr/colorOnBackground"
|
||||
app:cornerRadius="0dp"
|
||||
app:icon="@drawable/ic_round_color_picker_24"
|
||||
app:iconPadding="16dp"
|
||||
app:iconSize="24dp"
|
||||
app:iconTint="?attr/colorPrimary" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bottomBackgroundButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="-31dp"
|
||||
android:layout_marginEnd="-31dp"
|
||||
android:background="@drawable/ui_bg"
|
||||
android:backgroundTint="?attr/colorSecondary"
|
||||
android:backgroundTintMode="src_atop"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:paddingStart="31dp"
|
||||
android:paddingEnd="31dp"
|
||||
android:text="@string/bottom_background_color"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="?attr/colorOnBackground"
|
||||
app:cornerRadius="0dp"
|
||||
app:icon="@drawable/ic_round_color_picker_24"
|
||||
app:iconPadding="16dp"
|
||||
app:iconSize="24dp"
|
||||
app:iconTint="?attr/colorPrimary" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/titleColorButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="-31dp"
|
||||
android:layout_marginEnd="-31dp"
|
||||
android:background="@drawable/ui_bg"
|
||||
android:backgroundTint="?attr/colorSecondary"
|
||||
android:backgroundTintMode="src_atop"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:paddingStart="31dp"
|
||||
android:paddingEnd="31dp"
|
||||
android:text="@string/title_color"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="?attr/colorOnBackground"
|
||||
app:cornerRadius="0dp"
|
||||
app:icon="@drawable/ic_round_color_picker_24"
|
||||
app:iconPadding="16dp"
|
||||
app:iconSize="24dp"
|
||||
app:iconTint="?attr/colorPrimary" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/countdownColorButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="-31dp"
|
||||
android:layout_marginEnd="-31dp"
|
||||
android:background="@drawable/ui_bg"
|
||||
android:backgroundTint="?attr/colorSecondary"
|
||||
android:backgroundTintMode="src_atop"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:paddingStart="31dp"
|
||||
android:paddingEnd="31dp"
|
||||
android:text="@string/countdown_text_color"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="?attr/colorOnBackground"
|
||||
app:cornerRadius="0dp"
|
||||
app:icon="@drawable/ic_round_color_picker_24"
|
||||
app:iconPadding="16dp"
|
||||
app:iconSize="24dp"
|
||||
app:iconTint="?attr/colorPrimary" />
|
||||
|
||||
<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>
|
||||
@@ -8,4 +8,14 @@
|
||||
<item name="appWidgetRadius">@android:dimen/system_app_widget_background_radius</item>
|
||||
<item name="appWidgetInnerRadius">@android:dimen/system_app_widget_inner_radius</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Dantotsu.AppWidgetContainer" parent="Theme.Dantotsu.AppWidgetContainerParent">
|
||||
<item name="appWidgetRadius">
|
||||
@android:dimen/system_app_widget_background_radius
|
||||
</item>
|
||||
<item name="appWidgetInnerRadius">
|
||||
@android:dimen/system_app_widget_inner_radius
|
||||
</item>
|
||||
<item name="appWidgetPadding">16dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -19,6 +19,7 @@
|
||||
<color name="button_icon">#A9FFFFFF</color>
|
||||
<color name="nav_status">#80FFFFFF</color>
|
||||
<color name="fav">#ad5edd</color>
|
||||
<color name="theme">#B313DC</color>
|
||||
<color name="incognito">#291B65</color>
|
||||
<color name="filler">#54FF8400</color>
|
||||
<color name="warning">#FF0000</color>
|
||||
|
||||
@@ -307,6 +307,7 @@
|
||||
<string name="animations">Animations</string>
|
||||
<string name="banner_animations">Banner Animations</string>
|
||||
<string name="layout_animations">Layout Animations</string>
|
||||
<string name="trending_scroller">Trending Scroller</string>
|
||||
<string name="animation_speed">Overall Speed</string>
|
||||
<string name="empty_fav">Looks like you don\'t like anything,\nTry liking a show to keep it here.</string>
|
||||
<string name="fav_anime">Favourite Anime</string>
|
||||
@@ -406,7 +407,7 @@
|
||||
<string name="subscriptions_checking_time">Subscriptions Update Frequency</string>
|
||||
<string name="subscriptions_info">Amount of time for Dantotsu to periodically check for new Episodes/Chapters\n(Less time will cause more battery consumption)</string>
|
||||
<string name="do_not_update">Don\'t Update</string>
|
||||
<string name="loading_next_chap">Loading Next Chapter</string>
|
||||
<string name="loading_chap_number">Loading Chapter %1$s</string>
|
||||
<string name="sort_by_release_date">Sort by Release Date</string>
|
||||
<string name="crop_borders">Crop Borders</string>
|
||||
<string name="note">NOTE</string>
|
||||
@@ -422,7 +423,7 @@
|
||||
<string name="congrats_vro">Congrats Vro</string>
|
||||
<string name="please_reload">Please Reload.</string>
|
||||
<string name="copied_text">Copied "%1$s"</string>
|
||||
<string name="back_to_exit">Please perform BACK again to Exit</string>
|
||||
<string name="back_to_exit">Press BACK again to exit</string>
|
||||
<string name="no_internet_connection">No Internet Connection</string>
|
||||
<string name="anilist_not_found">Seems like that wasn\'t found on Anilist.</string>
|
||||
<string name="disabled_auto_skip">Disabled Auto Skipping OP & ED</string>
|
||||
@@ -658,6 +659,12 @@
|
||||
<string name="discord_dantotsu_button">Display dantotsu in the second button</string>
|
||||
<string name="discord_anilist_button">Display your AniList profile</string>
|
||||
<string name="discord_custom_button">Set up your own custom button</string>
|
||||
<string name="discord_rich_presence">Discord Rich Presence</string>
|
||||
<string name="stream_on_dantotsu">Stream on Dantotsu</string>
|
||||
<string name="view_my_anilist">View My AniList</string>
|
||||
<string name="button_text">Button Text</string>
|
||||
<string name="button_link">Button Link</string>
|
||||
<string name="discord_custom_sample">Sample</string>
|
||||
<string name="warning">Warning</string>
|
||||
<string name="view_anime">View Anime</string>
|
||||
<string name="view_manga">View Manga</string>
|
||||
@@ -683,6 +690,7 @@
|
||||
<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="upcoming_anime">Upcoming Anime</string>
|
||||
<string name="airing_image">Airing Image</string>
|
||||
<string name="anime_downloads">animeDownloads</string>
|
||||
<string name="purge_anime_downloads">Delete all Anime downloads</string>
|
||||
@@ -725,7 +733,7 @@
|
||||
<string name="mutual">Mutual</string>
|
||||
<string name="success">Success</string>
|
||||
|
||||
<string name="currently_airing">Currently Airing</string>
|
||||
<string name="upcoming">Upcoming</string>
|
||||
<string name="no_shows_to_display">No shows to display</string>
|
||||
<string name="extension_name">Extension Name</string>
|
||||
<string name="extension_version">version</string>
|
||||
@@ -816,10 +824,10 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
|
||||
<string name="donate">donate :)</string>
|
||||
<string name="do_it">Do it!</string>
|
||||
<string name="password">Password</string>
|
||||
<string name="discord_rich_presence">Discord Rich Presence</string>
|
||||
<string name="stream_on_dantotsu">Stream on Dantotsu</string>
|
||||
<string name="view_my_anilist">View My AniList</string>
|
||||
<string name="button_text">Button Text</string>
|
||||
<string name="button_link">Button Link</string>
|
||||
<string name="discord_custom_sample">Sample</string>
|
||||
|
||||
<string name="top_background_color">Top background color</string>
|
||||
<string name="bottom_background_color">Bottom Background Color</string>
|
||||
<string name="countdown_text_color">Countdown Text Color</string>
|
||||
<string name="title_color">Title Color</string>
|
||||
<string name="placeholder">Placeholder</string>
|
||||
</resources>
|
||||
|
||||
@@ -101,5 +101,5 @@
|
||||
</style>
|
||||
|
||||
|
||||
<style name="ThemeOverlay_Dantotsu_MediaRouter" parent="ThemeOverlay.AppCompat"></style>
|
||||
<style name="ThemeOverlay_Dantotsu_MediaRouter" parent="ThemeOverlay.AppCompat"/>
|
||||
</resources>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?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>
|
||||
13
app/src/main/res/xml-v31/upcoming_widget_info.xml
Normal file
13
app/src/main/res/xml-v31/upcoming_widget_info.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:description="@string/upcoming_anime"
|
||||
android:configure="ani.dantotsu.widgets.upcoming.UpcomingWidgetConfigureActivity"
|
||||
android:initialKeyguardLayout="@layout/upcoming_widget"
|
||||
android:initialLayout="@layout/upcoming_widget"
|
||||
android:minWidth="160dp"
|
||||
android:minHeight="80dp"
|
||||
android:previewImage="@drawable/example_appwidget_preview"
|
||||
android:previewLayout="@layout/upcoming_widget"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="3600000"
|
||||
android:widgetCategory="home_screen"/>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="86400000"
|
||||
android:widgetCategory="home_screen"></appwidget-provider>
|
||||
12
app/src/main/res/xml/upcoming_widget_info.xml
Normal file
12
app/src/main/res/xml/upcoming_widget_info.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:description="@string/upcoming_anime"
|
||||
android:configure="ani.dantotsu.widgets.upcoming.UpcomingWidgetConfigureActivity"
|
||||
android:initialKeyguardLayout="@layout/upcoming_widget"
|
||||
android:initialLayout="@layout/upcoming_widget"
|
||||
android:minWidth="160dp"
|
||||
android:minHeight="80dp"
|
||||
android:previewImage="@drawable/example_appwidget_preview"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="3600000"
|
||||
android:widgetCategory="home_screen"/>
|
||||
Reference in New Issue
Block a user