feat: commit to the prank...
This commit is contained in:
parent
125a95285d
commit
958aa634b1
4 changed files with 27 additions and 6 deletions
|
@ -151,10 +151,10 @@ class App : MultiDexApplication() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
private var instance: App? = null
|
||||
/** Reference to the application context.
|
||||
*
|
||||
* USE WITH EXTREME CAUTION!**/
|
||||
var instance: App? = null
|
||||
var context: Context? = null
|
||||
fun currentContext(): Context? {
|
||||
return instance?.mFTActivityLifecycleCallbacks?.currentActivity ?: context
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.app.PendingIntent
|
|||
import android.content.ActivityNotFoundException
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
|
@ -718,6 +719,23 @@ fun openLinkInBrowser(link: String?) {
|
|||
}
|
||||
}
|
||||
|
||||
fun openLinkInYouTube(link: String?) {
|
||||
link?.let {
|
||||
try {
|
||||
val videoIntent = Intent(Intent.ACTION_VIEW).apply {
|
||||
addCategory(Intent.CATEGORY_BROWSABLE)
|
||||
data = Uri.parse(link)
|
||||
setPackage("com.google.android.youtube")
|
||||
}
|
||||
currContext()!!.startActivity(videoIntent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
openLinkInBrowser(link)
|
||||
} catch (e: Exception) {
|
||||
Logger.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun saveImageToDownloads(title: String, bitmap: Bitmap, context: Activity) {
|
||||
FileProvider.getUriForFile(
|
||||
context,
|
||||
|
@ -1007,7 +1025,7 @@ class EmptyAdapter(private val count: Int) : RecyclerView.Adapter<RecyclerView.V
|
|||
}
|
||||
|
||||
fun getAppString(res: Int): String {
|
||||
return App.instance?.getString(res) ?: ""
|
||||
return currContext()!!.getString(res) ?: ""
|
||||
}
|
||||
|
||||
fun toast(string: String?) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package ani.dantotsu.settings
|
|||
import android.annotation.SuppressLint
|
||||
import android.app.AlarmManager
|
||||
import android.app.AlertDialog
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.drawable.Animatable
|
||||
|
@ -59,10 +60,11 @@ import ani.dantotsu.loadImage
|
|||
import ani.dantotsu.util.Logger
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.notifications.TaskScheduler
|
||||
import ani.dantotsu.notifications.comment.CommentNotificationWorker
|
||||
import ani.dantotsu.notifications.anilist.AnilistNotificationWorker
|
||||
import ani.dantotsu.notifications.comment.CommentNotificationWorker
|
||||
import ani.dantotsu.notifications.subscription.SubscriptionNotificationWorker.Companion.checkIntervals
|
||||
import ani.dantotsu.openLinkInBrowser
|
||||
import ani.dantotsu.openLinkInYouTube
|
||||
import ani.dantotsu.openSettings
|
||||
import ani.dantotsu.others.AppUpdater
|
||||
import ani.dantotsu.others.CustomBottomDialog
|
||||
|
@ -641,9 +643,8 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
|||
cursedCounter++
|
||||
(binding.settingsLogo.drawable as Animatable).start()
|
||||
if (cursedCounter % 7 == 0) {
|
||||
Toast.makeText(this, "youwu have been cuwsed :pwayge:", Toast.LENGTH_LONG).show()
|
||||
val url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
||||
openLinkInBrowser(url)
|
||||
toast(R.string.you_cursed)
|
||||
openLinkInYouTube(getString(R.string.cursed_yt))
|
||||
//PrefManager.setVal(PrefName.ImageUrl, !PrefManager.getVal(PrefName.ImageUrl, false))
|
||||
} else {
|
||||
snackString(array[(Math.random() * array.size).toInt()], this)
|
||||
|
|
|
@ -723,6 +723,8 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
|
|||
<string name="comment_notification_checking_time">Comment notifications update frequency : %1$s</string>
|
||||
<string name="activities">Activities</string>
|
||||
|
||||
<string name="you_cursed">youwu have been cuwsed :pwayge:</string>
|
||||
<string name="cursed_yt">https://www.youtube.com/watch?v=dQw4w9WgXcQ</string>
|
||||
<string name="purge_confirm">Are you sure you want to purge all %1$s downloads?</string>
|
||||
|
||||
<string name="delete_fail_reason">Failed to delete because of… %1$s</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue