Showing
2 changed files
with
23 additions
and
27 deletions
| ... | @@ -2,6 +2,7 @@ package ly.warp.sdk.activities; | ... | @@ -2,6 +2,7 @@ package ly.warp.sdk.activities; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.app.AlertDialog; | 4 | import android.app.AlertDialog; |
| 5 | +import android.app.Dialog; | ||
| 5 | import android.content.Intent; | 6 | import android.content.Intent; |
| 6 | import android.os.Bundle; | 7 | import android.os.Bundle; |
| 7 | import android.os.Handler; | 8 | import android.os.Handler; |
| ... | @@ -615,17 +616,23 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup | ... | @@ -615,17 +616,23 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup |
| 615 | private void showQuestionnaireDialog(User.Questionnaire questionnaire) { | 616 | private void showQuestionnaireDialog(User.Questionnaire questionnaire) { |
| 616 | if (questionnaire.getQuestions() == null || questionnaire.getQuestions().isEmpty()) return; | 617 | if (questionnaire.getQuestions() == null || questionnaire.getQuestions().isEmpty()) return; |
| 617 | 618 | ||
| 618 | - BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this, R.style.FullScreenBottomSheetDialog); | 619 | + Dialog questionnaireDialog = new Dialog(this, R.style.FullScreenDialogStyle); |
| 619 | View dialogView = LayoutInflater.from(this).inflate(R.layout.dialog_fullscreen_questionnaire, null); | 620 | View dialogView = LayoutInflater.from(this).inflate(R.layout.dialog_fullscreen_questionnaire, null); |
| 620 | - bottomSheetDialog.setContentView(dialogView); | 621 | + questionnaireDialog.setContentView(dialogView); |
| 622 | + if (questionnaireDialog.getWindow() != null) { | ||
| 623 | + questionnaireDialog.getWindow().setLayout( | ||
| 624 | + ViewGroup.LayoutParams.MATCH_PARENT, | ||
| 625 | + ViewGroup.LayoutParams.MATCH_PARENT | ||
| 626 | + ); | ||
| 627 | + } | ||
| 621 | 628 | ||
| 622 | ImageView ivClose = dialogView.findViewById(R.id.iv_back); | 629 | ImageView ivClose = dialogView.findViewById(R.id.iv_back); |
| 623 | ivClose.setOnClickListener(v -> { | 630 | ivClose.setOnClickListener(v -> { |
| 624 | if (mCurrentQuestionIndex > 0) { | 631 | if (mCurrentQuestionIndex > 0) { |
| 625 | mCurrentQuestionIndex--; | 632 | mCurrentQuestionIndex--; |
| 626 | - renderQuestion(questionnaire, dialogView, bottomSheetDialog); | 633 | + renderQuestion(questionnaire, dialogView, questionnaireDialog); |
| 627 | } else { | 634 | } else { |
| 628 | - bottomSheetDialog.dismiss(); | 635 | + questionnaireDialog.dismiss(); |
| 629 | } | 636 | } |
| 630 | }); | 637 | }); |
| 631 | 638 | ||
| ... | @@ -642,31 +649,11 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup | ... | @@ -642,31 +649,11 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup |
| 642 | mQuestionnaireAnswers = new ArrayList<>(); | 649 | mQuestionnaireAnswers = new ArrayList<>(); |
| 643 | } | 650 | } |
| 644 | 651 | ||
| 645 | - renderQuestion(questionnaire, dialogView, bottomSheetDialog); | 652 | + renderQuestion(questionnaire, dialogView, questionnaireDialog); |
| 646 | - | 653 | + questionnaireDialog.show(); |
| 647 | - bottomSheetDialog.setOnShowListener(dialog -> { | ||
| 648 | - View bottomSheet = bottomSheetDialog.findViewById(com.google.android.material.R.id.design_bottom_sheet); | ||
| 649 | - if (bottomSheet != null) { | ||
| 650 | - bottomSheet.post(() -> { | ||
| 651 | - // Disable fitsSystemWindows so the BottomSheet doesn't add nav bar padding automatically | ||
| 652 | - bottomSheet.setFitsSystemWindows(false); | ||
| 653 | - | ||
| 654 | - int screenHeight = getResources().getDisplayMetrics().heightPixels; | ||
| 655 | - ViewGroup.LayoutParams lp = bottomSheet.getLayoutParams(); | ||
| 656 | - lp.height = screenHeight; | ||
| 657 | - bottomSheet.setLayoutParams(lp); | ||
| 658 | - BottomSheetBehavior<View> behavior = BottomSheetBehavior.from(bottomSheet); | ||
| 659 | - behavior.setSkipCollapsed(true); | ||
| 660 | - behavior.setPeekHeight(screenHeight); | ||
| 661 | - behavior.setState(BottomSheetBehavior.STATE_EXPANDED); | ||
| 662 | - behavior.setDraggable(false); | ||
| 663 | - }); | ||
| 664 | - } | ||
| 665 | - }); | ||
| 666 | - bottomSheetDialog.show(); | ||
| 667 | } | 654 | } |
| 668 | 655 | ||
| 669 | - private void renderQuestion(User.Questionnaire questionnaire, View dialogView, BottomSheetDialog dialog) { | 656 | + private void renderQuestion(User.Questionnaire questionnaire, View dialogView, Dialog dialog) { |
| 670 | if (mCurrentQuestionIndex >= questionnaire.getQuestions().size()) { | 657 | if (mCurrentQuestionIndex >= questionnaire.getQuestions().size()) { |
| 671 | return; | 658 | return; |
| 672 | } | 659 | } | ... | ... |
| ... | @@ -63,4 +63,13 @@ | ... | @@ -63,4 +63,13 @@ |
| 63 | <style name="NoCornerShapeAppearance" parent=""> | 63 | <style name="NoCornerShapeAppearance" parent=""> |
| 64 | <item name="cornerSize">0dp</item> | 64 | <item name="cornerSize">0dp</item> |
| 65 | </style> | 65 | </style> |
| 66 | + | ||
| 67 | + <style name="FullScreenDialogStyle" parent="Theme.MaterialComponents.Light"> | ||
| 68 | + <item name="android:windowNoTitle">true</item> | ||
| 69 | + <item name="android:windowFullscreen">false</item> | ||
| 70 | + <item name="android:windowIsFloating">false</item> | ||
| 71 | + <item name="android:windowBackground">@color/white</item> | ||
| 72 | + <item name="android:statusBarColor">@android:color/transparent</item> | ||
| 73 | + <item name="android:windowLightStatusBar">true</item> | ||
| 74 | + </style> | ||
| 66 | </resources> | 75 | </resources> | ... | ... |
-
Please register or login to post a comment