[Libreoffice-commits] core.git: 4 commits - android/source
Christian Lohmaier
lohmaier+LibreOffice at googlemail.com
Sat Jun 30 10:19:39 UTC 2018
android/source/build.gradle | 19 +---
android/source/gradle/wrapper/gradle-wrapper.properties | 4
android/source/src/java/org/libreoffice/AboutDialogFragment.java | 5 -
android/source/src/java/org/libreoffice/FontController.java | 46 ++++------
android/source/src/java/org/libreoffice/InvalidationHandler.java | 2
android/source/src/java/org/mozilla/gecko/gfx/RectUtils.java | 5 -
6 files changed, 36 insertions(+), 45 deletions(-)
New commits:
commit f091cc76d4782f8add6efd0b55b58c3c83711e32
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date: Fri Jun 29 21:40:20 2018 +0200
android: simplify boolean statement
Change-Id: I92cdccfe7b97d9baf29b1155990a38b26579e365
diff --git a/android/source/src/java/org/mozilla/gecko/gfx/RectUtils.java b/android/source/src/java/org/mozilla/gecko/gfx/RectUtils.java
index 8c1670f0f11f..e7fa540a390c 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/RectUtils.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/RectUtils.java
@@ -89,10 +89,9 @@ public final class RectUtils {
public static boolean fuzzyEquals(RectF a, RectF b) {
if (a == null && b == null)
return true;
- else if ((a == null && b != null) || (a != null && b == null))
- return false;
else
- return FloatUtils.fuzzyEquals(a.top, b.top)
+ return a != null && b != null
+ && FloatUtils.fuzzyEquals(a.top, b.top)
&& FloatUtils.fuzzyEquals(a.left, b.left)
&& FloatUtils.fuzzyEquals(a.right, b.right)
&& FloatUtils.fuzzyEquals(a.bottom, b.bottom);
commit 8be74d03026a421b4cf4c5f8c3ede9998c61fd3d
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date: Fri Jun 29 21:26:25 2018 +0200
android: get rid of unsafe/unchecked casts
Change-Id: I95bb78c563589501d756fdd4dd6529b9eee0f4ac
diff --git a/android/source/src/java/org/libreoffice/FontController.java b/android/source/src/java/org/libreoffice/FontController.java
index 7a3f18366c7a..250a67bbd8c9 100644
--- a/android/source/src/java/org/libreoffice/FontController.java
+++ b/android/source/src/java/org/libreoffice/FontController.java
@@ -20,17 +20,15 @@ import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
public class FontController implements AdapterView.OnItemSelectedListener {
private boolean mFontNameSpinnerSet = false;
private boolean mFontSizeSpinnerSet = false;
- private LibreOfficeMainActivity mActivity;
- private List<String> mFontList = null;
- private List<String> mFontSizes = new ArrayList<String>();
- private Map<String, List<String>> mAllFontSizes = null;
+ private final LibreOfficeMainActivity mActivity;
+ private final ArrayList<String> mFontList = new ArrayList<String>();
+ private final ArrayList<String> mFontSizes = new ArrayList<String>();
+ private final HashMap<String, ArrayList<String>> mAllFontSizes = new HashMap<String, ArrayList<String>>();
private String mCurrentFontSelected = null;
private String mCurrentFontSizeSelected = null;
@@ -44,7 +42,7 @@ public class FontController implements AdapterView.OnItemSelectedListener {
private ColorPickerAdapter colorPickerAdapter;
private ColorPickerAdapter backColorPickerAdapter;
- ColorPaletteListener colorPaletteListener = new ColorPaletteListener() {
+ final ColorPaletteListener colorPaletteListener = new ColorPaletteListener() {
@Override
public void applyColor(int color) {
sendFontColorChange(color);
@@ -58,7 +56,7 @@ public class FontController implements AdapterView.OnItemSelectedListener {
}
};
- ColorPaletteListener backColorPaletteListener = new ColorPaletteListener() {
+ final ColorPaletteListener backColorPaletteListener = new ColorPaletteListener() {
@Override
public void applyColor(int color) {
sendFontBackColorChange(color);
@@ -177,7 +175,7 @@ public class FontController implements AdapterView.OnItemSelectedListener {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
- if (mFontList == null || !mFontNameSpinnerSet)
+ if (mFontList.isEmpty() || !mFontNameSpinnerSet)
return;
if (parent == mActivity.findViewById(R.id.font_name_spinner)) {
String currentFontSelected = parent.getItemAtPosition(pos).toString();
@@ -200,13 +198,13 @@ public class FontController implements AdapterView.OnItemSelectedListener {
}
public void parseJson(String json) {
- mFontList = new ArrayList<String>();
- mAllFontSizes = new HashMap<String, List<String>>();
+ mFontList.clear();
+ mAllFontSizes.clear();
try {
JSONObject jObject = new JSONObject(json);
JSONObject jObject2 = jObject.getJSONObject("commandValues");
Iterator<String> keys = jObject2.keys();
- List<String> fontSizes;
+ ArrayList<String> fontSizes;
while (keys.hasNext()) {
String key = keys.next();
mFontList.add(key);
@@ -375,7 +373,6 @@ public class FontController implements AdapterView.OnItemSelectedListener {
private void selectFontCurrentThread(String fontName) {
Spinner spinner = mActivity.findViewById(R.id.font_name_spinner);
-
if (!mFontNameSpinnerSet) {
spinner.setOnItemSelectedListener(this);
mFontNameSpinnerSet = true;
@@ -384,24 +381,22 @@ public class FontController implements AdapterView.OnItemSelectedListener {
if (fontName.equals(mCurrentFontSelected))
return;
- ArrayAdapter<String> arrayAdapter = (ArrayAdapter<String>) spinner.getAdapter();
- int position = arrayAdapter.getPosition(fontName);
+ int position = mFontList.indexOf(fontName);
if (position != -1) {
mCurrentFontSelected = fontName;
- spinner.setSelection(position);
+ spinner.setSelection(position,false);
}
resetFontSizes(fontName);
}
private void resetFontSizes(String fontName) {
- Spinner spinner = mActivity.findViewById(R.id.font_size_spinner);
- ArrayAdapter<String> arrayAdapter = (ArrayAdapter<String>) spinner.getAdapter();
-
- List<String> fontSizes = mAllFontSizes.get(fontName);
- if (fontSizes != null) {
- arrayAdapter.clear();
- arrayAdapter.addAll(mAllFontSizes.get(fontName));
+ if (mAllFontSizes.get(fontName) != null) {
+ mFontSizes.clear();
+ mFontSizes.addAll(mAllFontSizes.get(fontName));
+ Spinner spinner = mActivity.findViewById(R.id.font_size_spinner);
+ ArrayAdapter<?> arrayAdapter = (ArrayAdapter<?>)spinner.getAdapter();
+ arrayAdapter.notifyDataSetChanged();
}
}
@@ -423,13 +418,10 @@ public class FontController implements AdapterView.OnItemSelectedListener {
if (fontSize.equals(mCurrentFontSizeSelected))
return;
- ArrayAdapter<String> arrayAdapter = (ArrayAdapter<String>) spinner.getAdapter();
-
- int position = arrayAdapter.getPosition(fontSize);
+ int position = mFontSizes.indexOf(fontSize);
if (position != -1) {
mCurrentFontSizeSelected = fontSize;
spinner.setSelection(position, false);
}
-
}
}
diff --git a/android/source/src/java/org/libreoffice/InvalidationHandler.java b/android/source/src/java/org/libreoffice/InvalidationHandler.java
index 26cf7abfb9d5..25771afdcde3 100644
--- a/android/source/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/source/src/java/org/libreoffice/InvalidationHandler.java
@@ -467,7 +467,7 @@ public class InvalidationHandler implements Document.MessageCallback, Office.Mes
if (mState == OverlayState.SELECTION) {
changeStateTo(OverlayState.TRANSITION);
}
- mDocumentOverlay.changeSelections(Collections.EMPTY_LIST);
+ mDocumentOverlay.changeSelections(Collections.<RectF>emptyList());
if (mContext.isSpreadsheet()) {
mDocumentOverlay.showHeaderSelection(null);
}
commit 778fe76aca71c4e5c532eb38f27a29a98dc07077
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date: Fri Jun 29 21:20:10 2018 +0200
android: suppress deprecation warning for Html.toHtml(String)
deprecated since 24/Nougat, but we still want to support devices running
Marshmallow and older..
Change-Id: Iedcf8a56028eff44134b548dc07a89573cb2210d
diff --git a/android/source/src/java/org/libreoffice/AboutDialogFragment.java b/android/source/src/java/org/libreoffice/AboutDialogFragment.java
index 9b9a6c7b348f..6c944bae7ef1 100644
--- a/android/source/src/java/org/libreoffice/AboutDialogFragment.java
+++ b/android/source/src/java/org/libreoffice/AboutDialogFragment.java
@@ -21,6 +21,7 @@ import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.text.Html;
+import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.TextView;
@@ -56,7 +57,9 @@ public class AboutDialogFragment extends DialogFragment {
{
String version = String.format(versionView.getText().toString().replace("\n", "<br/>"),
tokens[0], "<a href=\"https://hub.libreoffice.org/git-core/" + tokens[1] + "\">" + tokens[1] + "</a>");
- versionView.setText(Html.fromHtml(version));
+ @SuppressWarnings("deprecation") // since 24 with additional option parameter
+ Spanned versionString = Html.fromHtml(version);
+ versionView.setText(versionString);
versionView.setMovementMethod(LinkMovementMethod.getInstance());
String vendor = vendorView.getText().toString();
vendor = vendor.replace("$VENDOR", tokens[2]);
commit aea65dc3f97f05d2f4f53da8a2ed8b5a62657bc7
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date: Fri Jun 29 21:15:29 2018 +0200
android: bump gradle, gradle-plugin, support libary & target versions
Change-Id: I971f02c624a19ec58539738f5e736a986b5ba0d6
diff --git a/android/source/build.gradle b/android/source/build.gradle
index c2d4aeae0e56..2fa5dda5b817 100644
--- a/android/source/build.gradle
+++ b/android/source/build.gradle
@@ -5,9 +5,8 @@ apply from: 'liboSettings.gradle'
project.ext.set("archivesBaseName", "LibreOfficeViewer")
allprojects {
repositories {
- maven {
- url "https://maven.google.com"
- }
+ jcenter()
+ google()
flatDir {
dirs "${liboWorkdir}/UnpackedTarball/owncloud_android_lib/build/outputs/aar"
}
@@ -17,12 +16,10 @@ allprojects {
buildscript {
repositories {
jcenter()
- maven {
- url "https://maven.google.com"
- }
+ google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.0.1'
+ classpath 'com.android.tools.build:gradle:3.1.3'
}
}
@@ -38,13 +35,13 @@ dependencies {
implementation files("${liboInstdir}/${liboShareJavaFolder}/unoil.jar")
debugImplementation(name:'owncloud_android_lib-debug', ext:'aar')
releaseImplementation(name:'owncloud_android_lib-release', ext:'aar')
- implementation 'com.android.support:design:27.0.1' // also pulls-in corresponding support libraries
- implementation 'com.android.support.constraint:constraint-layout:1.0.2'
+ implementation 'com.android.support:design:27.1.1' // also pulls-in corresponding support libraries
+ implementation 'com.android.support.constraint:constraint-layout:1.1.2'
}
android {
compileSdkVersion 26
- buildToolsVersion "27.0.1"
+ buildToolsVersion "27.0.3"
compileOptions {
// silence some java-language features hints
sourceCompatibility 6
@@ -64,7 +61,7 @@ android {
}
defaultConfig {
minSdkVersion 14
- targetSdkVersion 24
+ targetSdkVersion 26
vectorDrawables.useSupportLibrary = true
}
buildTypes {
diff --git a/android/source/gradle/wrapper/gradle-wrapper.properties b/android/source/gradle/wrapper/gradle-wrapper.properties
index 26a7675eb5fc..1490158923d0 100644
--- a/android/source/gradle/wrapper/gradle-wrapper.properties
+++ b/android/source/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Nov 20 19:19:05 CET 2017
+#Fri May 18 16:50:44 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
More information about the Libreoffice-commits
mailing list