Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed May 29, 2021
1 parent 0c87642 commit 63bd468
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@

public class PaymentFragment extends Fragment {

final String PROMPT_API = "https://prompt.cash/demo?amount=0.01";
final String PROMPT_API = "https://prompt.cash/demo?amount=";

public static double mAmount = 0.01;

private FragmentSecondBinding binding;

Expand Down Expand Up @@ -58,7 +60,7 @@ public void onClick(View view) {
// ensure we will stay on the page and dont open a exernal browser
binding.webView.setWebViewClient(new MyWebViewClient());
// and load the payment page
binding.webView.loadUrl(this.PROMPT_API);
binding.webView.loadUrl(this.PROMPT_API + mAmount);

// set up a timer to check every second if the payment was successfull
FragmentActivity activity = getActivity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ public View onCreateView(
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

android.widget.EditText num = binding.numAmount;
num.setText("0.01");

binding.buttonFirst.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

PaymentFragment.mAmount = Double.parseDouble(num.getText().toString());

NavHostFragment.findNavController(WelcomeFragment.this)
.navigate(R.id.action_FirstFragment_to_SecondFragment);
}
Expand Down
20 changes: 17 additions & 3 deletions app/src/main/res/layout/fragment_first.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="https://prompt.cash demo"
app:layout_constraintBottom_toTopOf="@id/button_first"
app:layout_constraintBottom_toTopOf="@+id/numAmount"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Expand All @@ -20,9 +20,23 @@
android:id="@+id/button_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="296dp"
android:text="@string/next"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textview_first" />
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent" />

<EditText
android:id="@+id/numAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="100dp"
android:layout_marginRight="100dp"
android:layout_marginBottom="36dp"
android:ems="10"
android:inputType="numberSigned"
app:layout_constraintBottom_toTopOf="@+id/button_first"
app:layout_constraintEnd_toEndOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 63bd468

Please sign in to comment.