1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2025-12-15 08:41:10 +01:00

Added reports navdrawer entry and divided visibility options into subcategories as suggested by gsantner

Merge PR #110 from DfA/divide-visibility-options

Reports Navdrawer Item reworked
set context of webview in onAttach method of BrowserFragment

Merge branch 'master' of github.com:Diaspora-for-Android/diaspora-android
This commit is contained in:
vanitasvitae 2016-11-06 20:36:43 +01:00
parent e6f16fce50
commit 8e324d8f2b
10 changed files with 130 additions and 51 deletions

View file

@ -399,6 +399,7 @@ public class MainActivity extends ThemedActivity
navMenu.findItem(R.id.nav_profile).setVisible(appSettings.isVisibleInNavProfile());
navMenu.findItem(R.id.nav_public).setVisible(appSettings.isVisibleInNavPublic_activities());
navMenu.findItem(R.id.nav_stream).setVisible(true);
navMenu.findItem(R.id.nav_reports).setVisible(appSettings.isVisibleInNavReports());
// Hide whole group (for logged in use) if no pod was selected
@ -1029,8 +1030,8 @@ public class MainActivity extends ThemedActivity
} else {
snackbarNoInternet.show();
}
break;
}
break;
case R.id.nav_public: {
if (WebHelper.isOnline(MainActivity.this)) {
@ -1038,14 +1039,23 @@ public class MainActivity extends ThemedActivity
} else {
snackbarNoInternet.show();
}
break;
}
break;
case R.id.nav_reports: {
if(WebHelper.isOnline(MainActivity.this)) {
openDiasporaUrl(urls.getReportsUrl());
} else {
snackbarNoInternet.show();
}
}
break;
case R.id.nav_exit: {
moveTaskToBack(true);
finish();
break;
}
break;
case R.id.nav_settings: {
startActivity(new Intent(this, SettingsActivity.class));

View file

@ -394,6 +394,10 @@ public class AppSettings {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__contacts, false);
}
public boolean isVisibleInNavReports() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__reports, false);
}
public void setPrimaryColorSettings(int base, int shade) {
setInt(prefApp, R.string.pref_key__primary_color_base, base);
setInt(prefApp, R.string.pref_key__primary_color_shade, shade);

View file

@ -53,6 +53,7 @@ public class DiasporaUrlHelper {
public static final String SUBURL_MANAGE_TAGS = "/tag_followings/manage";
public static final String SUBURL_SIGN_IN = "/users/sign_in";
public static final String SUBURL_MANAGE_CONTACTS = "/contacts";
public static final String SUBURL_REPORTS = "/reports";
public static final String URL_BLANK = "about:blank";
public static final String SUBURL_NOTIFICATIONS_ALSO_COMMENTED = "/notifications?type=also_commented";
public static final String SUBURL_NOTIFICATIONS_COMMENT_ON_POST = "/notifications?type=comment_on_post";
@ -237,6 +238,16 @@ public class DiasporaUrlHelper {
return getPodUrl() + SUBURL_STATISTICS;
}
/**
* Return an Url that points to the reports page of a the configured pod.
* Note: This url is only useful/visible for podmins and moderators.
*
* @return https://(pod-domain.tld)/reports
*/
public String getReportsUrl() {
return getPodUrl() + SUBURL_REPORTS;
}
/**
* Return a url that points to the sign in page of the pod.
*

View file

@ -19,6 +19,7 @@
package com.github.dfa.diaspora_android.web;
import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.MutableContextWrapper;
@ -256,6 +257,14 @@ public class BrowserFragment extends ThemedFragment {
/* Nothing to do here */
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if(webView != null && webView.getContext() instanceof MutableContextWrapper) {
((MutableContextWrapper) webView.getContext()).setBaseContext(context);
}
}
public boolean onBackPressed() {
if (webView.canGoBack()) {
getActivity().runOnUiThread(new Runnable() {

View file

@ -114,6 +114,7 @@ public class ContextMenuWebView extends NestedWebView {
+ System.currentTimeMillis() + ".png");
request.setDestinationUri(Uri.fromFile(destinationFile));
((DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
Toast.makeText(context, context.getText(R.string.share__toast_saved_image_to_location) + " " +
destinationFile.getAbsolutePath(), Toast.LENGTH_LONG).show();
}