1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 04:12:08 +01:00

Added change-pod-option to SettingsActivity

This commit is contained in:
vanitasvitae 2016-06-18 21:45:23 +02:00
parent dbfa8692e8
commit 28bc94da44
3 changed files with 25 additions and 0 deletions

View file

@ -109,6 +109,7 @@ public class MainActivity extends AppCompatActivity
private static final int REQUEST_CODE_ASK_PERMISSIONS = 123;
public static final int REQUEST_CODE_ASK_PERMISSIONS_SAVE_IMAGE = 124;
public static final int REQUEST_CODE_SETTINGS = 125;
public static final int RESULT_CODE_CHANGE_POD = 130;
public static final String URL_MESSAGE = "URL_MESSAGE";
private App app;
@ -411,6 +412,9 @@ public class MainActivity extends AppCompatActivity
if(resultCode == Activity.RESULT_OK) {
String url = data.getStringExtra(URL_MESSAGE);
webView.loadUrl(url);
} else if(resultCode == RESULT_CODE_CHANGE_POD) {
app.resetPodData(webView);
Helpers.animateToActivity(MainActivity.this, PodSelectionActivity.class, true);
}
}
if (requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) {

View file

@ -1,6 +1,8 @@
package com.github.dfa.diaspora_android.activity;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
@ -17,6 +19,7 @@ import android.util.Log;
import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.util.Helpers;
/**
* @author vanitas
@ -82,6 +85,19 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
results.putExtra(MainActivity.URL_MESSAGE, "https://" + podDomain + "/contacts");
setResult(Activity.RESULT_OK, results);
finish();
case "pref_key_change_pod":
new AlertDialog.Builder(SettingsActivity.this)
.setTitle(getString(R.string.confirmation))
.setMessage(getString(R.string.change_pod_warning))
.setNegativeButton(android.R.string.no, null)
.setPositiveButton(android.R.string.yes,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
setResult(MainActivity.RESULT_CODE_CHANGE_POD);
finish();
}
})
.show();
}
return super.onPreferenceTreeClick(screen, preference);
}

View file

@ -31,6 +31,11 @@
android:title="@string/pref_title_manage_contacts"
android:key="pref_key_manage_contacts">
</Preference>
<Preference
android:title="@string/pref_title_change_pod"
android:key="pref_key_change_pod">
</Preference>
</PreferenceCategory>
<!-- Networking -->