This commit is contained in:
Mylloon 2021-09-01 02:01:42 +02:00
parent 527e8c395b
commit cec312c93c

View file

@ -3,6 +3,7 @@ package com.mylloon.mobidl
import android.Manifest
import android.annotation.SuppressLint
import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
@ -24,12 +25,9 @@ import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import kotlinx.coroutines.runBlocking
import java.util.*
import android.widget.Toast
import kotlinx.coroutines.*
class MainActivity : AppCompatActivity() {
@ -154,8 +152,8 @@ class MainActivity : AppCompatActivity() {
init {
button = itemView?.findViewById(R.id.text_list_item)
button?.setOnLongClickListener {
val builder: android.app.AlertDialog.Builder =
android.app.AlertDialog.Builder(instance)
val builder: AlertDialog.Builder =
AlertDialog.Builder(instance)
builder.setTitle("${getString(R.string.remove)} ${button?.text} ?")
builder.setPositiveButton(R.string.remove) { _, _ ->
instance?.mainPage(
@ -216,7 +214,7 @@ class MainActivity : AppCompatActivity() {
val addButton = findViewById<FloatingActionButton>(R.id.addButton)
addButton.setOnClickListener {
val builder: android.app.AlertDialog.Builder = android.app.AlertDialog.Builder(this)
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
builder.setTitle(R.string.newAppDialogTitle)
val input = EditText(this)
input.inputType = InputType.TYPE_CLASS_TEXT
@ -243,8 +241,8 @@ class MainActivity : AppCompatActivity() {
.show()
this.finishAffinity()
} else {
runBlocking {
val returns: MutableList<String>? = Scraper(user, password, app, captchaID = captchaID, captchaResponse = captchaResponse, debug = true).search()
runBlocking { // GlobalScope.launch {
val returns: MutableList<String>? = Scraper(user, password, app, captchaID = captchaID, captchaResponse = captchaResponse, debug = true).search()
if (returns != null) { // if job is needed
if (returns[0] == "errorNotConnected") loginPage()
if (returns[0] == "loginAttemptsExceeded") {
@ -257,7 +255,7 @@ class MainActivity : AppCompatActivity() {
for((key, value) in registeredAnswered){
if (returns[1] == key) return@runBlocking callScrapper(user, password, app, returns[2], value)
}
val builder: android.app.AlertDialog.Builder = android.app.AlertDialog.Builder(
val builder: AlertDialog.Builder = AlertDialog.Builder(
instance)
builder.setTitle("Captcha")
builder.setMessage(returns[1])