mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +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
|
||||
protected void onClick() {
|
||||
if (isChecked()) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
superOnClick();
|
||||
if (!isChecked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
syncPreferences.run();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue