use of com.manan.dev.ec2018app.Fragments.FragmentOtpChecker in project EC2018App by Manan-YMCA.
the class RegisterActivity method checkOTP.
private void checkOTP(UserDetails userDetails) {
checkAndRequestPermissions();
if (ContextCompat.checkSelfPermission(RegisterActivity.this, android.Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED) {
FragmentManager fm = getFragmentManager();
FragmentOtpChecker otpChecker = new FragmentOtpChecker();
Bundle bundle = new Bundle();
bundle.putString("phone", userPhone.getText().toString());
otpChecker.setArguments(bundle);
otpChecker.show(fm, "otpCheckerFragment");
}
mProgress.dismiss();
}
use of com.manan.dev.ec2018app.Fragments.FragmentOtpChecker in project EC2018App by Manan-YMCA.
the class LoginActivity method getDetails.
private void getDetails(final UserDetails userDetails, final String phone) {
String url = getResources().getString(R.string.get_user_details_api) + phone;
RequestQueue queue = Volley.newRequestQueue(this);
StringRequest obreq = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject obj1 = new JSONObject(response);
Long success = obj1.getLong("success");
if (success == 1) {
checkAndRequestPermissions();
if (ContextCompat.checkSelfPermission(LoginActivity.this, android.Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED) {
FragmentManager fm = getFragmentManager();
FragmentOtpChecker otpChecker = new FragmentOtpChecker();
Bundle bundle = new Bundle();
bundle.putString("phone", mobileNum.getText().toString());
otpChecker.setArguments(bundle);
otpChecker.show(fm, "otpCheckerFragment");
}
} else {
pbLogin.setVisibility(View.GONE);
// Snackbar.make(RelativeView, "Please register yourself first!", Snackbar.LENGTH_LONG).show();
MDToast.makeText(LoginActivity.this, "Please register yourself first!", Toast.LENGTH_LONG, MDToast.TYPE_INFO).show();
Intent i = new Intent(LoginActivity.this, RegisterActivity.class).putExtra("parent", "xunbao");
;
startActivity(i);
finish();
}
}// Try and catch are included to handle any errors due to JSON
catch (Exception e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public // Handles errors that occur due to Volley
void onErrorResponse(VolleyError error) {
}
});
queue.add(obreq);
}
use of com.manan.dev.ec2018app.Fragments.FragmentOtpChecker in project EC2018App by Manan-YMCA.
the class LoginActivity method onRequestPermissionsResult.
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == REQUEST_ID_MULTIPLE_PERMISSIONS) {
FragmentManager fm = getFragmentManager();
FragmentOtpChecker otpChecker = new FragmentOtpChecker();
Bundle bundle = new Bundle();
bundle.putString("phone", mobileNum.getText().toString());
otpChecker.setArguments(bundle);
otpChecker.show(fm, "otpCheckerFragment");
}
}
use of com.manan.dev.ec2018app.Fragments.FragmentOtpChecker in project EC2018App by Manan-YMCA.
the class RegisterActivity method onRequestPermissionsResult.
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == REQUEST_ID_MULTIPLE_PERMISSIONS) {
Bundle bundle = new Bundle();
FragmentManager fm = getFragmentManager();
FragmentOtpChecker otpChecker = new FragmentOtpChecker();
bundle.putString("phone", userDetails.getmPhone());
otpChecker.setArguments(bundle);
otpChecker.show(fm, "otpCheckerFragment");
}
}
Aggregations