Rename test flavor to atest (so it's default dev flavor when starting android studio)

This commit is contained in:
Gregor Santner 2019-08-24 14:54:25 +02:00
parent 6d45620181
commit 194fbf6927
24 changed files with 79 additions and 18 deletions

View File

@ -10,18 +10,19 @@ android {
compileSdkVersion rootProject.ext.version_compileSdk
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
targetSdkVersion rootProject.ext.version_compileSdk
buildConfigField "boolean", "IS_TEST_BUILD", "false"
buildConfigField "boolean", "IS_GPLAY_BUILD", "false"
buildConfigField "String[]", "DETECTED_ANDROID_LOCALES", "${findUsedAndroidLocales()}"
buildConfigField "String", "GITHASH", "\"${getGitHash()}\""
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
setProperty("archivesBaseName", applicationId + "-v" + versionCode + "-" + versionName)
}
flavorDimensions "default"
@ -38,7 +39,7 @@ android {
applicationId "net.gsantner.dandelior"
}
flavorTest {
flavorAtest {
applicationId "net.gsantner.secondlion"
versionCode = Integer.parseInt(new Date().format('yyMMdd'))
versionName = new Date().format('yyMMdd')

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -58,6 +58,8 @@ public class SharedPreferencesPropertyBackend implements PropertyBackend<String,
protected static final String ARRAY_SEPARATOR = "%%%";
protected static final String ARRAY_SEPARATOR_SUBSTITUTE = "§§§";
public static final String SHARED_PREF_APP = "app";
private static String _debugLog = "";
//
// Members, Constructors
@ -571,4 +573,16 @@ public class SharedPreferencesPropertyBackend implements PropertyBackend<String,
}
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";
}
}

View File

@ -126,7 +126,6 @@ public class SearchOrCustomTextDialog {
}
};
final ActivityUtils activityUtils = new ActivityUtils(activity);
final AppCompatEditText searchEditText = new AppCompatEditText(activity);
searchEditText.setSingleLine(true);
searchEditText.setMaxLines(1);
@ -156,8 +155,7 @@ public class SearchOrCustomTextDialog {
linearLayout.setOrientation(LinearLayout.VERTICAL);
if (dopt.isSearchEnabled) {
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 net.gsantner.opoc.util.ContextUtils(listView.getContext()).convertDpToPx(8));
int px = (int) (new ContextUtils(listView.getContext()).convertDpToPx(8));
lp.setMargins(px, px / 2, px, px / 2);
linearLayout.addView(searchEditText, lp);
}
@ -288,7 +286,13 @@ public class SearchOrCustomTextDialog {
List<String> ret = new ArrayList<>();
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()) {
File f = iter.next();
if (first) {

View File

@ -32,6 +32,7 @@ import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.util.TypedValue;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebView;
@ -175,11 +176,15 @@ public class ActivityUtils extends net.gsantner.opoc.util.ContextUtils {
scroll.addView(textView);
textView.setMovementMethod(new LinkMovementMethod());
textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17);
AlertDialog.Builder dialog = new AlertDialog.Builder(_context)
.setPositiveButton(android.R.string.ok, null).setOnDismissListener(dismissedListener)
.setTitle(resTitleId).setView(scroll);
dialog.show();
.setView(scroll);
if (resTitleId != 0) {
dialog.setTitle(resTitleId);
}
dialogFullWidth(dialog.show(), true, false);
}
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)
.setTitle(resTitleId)
.setView(wv);
dialog.show();
dialogFullWidth(dialog.show(), true, false);
}
// 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);
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) {
}
}
}

View File

@ -66,7 +66,7 @@ public class AndroidSupportMeWrapper extends ActivityUtils {
}
public boolean all14dRequest() {
return afterDaysTrue("all14dRequest", 14, 3);
return afterDaysTrue("all14dRequest", 31, 3);
}
}
}

View File

@ -100,6 +100,10 @@ public class ShareUtil {
_chooserTitle = "";
}
public void setContext(Context c) {
_context = c;
}
public void freeContextRef() {
_context = null;
}
@ -334,14 +338,17 @@ public class ShareUtil {
public PrintJob print(WebView webview, String jobName) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
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) {
printAdapter = webview.createPrintDocumentAdapter(jobName);
} else {
printAdapter = webview.createPrintDocumentAdapter();
}
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 {
Log.e(getClass().getName(), "ERROR: Method called on too low Android API version");

View File

@ -14,7 +14,7 @@ import java.text.SimpleDateFormat
buildscript {
ext {
version_gradle_tools = "3.5.0"
version_plugin_kotlin = "1.3.41"
version_plugin_kotlin = "1.3.50"
enable_plugin_kotlin = false
version_compileSdk = 28