Berislav 9 rokov pred
rodič
commit
4a9076576e

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 1 - 1
app/build.gradle

@@ -4,7 +4,7 @@ apply plugin: 'maven-publish'
 
 def libraryGroupId = 'hr.tacitus.components'
 def libraryArtifactId = 'tankers-components'
-def libraryVersion = '0.0.4'
+def libraryVersion = '0.0.6'
 
 android {
     compileSdkVersion 25

+ 1 - 5
app/src/main/java/hr/tacitus/componentpack/layouts/StatsBoundsLayout.java

@@ -5,6 +5,7 @@ import android.content.res.TypedArray;
 import android.support.constraint.ConstraintLayout;
 import android.support.v4.content.ContextCompat;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.util.TypedValue;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -86,11 +87,6 @@ public class StatsBoundsLayout extends ConstraintLayout {
     @Override
     public void onMeasure(int w, int h) {
         super.onMeasure(w, h);
-
-//        int parentWidth = MeasureSpec.getSize(w);
-//        int parentHeight = MeasureSpec.getSize(h);
-//
-//        measureChildren(MeasureSpec.makeMeasureSpec(parentWidth, MeasureSpec.EXACTLY), h);
     }
 
     private void initComponents() {

+ 22 - 17
app/src/main/java/hr/tacitus/componentpack/views/ArcView.java

@@ -30,7 +30,7 @@ public class ArcView extends View {
     private float arcWidthInPixels = 32;
 
     private int intrinsicWidth = (int)Utils.dipToPixels(180);
-    private int intrinsicHeight = (int)Utils.dipToPixels(90);
+    private int intrinsicHeight = (int)Utils.dipToPixels(60);
 
     private Paint arcPaint;
     private Paint canvasPaint;
@@ -80,27 +80,30 @@ public class ArcView extends View {
             @Override
             public void onGlobalLayout() {
                 getRootView().getViewTreeObserver().removeOnGlobalLayoutListener(this);
+                updateArcData();
+            }
+        });
+    }
 
-                float left = getPaddingLeft();
-                float top = getPaddingTop();
-                float right = getWidth() - getPaddingRight();
-                float height = (getHeight() - (getPaddingTop() + getPaddingBottom())) * 2;
-                float bottom = top + height;
+    private void updateArcData() {
+        float left = getPaddingLeft();
+        float top = getPaddingTop();
+        float right = getMeasuredWidth() - getPaddingRight();
+        float height = (getMeasuredHeight() - (getPaddingTop() + getPaddingBottom())) * 2;
+        float bottom = top + height;
 
-                arcRect = new RectF(left, top, right, bottom);
+        arcRect = new RectF(left, top, right, bottom);
 
-                Shader shader = new LinearGradient(left, 0, right, 0, beginColor, endColor,
-                        Shader.TileMode.CLAMP);
-                arcPaint.setShader(shader);
+        Shader shader = new LinearGradient(left, 0, right, 0, beginColor, endColor,
+                Shader.TileMode.CLAMP);
+        arcPaint.setShader(shader);
 
-                left += arcWidthInPixels;
-                top += arcWidthInPixels;
-                right -= arcWidthInPixels;
-                bottom -= arcWidthInPixels;
+        left += arcWidthInPixels;
+        top += arcWidthInPixels;
+        right -= arcWidthInPixels;
+        bottom -= arcWidthInPixels;
 
-                subArcRect = new RectF(left, top, right, bottom);
-            }
-        });
+        subArcRect = new RectF(left, top, right, bottom);
     }
 
     @Override
@@ -135,6 +138,8 @@ public class ArcView extends View {
         }
 
         setMeasuredDimension(width, height);
+
+        updateArcData();
     }
 
     @Override

+ 22 - 25
app/src/main/res/layout/view_stats_bounds.xml

@@ -12,51 +12,48 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginEnd="8dp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginRight="8dp"
         android:layout_marginStart="8dp"
-        android:text="TextView"
-        app:layout_constraintTop_toTopOf="parent"
         android:layout_marginTop="0dp"
-        android:layout_marginRight="8dp"
+        app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
-        android:layout_marginLeft="8dp"
-        app:layout_constraintLeft_toLeftOf="parent" />
+        app:layout_constraintTop_toTopOf="parent"
+        tools:text="TextView" />
 
     <hr.tacitus.componentpack.views.ArcView
-        tools:layout_width="180dp"
-        tools:layout_height="60dp"
         android:id="@+id/arcView"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        app:backgroundColor="?android:colorBackground"
-        android:layout_marginTop="0dp"
-        app:layout_constraintTop_toBottomOf="@+id/tvAverage"
         android:layout_marginLeft="8dp"
-        app:layout_constraintLeft_toLeftOf="parent"
         android:layout_marginRight="8dp"
-        app:layout_constraintRight_toRightOf="parent" />
+        android:layout_marginTop="0dp"
+        app:backgroundColor="?android:colorBackground"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tvAverage"
+        tools:layout_height="75dp"
+        tools:layout_width="180dp" />
 
     <TextView
         android:id="@+id/tvMinimum"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:text="TextView"
         android:layout_marginTop="0dp"
-        app:layout_constraintTop_toBottomOf="@+id/arcView"
-        android:layout_marginLeft="0dp"
-        app:layout_constraintLeft_toLeftOf="@+id/arcView"
-        app:layout_constraintRight_toLeftOf="@+id/arcView"
-        android:layout_marginRight="0dp" />
+        app:layout_constraintHorizontal_chainStyle="spread_inside"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toLeftOf="@+id/tvMaximum"
+        app:layout_constraintTop_toBottomOf="@id/arcView"
+        tools:text="TextView" />
 
     <TextView
-        android:id="@+id/tvMaximum"
+        android:id="@id/tvMaximum"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:text="TextView"
         android:layout_marginTop="0dp"
-        app:layout_constraintTop_toBottomOf="@+id/arcView"
-        android:layout_marginRight="0dp"
-        app:layout_constraintRight_toRightOf="@+id/arcView"
-        app:layout_constraintLeft_toRightOf="@+id/arcView"
-        android:layout_marginLeft="0dp" />
+        app:layout_constraintLeft_toRightOf="@id/tvMinimum"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/arcView"
+        tools:text="TextView" />
 
 </android.support.constraint.ConstraintLayout>

+ 21 - 20
componentsactivity/src/main/res/layout/activity_main.xml

@@ -6,35 +6,36 @@
     android:layout_height="match_parent"
     tools:context="hr.tacitus.componentsactivity.MainActivity">
 
-    <hr.tacitus.componentpack.views.ArcView
-        android:id="@+id/arcView2"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="8dp"
-        android:layout_marginLeft="8dp"
-        android:layout_marginRight="8dp"
-        android:layout_marginStart="8dp"
-        android:layout_marginTop="40dp"
-        android:paddingBottom="6dp"
-        android:paddingEnd="10dp"
-        android:paddingStart="10dp"
-        android:paddingTop="6dp"
-        app:arcWidth="8dp"
-        app:backgroundColor="?android:colorBackground"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+    <!--<hr.tacitus.componentpack.views.ArcView-->
+        <!--android:id="@+id/arcView2"-->
+        <!--android:layout_width="wrap_content"-->
+        <!--android:layout_height="wrap_content"-->
+        <!--android:layout_marginEnd="8dp"-->
+        <!--android:layout_marginLeft="8dp"-->
+        <!--android:layout_marginRight="8dp"-->
+        <!--android:layout_marginStart="8dp"-->
+        <!--android:layout_marginTop="40dp"-->
+        <!--android:paddingBottom="6dp"-->
+        <!--android:paddingEnd="10dp"-->
+        <!--android:paddingStart="10dp"-->
+        <!--android:paddingTop="6dp"-->
+        <!--app:arcWidth="8dp"-->
+        <!--app:backgroundColor="?android:colorBackground"-->
+        <!--app:layout_constraintLeft_toLeftOf="parent"-->
+        <!--app:layout_constraintRight_toRightOf="parent"-->
+        <!--app:layout_constraintTop_toTopOf="parent" />-->
 
     <hr.tacitus.componentpack.layouts.StatsBoundsLayout
         android:id="@+id/statsBounds"
         android:layout_width="wrap_content"
-        android:layout_height="60dp"
+        android:layout_height="120dp"
         android:layout_marginLeft="8dp"
         android:layout_marginRight="8dp"
         android:layout_marginTop="89dp"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/arcView2"
+        android:background="@android:color/holo_purple"
+
         app:textSize="10sp" />
 
 </android.support.constraint.ConstraintLayout>