mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 02:09:35 +02:00
switch sync options off if authorization is failed
This commit is contained in:
parent
b9ac8d7913
commit
c02cc10d28
1 changed files with 25 additions and 17 deletions
|
@ -142,24 +142,32 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
||||||
) {
|
) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
if (isChecked()) {
|
superOnClick();
|
||||||
new Thread() {
|
if (!isChecked()) {
|
||||||
public void run() {
|
return;
|
||||||
try {
|
|
||||||
myNetworkContext.perform(
|
|
||||||
new JsonRequest("https://demo.fbreader.org/login/test") {
|
|
||||||
@Override
|
|
||||||
public void processResponse(Object response) {
|
|
||||||
// TODO: update message
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} catch (ZLNetworkException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new Thread() {
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
myNetworkContext.perform(
|
||||||
|
new JsonRequest("https://demo.fbreader.org/login/test") {
|
||||||
|
@Override
|
||||||
|
public void processResponse(Object response) {
|
||||||
|
// TODO: update message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (ZLNetworkException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
setChecked(false);
|
||||||
|
superOnClick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void superOnClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
syncPreferences.run();
|
syncPreferences.run();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue