From 47c65ebfe810633ee74ad303510158833902982b Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 25 Jun 2022 17:55:03 +0200 Subject: [PATCH 1/3] delete account --- .../libretube/dialogs/DeleteAccountDialog.kt | 94 +++++++++++++++++++ .../github/libretube/obj/DeleteUserRequest.kt | 5 + .../com/github/libretube/util/PipedApi.kt | 7 ++ app/src/main/res/layout/activity_settings.xml | 5 +- .../main/res/layout/dialog_delete_account.xml | 46 +++++++++ app/src/main/res/layout/fragment_about.xml | 12 --- app/src/main/res/values/strings.xml | 6 +- app/src/main/res/xml/instance_settings.xml | 22 ++++- 8 files changed, 178 insertions(+), 19 deletions(-) create mode 100644 app/src/main/java/com/github/libretube/dialogs/DeleteAccountDialog.kt create mode 100644 app/src/main/java/com/github/libretube/obj/DeleteUserRequest.kt create mode 100644 app/src/main/res/layout/dialog_delete_account.xml diff --git a/app/src/main/java/com/github/libretube/dialogs/DeleteAccountDialog.kt b/app/src/main/java/com/github/libretube/dialogs/DeleteAccountDialog.kt new file mode 100644 index 000000000..ca635b5d4 --- /dev/null +++ b/app/src/main/java/com/github/libretube/dialogs/DeleteAccountDialog.kt @@ -0,0 +1,94 @@ +package com.github.libretube.dialogs + +import android.app.Dialog +import android.content.Context +import android.os.Bundle +import android.util.Log +import android.util.TypedValue +import android.widget.Button +import android.widget.EditText +import android.widget.TextView +import android.widget.Toast +import androidx.core.text.HtmlCompat +import androidx.fragment.app.DialogFragment +import androidx.lifecycle.lifecycleScope +import com.github.libretube.R +import com.github.libretube.obj.DeleteUserRequest +import com.github.libretube.util.RetrofitInstance +import com.google.android.material.dialog.MaterialAlertDialogBuilder +import retrofit2.HttpException +import java.io.IOException + +class DeleteAccountDialog : DialogFragment() { + private val TAG = "DeleteAccountDialog" + lateinit var username: EditText + lateinit var password: EditText + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + return activity?.let { + val builder = MaterialAlertDialogBuilder(it) + val inflater = requireActivity().layoutInflater + val view = inflater.inflate(R.layout.dialog_login, null) + + password = view.findViewById(R.id.delete_password) + view.findViewById