diff --git a/app/build.gradle b/app/build.gradle index c9bda77c..a0ef3990 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,6 +12,7 @@ android { versionName "0.19" //resConfigs "en", "de" buildConfigField "boolean", "enableColorSniffer", "false" + testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' } buildTypes { debug { @@ -68,6 +69,10 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':flowlayout:layouts') + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2', { + exclude group: 'com.android.support', module: 'support-annotations' + } + androidTestImplementation 'com.android.support.test:rules:1.0.2' debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2' } diff --git a/app/src/main/res/layout/activity_launcher.xml b/app/src/main/res/layout/activity_launcher.xml index 2d2e0ccf..8d3a0ab4 100644 --- a/app/src/main/res/layout/activity_launcher.xml +++ b/app/src/main/res/layout/activity_launcher.xml @@ -2,19 +2,23 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" - android:orientation="vertical"> + android:orientation="vertical" + android:focusable="true" + android:focusableInTouchMode="true"> + android:layout_weight="1" + > + android:orientation="horizontal" + /> diff --git a/app/src/main/res/menu/menu.xml b/app/src/main/res/menu/menu.xml index ff161f27..e113414b 100644 --- a/app/src/main/res/menu/menu.xml +++ b/app/src/main/res/menu/menu.xml @@ -30,7 +30,6 @@ - @@ -51,4 +50,5 @@ android:title="@string/uninstall" /> + \ No newline at end of file diff --git a/flowlayout/layouts/src/main/java/org/apmem/tools/layouts/FlowLayout.java b/flowlayout/layouts/src/main/java/org/apmem/tools/layouts/FlowLayout.java index 15492067..83622fc9 100644 --- a/flowlayout/layouts/src/main/java/org/apmem/tools/layouts/FlowLayout.java +++ b/flowlayout/layouts/src/main/java/org/apmem/tools/layouts/FlowLayout.java @@ -23,7 +23,7 @@ public class FlowLayout extends ViewGroup { private final ConfigDefinition config; - List lines = new ArrayList<>(); + List lines = new ArrayList<>(); //NOPMD - suppressed CommentDefaultAccessModifier - TODO explain reason for suppression List views = new ArrayList<>(); public FlowLayout(Context context) { @@ -45,7 +45,7 @@ public FlowLayout(Context context, AttributeSet attributeSet, int defStyle) { } private void readStyleParameters(Context context, AttributeSet attributeSet) { - TypedArray a = context.obtainStyledAttributes(attributeSet, R.styleable.FlowLayout); + TypedArray a = context.obtainStyledAttributes(attributeSet, R.styleable.FlowLayout); //NOPMD - suppressed ShortVariable - TODO explain reason for suppression try { this.config.setOrientation(a.getInteger(R.styleable.FlowLayout_android_orientation, CommonLogic.HORIZONTAL)); this.config.setMaxLines(a.getInteger(R.styleable.FlowLayout_maxLines, 0)); @@ -91,6 +91,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { view.setNewLine(lp.isNewLine()); view.setGravity(lp.getGravity()); view.setWeight(lp.getWeight()); + view.setMargins(lp.leftMargin, lp.topMargin, lp.rightMargin, lp.bottomMargin); views.add(view); } @@ -124,16 +125,18 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } /* need to take padding into account */ + int totalControlWidth = this.getPaddingLeft() + this.getPaddingRight(); int totalControlHeight = this.getPaddingBottom() + this.getPaddingTop(); if (this.config.getOrientation() == CommonLogic.HORIZONTAL) { totalControlWidth += contentLength; - totalControlHeight += contentThickness; + totalControlHeight += contentThickness; //NOPMD - suppressed UnusedAssignment - TODO explain reason for suppression } else { totalControlWidth += contentThickness; totalControlHeight += contentLength; } - this.setMeasuredDimension(resolveSize(totalControlWidth, widthMeasureSpec), resolveSize(totalControlHeight, heightMeasureSpec)); + this.setMeasuredDimension(resolveSize(totalControlWidth, widthMeasureSpec), heightMeasureSpec); + } private void applyPositionsToViews(LineDefinition line) { @@ -161,11 +164,17 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { View view = child.getView(); LayoutParams lp = (LayoutParams) view.getLayoutParams(); view.layout( - this.getPaddingLeft() + line.getX() + child.getInlineX() + lp.leftMargin, - this.getPaddingTop() + line.getY() + child.getInlineY() + lp.topMargin, - this.getPaddingLeft() + line.getX() + child.getInlineX() + lp.leftMargin + child.getWidth(), - this.getPaddingTop() + line.getY() + child.getInlineY() + lp.topMargin + child.getHeight() + + //this.getPaddingLeft() + line.getX() + child.getInlineX() - lp.leftMargin , + //this.getPaddingTop() + line.getY() + child.getInlineY() - lp.topMargin+150, + //this.getPaddingLeft() + line.getX() + child.getInlineX() + lp.leftMargin + child.getWidth(), + //this.getPaddingTop() + line.getY() + child.getInlineY() + lp.topMargin+ child.getHeight()+150 + this.config.getMaxLength()-this.getPaddingLeft() - line.getX() - child.getInlineX() - lp.leftMargin- child.getWidth(), + this.config.getMaxThickness()+this.getPaddingTop() - line.getY() - child.getInlineY() - lp.topMargin- child.getHeight(), + this.config.getMaxLength()+this.getPaddingLeft() - line.getX() - child.getInlineX() - lp.leftMargin , + this.config.getMaxThickness()+this.getPaddingTop() - line.getY() - child.getInlineY() - lp.topMargin ); + } } }