mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-29 15:51:17 +00:00
Fix Syncthing version not showing in Drawer or incorrectly shown after app first start or update. Show syncthing native version regardless if syncthing is running or not.
This commit is contained in:
parent
0fcd84da0e
commit
7fb47b3aba
1 changed files with 10 additions and 18 deletions
|
@ -63,14 +63,13 @@ public class DrawerFragment extends Fragment implements SyncthingService.OnServi
|
||||||
@Override
|
@Override
|
||||||
public void onServiceStateChange(SyncthingService.State currentState) {
|
public void onServiceStateChange(SyncthingService.State currentState) {
|
||||||
mServiceState = currentState;
|
mServiceState = currentState;
|
||||||
updateButtons();
|
updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
updateLabels();
|
updateUI();
|
||||||
updateButtons();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -111,8 +110,8 @@ public class DrawerFragment extends Fragment implements SyncthingService.OnServi
|
||||||
mDrawerActionSettings.setOnClickListener(this);
|
mDrawerActionSettings.setOnClickListener(this);
|
||||||
mDrawerActionExit.setOnClickListener(this);
|
mDrawerActionExit.setOnClickListener(this);
|
||||||
|
|
||||||
updateLabels();
|
// Initially fill UI elements.
|
||||||
updateButtons();
|
updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -120,23 +119,16 @@ public class DrawerFragment extends Fragment implements SyncthingService.OnServi
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void updateUI() {
|
||||||
* Update static info labels.
|
Boolean synthingRunning = mServiceState == SyncthingService.State.ACTIVE;
|
||||||
*/
|
|
||||||
private void updateLabels() {
|
// Update static info labels.
|
||||||
if (sharedPreferences != null && mVersion != null) {
|
if (sharedPreferences != null && mVersion != null) {
|
||||||
mVersion.setText(sharedPreferences.getString(Constants.PREF_LAST_BINARY_VERSION, ""));
|
mVersion.setText(sharedPreferences.getString(Constants.PREF_LAST_BINARY_VERSION, ""));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// Update action button availability. Show buttons if syncthing is running.
|
||||||
* Update action button availability.
|
mVersion.setVisibility(View.VISIBLE);
|
||||||
*/
|
|
||||||
private void updateButtons() {
|
|
||||||
Boolean synthingRunning = mServiceState == SyncthingService.State.ACTIVE;
|
|
||||||
|
|
||||||
// Show buttons if syncthing is running.
|
|
||||||
mVersion.setVisibility(synthingRunning ? View.VISIBLE : View.GONE);
|
|
||||||
mDrawerActionShowQrCode.setVisibility(synthingRunning ? View.VISIBLE : View.GONE);
|
mDrawerActionShowQrCode.setVisibility(synthingRunning ? View.VISIBLE : View.GONE);
|
||||||
mDrawerRecentChanges.setVisibility(synthingRunning ? View.VISIBLE : View.GONE);
|
mDrawerRecentChanges.setVisibility(synthingRunning ? View.VISIBLE : View.GONE);
|
||||||
mDrawerActionWebGui.setVisibility(synthingRunning ? View.VISIBLE : View.GONE);
|
mDrawerActionWebGui.setVisibility(synthingRunning ? View.VISIBLE : View.GONE);
|
||||||
|
|
Loading…
Reference in a new issue