diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0ed4efff..d4fa48da 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
### v1.0.3
- Update opoc
+- Better visibility for counter badge
+- Refactor DiasporaPod model
+- Update PodList (many new pods!)
+- Fix CustomTab bug
### v1.0.2 (2017-08-05)
- Improve build script
diff --git a/app/build.gradle b/app/build.gradle
index e2c38cf2..0524faf9 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -23,8 +23,8 @@ android {
minSdkVersion version_sdk.minSdk
targetSdkVersion version_sdk.targetSdk
- versionCode 22
- versionName "1.0.2"
+ versionCode 23
+ versionName "1.0.3"
applicationId "com.github.dfa.diaspora_android"
resValue 'string', 'app_name', "dandelion*"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 150e8241..db1a273b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -83,6 +83,7 @@
+
@@ -223,7 +224,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java
index 9f4574e4..94de6577 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java
@@ -447,7 +447,8 @@ public class MainActivity extends ThemedActivity
navMenu.findItem(R.id.nav_stream).setVisible(true);
navMenu.findItem(R.id.nav_statistics).setVisible(appSettings.isVisibleInNavStatistics());
navMenu.findItem(R.id.nav_reports).setVisible(appSettings.isVisibleInNavReports());
- navMenu.findItem(R.id.nav_toggle_desktop_page).setVisible(appSettings.isVisibleToggleMobileDesktop());
+ navMenu.findItem(R.id.nav_toggle_desktop_page).setVisible(appSettings.isVisibleInNavToggleMobileDesktop());
+ navMenu.findItem(R.id.nav_dandelion).setVisible(appSettings.isVisibleInNavDandelionAccount());
// Hide whole group (for logged in use) if no pod was selected
@@ -1122,6 +1123,11 @@ public class MainActivity extends ThemedActivity
}
break;
+ case R.id.nav_dandelion: {
+ openDiasporaUrl(urls.getProfileUrl("48b78420923501341ef3782bcb452bd5"));
+ }
+ break;
+
case R.id.nav_exit: {
moveTaskToBack(true);
finish();
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/PodSelectionFragment.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/PodSelectionFragment.java
index 6060db0e..c09cacde 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/activity/PodSelectionFragment.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/PodSelectionFragment.java
@@ -177,8 +177,13 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
rootView.setBackgroundColor(appSettings.isAmoledColorMode() ? Color.BLACK : Color.WHITE);
listViewPod.setDivider(new ColorDrawable(Color.GRAY));
listViewPod.setDividerHeight(dividerHeight);
- buttonUseCustomPod.setSupportBackgroundTintList(ColorStateList.valueOf(appSettings.isAmoledColorMode() ? Color.DKGRAY : Color.WHITE));
- buttonUseCustomPod.setTextColor(appSettings.isAmoledColorMode() ? Color.WHITE : Color.BLACK);
+ if (appSettings.isAmoledColorMode()) {
+ buttonUseCustomPod.setSupportBackgroundTintList(ColorStateList.valueOf(Color.DKGRAY));
+ buttonUseCustomPod.setTextColor(Color.WHITE);
+ } else {
+ buttonUseCustomPod.setSupportBackgroundTintList(ColorStateList.valueOf(appSettings.getAccentColor()));
+ buttonUseCustomPod.setTextColor(Helpers.get().shouldColorOnTopBeLight(appSettings.getAccentColor()) ? Color.WHITE : Color.BLACK);
+ }
}
@Override
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/data/DiasporaPodList.java b/app/src/main/java/com/github/dfa/diaspora_android/data/DiasporaPodList.java
index 2047738b..5c806544 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/data/DiasporaPodList.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/data/DiasporaPodList.java
@@ -6,6 +6,7 @@ import org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -18,8 +19,9 @@ import java.util.List;
* DiasporaPodUrl - A Url of an DiasporaPod
* For all Classes a loading and saving to JSON method is available
*/
+@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue", "SpellCheckingInspection", "UnusedReturnValue", "JavaDoc", "FieldCanBeLocal"})
public class DiasporaPodList implements Iterable, Serializable {
- private static final boolean EXPORT_TOJSON_ACTIVE6 = false;
+ private static final boolean EXPORT_TOJSON_POST_COUNT_LOCAL = true;
private List pods = new ArrayList<>();
private boolean trackMergeChanges = false;
private Integer trackAddedIndexStart = -1;
@@ -88,8 +90,8 @@ public class DiasporaPodList implements Iterable, S
if (updatePodBak.getId() != 0 && updatePod.getId() == 0) {
updatePod.setId(updatePodBak.getId());
}
- if (updatePodBak.getActive6() != 0 && updatePod.getActive6() == 0) {
- updatePod.setActive6(updatePodBak.getActive6());
+ if (updatePodBak.getPostCountLocal() != 0 && updatePod.getPostCountLocal() == 0) {
+ updatePod.setPostCountLocal(updatePodBak.getPostCountLocal());
}
if (updatePodBak.getScore() != 0 && updatePod.getScore() == 0) {
updatePod.setScore(updatePodBak.getScore());
@@ -179,12 +181,12 @@ public class DiasporaPodList implements Iterable, S
* ╚═╝ ╚═════╝ ╚═════╝
*/
public static class DiasporaPod implements Iterable, Comparable, Serializable {
- private List podUrls = new ArrayList<>();
- private List mainLangs = new ArrayList<>();
- private String name = "";
- private int score = 0;
- private int id = 0;
- private long active6 = 0;
+ private List _podUrls = new ArrayList<>();
+ private List _mainLangs = new ArrayList<>();
+ private String _name = "";
+ private int _score = 0;
+ private int _id = 0;
+ private long _postCountLocal = 0;
public DiasporaPod() {
@@ -199,14 +201,14 @@ public class DiasporaPodList implements Iterable, S
JSONArray jarr;
if (json.has("name")) {
- name = json.getString("name");
+ _name = json.getString("name");
}
if (json.has("mainLangs")) {
jarr = json.getJSONArray("mainLangs");
for (int i = 0; i < jarr.length(); i++) {
String val = jarr.getString(i);
- if (!mainLangs.contains(val)) {
- mainLangs.add(val);
+ if (!_mainLangs.contains(val)) {
+ _mainLangs.add(val);
}
}
}
@@ -214,19 +216,19 @@ public class DiasporaPodList implements Iterable, S
jarr = json.getJSONArray("podUrls");
for (int i = 0; i < jarr.length(); i++) {
DiasporaPodUrl podUrl = new DiasporaPodUrl().fromJson(jarr.getJSONObject(i));
- if (!podUrls.contains(podUrl)) {
- podUrls.add(podUrl);
+ if (!_podUrls.contains(podUrl)) {
+ _podUrls.add(podUrl);
}
}
}
if (json.has("score")) {
- score = json.getInt("score");
+ _score = json.getInt("score");
}
- if (json.has("active6")) {
- active6 = json.getLong("active6");
+ if (json.has("postCountLocal")) {
+ _postCountLocal = json.getLong("postCountLocal");
}
if (json.has("id")) {
- id = json.getInt("id");
+ _id = json.getInt("id");
}
return this;
}
@@ -236,25 +238,28 @@ public class DiasporaPodList implements Iterable, S
*/
public JSONObject toJson() throws JSONException {
JSONObject json = new JSONObject();
- json.put("name", name);
- json.put("score", score);
- json.put("id", id);
+ json.put("name", _name);
+ json.put("id", _id);
+
+ if (_score != 0) {
+ json.put("score", _score);
+ }
// Only export active6 (frequently changing if told to do)
- if (EXPORT_TOJSON_ACTIVE6) {
- json.put("active6", active6);
+ if (EXPORT_TOJSON_POST_COUNT_LOCAL && _postCountLocal > 0) {
+ json.put("postCountLocal", _postCountLocal);
}
// Pod urls
JSONArray jarr = new JSONArray();
- for (DiasporaPodUrl value : podUrls) {
+ for (DiasporaPodUrl value : _podUrls) {
jarr.put(value.toJson());
}
json.put("podUrls", jarr);
// main langs
jarr = new JSONArray();
- for (String value : mainLangs) {
+ for (String value : _mainLangs) {
jarr.put(value);
}
json.put("mainLangs", jarr);
@@ -268,11 +273,11 @@ public class DiasporaPodList implements Iterable, S
DiasporaPod otherPod = (DiasporaPod) o;
// Check if id is equal
- ret = this.id != 0 && this.id == otherPod.id;
+ ret = _id != 0 && _id == otherPod._id;
- // Check if host is the same (fallback if id is 0)
+ // Check if _host is the same (fallback if id is 0)
if (!ret) {
- for (DiasporaPodUrl podUrl : podUrls) {
+ for (DiasporaPodUrl podUrl : _podUrls) {
for (DiasporaPodUrl otherPodUrl : otherPod.getPodUrls()) {
if (podUrl.getBaseUrl().equals(otherPodUrl.getBaseUrl())) {
ret = true;
@@ -292,45 +297,46 @@ public class DiasporaPodList implements Iterable, S
if (!myPodUrls.isEmpty() && !otherPodUrls.isEmpty()) {
return myPodUrls.get(0).getHost().compareTo(otherPodUrls.get(0).getHost());
}
+ return _name.compareTo(otherPod.getName());
}
- return name.compareTo(otherPod.getName());
+ return _name.compareTo("");
}
@Override
public String toString() {
- return name + "(" + id + ")";
+ return _name + "(" + _id + ")";
}
/**
* Iterator for Iterable interface (forEach, ..)
*/
public Iterator iterator() {
- return podUrls.iterator();
+ return _podUrls.iterator();
}
/*
* Getter & Setter
*/
public List getPodUrls() {
- return podUrls;
+ return _podUrls;
}
public DiasporaPod setPodUrls(List podUrls) {
- this.podUrls = podUrls;
+ _podUrls = podUrls;
return this;
}
public List getMainLangs() {
- return mainLangs;
+ return _mainLangs;
}
public DiasporaPod setMainLangs(List mainLangs) {
- this.mainLangs = mainLangs;
+ _mainLangs = mainLangs;
return this;
}
public DiasporaPod appendMainLangs(String... values) {
- Collections.addAll(this.mainLangs, values);
+ _mainLangs.addAll(Arrays.asList(values));
return this;
}
@@ -338,50 +344,50 @@ public class DiasporaPodList implements Iterable, S
* Returns the first DiasporaPodUrl in the list
*/
public DiasporaPodUrl getPodUrl() {
- if (podUrls.size() > 0) {
- return podUrls.get(0);
+ if (_podUrls.size() > 0) {
+ return _podUrls.get(0);
}
return null;
}
public DiasporaPod appendPodUrls(DiasporaPodUrl... values) {
- Collections.addAll(this.podUrls, values);
+ _podUrls.addAll(Arrays.asList(values));
return this;
}
public String getName() {
- return name;
+ return _name;
}
public DiasporaPod setName(String name) {
- this.name = name;
+ _name = name;
return this;
}
public int getScore() {
- return score;
+ return _score;
}
public DiasporaPod setScore(int score) {
- this.score = score;
+ _score = score;
return this;
}
- public long getActive6() {
- return active6;
+ public long getPostCountLocal() {
+ return _postCountLocal;
}
- public DiasporaPod setActive6(long active6) {
- this.active6 = active6;
+ public DiasporaPod setPostCountLocal(long postCountLocal) {
+ _postCountLocal = postCountLocal;
return this;
}
public int getId() {
- return id;
+ return _id;
}
public DiasporaPod setId(int id) {
- this.id = id;
+ _id = id;
return this;
}
@@ -393,9 +399,9 @@ public class DiasporaPodList implements Iterable, S
* ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
*/
public static class DiasporaPodUrl implements Serializable {
- private String host = "";
- private String protocol = "https";
- private Integer port = 443;
+ private String _host = "";
+ private String _protocol = "https";
+ private Integer _port = 443;
public DiasporaPodUrl() {
}
@@ -407,10 +413,10 @@ public class DiasporaPodList implements Iterable, S
/**
* Get the base url
*
- * @return base url with port
+ * @return
*/
public String getBaseUrl() {
- return protocol + "://" + host + (isPortNeeded() ? port : "");
+ return _protocol + "://" + _host + (isPortNeeded() ? _port : "");
}
/**
@@ -420,13 +426,13 @@ public class DiasporaPodList implements Iterable, S
*/
public DiasporaPodUrl fromJson(JSONObject json) throws JSONException {
if (json.has("host")) {
- host = json.getString("host");
+ _host = json.getString("host");
}
if (json.has("protocol")) {
- protocol = json.getString("protocol");
+ _protocol = json.getString("protocol");
}
if (json.has("port")) {
- port = json.getInt("port");
+ _port = json.getInt("port");
}
return this;
}
@@ -436,12 +442,12 @@ public class DiasporaPodList implements Iterable, S
*/
public JSONObject toJson() throws JSONException {
JSONObject json = new JSONObject();
- json.put("host", host);
- if (!protocol.equals("https")) {
- json.put("protocol", protocol);
+ json.put("host", _host);
+ if (!_protocol.equals("https")) {
+ json.put("protocol", _protocol);
}
- if (port != 443) {
- json.put("port", port);
+ if (_port != 443) {
+ json.put("port", _port);
}
return json;
}
@@ -467,7 +473,7 @@ public class DiasporaPodList implements Iterable, S
* Tells if the ports needs to shown
*/
public boolean isPortNeeded() {
- return !((port == 80 && protocol.equals("http")) || (port == 443 && protocol.equals("https")));
+ return !((_port == 80 && _protocol.equals("http")) || (_port == 443 && _protocol.equals("https")));
}
@Override
@@ -476,6 +482,7 @@ public class DiasporaPodList implements Iterable, S
}
@Override
+ @SuppressWarnings("SimplifiableIfStatement")
public boolean equals(Object o) {
if (o instanceof DiasporaPodUrl) {
return getBaseUrl().equals(((DiasporaPodUrl) o).getBaseUrl());
@@ -487,29 +494,29 @@ public class DiasporaPodList implements Iterable, S
* GETTER & SETTER
*/
public String getHost() {
- return host;
+ return _host;
}
public DiasporaPodUrl setHost(String host) {
- this.host = host;
+ _host = host;
return this;
}
public String getProtocol() {
- return protocol;
+ return _protocol;
}
public DiasporaPodUrl setProtocol(String protocol) {
- this.protocol = protocol;
+ _protocol = protocol;
return this;
}
public Integer getPort() {
- return port;
+ return _port;
}
public DiasporaPodUrl setPort(Integer port) {
- this.port = port;
+ _port = port;
return this;
}
}
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java
index 890295c9..d943deaf 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java
@@ -28,95 +28,80 @@ import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
-import android.support.v4.content.ContextCompat;
+import android.support.annotation.NonNull;
import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.util.AppSettings;
+import com.github.dfa.diaspora_android.util.Helpers;
+@SuppressWarnings("WeakerAccess")
public class BadgeDrawable extends Drawable {
// Source: http://mobikul.com/adding-badge-count-on-menu-items-like-cart-notification-etc/
private static final String BADGE_VALUE_OVERFLOW = "*";
- private Paint badgeBackground;
- private Paint badgeStroke;
- private Paint badgeText;
- private Rect textRect = new Rect();
+ private Paint _badgeBackground;
+ private Paint _badgeText;
+ private Rect _textRect = new Rect();
- private String badgeValue = "";
- private boolean shouldDraw;
+ private String _badgeValue = "";
+ private boolean _shouldDraw;
public BadgeDrawable(Context context) {
float textSize = context.getResources().getDimension(R.dimen.textsize_badge_count);
AppSettings settings = AppSettings.get();
- badgeBackground = new Paint();
- badgeBackground.setColor(settings.getAccentColor());
- badgeBackground.setAntiAlias(true);
- badgeBackground.setStyle(Paint.Style.FILL);
- badgeStroke = new Paint();
- badgeStroke.setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.colorPrimaryDark));
- badgeStroke.setAntiAlias(true);
- badgeStroke.setStyle(Paint.Style.FILL);
+ _badgeBackground = new Paint();
+ _badgeBackground.setColor(settings.getAccentColor());
+ _badgeBackground.setAntiAlias(true);
+ _badgeBackground.setStyle(Paint.Style.FILL);
- badgeText = new Paint();
- badgeText.setColor(Color.WHITE);
- badgeText.setTypeface(Typeface.DEFAULT);
- badgeText.setTextSize(textSize);
- badgeText.setAntiAlias(true);
- badgeText.setTextAlign(Paint.Align.CENTER);
+ _badgeText = new Paint();
+ _badgeText.setColor(Helpers.get().shouldColorOnTopBeLight(settings.getAccentColor()) ? Color.WHITE : Color.BLACK);
+ _badgeText.setTypeface(Typeface.DEFAULT);
+ _badgeText.setTextSize(textSize);
+ _badgeText.setAntiAlias(true);
+ _badgeText.setTextAlign(Paint.Align.CENTER);
}
@Override
- public void draw(Canvas canvas) {
- if (!shouldDraw) {
+ public void draw(@NonNull Canvas canvas) {
+ if (!_shouldDraw) {
return;
}
Rect bounds = getBounds();
float width = bounds.right - bounds.left;
float height = bounds.bottom - bounds.top;
+ float oneDp = Helpers.get().dp2px(1);
// Position the badge in the top-right quadrant of the icon.
float radius = ((Math.max(width, height) / 2)) / 2;
- float centerX = (width - radius - 1) + 5;
- float centerY = radius - 5;
- if (badgeValue.length() <= 2) {
- // Draw badge circle.
- canvas.drawCircle(centerX, centerY, (int) (radius + 7.5), badgeStroke);
- canvas.drawCircle(centerX, centerY, (int) (radius + 5.5), badgeBackground);
- } else {
- canvas.drawCircle(centerX, centerY, (int) (radius + 8.5), badgeStroke);
- canvas.drawCircle(centerX, centerY, (int) (radius + 6.5), badgeBackground);
- //canvas.drawRoundRect(radius, radius, radius, radius, 10, 10, badgeBackground);
- }
+ float centerX = (width - radius - 1) + oneDp * 2;
+ float centerY = radius - 2 * oneDp;
+ canvas.drawCircle(centerX, centerY, (int) (radius + oneDp * 5), _badgeBackground);
+
// Draw badge count message inside the circle.
- badgeText.getTextBounds(badgeValue, 0, badgeValue.length(), textRect);
- float textHeight = textRect.bottom - textRect.top;
+ _badgeText.getTextBounds(_badgeValue, 0, _badgeValue.length(), _textRect);
+ float textHeight = _textRect.bottom - _textRect.top;
float textY = centerY + (textHeight / 2f);
- if (badgeValue.length() > 2)
- canvas.drawText(BADGE_VALUE_OVERFLOW, centerX, textY, badgeText);
- else
- canvas.drawText(badgeValue, centerX, textY, badgeText);
+ canvas.drawText(_badgeValue.length() > 2 ? BADGE_VALUE_OVERFLOW : _badgeValue,
+ centerX, textY, _badgeText);
}
- /*
- Sets the count (i.e notifications) to display.
- */
- public void setCount(String count) {
- badgeValue = count;
+ // Sets the text to display. Badge displays a '*' if more than 2 characters
+ private void setBadgeText(String text) {
+ _badgeValue = text;
- // Only draw a badge if there are notifications.
- shouldDraw = !count.equalsIgnoreCase("0");
+ // Only draw a badge if the value isn't a zero
+ _shouldDraw = !text.equalsIgnoreCase("0");
invalidateSelf();
}
@Override
public void setAlpha(int alpha) {
- // do nothing
}
@Override
public void setColorFilter(ColorFilter cf) {
- // do nothing
}
@Override
@@ -125,11 +110,11 @@ public class BadgeDrawable extends Drawable {
}
public static void setBadgeCount(Context context, LayerDrawable icon, Integer count) {
- setBadgeCount(context, icon, count.toString());
+ setBadgeText(context, icon, count.toString());
}
- public static void setBadgeCount(Context context, LayerDrawable icon, String count) {
-
+ // Max of 2 characters
+ public static void setBadgeText(Context context, LayerDrawable icon, String text) {
BadgeDrawable badge;
// Reuse drawable if possible
@@ -140,7 +125,7 @@ public class BadgeDrawable extends Drawable {
badge = new BadgeDrawable(context);
}
- badge.setCount(count);
+ badge.setBadgeText(text);
icon.mutate();
icon.setDrawableByLayerId(R.id.ic_badge, badge);
}
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java b/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java
index 2a9812a2..81aaa21c 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/util/AppSettings.java
@@ -341,7 +341,11 @@ public class AppSettings extends AppSettingsBase {
return getBool(_prefApp, R.string.pref_key__visibility_nav__reports, false);
}
- public boolean isVisibleToggleMobileDesktop() {
+ public boolean isVisibleInNavDandelionAccount() {
+ return getBool(_prefApp, R.string.pref_key__visibility_nav__dandelion_account, false);
+ }
+
+ public boolean isVisibleInNavToggleMobileDesktop() {
return getBool(_prefApp, R.string.pref_key__visibility_nav__toggle_mobile_desktop, false);
}
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java b/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java
index eb7876c9..a4bf65c6 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java
@@ -27,7 +27,7 @@ import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
* Helper class that provides easy access to specific urls related to diaspora
* Created by vanitasvitae on 10.08.16.
*/
-@SuppressWarnings("unused")
+@SuppressWarnings({"unused", "SpellCheckingInspection", "SameParameterValue", "WeakerAccess"})
public class DiasporaUrlHelper {
private final AppSettings settings;
@@ -151,7 +151,7 @@ public class DiasporaUrlHelper {
* @param profileId Id of the profile to be shown
* @return https://(pod-domain.tld)/people/(profileId)
*/
- public String getProfileUrl(long profileId) {
+ public String getProfileUrl(String profileId) {
return getPodUrl() + SUBURL_PEOPLE + profileId;
}
diff --git a/app/src/main/java/io/github/gsantner/opoc/util/Helpers.java b/app/src/main/java/io/github/gsantner/opoc/util/Helpers.java
index d6695791..adf4b046 100644
--- a/app/src/main/java/io/github/gsantner/opoc/util/Helpers.java
+++ b/app/src/main/java/io/github/gsantner/opoc/util/Helpers.java
@@ -21,6 +21,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
+import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@@ -298,6 +299,13 @@ public class Helpers {
_context.getResources().updateConfiguration(config, null);
}
+ // Find out if color above the given color should be light or dark. true if light
+ public boolean shouldColorOnTopBeLight(int colorOnBottomInt) {
+ return 186 > (((0.299 * Color.red(colorOnBottomInt))
+ + ((0.587 * Color.green(colorOnBottomInt))
+ + (0.114 * Color.blue(colorOnBottomInt)))));
+ }
+
public float px2dp(final float px) {
return px / _context.getResources().getDisplayMetrics().density;
}
diff --git a/app/src/main/res/layout/podselection__fragment.xml b/app/src/main/res/layout/podselection__fragment.xml
index 9402ce26..c6d9f45f 100644
--- a/app/src/main/res/layout/podselection__fragment.xml
+++ b/app/src/main/res/layout/podselection__fragment.xml
@@ -2,14 +2,11 @@
+ android:choiceMode="singleChoice"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin" />
\ No newline at end of file
diff --git a/app/src/main/res/menu/main__navdrawer.xml b/app/src/main/res/menu/main__navdrawer.xml
index f60b4a4d..9a69c2f5 100644
--- a/app/src/main/res/menu/main__navdrawer.xml
+++ b/app/src/main/res/menu/main__navdrawer.xml
@@ -53,6 +53,11 @@
android:icon="@drawable/ic_public_black_48px"
android:title="@string/nav_public_activities" />
+
+
-
- 11sp
+ 13sp
30dp
diff --git a/app/src/main/res/values/strings-not_translatable.xml b/app/src/main/res/values/strings-not_translatable.xml
index 39394e2a..9259cb48 100644
--- a/app/src/main/res/values/strings-not_translatable.xml
+++ b/app/src/main/res/values/strings-not_translatable.xml
@@ -93,6 +93,7 @@
pref_key__visibility_nav__reports
pref_key__visibility_nav__statistics
pref_key__visibility_nav__toggle_mobile_desktop
+ pref_key__visibility_nav__dandelion_account
pref_key__podprofile_avatar_url
diff --git a/app/src/main/res/xml/preferences__sub_navslider_vis.xml b/app/src/main/res/xml/preferences__sub_navslider_vis.xml
index 5f2f890a..55150b9f 100644
--- a/app/src/main/res/xml/preferences__sub_navslider_vis.xml
+++ b/app/src/main/res/xml/preferences__sub_navslider_vis.xml
@@ -40,6 +40,10 @@
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__public_activities"
android:title="@string/nav_public_activities"/>
+