1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-24 21:32:07 +01:00

Update paths

This commit is contained in:
Gregor Santner 2018-05-13 12:08:27 +02:00
parent 099eb9ca78
commit 65ba10712f
10 changed files with 82 additions and 28 deletions

View file

@ -23,5 +23,5 @@
If a crash is happening a log is needed. Screenshots or demonstration videos are always helpful too. If a crash is happening a log is needed. Screenshots or demonstration videos are always helpful too.
About logging: About logging:
https://gsantner.net/android-contribution-guide/?packageid=com.github.dfa.diaspora_android&name=dandelion&web=https://github.com/diaspora-for-android/dandelion#logcat https://gsantner.net/android-contribution-guide/?packageid=com.github.dfa.diaspora_android&name=dandelion&web=https://github.com/gsantner/dandelion#logcat
--> -->

View file

@ -1,8 +1,8 @@
[![GitHub release](https://img.shields.io/github/tag/diaspora-for-android/dandelion.svg)](https://github.com/diaspora-for-android/dandelion/releases) [![GitHub release](https://img.shields.io/github/tag/gsantner/dandelion.svg)](https://github.com/gsantner/dandelion/releases)
[![Build Status](https://travis-ci.org/Diaspora-for-Android/dandelion.svg?branch=master)](https://travis-ci.org/Diaspora-for-Android/dandelion) [![Build Status](https://travis-ci.org/gsantner/dandelion.svg?branch=master)](https://travis-ci.org/gsantner/dandelion)
[![Translate - with Stringlate](https://img.shields.io/badge/stringlate-translate-green.svg)](https://lonamiwebs.github.io/stringlate/translate?git=https%3A%2F%2Fgithub.com%2Fdiaspora-for-android%2Fdandelion.git&mail=gro.xobliam@@rentnasg) [![Translate - with Stringlate](https://img.shields.io/badge/stringlate-translate-green.svg)](https://lonamiwebs.github.io/stringlate/translate?git=https%3A%2F%2Fgithub.com%2Fgsantner%2Fdandelion.git&mail=gro.xobliam@@rentnasg)
[![Chat - Matrix](https://img.shields.io/badge/chat-on%20matrix-blue.svg)](https://matrix.to/#/#dandelion:matrix.org) [![Chat - FreeNode IRC](https://img.shields.io/badge/chat-on%20irc-blue.svg)](https://kiwiirc.com/client/irc.freenode.net/?nick=dandelion-anon|?##dandelion) [![Chat - Matrix](https://img.shields.io/badge/chat-on%20matrix-blue.svg)](https://matrix.to/#/#dandelion:matrix.org) [![Chat - FreeNode IRC](https://img.shields.io/badge/chat-on%20irc-blue.svg)](https://kiwiirc.com/client/irc.freenode.net/?nick=dandelion-anon|?##dandelion)
[![Donate Bitcoin](https://img.shields.io/badge/donate-bitcoin-orange.svg)](https://gsantner.net/supportme/?project=dandelion&source=readme) [![Donate Bitcoin](https://img.shields.io/badge/support-project-orange.svg)](https://gsantner.net/supportme/?project=dandelion&source=readme)
[![Donate LiberaPay](https://img.shields.io/badge/donate-liberapay-orange.svg)](https://liberapay.com/gsantner/donate) [![Donate LiberaPay](https://img.shields.io/badge/donate-liberapay-orange.svg)](https://liberapay.com/gsantner/donate)
# dandelion\* # dandelion\*
@ -39,9 +39,9 @@ dandelion\* requires access to the Internet and to external storage to be able t
## Contributions ## Contributions
The project is always open for contributions and accepts pull requests. The project is always open for contributions and accepts pull requests.
The project uses [AOSP Java Code Style](https://source.android.com/source/code-style#follow-field-naming-conventions), with one exception: private members are `_camelCase` instead of `mBigCamel`. You may use Android Studios _auto reformat feature_ before sending a PR. The project uses [AOSP Java Code Style](https://source.android.com/source/code-style#follow-field-naming-conventions), with one exception: private members are `_camelCase` instead of `mBigCamel`. You may use Android Studios _auto reformat feature_ before sending a PR. See [gsantner's android contribution guide](https://gsantner.net/android-contribution-guide/?packageid=com.github.dfa.diaspora_android&name=dandelion&web=https://github.com/gsantner/dandelion#logcat) for more information.
Translations can be contributed on GitHub or via [E-Mail](http://gsantner.net/#contact). You can use Stringlate ([![Translate - with Stringlate](https://img.shields.io/badge/stringlate-translate-green.svg)](https://lonamiwebs.github.io/stringlate/translate?git=https%3A%2F%2Fgithub.com%2Fdiaspora-for-android%2Fdandelion.git)) to translate the project directly on your Android phone. It allows you to export as E-Mail attachement and to post on GitHub. Translations can be contributed on GitHub or via [E-Mail](https://gsantner.net/#contact). You can use Stringlate ([![Translate - with Stringlate](https://img.shields.io/badge/stringlate-translate-green.svg)](https://lonamiwebs.github.io/stringlate/translate?git=https%3A%2F%2Fgithub.com%2Fgsantner%2Fdandelion.git)) to translate the project directly on your Android phone. It allows you to export as E-Mail attachement and to post on GitHub.
Join our IRC or Matrix channel (bridged) and say hello! Don't be afraid to start talking. [![Chat - Matrix](https://img.shields.io/badge/chat-on%20matrix-blue.svg)](https://matrix.to/#/#dandelion:matrix.org) [![Chat - FreeNode IRC](https://img.shields.io/badge/chat-on%20irc-blue.svg)](https://kiwiirc.com/client/irc.freenode.net/?nick=dandelion-anon|?##dandelion) Join our IRC or Matrix channel (bridged) and say hello! Don't be afraid to start talking. [![Chat - Matrix](https://img.shields.io/badge/chat-on%20matrix-blue.svg)](https://matrix.to/#/#dandelion:matrix.org) [![Chat - FreeNode IRC](https://img.shields.io/badge/chat-on%20irc-blue.svg)](https://kiwiirc.com/client/irc.freenode.net/?nick=dandelion-anon|?##dandelion)
@ -49,14 +49,14 @@ Note that the main project members are working on this project for free during l
#### Resources #### Resources
* Project: [Changelog](/CHANGELOG.md) | [Issues level/beginner](https://github.com/diaspora-for-android/dandelion/issues?q=is%3Aissue+is%3Aopen+label%3Alevel%2Fbeginner) | [License](/LICENSE.txt) | [CoC](/CODE_OF_CONDUCT.md) * Project: [Changelog](/CHANGELOG.md) | [Issues level/beginner](https://github.com/gsantner/dandelion/issues?q=is%3Aissue+is%3Aopen+label%3Alevel%2Fbeginner) | [License](/LICENSE.txt) | [CoC](/CODE_OF_CONDUCT.md)
* Project diaspora\* account: [dandelion00@diasp.org](https://diasp.org/people/48b78420923501341ef3782bcb452bd5) * Project diaspora\* account: [dandelion00@diasp.org](https://diasp.org/people/48b78420923501341ef3782bcb452bd5)
* diaspora\*: [GitHub](https://github.com/diaspora/diaspora) | [Web](https://diasporafoundation.org) | [d\* HQ account](https://pod.diaspora.software/people/7bca7c80311b01332d046c626dd55703) * diaspora\*: [GitHub](https://github.com/diaspora/diaspora) | [Web](https://diasporafoundation.org) | [d\* HQ account](https://pod.diaspora.software/people/7bca7c80311b01332d046c626dd55703)
* App on F-Droid: [Metadata](https://gitlab.com/fdroid/fdroiddata/blob/master/metadata/com.github.dfa.diaspora_android.txt) | [Page](https://f-droid.org/packages/com.github.dfa.diaspora_android/) | [Wiki](https://f-droid.org/wiki/page/com.github.dfa.diaspora_android) | [Build log](https://f-droid.org/wiki/page/com.github.dfa.diaspora_android/lastbuild) * App on F-Droid: [Metadata](https://gitlab.com/fdroid/fdroiddata/blob/master/metadata/com.github.dfa.diaspora_android.txt) | [Page](https://f-droid.org/packages/com.github.dfa.diaspora_android/) | [Wiki](https://f-droid.org/wiki/page/com.github.dfa.diaspora_android) | [Build log](https://f-droid.org/wiki/page/com.github.dfa.diaspora_android/lastbuild)
## Licensing ## Licensing
dandelion\* is released under GNU GENERAL PUBLIC LICENSE (see [LICENCE](https://github.com/Diaspora-for-Android/dandelion/blob/master/LICENSE.md)). dandelion\* is released under GNU GENERAL PUBLIC LICENSE (see [LICENCE](https://github.com/gsantner/dandelion/blob/master/LICENSE.md)).
The app is licensed GPL v3. Localization files and resources (strings\*.xml) are licensed CC0 1.0. The app is licensed GPL v3. Localization files and resources (strings\*.xml) are licensed CC0 1.0.
For more licensing informations, see [`3rd party licenses`](/app/src/main/res/raw/licenses_3rd_party.md). For more licensing informations, see [`3rd party licenses`](/app/src/main/res/raw/licenses_3rd_party.md).
@ -78,7 +78,7 @@ For more licensing informations, see [`3rd party licenses`](/app/src/main/res/ra
### Notice ### Notice
#### Maintainers #### Maintainers
- gsantner ([GitHub](https://github.com/gsantner), [Web](https://gsantner.net), [diaspora*](https://pod.geraspora.de/people/d1cbdd70095301341e834860008dbc6c)) - gsantner ([GitHub](https://github.com/gsantner), [Web](https://gsantner.net/supportme/?project=dandelion&source=readme), [diaspora*](https://pod.geraspora.de/people/d1cbdd70095301341e834860008dbc6c))
- Bitcoin: [1B9ZyYdQoY9BxMe9dRUEKaZbJWsbQqfXU5](http://gsantner.net/donate/#donate) - Bitcoin: [1B9ZyYdQoY9BxMe9dRUEKaZbJWsbQqfXU5](https://gsantner.net/donate/#donate)
- vanitasvitae ([GitHub](https://github.com/vanitasvitae), [diaspora*](https://pod.geraspora.de/people/bbd7af90fbec013213e34860008dbc6c)) - vanitasvitae ([GitHub](https://github.com/vanitasvitae), [diaspora*](https://pod.geraspora.de/people/bbd7af90fbec013213e34860008dbc6c))
- Bitcoin: 1Ao3W6NaQv3xKppviB7RSFKjHo6PGd8RTy - Bitcoin: 1Ao3W6NaQv3xKppviB7RSFKjHo6PGd8RTy

View file

@ -337,7 +337,7 @@ public class MainActivity extends ThemedActivity
// This URL seems to be called somehow, but it doesn't make sense ;) // This URL seems to be called somehow, but it doesn't make sense ;)
toolbarTop.postDelayed(() -> { toolbarTop.postDelayed(() -> {
Intent i = new Intent(ACTION_OPEN_EXTERNAL_URL); Intent i = new Intent(ACTION_OPEN_EXTERNAL_URL);
i.putExtra(EXTRA_URL, "https://github.com/Diaspora-for-Android/dandelion/blob/master/README.md"); i.putExtra(EXTRA_URL, "https://github.com/gsantner/dandelion/blob/master/README.md");
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(i); LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(i);
}, 1000); }, 1000);
return; return;

View file

@ -59,7 +59,7 @@ public class FetchPodsService extends Service {
} }
class GetPodsTask extends AsyncTask<Void, Void, DiasporaPodList> { class GetPodsTask extends AsyncTask<Void, Void, DiasporaPodList> {
private static final String PODDY_PODLIST_URL = "https://raw.githubusercontent.com/Diaspora-for-Android/dandelion/master/app/src/main/res/raw/podlist.json"; private static final String PODDY_PODLIST_URL = "https://raw.githubusercontent.com/gsantner/dandelion/master/app/src/main/res/raw/podlist.json";
private final Service service; private final Service service;

View file

@ -166,7 +166,7 @@ public class ContextUtils {
public String getAppVersionName() { public String getAppVersionName() {
try { try {
PackageManager manager = _context.getPackageManager(); PackageManager manager = _context.getPackageManager();
PackageInfo info = manager.getPackageInfo(_context.getPackageName(), 0); PackageInfo info = manager.getPackageInfo(getPackageName(), 0);
return info.versionName; return info.versionName;
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
@ -174,6 +174,39 @@ public class ContextUtils {
} }
} }
public String getAppInstallationSource() {
String src = null;
try {
src = _context.getPackageManager().getInstallerPackageName(getPackageName());
} catch (Exception ignored) {
}
if (TextUtils.isEmpty(src)) {
return "Sideloaded";
} else if (src.toLowerCase().contains(".amazon.")) {
return "Amazon Appstore";
}
switch (src) {
case "com.android.vending":
case "com.google.android.feedback": {
return "Google Play Store";
}
case "org.fdroid.fdroid.privileged":
case "org.fdroid.fdroid": {
return "F-Droid";
}
case "com.github.yeriomin.yalpstore": {
return "Yalp Store";
}
case "cm.aptoide.pt": {
return "Aptoide";
}
case "com.android.packageinstaller": {
return "Package Installer";
}
}
return src;
}
/** /**
* Send a {@link Intent#ACTION_VIEW} Intent with given paramter * Send a {@link Intent#ACTION_VIEW} Intent with given paramter
* If the parameter is an string a browser will get triggered * If the parameter is an string a browser will get triggered
@ -189,6 +222,14 @@ public class ContextUtils {
} }
} }
/**
* Get this apps package name. The builtin method may fail when used with flavors
*/
public String getPackageName() {
String pkg = rstr("manifest_package_id");
return pkg != null ? pkg : _context.getPackageName();
}
/** /**
* Get field from ${applicationId}.BuildConfig * Get field from ${applicationId}.BuildConfig
* May be helpful in libraries, where a access to * May be helpful in libraries, where a access to
@ -198,8 +239,7 @@ public class ContextUtils {
* Falls back to applicationId of the app which may differ from manifest. * Falls back to applicationId of the app which may differ from manifest.
*/ */
public Object getBuildConfigValue(String fieldName) { public Object getBuildConfigValue(String fieldName) {
String pkg = rstr("manifest_package_id"); String pkg = getPackageName() + ".BuildConfig";
pkg = (pkg != null ? pkg : _context.getPackageName()) + ".BuildConfig";
try { try {
Class<?> c = Class.forName(pkg); Class<?> c = Class.forName(pkg);
return c.getField(fieldName).get(null); return c.getField(fieldName).get(null);
@ -231,6 +271,17 @@ public class ContextUtils {
return defaultValue; return defaultValue;
} }
/**
* Get a BuildConfig string value
*/
public Integer bcint(String fieldName, int defaultValue) {
Object field = getBuildConfigValue(fieldName);
if (field != null && field instanceof Integer) {
return (Integer) field;
}
return defaultValue;
}
/** /**
* Check if this is a gplay build (requires BuildConfig field) * Check if this is a gplay build (requires BuildConfig field)
*/ */

View file

@ -21,9 +21,9 @@ import java.io.File;
@SuppressWarnings({"unused", "WeakerAccess"}) @SuppressWarnings({"unused", "WeakerAccess"})
public class PermissionChecker { public class PermissionChecker {
private static final int CODE_PERMISSION_EXTERNAL_STORAGE = 4000; protected static final int CODE_PERMISSION_EXTERNAL_STORAGE = 4000;
private Activity _activity; protected Activity _activity;
public PermissionChecker(Activity activity) { public PermissionChecker(Activity activity) {
_activity = activity; _activity = activity;

View file

@ -54,6 +54,7 @@ public class ShareUtil {
public final static String EXTRA_FILEPATH = "real_file_path_2"; public final static String EXTRA_FILEPATH = "real_file_path_2";
public final static SimpleDateFormat SDF_RFC3339_ISH = new SimpleDateFormat("yyyy-MM-dd'T'HH-mm", Locale.getDefault()); public final static SimpleDateFormat SDF_RFC3339_ISH = new SimpleDateFormat("yyyy-MM-dd'T'HH-mm", Locale.getDefault());
public final static SimpleDateFormat SDF_SHORT = new SimpleDateFormat("yyMMdd-HHmm", Locale.getDefault()); public final static SimpleDateFormat SDF_SHORT = new SimpleDateFormat("yyMMdd-HHmm", Locale.getDefault());
public final static String MIME_TEXT_PLAIN = "text/plain";
protected Context _context; protected Context _context;
@ -162,7 +163,7 @@ public class ShareUtil {
public void shareText(String text, @Nullable String mimeType) { public void shareText(String text, @Nullable String mimeType) {
Intent intent = new Intent(Intent.ACTION_SEND); Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, text); intent.putExtra(Intent.EXTRA_TEXT, text);
intent.setType(mimeType != null ? mimeType : "text/plain"); intent.setType(mimeType != null ? mimeType : MIME_TEXT_PLAIN);
showChooser(intent, null); showChooser(intent, null);
} }
@ -419,7 +420,7 @@ public class ShareUtil {
fileStr = "/" + fileStr; fileStr = "/" + fileStr;
} }
// Some do add some custom prefix // Some do add some custom prefix
for (String prefix : new String[]{"file", "document", "root_files"}) { for (String prefix : new String[]{"file", "document", "root_files", "name"}) {
if (fileStr.startsWith(prefix)) { if (fileStr.startsWith(prefix)) {
fileStr = fileStr.substring(prefix.length()); fileStr = fileStr.substring(prefix.length());
} }
@ -443,6 +444,8 @@ public class ShareUtil {
tmpf = new File(Uri.decode(fileStr)); tmpf = new File(Uri.decode(fileStr));
if (tmpf.exists()) { if (tmpf.exists()) {
return tmpf; return tmpf;
} else if ((tmpf = new File(fileStr)).exists()) {
return tmpf;
} }
} }
} }

View file

@ -6,7 +6,7 @@
<string name="shared_via_app" translatable="false"> <string name="shared_via_app" translatable="false">
\n\n\n_________________________\n \n\n\n_________________________\n
**Tags:** #dandelíon \n\n **Tags:** #dandelíon \n\n
*via [dandelion*](/people?q=dandelion00%40diasp.org) client [(Source)](https://github.com/Diaspora-for-Android/dandelion)*</string> *via [dandelion*](/people?q=dandelion00%40diasp.org) client [(Source)](https://github.com/gsantner/dandelion)*</string>
<string name="tor" translatable="false">Tor</string> <string name="tor" translatable="false">Tor</string>
@ -29,9 +29,9 @@
<string name="fragment_licesen__misc_leafpic_link" translatable="false">https://github.com/HoraApps/LeafPic</string> <string name="fragment_licesen__misc_leafpic_link" translatable="false">https://github.com/HoraApps/LeafPic</string>
<string name="fragment_about__fdroid_link" translatable="false">https://f-droid.org/repository/browse/?fdid=com.github.dfa.diaspora_android</string> <string name="fragment_about__fdroid_link" translatable="false">https://f-droid.org/repository/browse/?fdid=com.github.dfa.diaspora_android</string>
<string name="fragment_about__about" translatable="false">@string/app_name</string> <string name="fragment_about__about" translatable="false">@string/app_name</string>
<string name="fragment_about__contribute_link" translatable="false">https://github.com/Diaspora-for-Android/dandelion</string> <string name="fragment_about__contribute_link" translatable="false">https://github.com/gsantner/dandelion</string>
<string name="fragment_about__translate_link" translatable="false">https://crowdin.com/project/diaspora-for-android/invite</string> <string name="fragment_about__translate_link" translatable="false">https://crowdin.com/project/gsantner/invite</string>
<string name="fragment_About__feedback_link" translatable="false">https://github.com/Diaspora-for-Android/dandelion/issues</string> <string name="fragment_About__feedback_link" translatable="false">https://github.com/gsantner/dandelion/issues</string>

View file

@ -17,7 +17,7 @@ buildscript {
// https://github.com/guardianproject/NetCipher/releases // https://github.com/guardianproject/NetCipher/releases
ext.version_library_netcipher = "2.0.0-alpha1" ext.version_library_netcipher = "2.0.0-alpha1"
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-gradle-plugin#LookAtCentral // https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-gradle-plugin#LookAtCentral
ext.version_plugin_kotlin = "1.2.21" ext.version_plugin_kotlin = "1.2.41"
ext.enable_plugin_kotlin = false ext.enable_plugin_kotlin = false
repositories { repositories {

View file

@ -11,8 +11,8 @@ It adds useful features to your networking experience:
✔️ Allows system independent language ✔️ Allows system independent language
<b>Support the project:</b> <b>Support the project:</b>
✋ <a href="https://lonamiwebs.github.io/stringlate/translate?git=https%3A%2F%2Fgithub.com%2Fdiaspora-for-android%2Fdandelion.git&mail=gro.xobliam@@rentnasg">Translate using Stringlate</a> ✋ <a href="https://lonamiwebs.github.io/stringlate/translate?git=https%3A%2F%2Fgithub.com%2Fgsantner%2Fdandelion.git&mail=gro.xobliam@@rentnasg">Translate using Stringlate</a>
✋ <a href="https://matrix.to/#/#dandelion:matrix.org">Join discussion on Matrix</a> ✋ <a href="https://matrix.to/#/#dandelion:matrix.org">Join discussion on Matrix</a>
✋ <a href="https://github.com/diaspora-for-android/dandelion#contributions">More information about contributions</a> ✋ <a href="https://github.com/gsantner/dandelion#contributions">More information about contributions</a>
✋ <a href="https://gsantner.net/android-contribution-guide/?packageid=com.github.dfa.diaspora_android&name=dandelion&web=https://github.com/diaspora-for-android/dandelion">Android Contribution Guide (gsantner blog)</a> ✋ <a href="https://gsantner.net/android-contribution-guide/?packageid=com.github.dfa.diaspora_android&name=dandelion&web=https://github.com/gsantner/dandelion">Android Contribution Guide (gsantner blog)</a>
✋ <a href="http://gsantner.net/supportme?ref=dandelion&source=fdroid">Support main developer</a> ✋ <a href="http://gsantner.net/supportme?ref=dandelion&source=fdroid">Support main developer</a>