mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-28 14:42:16 +03: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"
|
<manifest xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
package="com.thejoshwa.ultrasonic.androidapp"
|
package="com.thejoshwa.ultrasonic.androidapp"
|
||||||
a:installLocation="auto"
|
a:installLocation="auto"
|
||||||
a:versionCode="15"
|
a:versionCode="16"
|
||||||
a:versionName="1.1.0.11" >
|
a:versionName="1.1.0.12" >
|
||||||
|
|
||||||
<uses-permission a:name="android.permission.INTERNET" />
|
<uses-permission a:name="android.permission.INTERNET" />
|
||||||
<uses-permission a:name="android.permission.READ_PHONE_STATE" />
|
<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);
|
final View dummyView = findViewById(R.id.main_dummy);
|
||||||
|
|
||||||
|
boolean shouldShowDialog = false;
|
||||||
|
|
||||||
if (!getActiveServerEnabled()) {
|
if (!getActiveServerEnabled()) {
|
||||||
|
shouldShowDialog = true;
|
||||||
Util.setActiveServer(this, 0);
|
Util.setActiveServer(this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int instance = Util.getActiveServer(this);
|
int instance = Util.getActiveServer(this);
|
||||||
String name = Util.getServerName(this, instance);
|
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);
|
serverTextView.setText(name);
|
||||||
|
|
||||||
ListView list = (ListView) findViewById(R.id.main_list);
|
ListView list = (ListView) findViewById(R.id.main_list);
|
||||||
@ -172,7 +183,7 @@ public class MainActivity extends SubsonicTabActivity {
|
|||||||
// Remember the current theme.
|
// Remember the current theme.
|
||||||
theme = Util.getTheme(this);
|
theme = Util.getTheme(this);
|
||||||
|
|
||||||
showInfoDialog();
|
showInfoDialog(shouldShowDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadSettings() {
|
private void loadSettings() {
|
||||||
@ -214,6 +225,10 @@ public class MainActivity extends SubsonicTabActivity {
|
|||||||
for (int i = 0; i <= Util.getActiveServers(this); i++) {
|
for (int i = 0; i <= Util.getActiveServers(this); i++) {
|
||||||
String serverName = Util.getServerName(this, i);
|
String serverName = Util.getServerName(this, i);
|
||||||
|
|
||||||
|
if (serverName == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (Util.getServerEnabled(this, i)) {
|
if (Util.getServerEnabled(this, i)) {
|
||||||
int menuItemNum = getMenuItem(i);
|
int menuItemNum = getMenuItem(i);
|
||||||
|
|
||||||
@ -363,10 +378,11 @@ public class MainActivity extends SubsonicTabActivity {
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showInfoDialog() {
|
private void showInfoDialog(boolean show) {
|
||||||
if (!infoDialogDisplayed) {
|
if (!infoDialogDisplayed) {
|
||||||
infoDialogDisplayed = true;
|
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);
|
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);
|
serverPasswordPreference.setText(null);
|
||||||
serverEnabledPreference.setChecked(true);
|
serverEnabledPreference.setChecked(true);
|
||||||
|
|
||||||
|
if (Util.getActiveServer(SettingsActivity.this) == instance) {
|
||||||
|
Util.setActiveServer(SettingsActivity.this, 0);
|
||||||
|
}
|
||||||
|
|
||||||
activeServers--;
|
activeServers--;
|
||||||
serversCategory.removePreference(screen);
|
serversCategory.removePreference(screen);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user