|
|
@ -248,10 +248,45 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
|
|
this.binding.btnSaveCfg.setOnClickListener(new View.OnClickListener() {
|
|
|
|
this.binding.btnSaveCfg.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
|
|
|
public void onClick(final View view) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MicroPhotoContext.AppConfig appCfg = MicroPhotoContext.getMpAppConfig(getApplicationContext());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String protocolStr = MainActivity.this.binding.protocol.getSelectedItem().toString();
|
|
|
|
|
|
|
|
int protocol = MicroPhotoContext.DEFAULT_PROTOCOL;
|
|
|
|
|
|
|
|
String[] parts = protocolStr.split("-");
|
|
|
|
|
|
|
|
if (parts != null) {
|
|
|
|
|
|
|
|
protocol = Integer.parseInt(parts[0]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (appCfg.protocol != protocol) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
|
|
|
|
|
|
|
|
builder.setTitle(R.string.confirm_change_protocol);
|
|
|
|
|
|
|
|
builder.setMessage(R.string.confirm_change_protocol_text);
|
|
|
|
|
|
|
|
builder.setCancelable(true);
|
|
|
|
|
|
|
|
builder.setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
|
|
|
|
|
dialogInterface.dismiss();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
retrieveAndSaveAppConfig();
|
|
|
|
|
|
|
|
MicroPhotoContext.removeMpConfigFiles(getApplicationContext());
|
|
|
|
|
|
|
|
MicroPhotoService.updateConfigs(MainActivity.this.getApplicationContext());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
builder.setNegativeButton(R.string.btn_cancel, new DialogInterface.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
|
|
|
|
|
dialogInterface.dismiss();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
builder.show();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
retrieveAndSaveAppConfig();
|
|
|
|
|
|
|
|
MicroPhotoService.updateConfigs(MainActivity.this.getApplicationContext());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
retrieveAndSaveAppConfig();
|
|
|
|
|
|
|
|
MicroPhotoService.updateConfigs(MainActivity.this.getApplicationContext());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|