Berislav il y a 9 ans
Parent
commit
4e840ee00e

+ 2 - 2
app/build.gradle

@@ -21,7 +21,7 @@ android {
 }
 
 dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
+    compile fileTree(dir: 'libs', include: ['*.jar', 'src/main/res/values/attrs.xml'])
     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
         exclude group: 'com.android.support', module: 'support-annotations'
     })
@@ -31,7 +31,7 @@ dependencies {
 
 def libraryGroupId = 'hr.tacitus.graphs'
 def libraryArtifactId = 'android-graphs'
-def libraryVersion = '0.0.2'
+def libraryVersion = '0.0.4'
 
 publishing {
     publications {

+ 0 - 1
app/src/main/AndroidManifest.xml

@@ -1,5 +1,4 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-
     package="hr.tacitus.graphs">
 
 </manifest>

+ 14 - 12
app/src/main/java/hr/tacitus/graphs/BarGraphView.java

@@ -415,18 +415,20 @@ public class BarGraphView extends View {
     }
 
     private void adapterChanged() {
-        verticalAxisRect.init();
-        horizontalAxisRect.init();
-        barConfig.init();
-
-        // max vrijednost unutar Data arraya, max vrijednost podataka koje imamo
-        maxDataValue = getDataMaxValue();
-        // max vrijednost grafa, ovisi o max vrijednosti data arraya, ali nije
-        // ista (nekad imamo lufta)
-        maxGraphValue = getGraphMaxValue(maxDataValue);
-
-        verticalAxisValues.setHeight(-1);
-        verticalAxisValues.setAverageValue(getAverageDataValue());
+        if (adapter != null) {
+            verticalAxisRect.init();
+            horizontalAxisRect.init();
+            barConfig.init();
+
+            // max vrijednost unutar Data arraya, max vrijednost podataka koje imamo
+            maxDataValue = getDataMaxValue();
+            // max vrijednost grafa, ovisi o max vrijednosti data arraya, ali nije
+            // ista (nekad imamo lufta)
+            maxGraphValue = getGraphMaxValue(maxDataValue);
+
+            verticalAxisValues.setHeight(-1);
+            verticalAxisValues.setAverageValue(getAverageDataValue());
+        }
 
         invalidate();
     }

+ 0 - 6
app/src/main/res/values/colors.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-    <color name="colorPrimary">#3F51B5</color>
-    <color name="colorPrimaryDark">#303F9F</color>
-    <color name="colorAccent">#FF4081</color>
-</resources>

+ 0 - 3
app/src/main/res/values/strings.xml

@@ -1,3 +0,0 @@
-<resources>
-    <string name="app_name">Graphs</string>
-</resources>

+ 0 - 11
app/src/main/res/values/styles.xml

@@ -1,11 +0,0 @@
-<resources>
-
-    <!-- Base application theme. -->
-    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
-        <!-- Customize your theme here. -->
-        <item name="colorPrimary">@color/colorPrimary</item>
-        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
-        <item name="colorAccent">@color/colorAccent</item>
-    </style>
-
-</resources>