Commit 7c720a08 authored by iman Fauzi's avatar iman Fauzi

round bottom sheet

parent b60ffb58
......@@ -76,41 +76,41 @@ public class BottomSheets extends BottomSheetDialogFragment {
btnCash = v.findViewById(R.id.btnCash);
totalHarga = v.findViewById(R.id.totalHarga);
utils = new Utils();
bottomSheetBehavior = BottomSheetBehavior.from(layoutFormCash);
// bottomSheetBehavior = BottomSheetBehavior.from(layoutFormCash);
// sharedPreferences = getActivity().getSharedPreferences(MainActivity.ORDER_ID, Context.MODE_PRIVATE);
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
// bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
long ga = paymentsModels.getGrossAmount();
String setCurrency = utils.convertPrice("Rp.", ga);
totalHarga.setText(setCurrency);
hargaChange.setText(defaultText);
bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
switch (newState) {
case BottomSheetBehavior.STATE_HIDDEN:
break;
case BottomSheetBehavior.STATE_EXPANDED:
break;
case BottomSheetBehavior.STATE_COLLAPSED:
break;
case BottomSheetBehavior.STATE_DRAGGING:
break;
case BottomSheetBehavior.STATE_SETTLING:
break;
}
}
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
if (bottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
} else {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
}
});
// bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
// @Override
// public void onStateChanged(@NonNull View bottomSheet, int newState) {
// switch (newState) {
// case BottomSheetBehavior.STATE_HIDDEN:
// break;
// case BottomSheetBehavior.STATE_EXPANDED:
// break;
// case BottomSheetBehavior.STATE_COLLAPSED:
// break;
// case BottomSheetBehavior.STATE_DRAGGING:
// break;
// case BottomSheetBehavior.STATE_SETTLING:
// break;
// }
// }
// @Override
// public void onSlide(@NonNull View bottomSheet, float slideOffset) {
// if (bottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
// bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
// } else {
// bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
// }
// }
// });
inputAmount.addTextChangedListener(new TextWatcher() {
@Override
......@@ -120,7 +120,7 @@ public class BottomSheets extends BottomSheetDialogFragment {
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if (TextUtils.isEmpty(charSequence)) inputAmount.setText("0");
if (TextUtils.isEmpty(charSequence)) inputAmount.setText("");
grossAmount = paymentsModels.getGrossAmount();
long input = Long.parseLong(inputAmount.getText().toString());
......@@ -142,6 +142,7 @@ public class BottomSheets extends BottomSheetDialogFragment {
}
private void bayar(View view) {
// String orderId, String paymentType, String bank, long grossAmount
PaymentsModels paymentsModels = new PaymentsModels(
MainActivity.orderId,
......
......@@ -68,7 +68,7 @@ public class PaymentActivity extends AppCompatActivity {
Button cashBtn;
ProgressDialog progressDialog;
BottomSheetBehavior bottomSheetBank;
RelativeLayout qrcodeLayoutBank;
// RelativeLayout qrcodeLayoutBank;
......@@ -89,8 +89,8 @@ public class PaymentActivity extends AppCompatActivity {
checkoutAdapter = new CheckoutAdapter();
recyclerView = findViewById(R.id.rvItem);
grandTotal = findViewById(R.id.grand_total);
qrcodeLayoutBank = findViewById(R.id.qrCodeForm);
bottomSheetBank = BottomSheetBehavior.from(qrcodeLayoutBank);
// qrcodeLayoutBank = findViewById(R.id.qrCodeForm);
// bottomSheetBank = BottomSheetBehavior.from(qrcodeLayoutBank);
progressDialog = new ProgressDialog(PaymentActivity.this);
progressDialog.setMessage("Loading...");
progressDialog.setCancelable(false);
......@@ -144,32 +144,32 @@ public class PaymentActivity extends AppCompatActivity {
});
bottomSheetBank.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
switch (newState) {
case BottomSheetBehavior.STATE_HIDDEN:
break;
case BottomSheetBehavior.STATE_EXPANDED:
break;
case BottomSheetBehavior.STATE_COLLAPSED:
break;
case BottomSheetBehavior.STATE_DRAGGING:
break;
case BottomSheetBehavior.STATE_SETTLING:
break;
}
}
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
if (bottomSheetBank.getState() != BottomSheetBehavior.STATE_EXPANDED) {
bottomSheetBank.setState(BottomSheetBehavior.STATE_EXPANDED);
} else {
bottomSheetBank.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
}
});
// bottomSheetBank.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
// @Override
// public void onStateChanged(@NonNull View bottomSheet, int newState) {
// switch (newState) {
// case BottomSheetBehavior.STATE_HIDDEN:
// break;
// case BottomSheetBehavior.STATE_EXPANDED:
// break;
// case BottomSheetBehavior.STATE_COLLAPSED:
// break;
// case BottomSheetBehavior.STATE_DRAGGING:
// break;
// case BottomSheetBehavior.STATE_SETTLING:
// break;
// }
// }
//
// @Override
// public void onSlide(@NonNull View bottomSheet, float slideOffset) {
// if (bottomSheetBank.getState() != BottomSheetBehavior.STATE_EXPANDED) {
// bottomSheetBank.setState(BottomSheetBehavior.STATE_EXPANDED);
// } else {
// bottomSheetBank.setState(BottomSheetBehavior.STATE_COLLAPSED);
// }
// }
// });
btnPay.setOnClickListener(new View.OnClickListener() {
......
package com.yono.messeripos;
import android.content.Context;
import com.google.android.material.appbar.MaterialToolbar;
public class ToolbarApp {
}
......@@ -15,8 +15,7 @@
android:orientation="vertical"
app:behavior_hideable="true"
app:behavior_peekHeight="56dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
style="@style/AppModalStyle"
style="@style/Widget.Rounded.BottomSheet"
android:padding="16dp">
<TextView
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent">
<FrameLayout
android:id="@+id/btSheet"
style="?attr/bottomSheetStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="hello"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="This is"/>
</FrameLayout>
</FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
......@@ -87,5 +87,4 @@
</RelativeLayout>
<include layout="@layout/activity_q_r_code"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
......@@ -24,7 +24,7 @@
<item name="windowActionBarOverlay">true</item>
<item name="android:fontFamily">@font/roboto</item>
<item name="actionBarStyle">@style/ThemeActionBar</item>
<item name="bottomSheetDialogTheme">@style/ThemeOverlay.Me.BottomSheetDialog</item>
<item name="bottomSheetDialogTheme">@style/ThemeOverlay.Rounded.BottomSheetDialog</item>
</style>
......@@ -75,6 +75,22 @@
<item name="android:hint">Select kategori</item>
</style>
<style name="ShapeAppearanceOverlay.Rounded.top" parent="">
<item name="cornerSizeTopLeft">30dp</item>
<item name="cornerSizeTopRight">30dp</item>
<item name="cornerFamily">rounded</item>
</style>
<style
name="ThemeOverlay.Rounded.BottomSheetDialog"
parent="@style/ThemeOverlay.MaterialComponents.BottomSheetDialog">
<item name="bottomSheetStyle">@style/Widget.Rounded.BottomSheet</item>
</style>
<style name="Widget.Rounded.BottomSheet" parent="Widget.MaterialComponents.BottomSheet">
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.Rounded.top</item>
</style>
<style name="AppModalStyle" parent="Widget.Design.BottomSheet.Modal">
<item name="android:background">@drawable/round_corner_sheet</item>
</style>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment