mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-01-30 17:04:51 +01:00
Fix for server drop down on fresh installs
This commit is contained in:
parent
d2452c3212
commit
ad5180c007
@ -2,8 +2,8 @@
|
||||
<manifest xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
package="com.thejoshwa.ultrasonic.androidapp"
|
||||
a:installLocation="auto"
|
||||
a:versionCode="15"
|
||||
a:versionName="1.1.0.11" >
|
||||
a:versionCode="16"
|
||||
a:versionName="1.1.0.12" >
|
||||
|
||||
<uses-permission a:name="android.permission.INTERNET" />
|
||||
<uses-permission a:name="android.permission.READ_PHONE_STATE" />
|
||||
|
@ -103,12 +103,23 @@ public class MainActivity extends SubsonicTabActivity {
|
||||
|
||||
final View dummyView = findViewById(R.id.main_dummy);
|
||||
|
||||
boolean shouldShowDialog = false;
|
||||
|
||||
if (!getActiveServerEnabled()) {
|
||||
shouldShowDialog = true;
|
||||
Util.setActiveServer(this, 0);
|
||||
}
|
||||
|
||||
int instance = Util.getActiveServer(this);
|
||||
String name = Util.getServerName(this, instance);
|
||||
|
||||
if (name == null) {
|
||||
shouldShowDialog = true;
|
||||
Util.setActiveServer(this, 0);
|
||||
instance = Util.getActiveServer(this);
|
||||
name = Util.getServerName(this, instance);
|
||||
}
|
||||
|
||||
serverTextView.setText(name);
|
||||
|
||||
ListView list = (ListView) findViewById(R.id.main_list);
|
||||
@ -172,7 +183,7 @@ public class MainActivity extends SubsonicTabActivity {
|
||||
// Remember the current theme.
|
||||
theme = Util.getTheme(this);
|
||||
|
||||
showInfoDialog();
|
||||
showInfoDialog(shouldShowDialog);
|
||||
}
|
||||
|
||||
private void loadSettings() {
|
||||
@ -214,6 +225,10 @@ public class MainActivity extends SubsonicTabActivity {
|
||||
for (int i = 0; i <= Util.getActiveServers(this); i++) {
|
||||
String serverName = Util.getServerName(this, i);
|
||||
|
||||
if (serverName == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Util.getServerEnabled(this, i)) {
|
||||
int menuItemNum = getMenuItem(i);
|
||||
|
||||
@ -363,10 +378,11 @@ public class MainActivity extends SubsonicTabActivity {
|
||||
finish();
|
||||
}
|
||||
|
||||
private void showInfoDialog() {
|
||||
private void showInfoDialog(boolean show) {
|
||||
if (!infoDialogDisplayed) {
|
||||
infoDialogDisplayed = true;
|
||||
if (Util.getRestUrl(this, null).contains("yourhost")) {
|
||||
|
||||
if (show || Util.getRestUrl(this, null).contains("yourhost")) {
|
||||
Util.info(this, R.string.main_welcome_title, R.string.main_welcome_text);
|
||||
}
|
||||
}
|
||||
|
@ -290,6 +290,10 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
|
||||
serverPasswordPreference.setText(null);
|
||||
serverEnabledPreference.setChecked(true);
|
||||
|
||||
if (Util.getActiveServer(SettingsActivity.this) == instance) {
|
||||
Util.setActiveServer(SettingsActivity.this, 0);
|
||||
}
|
||||
|
||||
activeServers--;
|
||||
serversCategory.removePreference(screen);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user