diff --git a/app/src/main/java/com/fogplix/anime/dialogs/EpisodeDialogBuilder.java b/app/src/main/java/com/fogplix/anime/dialogs/EpisodeDialogBuilder.java index 37fe480..1f5b2eb 100644 --- a/app/src/main/java/com/fogplix/anime/dialogs/EpisodeDialogBuilder.java +++ b/app/src/main/java/com/fogplix/anime/dialogs/EpisodeDialogBuilder.java @@ -3,7 +3,6 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; -import android.app.ProgressDialog; import android.content.Intent; import android.net.Uri; import android.util.Log; @@ -75,14 +74,14 @@ public void choosePlayServer(String episodeId, String animeTitle, String animeId HPSharedPreference hpSharedPreference = new HPSharedPreference(activity); - boolean server_status = hpSharedPreference.getPlayableServersStatus("server_1"); + boolean serverStatus = hpSharedPreference.getPlayableServersStatus("server_1"); - if (server_status) { + if (serverStatus) { - ProgressDialog pd = new ProgressDialog(activity); - pd.setMessage("Generating playable link..."); - pd.setCancelable(false); - pd.show(); + MyProgressDialog mpd = new MyProgressDialog(activity); + mpd.setMessage("Generating playable link..."); + mpd.setCancelable(false); + mpd.show(); GenerateDirectLink generateDirectLink = new GenerateDirectLink(activity); @@ -90,7 +89,7 @@ public void choosePlayServer(String episodeId, String animeTitle, String animeId @Override public void onComplete(JSONObject object) { - pd.dismiss(); + mpd.dismiss(); dialog.dismiss(); try { @@ -108,7 +107,7 @@ public void onComplete(JSONObject object) { @Override public void onFailed(String error) { - pd.dismiss(); + mpd.dismiss(); dialog.dismiss(); Toast.makeText(activity, error, Toast.LENGTH_SHORT).show(); Log.d(TAG, "onFailed: "); @@ -126,13 +125,13 @@ public void onFailed(String error) { HPSharedPreference hpSharedPreference = new HPSharedPreference(activity); - boolean server_status = hpSharedPreference.getPlayableServersStatus("server_2"); + boolean serverStatus = hpSharedPreference.getPlayableServersStatus("server_2"); - if (server_status) { + if (serverStatus) { String vidcdn_api = activity.getString(R.string.VIDCDN_API_URL) + episodeId; - ProgressDialog pd = new ProgressDialog(activity); + MyProgressDialog pd = new MyProgressDialog(activity); pd.setMessage("Generating playable link..."); pd.setCancelable(false); pd.show(); @@ -191,7 +190,7 @@ public void onFailed(String error) { public void choosePlayOrDownload(String animeId, String animeTitle, String episodeId, String refererUrl, String videoHLSUrl, String videoHLSUrl2) { - final Dialog dialog = new Dialog(activity); + Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true); dialog.setContentView(R.layout.dialog_play_or_download); diff --git a/app/src/main/java/com/fogplix/anime/dialogs/MyProgressDialog.java b/app/src/main/java/com/fogplix/anime/dialogs/MyProgressDialog.java index d776cb0..b09f03b 100644 --- a/app/src/main/java/com/fogplix/anime/dialogs/MyProgressDialog.java +++ b/app/src/main/java/com/fogplix/anime/dialogs/MyProgressDialog.java @@ -1,4 +1,35 @@ package com.fogplix.anime.dialogs; +import android.app.Activity; +import android.app.Dialog; +import android.widget.TextView; + +import com.fogplix.anime.R; + public class MyProgressDialog { + + private final Dialog dialog; + private final TextView progressTV; + + public MyProgressDialog(Activity activity) { + dialog = new Dialog(activity); + dialog.setContentView(R.layout.dialog_my_progress); + progressTV = dialog.findViewById(R.id.progressTV); + } + + public void setMessage(String text) { + progressTV.setText(text); + } + + public void setCancelable(boolean cancelable) { + dialog.setCancelable(cancelable); + } + + public void show() { + dialog.show(); + } + + public void dismiss() { + dialog.dismiss(); + } } diff --git a/app/src/main/java/com/fogplix/anime/helpers/CustomMethods.java b/app/src/main/java/com/fogplix/anime/helpers/CustomMethods.java index 2a5f5d2..eb2f960 100644 --- a/app/src/main/java/com/fogplix/anime/helpers/CustomMethods.java +++ b/app/src/main/java/com/fogplix/anime/helpers/CustomMethods.java @@ -2,7 +2,6 @@ import android.app.Activity; import android.app.AlertDialog; -import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -13,15 +12,13 @@ import android.os.Looper; import android.util.Log; import android.view.View; -import android.view.WindowManager; -import android.view.inputmethod.InputMethodManager; -import android.widget.EditText; import android.widget.TextView; import androidx.core.content.FileProvider; import com.fogplix.anime.BuildConfig; import com.fogplix.anime.R; +import com.fogplix.anime.dialogs.MyProgressDialog; import com.fogplix.anime.params.Statics; import org.json.JSONArray; @@ -118,29 +115,13 @@ public static void errorAlert(Activity activity, String errorTitle, String error } }); builder.setNegativeButton("Report", (dialog, which) -> { - activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:" + activity.getString(R.string.feedback_email) + "?subject= FogPlix Error v" + BuildConfig.VERSION_NAME + "&body=" + errorBody))); + activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:" + activity.getString(R.string.feedback_email) + "?subject= Fogplix Anime Error v" + BuildConfig.VERSION_NAME + "&body=" + errorBody))); activity.finish(); }); AlertDialog dialog = builder.create(); dialog.show(); } } -//-------------------------------------------------------------------------------------------------- - - public static void showKeyBoard(Activity activity, EditText editText) { - if (editText.requestFocus()) { - InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); - if (imm != null) { - imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); - } - activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); - } - } - - public static void hideKeyboard(Context context, View view) { - InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); - inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); - } //-------------------------------------------------------------------------------------------------- @@ -283,7 +264,7 @@ public static void checkForUpdateOnStartApp(Activity activity) { String downloadPath = Objects.requireNonNull(activity.getExternalFilesDir(null)) + "/fogplix_v" + versionName + "_t" + getDateTime() + ".apk"; - ProgressDialog pd = new ProgressDialog(activity); + MyProgressDialog pd = new MyProgressDialog(activity); pd.setCancelable(false); pd.setMessage("Don't close the app. \nDownloading 0%"); pd.show(); diff --git a/app/src/main/res/layout/dialog_my_progress.xml b/app/src/main/res/layout/dialog_my_progress.xml index bc6d406..697d9a9 100644 --- a/app/src/main/res/layout/dialog_my_progress.xml +++ b/app/src/main/res/layout/dialog_my_progress.xml @@ -2,9 +2,9 @@ @@ -15,8 +15,8 @@ style="?android:attr/progressBarStyleLarge" /> #E0DEDE #EF3977 #FFC107 + #181818 #000000 #000000