Commit f4aa3bf7 authored by fauzi's avatar fauzi

forgot pwd

parent 2a3fce92
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173"> <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> <DBN-PSQL>
<case-options enabled="true"> <case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" /> <option name="KEYWORD_CASE" value="lower" />
......
...@@ -63,4 +63,12 @@ dependencies { ...@@ -63,4 +63,12 @@ dependencies {
implementation 'com.google.zxing:core:3.3.2' implementation 'com.google.zxing:core:3.3.2'
implementation 'com.github.florent37:expansionpanel:1.2.4' 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 @@ ...@@ -23,8 +23,9 @@
<activity android:name=".MethodePayment"/> <activity android:name=".MethodePayment"/>
<activity android:name=".ScannerNfc"/> <activity android:name=".ScannerNfc"/>
<activity android:name=".TransactionDetail"/> <activity android:name=".TransactionDetail"/>
<activity android:name=".ForgotPasswordActivity" <activity
android:windowSoftInputMode="adjustResize"></activity> android:name=".ForgotPasswordActivity"
android:windowSoftInputMode="adjustResize|stateHidden" />
<activity android:name=".RegisterActivity" /> <activity android:name=".RegisterActivity" />
<activity android:name=".TransactionActivity" /> <activity android:name=".TransactionActivity" />
<activity <activity
......
...@@ -5,29 +5,44 @@ import android.app.ProgressDialog; ...@@ -5,29 +5,44 @@ import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; 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.BottomSheetBehavior;
import com.google.android.material.bottomsheet.BottomSheetDialog; import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment; 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; import com.yono.messeripos.utils.Utils;
public class ForgotCode extends BottomSheetDialogFragment { public class ForgotCode extends BottomSheetDialogFragment {
private static final String TAG = "FORGOT CODE";
Utils utils; Utils utils;
BottomSheetBehavior sheetBehavior; BottomSheetBehavior sheetBehavior;
BottomSheetDialog sheetDialog; BottomSheetDialog sheetDialog;
RelativeLayout fpCode; RelativeLayout fpass;
View view; View view;
PinEntryEditText pinEntry;
DataResponse response;
ForgotPasswordModels forgotPasswordModels;
Context context; Context context;
public ForgotCode(Context c) { public ForgotCode(Context context, DataResponse response) {
context = c; this.context = context;
this.response = response;
} }
@NonNull @NonNull
...@@ -39,7 +54,7 @@ public class ForgotCode extends BottomSheetDialogFragment { ...@@ -39,7 +54,7 @@ public class ForgotCode extends BottomSheetDialogFragment {
view = View.inflate(getContext(), R.layout.forgot_password_code, null); view = View.inflate(getContext(), R.layout.forgot_password_code, null);
// bindUI // bindUI
fpCode = view.findViewById(R.id.fpCode); fpass = view.findViewById(R.id.fpasswd);
// utils // utils
utils = new Utils(); utils = new Utils();
...@@ -49,11 +64,30 @@ public class ForgotCode extends BottomSheetDialogFragment { ...@@ -49,11 +64,30 @@ public class ForgotCode extends BottomSheetDialogFragment {
sheetBehavior = BottomSheetBehavior.from((View) (view.getParent())); sheetBehavior = BottomSheetBehavior.from((View) (view.getParent()));
// get Window size // get Window size
int setHeight = utils.getWindowHeight() - (utils.getWindowHeight() * 5) / 100; int setHeight = utils.getWindowHeight() - (utils.getWindowHeight() * 50) / 100;
// set max height // set max height
sheetBehavior.setPeekHeight(setHeight); 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; return sheetDialog;
} }
......
...@@ -5,14 +5,32 @@ import androidx.fragment.app.FragmentManager; ...@@ -5,14 +5,32 @@ import androidx.fragment.app.FragmentManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.EditText;
import android.widget.ImageButton; 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 { public class ForgotPasswordActivity extends AppCompatActivity {
ImageButton btnReset; ImageButton btnReset;
ForgotCode forgotCode; ForgotCode forgotCode;
ForgotPasswordModels forgotPasswordModels;
Utils utils = new Utils();
Client client=new Client();
UsersService usersService;
EditText formForgot;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -24,13 +42,33 @@ public class ForgotPasswordActivity extends AppCompatActivity { ...@@ -24,13 +42,33 @@ public class ForgotPasswordActivity extends AppCompatActivity {
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); 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); btnReset = findViewById(R.id.btn_reset_password);
formForgot = findViewById(R.id.forgotEmail);
btnReset.setOnClickListener(new View.OnClickListener() { btnReset.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
forgotCode = new ForgotCode(ForgotPasswordActivity.this);
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"); forgotCode.show(getSupportFragmentManager(), "forgot code");
} }
@Override
public void onFailure(Call<DataResponse> call, Throwable t) {
}
});
}
}); });
} }
} }
\ No newline at end of file
...@@ -180,10 +180,8 @@ public class RegisterState extends BottomSheetDialogFragment { ...@@ -180,10 +180,8 @@ public class RegisterState extends BottomSheetDialogFragment {
* */ * */
setAllLayoutToFalse(); setAllLayoutToFalse();
if (usersModelsDataResponse != null) { if (usersModelsDataResponse != null) {
final View customLayout = getLayoutInflater()
.inflate(R.layout.alert_dialog, null);
activateEmail(customLayout); activateEmail();
setAllLayoutToTrue(); setAllLayoutToTrue();
} }
} }
...@@ -201,12 +199,7 @@ public class RegisterState extends BottomSheetDialogFragment { ...@@ -201,12 +199,7 @@ public class RegisterState extends BottomSheetDialogFragment {
return sheetDialog2; return sheetDialog2;
} }
<<<<<<< HEAD private void setAllLayoutToTrue() {
private void activateEmail() {
=======
private void
setAllLayoutToTrue() {
pbReg.setVisibility(View.GONE); pbReg.setVisibility(View.GONE);
registerButton.setText(DEFAULT_REGISTER); registerButton.setText(DEFAULT_REGISTER);
sheetDialog2.setCancelable(true); sheetDialog2.setCancelable(true);
...@@ -229,8 +222,7 @@ public class RegisterState extends BottomSheetDialogFragment { ...@@ -229,8 +222,7 @@ public class RegisterState extends BottomSheetDialogFragment {
} }
private void activateEmail(View customLayout) { private void activateEmail() {
>>>>>>> dev
utils = new Utils(); utils = new Utils();
utils.dialog(context, false, "Please Verifiy Email", utils.dialog(context, false, "Please Verifiy Email",
......
...@@ -103,29 +103,6 @@ ...@@ -103,29 +103,6 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
tools:ignore="DuplicateIds" /> 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> </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_mail_outline_black_24dp" android:drawableStart="@drawable/ic_mail_outline_black_24dp"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
android:id="@+id/email" android:id="@+id/forgotEmail"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:textSize="14sp" android:textSize="14sp"
android:drawablePadding="10dp" android:drawablePadding="10dp"
......
...@@ -8,105 +8,47 @@ ...@@ -8,105 +8,47 @@
android:layout_width="match_parent"> android:layout_width="match_parent">
<RelativeLayout <RelativeLayout
android:id="@+id/fpCode" android:id="@+id/fpasswd"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingHorizontal="70dp"
android:padding="16dp"> android:layout_marginTop="100dp"
android:layout_height="match_parent">
<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 <com.google.android.material.textview.MaterialTextView
android:id="@+id/insertCode"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/edit_text_2" android:text="Insert Code"
android:inputType="number" android:textStyle="bold"
android:maxLength="1" android:textSize="18sp"
android:maxLines="1" android:layout_marginBottom="20dp"
android:gravity="center" android:layout_alignParentTop="true"
android:nextFocusRight="@id/edit_text_3" android:layout_centerHorizontal="true"/>
android:padding="20dp"
app:layout_constraintTop_toTopOf="parent" <com.alimuzaffar.lib.pin.PinEntryEditText
app:layout_constraintEnd_toStartOf="@id/edit_text_3" android:id="@+id/txt_pin_entry"
app:layout_constraintBottom_toBottomOf="parent" android:layout_width="match_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:layout_height="wrap_content"
android:id="@+id/edit_text_3" android:cursorVisible="false"
android:digits="1234567890"
android:inputType="number" android:inputType="number"
android:maxLength="1" android:maxLength="4"
android:maxLines="1" android:textIsSelectable="false"
android:gravity="center" android:textSize="20sp"
android:padding="20dp" android:layout_marginBottom="20dp"
android:nextFocusRight="@id/edit_text_4" app:pinAnimationType="fromBottom"
app:layout_constraintTop_toTopOf="parent" app:pinTextBottomPadding="20dp"
app:layout_constraintEnd_toStartOf="@id/edit_text_4" android:layoutDirection="ltr"
app:layout_constraintBottom_toBottomOf="parent" android:layout_below="@id/insertCode"
app:layout_constraintStart_toEndOf="@id/edit_text_2" />
tools:ignore="Autofill,LabelFor"/>
<com.google.android.material.textview.MaterialTextView
<EditText
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/edit_text_4" android:text="enter the code that has been sent to the email"
android:inputType="number" android:layout_below="@id/txt_pin_entry"
android:maxLength="1" android:layout_centerHorizontal="true"/>
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> </RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout> </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