Rename test flavor to atest (so it's default dev flavor when starting android studio)
|
@ -10,18 +10,19 @@ android {
|
||||||
compileSdkVersion rootProject.ext.version_compileSdk
|
compileSdkVersion rootProject.ext.version_compileSdk
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
resValue "string", "manifest_package_id", "com.github.dfa.diaspora_android"
|
||||||
|
applicationId "com.github.dfa.diaspora_android"
|
||||||
|
versionName "1.3.1"
|
||||||
|
versionCode 42
|
||||||
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|
||||||
minSdkVersion rootProject.ext.version_minSdk
|
minSdkVersion rootProject.ext.version_minSdk
|
||||||
targetSdkVersion rootProject.ext.version_compileSdk
|
targetSdkVersion rootProject.ext.version_compileSdk
|
||||||
buildConfigField "boolean", "IS_TEST_BUILD", "false"
|
buildConfigField "boolean", "IS_TEST_BUILD", "false"
|
||||||
buildConfigField "boolean", "IS_GPLAY_BUILD", "false"
|
buildConfigField "boolean", "IS_GPLAY_BUILD", "false"
|
||||||
buildConfigField "String[]", "DETECTED_ANDROID_LOCALES", "${findUsedAndroidLocales()}"
|
buildConfigField "String[]", "DETECTED_ANDROID_LOCALES", "${findUsedAndroidLocales()}"
|
||||||
buildConfigField "String", "GITHASH", "\"${getGitHash()}\""
|
buildConfigField "String", "GITHASH", "\"${getGitHash()}\""
|
||||||
|
setProperty("archivesBaseName", applicationId + "-v" + versionCode + "-" + versionName)
|
||||||
resValue "string", "manifest_package_id", "com.github.dfa.diaspora_android"
|
|
||||||
applicationId "com.github.dfa.diaspora_android"
|
|
||||||
versionName "1.3.1"
|
|
||||||
versionCode 42
|
|
||||||
vectorDrawables.useSupportLibrary = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
|
@ -38,7 +39,7 @@ android {
|
||||||
applicationId "net.gsantner.dandelior"
|
applicationId "net.gsantner.dandelior"
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorTest {
|
flavorAtest {
|
||||||
applicationId "net.gsantner.secondlion"
|
applicationId "net.gsantner.secondlion"
|
||||||
versionCode = Integer.parseInt(new Date().format('yyMMdd'))
|
versionCode = Integer.parseInt(new Date().format('yyMMdd'))
|
||||||
versionName = new Date().format('yyMMdd')
|
versionName = new Date().format('yyMMdd')
|
||||||
|
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
@ -58,6 +58,8 @@ public class SharedPreferencesPropertyBackend implements PropertyBackend<String,
|
||||||
protected static final String ARRAY_SEPARATOR = "%%%";
|
protected static final String ARRAY_SEPARATOR = "%%%";
|
||||||
protected static final String ARRAY_SEPARATOR_SUBSTITUTE = "§§§";
|
protected static final String ARRAY_SEPARATOR_SUBSTITUTE = "§§§";
|
||||||
public static final String SHARED_PREF_APP = "app";
|
public static final String SHARED_PREF_APP = "app";
|
||||||
|
private static String _debugLog = "";
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Members, Constructors
|
// Members, Constructors
|
||||||
|
@ -571,4 +573,16 @@ public class SharedPreferencesPropertyBackend implements PropertyBackend<String,
|
||||||
}
|
}
|
||||||
return trigger;
|
return trigger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void clearDebugLog() {
|
||||||
|
_debugLog = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDebugLog() {
|
||||||
|
return _debugLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized void appendDebugLog(String text) {
|
||||||
|
_debugLog += "[" + new Date().toString() + "] " + text + "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,6 @@ public class SearchOrCustomTextDialog {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
final ActivityUtils activityUtils = new ActivityUtils(activity);
|
|
||||||
final AppCompatEditText searchEditText = new AppCompatEditText(activity);
|
final AppCompatEditText searchEditText = new AppCompatEditText(activity);
|
||||||
searchEditText.setSingleLine(true);
|
searchEditText.setSingleLine(true);
|
||||||
searchEditText.setMaxLines(1);
|
searchEditText.setMaxLines(1);
|
||||||
|
@ -156,8 +155,7 @@ public class SearchOrCustomTextDialog {
|
||||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||||
if (dopt.isSearchEnabled) {
|
if (dopt.isSearchEnabled) {
|
||||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
ContextUtils cu = new net.gsantner.opoc.util.ContextUtils(listView.getContext());
|
int px = (int) (new ContextUtils(listView.getContext()).convertDpToPx(8));
|
||||||
int px = (int) (new net.gsantner.opoc.util.ContextUtils(listView.getContext()).convertDpToPx(8));
|
|
||||||
lp.setMargins(px, px / 2, px, px / 2);
|
lp.setMargins(px, px / 2, px, px / 2);
|
||||||
linearLayout.addView(searchEditText, lp);
|
linearLayout.addView(searchEditText, lp);
|
||||||
}
|
}
|
||||||
|
@ -288,7 +286,13 @@ public class SearchOrCustomTextDialog {
|
||||||
List<String> ret = new ArrayList<>();
|
List<String> ret = new ArrayList<>();
|
||||||
|
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
Iterator<File> iter = FileUtils.iterateFilesAndDirs(_searchDir, this, this);
|
Iterator<File> iter = null;
|
||||||
|
try {
|
||||||
|
iter = FileUtils.iterateFilesAndDirs(_searchDir, this, this);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Iterator may throw an error at creation
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
while (iter.hasNext() && !isCancelled()) {
|
while (iter.hasNext() && !isCancelled()) {
|
||||||
File f = iter.next();
|
File f = iter.next();
|
||||||
if (first) {
|
if (first) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ import android.text.SpannableString;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
@ -175,11 +176,15 @@ public class ActivityUtils extends net.gsantner.opoc.util.ContextUtils {
|
||||||
scroll.addView(textView);
|
scroll.addView(textView);
|
||||||
textView.setMovementMethod(new LinkMovementMethod());
|
textView.setMovementMethod(new LinkMovementMethod());
|
||||||
textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text);
|
textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text);
|
||||||
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17);
|
||||||
|
|
||||||
AlertDialog.Builder dialog = new AlertDialog.Builder(_context)
|
AlertDialog.Builder dialog = new AlertDialog.Builder(_context)
|
||||||
.setPositiveButton(android.R.string.ok, null).setOnDismissListener(dismissedListener)
|
.setPositiveButton(android.R.string.ok, null).setOnDismissListener(dismissedListener)
|
||||||
.setTitle(resTitleId).setView(scroll);
|
.setView(scroll);
|
||||||
dialog.show();
|
if (resTitleId != 0) {
|
||||||
|
dialog.setTitle(resTitleId);
|
||||||
|
}
|
||||||
|
dialogFullWidth(dialog.show(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showDialogWithRawFileInWebView(String fileInRaw, @StringRes int resTitleId) {
|
public void showDialogWithRawFileInWebView(String fileInRaw, @StringRes int resTitleId) {
|
||||||
|
@ -189,7 +194,7 @@ public class ActivityUtils extends net.gsantner.opoc.util.ContextUtils {
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
.setTitle(resTitleId)
|
.setTitle(resTitleId)
|
||||||
.setView(wv);
|
.setView(wv);
|
||||||
dialog.show();
|
dialogFullWidth(dialog.show(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle with no param, else set visibility according to first bool
|
// Toggle with no param, else set visibility according to first bool
|
||||||
|
@ -281,4 +286,34 @@ public class ActivityUtils extends net.gsantner.opoc.util.ContextUtils {
|
||||||
_activity.startActivity(intent);
|
_activity.startActivity(intent);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect if the activity is currently in splitscreen/multiwindow mode
|
||||||
|
*/
|
||||||
|
public boolean isInSplitScreenMode() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
return _activity.isInMultiWindowMode();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show dialog in full width / show keyboard
|
||||||
|
*
|
||||||
|
* @param dialog Get via dialog.show()
|
||||||
|
*/
|
||||||
|
public void dialogFullWidth(AlertDialog dialog, boolean fullWidth, boolean showKeyboard) {
|
||||||
|
try {
|
||||||
|
Window w;
|
||||||
|
if (dialog != null && (w = dialog.getWindow()) != null) {
|
||||||
|
if (fullWidth) {
|
||||||
|
w.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
|
||||||
|
}
|
||||||
|
if (showKeyboard) {
|
||||||
|
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class AndroidSupportMeWrapper extends ActivityUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean all14dRequest() {
|
public boolean all14dRequest() {
|
||||||
return afterDaysTrue("all14dRequest", 14, 3);
|
return afterDaysTrue("all14dRequest", 31, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,10 @@ public class ShareUtil {
|
||||||
_chooserTitle = "➥";
|
_chooserTitle = "➥";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setContext(Context c) {
|
||||||
|
_context = c;
|
||||||
|
}
|
||||||
|
|
||||||
public void freeContextRef() {
|
public void freeContextRef() {
|
||||||
_context = null;
|
_context = null;
|
||||||
}
|
}
|
||||||
|
@ -334,14 +338,17 @@ public class ShareUtil {
|
||||||
public PrintJob print(WebView webview, String jobName) {
|
public PrintJob print(WebView webview, String jobName) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
PrintDocumentAdapter printAdapter;
|
PrintDocumentAdapter printAdapter;
|
||||||
PrintManager printManager = (PrintManager) webview.getContext().getSystemService(Context.PRINT_SERVICE);
|
PrintManager printManager = (PrintManager) _context.getSystemService(Context.PRINT_SERVICE);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
printAdapter = webview.createPrintDocumentAdapter(jobName);
|
printAdapter = webview.createPrintDocumentAdapter(jobName);
|
||||||
} else {
|
} else {
|
||||||
printAdapter = webview.createPrintDocumentAdapter();
|
printAdapter = webview.createPrintDocumentAdapter();
|
||||||
}
|
}
|
||||||
if (printManager != null) {
|
if (printManager != null) {
|
||||||
return printManager.print(jobName, printAdapter, new PrintAttributes.Builder().build());
|
try {
|
||||||
|
return printManager.print(jobName, printAdapter, new PrintAttributes.Builder().build());
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(getClass().getName(), "ERROR: Method called on too low Android API version");
|
Log.e(getClass().getName(), "ERROR: Method called on too low Android API version");
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.text.SimpleDateFormat
|
||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
version_gradle_tools = "3.5.0"
|
version_gradle_tools = "3.5.0"
|
||||||
version_plugin_kotlin = "1.3.41"
|
version_plugin_kotlin = "1.3.50"
|
||||||
enable_plugin_kotlin = false
|
enable_plugin_kotlin = false
|
||||||
|
|
||||||
version_compileSdk = 28
|
version_compileSdk = 28
|
||||||
|
|