Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Niedermann <info@niedermann.it>2021-06-17 17:30:59 +0300
committerStefan Niedermann <info@niedermann.it>2021-06-17 17:30:59 +0300
commit35605e4a0ae0dd27adeceec568183ca728d5d428 (patch)
treea3e5ffbf42b990620a7b86b5fcd69fd4fc70d2ee /app/src/main/java/it/niedermann/owncloud/notes/shared
parentf95175e8fa84830c4b6c4c665c83da3e1ac26282 (diff)
Minor code improvements
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java/it/niedermann/owncloud/notes/shared')
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/shared/util/DisplayUtils.java23
1 files changed, 4 insertions, 19 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/shared/util/DisplayUtils.java b/app/src/main/java/it/niedermann/owncloud/notes/shared/util/DisplayUtils.java
index ffea98b1..06cbf57d 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/shared/util/DisplayUtils.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/shared/util/DisplayUtils.java
@@ -2,34 +2,21 @@ package it.niedermann.owncloud.notes.shared.util;
import android.content.Context;
import android.content.res.Resources;
-import android.graphics.Color;
import android.graphics.Rect;
import android.os.Build;
-import android.text.Spannable;
-import android.text.TextPaint;
-import android.text.TextUtils;
-import android.text.style.MetricAffectingSpan;
import android.util.TypedValue;
import android.view.View;
import android.view.WindowInsets;
-import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import java.util.Collection;
import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import it.niedermann.android.util.ColorUtil;
-import it.niedermann.owncloud.notes.NotesApplication;
import it.niedermann.owncloud.notes.R;
-import it.niedermann.owncloud.notes.branding.BrandingUtil;
import it.niedermann.owncloud.notes.main.navigation.NavigationAdapter;
import it.niedermann.owncloud.notes.main.navigation.NavigationItem;
import it.niedermann.owncloud.notes.persistence.entity.CategoryWithNotesCount;
@@ -69,21 +56,19 @@ public class DisplayUtils {
*/
public static boolean isSoftKeyboardVisible(@NonNull View parentView) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
- WindowInsetsCompat insets = ViewCompat.getRootWindowInsets(parentView);
- if(insets != null){
+ final WindowInsetsCompat insets = ViewCompat.getRootWindowInsets(parentView);
+ if (insets != null) {
return insets.isVisible(WindowInsets.Type.ime());
}
}
- //Fall Back to workaround
//Arbitrary keyboard height
final int defaultKeyboardHeightDP = 100;
final int EstimatedKeyboardDP = defaultKeyboardHeightDP + (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 48 : 0);
final Rect rect = new Rect();
-
- int estimatedKeyboardHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, EstimatedKeyboardDP, parentView.getResources().getDisplayMetrics());
+ final int estimatedKeyboardHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, EstimatedKeyboardDP, parentView.getResources().getDisplayMetrics());
parentView.getWindowVisibleDisplayFrame(rect);
- int heightDiff = parentView.getRootView().getHeight() - (rect.bottom - rect.top);
+ final int heightDiff = parentView.getRootView().getHeight() - (rect.bottom - rect.top);
return heightDiff >= estimatedKeyboardHeight;
}
}