Commit cb7cc48d by Simhachalam ch

fixed naviagation and otp validation issues

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