Skip to content

Commit

Permalink
Merge pull request #187 from rebelonion/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
rebelonion authored Feb 8, 2024
2 parents ab199a3 + 83c0746 commit d778cd4
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 34 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ android {
applicationIdSuffix ".beta"
versionNameSuffix "-beta01"
manifestPlaceholders = [icon_placeholder: "@mipmap/ic_launcher_beta", icon_placeholder_round: "@mipmap/ic_launcher_beta_round"]
debuggable System.getenv("CI") == null
debuggable false
}
release {
manifestPlaceholders = [icon_placeholder: "@mipmap/ic_launcher", icon_placeholder_round: "@mipmap/ic_launcher_round"]
Expand Down
2 changes: 1 addition & 1 deletion app/src/google/java/ani/dantotsu/others/AppUpdater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object AppUpdater {
.parsed<JsonArray>().map {
Mapper.json.decodeFromJsonElement<GithubResponse>(it)
}
val r = res.filter { it.prerelease }.maxByOrNull {
val r = res.filter { it.prerelease }.filter { !it.tagName.contains("fdroid") }.maxByOrNull {
it.timeStamp()
} ?: throw Exception("No Pre Release Found")
val v = r.tagName.substringAfter("v", "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,42 @@ class DevelopersDialogFragment : BottomSheetDialogFragment() {
"Owner and Maintainer",
"https://github.com/rebelonion"
),
Developer(
"Wai What",
"https://avatars.githubusercontent.com/u/149729762?v=4",
"Icon Designer",
"https://github.com/WaiWhat"
),
Developer(
"Aayush262",
"https://avatars.githubusercontent.com/u/99584765?v=4",
"Contributor",
"https://github.com/aayush2622"
),
Developer(
"Sadwhy",
"https://avatars.githubusercontent.com/u/99601717?v=4",
"Contributor",
"https://github.com/Sadwhy"
),
Developer(
"Wai What",
"https://avatars.githubusercontent.com/u/149729762?v=4",
"Icon Designer",
"https://github.com/WaiWhat"
),
Developer(
"MarshMeadow",
"https://avatars.githubusercontent.com/u/88599122?v=4",
"Beta Icon Designer",
"https://github.com/MarshMeadow?tab=repositories"
),
Developer(
"Zaxx69",
"https://avatars.githubusercontent.com/u/138523882?v=4",
"Telegram Admin",
"https://github.com/Zaxx69"
),
Developer(
"Arif Alam",
"https://avatars.githubusercontent.com/u/70383209?v=4",
"Head Discord Moderator",
"https://youtube.com/watch?v=dQw4w9WgXcQ"
),
)

override fun onCreateView(
Expand Down
70 changes: 45 additions & 25 deletions app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.widget.ArrayAdapter
import android.widget.TextView
import android.widget.Toast
Expand Down Expand Up @@ -457,11 +458,6 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
binding.settingsRecentlyListOnly.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.RecentlyListOnly, isChecked)
}
binding.settingsShareUsername.isChecked = PrefManager.getVal(PrefName.SharedUserID)
binding.settingsShareUsername.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.SharedUserID, isChecked)
}

binding.settingsPreferDub.isChecked = PrefManager.getVal(PrefName.SettingsPreferDub)
binding.settingsPreferDub.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.SettingsPreferDub, isChecked)
Expand Down Expand Up @@ -695,15 +691,6 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
openSettings(this, null)
}


binding.settingsCheckUpdate.isChecked = PrefManager.getVal(PrefName.CheckUpdate)
binding.settingsCheckUpdate.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.CheckUpdate, isChecked)
if (!isChecked) {
snackString(getString(R.string.long_click_to_check_update))
}
}

if (!BuildConfig.FLAVOR.contains("fdroid")) {
binding.settingsLogo.setOnLongClickListener {
lifecycleScope.launch(Dispatchers.IO) {
Expand All @@ -712,15 +699,33 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
true
}

binding.settingsCheckUpdate.isChecked = PrefManager.getVal(PrefName.CheckUpdate)
binding.settingsCheckUpdate.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.CheckUpdate, isChecked)
if (!isChecked) {
snackString(getString(R.string.long_click_to_check_update))
}
}

binding.settingsCheckUpdate.setOnLongClickListener {
lifecycleScope.launch(Dispatchers.IO) {
AppUpdater.check(this@SettingsActivity, true)
}
true
}

binding.settingsShareUsername.isChecked = PrefManager.getVal(PrefName.SharedUserID)
binding.settingsShareUsername.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.SharedUserID, isChecked)
}

} else {
binding.settingsCheckUpdate.visibility = View.GONE
binding.settingsShareUsername.visibility = View.GONE
binding.settingsCheckUpdate.isEnabled = false
binding.settingsShareUsername.isEnabled = false
binding.settingsCheckUpdate.isChecked = false
binding.settingsShareUsername.isChecked = false
}

binding.settingsAccountHelp.setOnClickListener {
Expand Down Expand Up @@ -873,11 +878,9 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene

// Inflate the dialog layout
val dialogView = LayoutInflater.from(this).inflate(R.layout.dialog_user_agent, null)
dialogView.findViewById<TextInputEditText>(R.id.userAgentTextBox)?.hint = "Password"
val subtitleTextView = dialogView.findViewById<TextView>(R.id.subtitle)
subtitleTextView?.visibility = View.VISIBLE
if (!isExporting)
subtitleTextView?.text = "Enter your password to decrypt the file"
val box = dialogView.findViewById<TextInputEditText>(R.id.userAgentTextBox)
box?.hint = "Password"
box?.setSingleLine()

val dialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle("Enter Password")
Expand All @@ -889,12 +892,7 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
callback(null)
}
.create()

dialog.window?.setDimAmount(0.8f)
dialog.show()

// Override the positive button here
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
fun handleOkAction() {
val editText = dialog.findViewById<TextInputEditText>(R.id.userAgentTextBox)
if (editText?.text?.isNotBlank() == true) {
editText.text?.toString()?.trim()?.toCharArray(password)
Expand All @@ -904,6 +902,28 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
toast("Password cannot be empty")
}
}
box?.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_DONE) {
handleOkAction()
true
} else {
false
}
}
val subtitleTextView = dialogView.findViewById<TextView>(R.id.subtitle)
subtitleTextView?.visibility = View.VISIBLE
if (!isExporting)
subtitleTextView?.text = "Enter your password to decrypt the file"


dialog.window?.setDimAmount(0.8f)
dialog.show()

// Override the positive button here
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
handleOkAction()
}

}


Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/dialog_user_agent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
android:imeOptions="actionDone"
app:hintAnimationEnabled="true" />

</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
<string name="ui_settings">UI Settings</string>
<string name="about">About</string>
<string name="desc">" Dantotsu is crafted from the ashes of Saikou and based on simplistic yet state-of-the-art elegance. It is an Anilist only client, which also lets you stream-download Anime through extensions &amp; Manga.\nDantotsu literally means the \"best of the best\" in japanese. Well, we would like to say this is the best open source app for anime and manga on Android, what would you say?"</string>
<string name="devs">Developers</string>
<string name="devs">Developers/Helpers</string>
<string name="disclaimer">Disclaimer</string>
<string name="full_disclaimer">
- Dantotsu by itself only provides an anime and manga tracker and does not provide any anime or manga streaming or downloading capabilities.
Expand Down

0 comments on commit d778cd4

Please sign in to comment.