mirror of
https://github.com/gsantner/dandelion
synced 2024-11-22 12:22:08 +01:00
Added change-pod-option to SettingsActivity
This commit is contained in:
parent
dbfa8692e8
commit
28bc94da44
3 changed files with 25 additions and 0 deletions
|
@ -109,6 +109,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
private static final int REQUEST_CODE_ASK_PERMISSIONS = 123;
|
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_ASK_PERMISSIONS_SAVE_IMAGE = 124;
|
||||||
public static final int REQUEST_CODE_SETTINGS = 125;
|
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";
|
public static final String URL_MESSAGE = "URL_MESSAGE";
|
||||||
|
|
||||||
private App app;
|
private App app;
|
||||||
|
@ -411,6 +412,9 @@ public class MainActivity extends AppCompatActivity
|
||||||
if(resultCode == Activity.RESULT_OK) {
|
if(resultCode == Activity.RESULT_OK) {
|
||||||
String url = data.getStringExtra(URL_MESSAGE);
|
String url = data.getStringExtra(URL_MESSAGE);
|
||||||
webView.loadUrl(url);
|
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) {
|
if (requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.github.dfa.diaspora_android.activity;
|
package com.github.dfa.diaspora_android.activity;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
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.App;
|
||||||
import com.github.dfa.diaspora_android.R;
|
import com.github.dfa.diaspora_android.R;
|
||||||
import com.github.dfa.diaspora_android.data.AppSettings;
|
import com.github.dfa.diaspora_android.data.AppSettings;
|
||||||
|
import com.github.dfa.diaspora_android.util.Helpers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author vanitas
|
* @author vanitas
|
||||||
|
@ -82,6 +85,19 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
|
||||||
results.putExtra(MainActivity.URL_MESSAGE, "https://" + podDomain + "/contacts");
|
results.putExtra(MainActivity.URL_MESSAGE, "https://" + podDomain + "/contacts");
|
||||||
setResult(Activity.RESULT_OK, results);
|
setResult(Activity.RESULT_OK, results);
|
||||||
finish();
|
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);
|
return super.onPreferenceTreeClick(screen, preference);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
android:title="@string/pref_title_manage_contacts"
|
android:title="@string/pref_title_manage_contacts"
|
||||||
android:key="pref_key_manage_contacts">
|
android:key="pref_key_manage_contacts">
|
||||||
</Preference>
|
</Preference>
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:title="@string/pref_title_change_pod"
|
||||||
|
android:key="pref_key_change_pod">
|
||||||
|
</Preference>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<!-- Networking -->
|
<!-- Networking -->
|
||||||
|
|
Loading…
Reference in a new issue