From a7f86ece7174de9e9d65f8b577308e732a168d7f Mon Sep 17 00:00:00 2001 From: carlosmuvi Date: Fri, 23 Jun 2017 15:08:49 -0700 Subject: [PATCH] Added attrManager to handle xml styledAttrs. --- .idea/modules.xml | 3 -- app/build.gradle | 4 +- .../com/carlosmuvi/sample/MainActivity.java | 8 +--- app/src/main/res/layout/activity_main.xml | 30 +++++++++++---- app/src/main/res/values/dimens.xml | 1 + library/build.gradle | 4 +- .../segmentedprogressbar/PropertiesModel.kt | 35 +++++++++++++++--- .../SegmentedProgressBar.kt | 37 +++++++++---------- .../main/res/values/segmentedprogressbar.xml | 3 ++ 9 files changed, 79 insertions(+), 46 deletions(-) diff --git a/.idea/modules.xml b/.idea/modules.xml index 63c9a74..7a327c4 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -3,11 +3,8 @@ - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 95fa3ec..427c98e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 24 + compileSdkVersion 25 buildToolsVersion "26.0.0" defaultConfig { applicationId "com.carlosmuvi.segmentedprogressbar" minSdkVersion 16 - targetSdkVersion 24 + targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/com/carlosmuvi/sample/MainActivity.java b/app/src/main/java/com/carlosmuvi/sample/MainActivity.java index 848be1b..b225bab 100644 --- a/app/src/main/java/com/carlosmuvi/sample/MainActivity.java +++ b/app/src/main/java/com/carlosmuvi/sample/MainActivity.java @@ -1,6 +1,5 @@ package com.carlosmuvi.sample; -import android.graphics.Color; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; @@ -37,13 +36,8 @@ public class MainActivity extends AppCompatActivity { private void initSegmentedProgressBar() { segmentedProgressBar = (SegmentedProgressBar) findViewById(R.id.segmented_progressbar); - segmentedProgressBar.setSegmentCount(7); // number of segments in your bar - - //customize colors. - segmentedProgressBar.setContainerColor(Color.BLUE); //empty segment color - segmentedProgressBar.setFillColor(Color.GREEN); //empty segment color //set filled segments directly - segmentedProgressBar.setCompletedSegments(3); + segmentedProgressBar.setCompletedSegments(1); } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index b0722dc..12173ba 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,6 +1,7 @@ + tools:context="com.carlosmuvi.sample.MainActivity" + > + android:layout_height="5dp" + app:container_color="@color/colorAccent" + app:fill_color="@color/colorPrimary" + app:gap_size="@dimen/progressbar_gap" + app:segment_count="3" + /> +