1717import androidx .activity .result .ActivityResultLauncher ;
1818import androidx .activity .result .contract .ActivityResultContracts ;
1919import androidx .annotation .NonNull ;
20- import androidx .appcompat .app .AlertDialog ;
2120import androidx .appcompat .app .AppCompatActivity ;
2221import androidx .core .app .ActivityCompat ;
2322import androidx .core .content .ContextCompat ;
2625import com .chaquo .python .Python ;
2726import com .chaquo .python .android .AndroidPlatform ;
2827import com .google .android .material .card .MaterialCardView ;
28+ import com .google .android .material .dialog .MaterialAlertDialogBuilder ;
29+ import com .google .android .material .textfield .TextInputEditText ;
2930
3031import java .util .ArrayList ;
3132import java .util .List ;
@@ -37,8 +38,7 @@ public class MainActivity extends AppCompatActivity {
3738 private static final int PERMISSION_REQUEST_CODE = 100 ;
3839
3940 private MaterialCardView cardExtract , cardCreate , cardDecompile ;
40- private TextView tvStatus , tvExtractStatus , tvCreateStatus , tvDecompileStatus ;
41- private ProgressBar progressBar ;
41+ private TextView tvExtractStatus , tvCreateStatus , tvDecompileStatus ;
4242
4343 private Python python ;
4444 private PyObject rpaModule ;
@@ -92,11 +92,9 @@ private void initViews() {
9292 cardExtract = findViewById (R .id .card_extract );
9393 cardCreate = findViewById (R .id .card_create );
9494 cardDecompile = findViewById (R .id .card_decompile );
95- tvStatus = findViewById (R .id .tv_status );
9695 tvExtractStatus = findViewById (R .id .tv_extract_status );
9796 tvCreateStatus = findViewById (R .id .tv_create_status );
9897 tvDecompileStatus = findViewById (R .id .tv_decompile_status );
99- progressBar = findViewById (R .id .progress_bar );
10098
10199 // Set up click listeners
102100 cardExtract .setOnClickListener (v -> startExtractFlow ());
@@ -109,7 +107,7 @@ private void checkPermissions() {
109107 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .R ) {
110108 // Android 11 and above - use MANAGE_EXTERNAL_STORAGE
111109 if (!Environment .isExternalStorageManager ()) {
112- new AlertDialog . Builder (this )
110+ new MaterialAlertDialogBuilder (this )
113111 .setTitle ("Storage Permission Required" )
114112 .setMessage ("This app needs access to manage files for RPA operations." )
115113 .setPositiveButton ("Grant" , (dialog , which ) -> {
@@ -287,8 +285,9 @@ private void startCreateFlow() {
287285 }
288286
289287 private void showOutputFileNameDialog () {
290- android .widget .EditText etFileName = new android .widget .EditText (this );
291- etFileName .setHint ("archive.rpa" );
288+ // Inflate custom dialog layout
289+ View dialogView = getLayoutInflater ().inflate (R .layout .dialog_input , null );
290+ TextInputEditText etFileName = dialogView .findViewById (R .id .editText );
292291 etFileName .setText ("archive.rpa" );
293292
294293 // Determine the default output directory
@@ -300,10 +299,10 @@ private void showOutputFileNameDialog() {
300299 defaultOutputDir = selectedSourcePath ;
301300 }
302301
303- new AlertDialog . Builder (this )
302+ new MaterialAlertDialogBuilder (this )
304303 .setTitle ("Output File Name" )
305304 .setMessage ("Enter the name for the output RPA file:" )
306- .setView (etFileName )
305+ .setView (dialogView )
307306 .setPositiveButton ("Create" , (dialog , which ) -> {
308307 String fileName = etFileName .getText ().toString ().trim ();
309308 if (!fileName .isEmpty ()) {
@@ -831,16 +830,12 @@ private void performDecompile(String sourceDirPath) {
831830 }
832831
833832 private void showProgress (String message ) {
834- progressBar .setVisibility (View .VISIBLE );
835- tvStatus .setText (message );
836833 cardExtract .setEnabled (false );
837834 cardCreate .setEnabled (false );
838835 cardDecompile .setEnabled (false );
839836 }
840837
841838 private void hideProgress () {
842- progressBar .setVisibility (View .GONE );
843- tvStatus .setText ("Ready" );
844839 cardExtract .setEnabled (true );
845840 cardCreate .setEnabled (true );
846841 cardDecompile .setEnabled (true );
@@ -851,7 +846,7 @@ private void showSuccess(String message) {
851846 }
852847
853848 private void showError (String message ) {
854- new AlertDialog . Builder (this )
849+ new MaterialAlertDialogBuilder (this )
855850 .setTitle ("Error" )
856851 .setMessage (message )
857852 .setPositiveButton ("OK" , null )
@@ -925,7 +920,7 @@ private void showUpdateDialog(VersionInfo versionInfo) {
925920 currentVersion
926921 );
927922
928- new AlertDialog . Builder (this )
923+ new MaterialAlertDialogBuilder (this )
929924 .setTitle ("Update Available" )
930925 .setMessage (message )
931926 .setPositiveButton ("Update" , (dialog , which ) -> {
0 commit comments