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.
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)
[![Build Status](https://travis-ci.org/Diaspora-for-Android/dandelion.svg?branch=master)](https://travis-ci.org/Diaspora-for-Android/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)
[![GitHub release](https://img.shields.io/github/tag/gsantner/dandelion.svg)](https://github.com/gsantner/dandelion/releases)
[![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%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)
[![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)
# dandelion\*
@ -39,9 +39,9 @@ dandelion\* requires access to the Internet and to external storage to be able t
## Contributions
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)
@ -49,14 +49,14 @@ Note that the main project members are working on this project for free during l
#### 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)
* 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)
## 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.
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
#### Maintainers
- gsantner ([GitHub](https://github.com/gsantner), [Web](https://gsantner.net), [diaspora*](https://pod.geraspora.de/people/d1cbdd70095301341e834860008dbc6c))
- Bitcoin: [1B9ZyYdQoY9BxMe9dRUEKaZbJWsbQqfXU5](http://gsantner.net/donate/#donate)
- gsantner ([GitHub](https://github.com/gsantner), [Web](https://gsantner.net/supportme/?project=dandelion&source=readme), [diaspora*](https://pod.geraspora.de/people/d1cbdd70095301341e834860008dbc6c))
- Bitcoin: [1B9ZyYdQoY9BxMe9dRUEKaZbJWsbQqfXU5](https://gsantner.net/donate/#donate)
- vanitasvitae ([GitHub](https://github.com/vanitasvitae), [diaspora*](https://pod.geraspora.de/people/bbd7af90fbec013213e34860008dbc6c))
- 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 ;)
toolbarTop.postDelayed(() -> {
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);
}, 1000);
return;

View File

@ -59,7 +59,7 @@ public class FetchPodsService extends Service {
}
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;

View File

@ -166,7 +166,7 @@ public class ContextUtils {
public String getAppVersionName() {
try {
PackageManager manager = _context.getPackageManager();
PackageInfo info = manager.getPackageInfo(_context.getPackageName(), 0);
PackageInfo info = manager.getPackageInfo(getPackageName(), 0);
return info.versionName;
} catch (PackageManager.NameNotFoundException e) {
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
* 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
* 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.
*/
public Object getBuildConfigValue(String fieldName) {
String pkg = rstr("manifest_package_id");
pkg = (pkg != null ? pkg : _context.getPackageName()) + ".BuildConfig";
String pkg = getPackageName() + ".BuildConfig";
try {
Class<?> c = Class.forName(pkg);
return c.getField(fieldName).get(null);
@ -231,6 +271,17 @@ public class ContextUtils {
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)
*/

View File

@ -21,9 +21,9 @@ import java.io.File;
@SuppressWarnings({"unused", "WeakerAccess"})
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) {
_activity = activity;

View File

@ -54,6 +54,7 @@ public class ShareUtil {
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_SHORT = new SimpleDateFormat("yyMMdd-HHmm", Locale.getDefault());
public final static String MIME_TEXT_PLAIN = "text/plain";
protected Context _context;
@ -162,7 +163,7 @@ public class ShareUtil {
public void shareText(String text, @Nullable String mimeType) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, text);
intent.setType(mimeType != null ? mimeType : "text/plain");
intent.setType(mimeType != null ? mimeType : MIME_TEXT_PLAIN);
showChooser(intent, null);
}
@ -419,7 +420,7 @@ public class ShareUtil {
fileStr = "/" + fileStr;
}
// 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)) {
fileStr = fileStr.substring(prefix.length());
}
@ -443,6 +444,8 @@ public class ShareUtil {
tmpf = new File(Uri.decode(fileStr));
if (tmpf.exists()) {
return tmpf;
} else if ((tmpf = new File(fileStr)).exists()) {
return tmpf;
}
}
}

View File

@ -6,7 +6,7 @@
<string name="shared_via_app" translatable="false">
\n\n\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>
@ -29,9 +29,9 @@
<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__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__translate_link" translatable="false">https://crowdin.com/project/diaspora-for-android/invite</string>
<string name="fragment_About__feedback_link" translatable="false">https://github.com/Diaspora-for-Android/dandelion/issues</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/gsantner/invite</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
ext.version_library_netcipher = "2.0.0-alpha1"
// 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
repositories {

View File

@ -11,8 +11,8 @@ It adds useful features to your networking experience:
✔️ Allows system independent language
<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://github.com/diaspora-for-android/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://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/gsantner/dandelion">Android Contribution Guide (gsantner blog)</a>
✋ <a href="http://gsantner.net/supportme?ref=dandelion&source=fdroid">Support main developer</a>