From 3c21bb58591e83d486fc4a85a20cc1bf3318d6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20Ernesto=20Rodr=C3=ADguez=20Caba=C3=B1as?= Date: Sun, 27 Oct 2019 12:05:41 +0000 Subject: [PATCH] Upgraded dependencies and minor cleanup --- app/build.gradle | 6 +- .../com/verticalstepperform/MainActivity.java | 6 +- .../NewAlarmFormActivity.java | 23 +- app/src/main/res/values/strings.xml | 2 - app/src/main/res/values/styles.xml | 9 - build.gradle | 4 +- gradle/wrapper/gradle-wrapper.properties | 4 +- vertical-stepper-form/build.gradle | 10 +- .../VerticalStepperFormView.java | 232 +++++++++--------- 9 files changed, 139 insertions(+), 157 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index cb38042..7dd0379 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 28 + compileSdkVersion 29 defaultConfig { applicationId "verticalstepperform.ernestoyaquello.com.verticalstepperform" minSdkVersion 19 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 1 versionName "1.0" } @@ -23,7 +23,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.google.android.material:material:1.0.0' - implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.appcompat:appcompat:1.1.0' implementation project(path: ':vertical-stepper-form') } diff --git a/app/src/main/java/verticalstepperform/ernestoyaquello/com/verticalstepperform/MainActivity.java b/app/src/main/java/verticalstepperform/ernestoyaquello/com/verticalstepperform/MainActivity.java index 9a58d14..63465cd 100644 --- a/app/src/main/java/verticalstepperform/ernestoyaquello/com/verticalstepperform/MainActivity.java +++ b/app/src/main/java/verticalstepperform/ernestoyaquello/com/verticalstepperform/MainActivity.java @@ -5,6 +5,8 @@ import android.os.Bundle; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; + +import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.TextView; @@ -40,7 +42,7 @@ public void onClick(View view) { } @Override - public void onRestoreInstanceState(Bundle savedInstanceState) { + public void onRestoreInstanceState(@NonNull Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); dataReceived = savedInstanceState.getBoolean(DATA_RECEIVED, false); @@ -55,7 +57,7 @@ public void onRestoreInstanceState(Bundle savedInstanceState) { } @Override - public void onSaveInstanceState(Bundle savedInstanceState) { + public void onSaveInstanceState(@NonNull Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.putBoolean(DATA_RECEIVED, dataReceived); diff --git a/app/src/main/java/verticalstepperform/ernestoyaquello/com/verticalstepperform/NewAlarmFormActivity.java b/app/src/main/java/verticalstepperform/ernestoyaquello/com/verticalstepperform/NewAlarmFormActivity.java index 23f419c..e91a4fc 100644 --- a/app/src/main/java/verticalstepperform/ernestoyaquello/com/verticalstepperform/NewAlarmFormActivity.java +++ b/app/src/main/java/verticalstepperform/ernestoyaquello/com/verticalstepperform/NewAlarmFormActivity.java @@ -217,25 +217,20 @@ public void onRestoreInstanceState(Bundle savedInstanceState) { } public static class DiscardAlarmConfirmationFragment extends DialogFragment { - - private DialogInterface.OnClickListener listener; - - @Override - public void onAttach(Context context) { - super.onAttach(context); - - listener = (DialogInterface.OnClickListener) context; - } - @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + NewAlarmFormActivity activity = (NewAlarmFormActivity)getActivity(); + if (activity == null) { + throw new IllegalStateException("Fragment " + this + " not attached to an activity."); + } + + AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.form_discard_question) .setMessage(R.string.form_info_will_be_lost) - .setPositiveButton(R.string.form_discard, listener) - .setNegativeButton(R.string.form_discard_cancel, listener) - .setCancelable(false); + .setPositiveButton(R.string.form_discard, activity) + .setNegativeButton(R.string.form_discard_cancel, activity) + .setCancelable(false); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(false); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 376473e..2cec8e4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,7 +1,6 @@ Vertical Stepper Form Example Add Alarm - Confirm data and add alarm New alarm added successfully At least %1$d character(s) At least 1 day must be selected @@ -12,7 +11,6 @@ Alarm description (optional) Discard alarm? All the information about this new alarm will be lost - Add alarm Adding new alarm… Cancel Discard diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index f2940a5..0ba134b 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -7,13 +7,4 @@ 0dp - - -