|
@ -78,6 +78,21 @@ public class MainActivity extends AppCompatActivity { |
|
|
String username = editTextUsername.getText().toString().trim(); |
|
|
String username = editTextUsername.getText().toString().trim(); |
|
|
String password = editTextPassword.getText().toString().trim(); |
|
|
String password = editTextPassword.getText().toString().trim(); |
|
|
|
|
|
|
|
|
|
|
|
// 在测试环境下,如果用户名和密码都为空,自动填充默认账号 |
|
|
|
|
|
if (isTestEnvironment() && username.isEmpty() && password.isEmpty()) { |
|
|
|
|
|
username = "00167"; |
|
|
|
|
|
password = "123456"; |
|
|
|
|
|
|
|
|
|
|
|
// 更新输入框显示 |
|
|
|
|
|
editTextUsername.setText(username); |
|
|
|
|
|
editTextPassword.setText(password); |
|
|
|
|
|
|
|
|
|
|
|
// 显示提示信息 |
|
|
|
|
|
showToast("测试环境:已自动填充默认账号"); |
|
|
|
|
|
|
|
|
|
|
|
android.util.Log.d("MainActivity", "Test environment: Auto-filled default credentials"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (validateInput(username, password)) { |
|
|
if (validateInput(username, password)) { |
|
|
performLogin(username, password); |
|
|
performLogin(username, password); |
|
|
} |
|
|
} |
|
@ -137,6 +152,15 @@ public class MainActivity extends AppCompatActivity { |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 判断是否为测试环境 |
|
|
|
|
|
* @return true 如果是测试环境 |
|
|
|
|
|
*/ |
|
|
|
|
|
private boolean isTestEnvironment() { |
|
|
|
|
|
// 根据 NetworkConfig 中的 BASE_URL 判断是否为测试环境 |
|
|
|
|
|
return com.ouxuan.oxface.network.NetworkConfig.BASE_URL.contains("testmanager"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void performLogin(String username, String password) { |
|
|
private void performLogin(String username, String password) { |
|
|
// 使用Pad登录接口进行真实的API调用 |
|
|
// 使用Pad登录接口进行真实的API调用 |
|
|
String deviceId = "ANDROID_" + android.provider.Settings.Secure.getString( |
|
|
String deviceId = "ANDROID_" + android.provider.Settings.Secure.getString( |
|
|