diff --git a/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java b/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java index cc5b9672..0d1a928e 100644 --- a/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java @@ -111,6 +111,29 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener info_button.setOnClickListener(infoListener); + if(tinyDb.getBoolean("loginType")) { // username/password + + loginMethod.check(R.id.loginUsernamePassword); + + loginUidET.setVisibility(View.VISIBLE); + loginPassword.setVisibility(View.VISIBLE); + otpCode.setVisibility(View.VISIBLE); + otpInfo.setVisibility(View.VISIBLE); + loginTokenCode.setVisibility(View.GONE); + + } + else { + + loginMethod.check(R.id.loginToken); + + loginUidET.setVisibility(View.GONE); + loginPassword.setVisibility(View.GONE); + otpCode.setVisibility(View.GONE); + otpInfo.setVisibility(View.GONE); + loginTokenCode.setVisibility(View.VISIBLE); + + } + loginMethod.setOnCheckedChangeListener((group, checkedId) -> { if(checkedId == R.id.loginToken) { @@ -221,6 +244,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener if(loginMethodType == R.id.loginUsernamePassword) { + tinyDb.putBoolean("loginType", true); + if(instanceUrl.contains("@")) { String[] urlForHttpAuth = instanceUrl.split("@"); @@ -322,6 +347,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener } else { + tinyDb.putBoolean("loginType", false); + String instanceHost; if(AppUtil.httpCheck(instanceUrl)) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 144c78d7..282447b4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -100,7 +100,7 @@ Password is required Cannot access network, please check your Internet connection - Yay, Internet connection is back + Yay, We have Internet connection! Repository name is empty Repository name is not valid. [a–z A–Z 0–9 – _]