Commit f4aa3bf7 authored by fauzi's avatar fauzi

forgot pwd

parent 2a3fce92
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
......
......@@ -63,4 +63,12 @@ dependencies {
implementation 'com.google.zxing:core:3.3.2'
implementation 'com.github.florent37:expansionpanel:1.2.4'
implementation ('com.alimuzaffar.lib:pinentryedittext:1.3.10') {
// Exclude is only needed if you already have
// any of the following as a dependency in your project.
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'support-v13'
}
}
\ No newline at end of file
......@@ -23,8 +23,9 @@
<activity android:name=".MethodePayment"/>
<activity android:name=".ScannerNfc"/>
<activity android:name=".TransactionDetail"/>
<activity android:name=".ForgotPasswordActivity"
android:windowSoftInputMode="adjustResize"></activity>
<activity
android:name=".ForgotPasswordActivity"
android:windowSoftInputMode="adjustResize|stateHidden" />
<activity android:name=".RegisterActivity" />
<activity android:name=".TransactionActivity" />
<activity
......
......@@ -5,29 +5,44 @@ import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.alimuzaffar.lib.pin.PinEntryEditText;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import com.yono.messeripos.api.client.Client;
import com.yono.messeripos.api.service.UsersService;
import com.yono.messeripos.models.ForgotPasswordModels;
import com.yono.messeripos.models.MainViewModels;
import com.yono.messeripos.response.DataResponse;
import com.yono.messeripos.utils.Utils;
public class ForgotCode extends BottomSheetDialogFragment {
private static final String TAG = "FORGOT CODE";
Utils utils;
BottomSheetBehavior sheetBehavior;
BottomSheetDialog sheetDialog;
RelativeLayout fpCode;
RelativeLayout fpass;
View view;
PinEntryEditText pinEntry;
DataResponse response;
ForgotPasswordModels forgotPasswordModels;
Context context;
public ForgotCode(Context c) {
context = c;
public ForgotCode(Context context, DataResponse response) {
this.context = context;
this.response = response;
}
@NonNull
......@@ -39,7 +54,7 @@ public class ForgotCode extends BottomSheetDialogFragment {
view = View.inflate(getContext(), R.layout.forgot_password_code, null);
// bindUI
fpCode = view.findViewById(R.id.fpCode);
fpass = view.findViewById(R.id.fpasswd);
// utils
utils = new Utils();
......@@ -49,11 +64,30 @@ public class ForgotCode extends BottomSheetDialogFragment {
sheetBehavior = BottomSheetBehavior.from((View) (view.getParent()));
// get Window size
int setHeight = utils.getWindowHeight() - (utils.getWindowHeight() * 5) / 100;
int setHeight = utils.getWindowHeight() - (utils.getWindowHeight() * 50) / 100;
// set max height
sheetBehavior.setPeekHeight(setHeight);
fpCode.setMinimumHeight(setHeight);
fpass.setMinimumHeight(setHeight);
utils = new Utils();
// Log.d(TAG, "onCreateDialog: "+utils.convertGson(mainViewModels));
pinEntry = view.findViewById(R.id.txt_pin_entry);
if (pinEntry != null) {
pinEntry.setOnPinEnteredListener(new PinEntryEditText.OnPinEnteredListener() {
@Override
public void onPinEntered(CharSequence str) {
if (str.toString().equals(forgotPasswordModels.getMessage())) {
Toast.makeText(context, "SUCCESS", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(context, "FAIL", Toast.LENGTH_SHORT).show();
pinEntry.setText(null);
}
}
});
}
return sheetDialog;
}
......
......@@ -5,14 +5,32 @@ import androidx.fragment.app.FragmentManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.ImageButton;
import com.yono.messeripos.api.client.Client;
import com.yono.messeripos.api.service.UsersService;
import com.yono.messeripos.models.ForgotPasswordModels;
import com.yono.messeripos.models.MainViewModels;
import com.yono.messeripos.response.DataResponse;
import com.yono.messeripos.utils.Utils;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ForgotPasswordActivity extends AppCompatActivity {
ImageButton btnReset;
ForgotCode forgotCode;
ForgotPasswordModels forgotPasswordModels;
Utils utils = new Utils();
Client client=new Client();
UsersService usersService;
EditText formForgot;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -24,12 +42,32 @@ public class ForgotPasswordActivity extends AppCompatActivity {
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
forgotPasswordModels = new ForgotPasswordModels();
// bind UI
btnReset = findViewById(R.id.btn_reset_password);
formForgot = findViewById(R.id.forgotEmail);
btnReset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
forgotCode = new ForgotCode(ForgotPasswordActivity.this);
forgotCode.show(getSupportFragmentManager(), "forgot code");
forgotPasswordModels.setEmail(formForgot.getText().toString());
forgotPasswordModels.setMessage(utils.getRandomNumberString());
usersService = client.Client(UsersService.class);
usersService.postForgotPassword(forgotPasswordModels).enqueue(new Callback<DataResponse>() {
@Override
public void onResponse(Call<DataResponse> call, Response<DataResponse> response) {
forgotCode = new ForgotCode(ForgotPasswordActivity.this, response.body());
forgotCode.show(getSupportFragmentManager(), "forgot code");
}
@Override
public void onFailure(Call<DataResponse> call, Throwable t) {
}
});
}
});
}
......
......@@ -180,10 +180,8 @@ public class RegisterState extends BottomSheetDialogFragment {
* */
setAllLayoutToFalse();
if (usersModelsDataResponse != null) {
final View customLayout = getLayoutInflater()
.inflate(R.layout.alert_dialog, null);
activateEmail(customLayout);
activateEmail();
setAllLayoutToTrue();
}
}
......@@ -201,12 +199,7 @@ public class RegisterState extends BottomSheetDialogFragment {
return sheetDialog2;
}
<<<<<<< HEAD
private void activateEmail() {
=======
private void
setAllLayoutToTrue() {
private void setAllLayoutToTrue() {
pbReg.setVisibility(View.GONE);
registerButton.setText(DEFAULT_REGISTER);
sheetDialog2.setCancelable(true);
......@@ -229,8 +222,7 @@ public class RegisterState extends BottomSheetDialogFragment {
}
private void activateEmail(View customLayout) {
>>>>>>> dev
private void activateEmail() {
utils = new Utils();
utils.dialog(context, false, "Please Verifiy Email",
......
......@@ -103,29 +103,6 @@
android:layout_marginTop="10dp"
tools:ignore="DuplicateIds" />
<TextView
android:id="@+id/txtgrandTotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/txtAdminFee"
app:layout_constraintStart_toStartOf="parent"
android:text="Gross Amount"
android:textSize="18sp"
android:layout_marginTop="10dp"/>
<TextView
android:id="@+id/txtgrandTotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/adminFee"
app:layout_constraintEnd_toEndOf="parent"
android:text="Admin Fee"
android:textSize="18sp"
android:layout_marginTop="10dp"
tools:ignore="DuplicateIds" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
......
......@@ -77,7 +77,7 @@
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_mail_outline_black_24dp"
android:layout_marginEnd="20dp"
android:id="@+id/email"
android:id="@+id/forgotEmail"
android:layout_marginStart="20dp"
android:textSize="14sp"
android:drawablePadding="10dp"
......
......@@ -8,105 +8,47 @@
android:layout_width="match_parent">
<RelativeLayout
android:id="@+id/fpCode"
android:id="@+id/fpasswd"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<androidx.cardview.widget.CardView
android:id="@+id/verifCode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/edit_text_1"
android:inputType="number"
android:maxLength="1"
android:maxLines="1"
android:gravity="center"
android:padding="20dp"
android:nextFocusRight="@id/edit_text_2"
android:singleLine="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/edit_text_2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="Autofill,LabelFor"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/edit_text_2"
android:inputType="number"
android:maxLength="1"
android:maxLines="1"
android:gravity="center"
android:nextFocusRight="@id/edit_text_3"
android:padding="20dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/edit_text_3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/edit_text_1"
tools:ignore="Autofill,LabelFor"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/edit_text_3"
android:inputType="number"
android:maxLength="1"
android:maxLines="1"
android:gravity="center"
android:padding="20dp"
android:nextFocusRight="@id/edit_text_4"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/edit_text_4"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/edit_text_2"
tools:ignore="Autofill,LabelFor"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/edit_text_4"
android:inputType="number"
android:maxLength="1"
android:maxLines="1"
android:gravity="center"
android:padding="20dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/edit_text_3"
tools:ignore="Autofill,LabelFor"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!-- <androidx.cardview.widget.CardView-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_below="@id/verifCode"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content">-->
<!-- -->
<!-- <GridLayout-->
<!-- android:columnCount="3"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->
<!-- -->
<!-- <com.google.android.material.button.MaterialButton-->
<!-- android:text="1"/>-->
<!-- -->
<!-- </GridLayout>-->
<!-- </androidx.cardview.widget.CardView>-->
</RelativeLayout>
android:paddingHorizontal="70dp"
android:layout_marginTop="100dp"
android:layout_height="match_parent">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/insertCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Insert Code"
android:textStyle="bold"
android:textSize="18sp"
android:layout_marginBottom="20dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"/>
<com.alimuzaffar.lib.pin.PinEntryEditText
android:id="@+id/txt_pin_entry"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cursorVisible="false"
android:digits="1234567890"
android:inputType="number"
android:maxLength="4"
android:textIsSelectable="false"
android:textSize="20sp"
android:layout_marginBottom="20dp"
app:pinAnimationType="fromBottom"
app:pinTextBottomPadding="20dp"
android:layoutDirection="ltr"
android:layout_below="@id/insertCode"
/>
<com.google.android.material.textview.MaterialTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="enter the code that has been sent to the email"
android:layout_below="@id/txt_pin_entry"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
\ No newline at end of file
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