mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-05 02:29:24 +02:00
add restartIo() to DcContext
This commit is contained in:
parent
a7f0f753fd
commit
30580366fd
3 changed files with 10 additions and 12 deletions
|
@ -58,7 +58,7 @@ public class ProxySettingsActivity extends BaseActionBarActivity
|
|||
showAddProxyDialog();
|
||||
} else {
|
||||
DcHelper.set(this, CONFIG_PROXY_ENABLED, proxySwitch.isChecked()? "1" : "0");
|
||||
restartIO();
|
||||
DcHelper.getContext(this).restartIo();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class ProxySettingsActivity extends BaseActionBarActivity
|
|||
@Override
|
||||
public void onItemClick(String proxyUrl) {
|
||||
if (DcHelper.getContext(this).setConfigFromQr(proxyUrl)) {
|
||||
restartIO();
|
||||
DcHelper.getContext(this).restartIo();
|
||||
adapter.setSelectedProxy(proxyUrl);
|
||||
proxySwitch.setChecked(DcHelper.getInt(this, CONFIG_PROXY_ENABLED) == 1);
|
||||
} else {
|
||||
|
@ -137,7 +137,7 @@ public class ProxySettingsActivity extends BaseActionBarActivity
|
|||
}
|
||||
String proxyUrls = String.join("\n", proxies);
|
||||
DcHelper.set(this, CONFIG_PROXY_URL, proxyUrls);
|
||||
restartIO();
|
||||
DcHelper.getContext(this).restartIo();
|
||||
adapter.changeData(proxyUrls);
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ public class ProxySettingsActivity extends BaseActionBarActivity
|
|||
final DcLot qrParsed = dcContext.checkQr(newProxy);
|
||||
if (qrParsed.getState() == DcContext.DC_QR_PROXY) {
|
||||
dcContext.setConfigFromQr(newProxy);
|
||||
restartIO();
|
||||
DcHelper.getContext(this).restartIo();
|
||||
adapter.changeData(DcHelper.get(this, CONFIG_PROXY_URL));
|
||||
} else {
|
||||
Toast.makeText(this, R.string.proxy_invalid, Toast.LENGTH_LONG).show();
|
||||
|
@ -173,12 +173,6 @@ public class ProxySettingsActivity extends BaseActionBarActivity
|
|||
.show();
|
||||
}
|
||||
|
||||
private void restartIO() {
|
||||
DcContext dcContext = DcHelper.getContext(this);
|
||||
dcContext.stopIo();
|
||||
dcContext.startIo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEvent(@NonNull DcEvent event) {
|
||||
if (event.getId() == DcContext.DC_EVENT_CONNECTIVITY_CHANGED) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue