1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 02:09:35 +02:00

account name shown in sync settings

This commit is contained in:
Nikolay Pultsin 2014-08-02 21:30:34 +01:00
parent 913a14256a
commit 42a79481a1
37 changed files with 83 additions and 42 deletions

View file

@ -139,8 +139,12 @@ public class PreferenceActivity extends ZLPreferenceActivity {
}
};
syncScreen.addPreference(new ZLBooleanPreference(
this, syncOptions.Enabled, syncScreen.Resource, "enable"
this, syncOptions.Enabled, syncScreen.Resource.getResource("enable")
) {
{
setOnSummary(myNetworkContext.getAccountName(SyncOptions.DOMAIN, SyncOptions.REALM));
}
@Override
protected void onClick() {
super.onClick();
@ -149,33 +153,39 @@ public class PreferenceActivity extends ZLPreferenceActivity {
return;
}
new Thread() {
UIUtil.createExecutor(PreferenceActivity.this, "tryConnect").execute(new Runnable() {
public void run() {
UIUtil.createExecutor(PreferenceActivity.this, "tryConnect")
.execute(new Runnable() {
public void run() {
try {
myNetworkContext.perform(
new JsonRequest(SyncOptions.URL + "login/test") {
@Override
public void processResponse(Object response) {
// TODO: update message
}
}
);
} catch (ZLNetworkException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
forceValue(false);
syncPreferences.run();
}
});
try {
myNetworkContext.perform(
new JsonRequest(SyncOptions.URL + "login/test") {
@Override
public void processResponse(Object response) {
setOnSummary((String)((Map)response).get("user"));
}
}
}, null);
);
} catch (ZLNetworkException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
forceValue(false);
syncPreferences.run();
}
});
}
}
}.start();
}, null);
}
private void setOnSummary(String account) {
final String summary = account != null
? Resource.getResource("summaryOnWithAccount").getValue().replace("%s", account)
: Resource.getResource("summaryOn").getValue();
runOnUiThread(new Runnable() {
public void run() {
setSummaryOn(summary);
}
});
}
});
syncPreferences.add(syncScreen.addOption(syncOptions.UploadAllBooks, "uploadAllBooks", "values"));
@ -212,14 +222,12 @@ public class PreferenceActivity extends ZLPreferenceActivity {
appearanceScreen.addPreference(new ZLBooleanPreference(
this,
viewOptions.TwoColumnView,
appearanceScreen.Resource,
"twoColumnView"
appearanceScreen.Resource.getResource("twoColumnView")
));
appearanceScreen.addPreference(new ZLBooleanPreference(
this,
miscOptions.AllowScreenBrightnessAdjustment,
appearanceScreen.Resource,
"allowScreenBrightnessAdjustment"
appearanceScreen.Resource.getResource("allowScreenBrightnessAdjustment")
) {
private final int myLevel = androidLibrary.ScreenBrightnessLevelOption.getValue();
@ -238,8 +246,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
appearanceScreen.addPreference(new ZLBooleanPreference(
this,
androidLibrary.DontTurnScreenOffDuringChargingOption,
appearanceScreen.Resource,
"dontTurnScreenOffDuringCharging"
appearanceScreen.Resource.getResource("dontTurnScreenOffDuringCharging")
));
*/
appearanceScreen.addOption(androidLibrary.ShowStatusBarOption, "showStatusBar");
@ -256,7 +263,8 @@ public class PreferenceActivity extends ZLPreferenceActivity {
};
einkScreen.addPreference(new ZLBooleanPreference(
this, einkOptions.EnableFastRefresh, einkScreen.Resource, "enableFastRefresh"
this, einkOptions.EnableFastRefresh,
einkScreen.Resource.getResource("enableFastRefresh")
) {
@Override
protected void onClick() {
@ -506,7 +514,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
}
};
scrollingScreen.addPreference(new ZLCheckBoxPreference(
this, scrollingScreen.Resource, "volumeKeys"
this, scrollingScreen.Resource.getResource("volumeKeys")
) {
{
setChecked(keyBindings.hasBinding(KeyEvent.KEYCODE_VOLUME_UP, false));
@ -526,7 +534,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
}
});
volumeKeysPreferences.add(scrollingScreen.addPreference(new ZLCheckBoxPreference(
this, scrollingScreen.Resource, "invertVolumeKeys"
this, scrollingScreen.Resource.getResource("invertVolumeKeys")
) {
{
setChecked(ActionCode.VOLUME_KEY_SCROLL_FORWARD.equals(
@ -607,8 +615,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
dictionaryScreen.addPreference(new ZLBooleanPreference(
PreferenceActivity.this,
miscOptions.NavigateAllWords,
dictionaryScreen.Resource,
"navigateOverAllWords"
dictionaryScreen.Resource.getResource("navigateOverAllWords")
));
dictionaryScreen.addOption(miscOptions.WordTappingAction, "tappingAction");
dictionaryScreen.addPreference(targetLanguagePreference);