Commit cb7cc48d by Simhachalam ch

fixed naviagation and otp validation issues

parent a93642ba
...@@ -160,7 +160,7 @@ public class ADALActivity extends AppCompatActivity { ...@@ -160,7 +160,7 @@ public class ADALActivity extends AppCompatActivity {
} }
}); });
CheckLoginValues(); // CheckLoginValues();
callGraphButton = (Button) findViewById(R.id.callGraph); callGraphButton = (Button) findViewById(R.id.callGraph);
signOutButton = (Button) findViewById(R.id.clearCache); signOutButton = (Button) findViewById(R.id.clearCache);
login_with_otp = (Button) findViewById(R.id.login_with_otp); login_with_otp = (Button) findViewById(R.id.login_with_otp);
...@@ -244,10 +244,14 @@ public class ADALActivity extends AppCompatActivity { ...@@ -244,10 +244,14 @@ public class ADALActivity extends AppCompatActivity {
if (requestCode == Constants.LOGIN_SCREEN_REQUEST_CODE) { if (requestCode == Constants.LOGIN_SCREEN_REQUEST_CODE) {
setResult(Constants.LOGIN_SCREEN_REQUEST_CODE, new Intent()); setResult(Constants.LOGIN_SCREEN_REQUEST_CODE, new Intent());
} else { } else {
startActivity(new Intent(ADALActivity.this, HomeScreen.class)); Intent homeIntent = new Intent(ADALActivity.this, HomeScreen.class);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(homeIntent);
} }
} else { } else {
startActivity(new Intent(ADALActivity.this, HomeScreen.class)); Intent homeIntent = new Intent(ADALActivity.this, HomeScreen.class);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(homeIntent);
} }
isLogin = true; isLogin = true;
finish(); finish();
...@@ -690,10 +694,14 @@ public class ADALActivity extends AppCompatActivity { ...@@ -690,10 +694,14 @@ public class ADALActivity extends AppCompatActivity {
startActivity(new Intent(ADALActivity.this, ChatActivity.class)); startActivity(new Intent(ADALActivity.this, ChatActivity.class));
} else { } else {
startActivity(new Intent(ADALActivity.this, HomeScreen.class)); Intent homeIntent = new Intent(ADALActivity.this, HomeScreen.class);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(homeIntent);
} }
} else { } else {
startActivity(new Intent(ADALActivity.this, HomeScreen.class)); Intent homeIntent = new Intent(ADALActivity.this, HomeScreen.class);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(homeIntent);
} }
// //
} else { } else {
......
...@@ -81,13 +81,13 @@ public class OtpValidationActivity extends Activity { ...@@ -81,13 +81,13 @@ public class OtpValidationActivity extends Activity {
ButterKnife.bind(this); ButterKnife.bind(this);
mApplication = (CatalogueApplication) getApplication(); mApplication = (CatalogueApplication) getApplication();
new LoginDetailsSendToServer().execute(); // new LoginDetailsSendToServer().execute();
} }
@OnClick(R.id.otp_screen_text_view) @OnClick(R.id.otp_screen_text_view)
void onLoginClicked() { void onLoginClicked() {
// callOtpAPI(); callOtpAPI();
} }
...@@ -124,10 +124,7 @@ public class OtpValidationActivity extends Activity { ...@@ -124,10 +124,7 @@ public class OtpValidationActivity extends Activity {
String optCode = mOTPEditText.getText().toString().trim(); String optCode = mOTPEditText.getText().toString().trim();
if (TextUtils.isEmpty(optCode)) { if (TextUtils.isEmpty(optCode)) {
mOTPEditText.setError(getResources().getString(R.string.otp_error)); mOTPEditText.setError(getResources().getString(R.string.otp_error));
} }else{
if (!TextUtils.isEmpty(phoneString) ) {
KeyboardUtil.hideKeyboard(OtpValidationActivity.this); KeyboardUtil.hideKeyboard(OtpValidationActivity.this);
if (mApplication.isNetConnected()) { if (mApplication.isNetConnected()) {
...@@ -138,6 +135,7 @@ public class OtpValidationActivity extends Activity { ...@@ -138,6 +135,7 @@ public class OtpValidationActivity extends Activity {
DialogUtils.showNoConnectionDialog(OtpValidationActivity.this); DialogUtils.showNoConnectionDialog(OtpValidationActivity.this);
} }
} }
} }
...@@ -427,10 +425,14 @@ public class OtpValidationActivity extends Activity { ...@@ -427,10 +425,14 @@ public class OtpValidationActivity extends Activity {
if (requestCode == Constants.LOGIN_SCREEN_REQUEST_CODE) { if (requestCode == Constants.LOGIN_SCREEN_REQUEST_CODE) {
startActivity(new Intent(OtpValidationActivity.this, ChatActivity.class)); startActivity(new Intent(OtpValidationActivity.this, ChatActivity.class));
} else { } else {
startActivity(new Intent(OtpValidationActivity.this, HomeScreen.class)); Intent homeIntent = new Intent(OtpValidationActivity.this, HomeScreen.class);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(homeIntent);
} }
} else { } else {
startActivity(new Intent(OtpValidationActivity.this, HomeScreen.class)); Intent homeIntent = new Intent(OtpValidationActivity.this, HomeScreen.class);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(homeIntent);
} }
finish(); finish();
} else { } else {
......
...@@ -6,6 +6,8 @@ import android.graphics.drawable.Drawable; ...@@ -6,6 +6,8 @@ import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.content.LocalBroadcastManager;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Window; import android.view.Window;
import android.widget.LinearLayout; import android.widget.LinearLayout;
...@@ -24,6 +26,8 @@ import org.json.JSONException; ...@@ -24,6 +26,8 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import com.microsoft.appcenter.AppCenter; import com.microsoft.appcenter.AppCenter;
import com.microsoft.appcenter.crashes.Crashes; import com.microsoft.appcenter.crashes.Crashes;
import com.vsoft.vera.utils.Constants;
import com.vsoft.vera.utils.PrefManager;
import butterknife.ButterKnife; import butterknife.ButterKnife;
...@@ -59,7 +63,19 @@ public class SplashScreen extends Activity { ...@@ -59,7 +63,19 @@ public class SplashScreen extends Activity {
ButterKnife.bind(this); ButterKnife.bind(this);
startThread(); startThread();
} }
private void CheckLoginValues() {
String sysId = PrefManager.getSharedPref(SplashScreen.this, PrefManager.PREFERENCE_USER_SYS_ID);
if (!TextUtils.isEmpty(sysId)) {
/*Send broadcast to start SyncService*/
Intent intent = new Intent(Constants.APPLICATION_BROADCAST_INTENT);
intent.putExtra(Constants.APPLICATION_BROADCAST_DATA_ACTION, Constants.ACTION_SYNC);
LocalBroadcastManager.getInstance(SplashScreen.this).sendBroadcast(intent);
startActivity(new Intent(SplashScreen.this, HomeScreen.class));
}else{
startActivity(new Intent(SplashScreen.this, ADALActivity.class));
}
}
private void startThread() { private void startThread() {
new Handler().postDelayed(new Runnable() { new Handler().postDelayed(new Runnable() {
...@@ -72,9 +88,9 @@ public class SplashScreen extends Activity { ...@@ -72,9 +88,9 @@ public class SplashScreen extends Activity {
public void run() { public void run() {
// This method will be executed once the timer is over // This method will be executed once the timer is over
// Start your app main activity // Start your app main activity
Intent i = new Intent(SplashScreen.this, ADALActivity.class); // Intent i = new Intent(SplashScreen.this, ADALActivity.class);
startActivity(i); // startActivity(i);
CheckLoginValues();
// close this activity // close this activity
finish(); finish();
} }
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<RelativeLayout <RelativeLayout
android:id="@+id/phone_validate_layout" android:id="@+id/phone_validate_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:visibility="gone" android:visibility="visible"
android:layout_height="match_parent"> android:layout_height="match_parent">
......
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 sign in to comment