Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
badoualy authored Jul 12, 2017
2 parents 601db02 + 4fbadcc commit 8184a05
Show file tree
Hide file tree
Showing 10 changed files with 304 additions and 217 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0-rc1'
classpath 'com.android.tools.build:gradle:2.3.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,7 +15,9 @@ buildscript {
allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
}

Expand Down
10 changes: 5 additions & 5 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 26
buildToolsVersion "26.0.0"

defaultConfig {
minSdkVersion 14
targetSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
Expand All @@ -24,11 +24,11 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:appcompat-v7:26.0.0-beta2'
}

apply from: 'gradle-mvn-push.gradle'

repositories {
mavenCentral()
jcenter()
}
286 changes: 180 additions & 106 deletions library/src/main/java/com/badoualy/stepperindicator/StepperIndicator.java

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<declare-styleable name="StepperIndicator" tools:ignore="ResourceName">
<attr format="integer" name="stpi_stepCount"/>
<attr format="integer" name="stpi_animDuration"/>

<attr format="color" name="stpi_circleColor"/>
<attr format="dimension" name="stpi_circleRadius"/>
<attr format="dimension" name="stpi_circleStrokeWidth"/>

<attr format="color" name="stpi_indicatorColor"/>
<attr format="dimension" name="stpi_indicatorRadius"/>

<attr format="color" name="stpi_lineColor"/>
<attr format="color" name="stpi_lineDoneColor"/>
<attr format="dimension" name="stpi_lineStrokeWidth"/>
<attr format="dimension" name="stpi_lineMargin"/>

<attr format="boolean" name="stpi_showDoneIcon"/>
<attr format="boolean" name="stpi_showStepNumberInstead"/>

<attr format="boolean" name="stpi_useBottomIndicator"/>
<attr format="boolean" name="stpi_useBottomIndicatorWithStepColors"/>
<attr format="dimension" name="stpi_bottomIndicatorHeight"/>
<attr format="dimension" name="stpi_bottomIndicatorWidth"/>
<attr format="dimension" name="stpi_bottomIndicatorMarginTop"/>

<attr format="reference" name="stpi_stepsCircleColors"/>
<attr format="reference" name="stpi_stepsIndicatorColors"/>


<attr format="reference" name="stpi_labels"/>
<attr format="boolean" name="stpi_showLabels"/>
<attr format="dimension" name="stpi_labelMarginTop"/>
<attr format="dimension" name="stpi_labelSize"/>
<attr format="color" name="stpi_labelColor"/>
<attr name="stpi_stepCount" format="integer"/>
<attr name="stpi_animDuration" format="integer"/>

<attr name="stpi_circleColor" format="color"/>
<attr name="stpi_circleRadius" format="dimension"/>
<attr name="stpi_circleStrokeWidth" format="dimension"/>

<attr name="stpi_indicatorColor" format="color"/>
<attr name="stpi_indicatorRadius" format="dimension"/>

<attr name="stpi_lineColor" format="color"/>
<attr name="stpi_lineDoneColor" format="color"/>
<attr name="stpi_lineStrokeWidth" format="dimension"/>
<attr name="stpi_lineMargin" format="dimension"/>

<attr name="stpi_showDoneIcon" format="boolean"/>
<attr name="stpi_showStepNumberInstead" format="boolean"/>
<attr name="stpi_doneIconDrawable" format="reference"/>

<attr name="stpi_useBottomIndicator" format="boolean"/>
<attr name="stpi_useBottomIndicatorWithStepColors" format="boolean"/>
<attr name="stpi_bottomIndicatorHeight" format="dimension"/>
<attr name="stpi_bottomIndicatorWidth" format="dimension"/>
<attr name="stpi_bottomIndicatorMarginTop" format="dimension"/>

<attr name="stpi_stepsCircleColors" format="reference"/>
<attr name="stpi_stepsIndicatorColors" format="reference"/>

<attr name="stpi_labels" format="reference"/>
<attr name="stpi_showLabels" format="boolean"/>
<attr name="stpi_labelMarginTop" format="dimension"/>
<attr name="stpi_labelSize" format="dimension"/>
<attr name="stpi_labelColor" format="color"/>
</declare-styleable>
</resources>
3 changes: 2 additions & 1 deletion library/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<dimen name="stpi_default_line_stroke_width">2dp</dimen>
<dimen name="stpi_default_line_margin">5dp</dimen>

<dimen name="stpi_default_text_size">10sp</dimen>
<dimen name="stpi_default_text_size">12sp</dimen>

<dimen name="stpi_default_bottom_indicator_height">3dp</dimen>
<dimen name="stpi_default_bottom_indicator_width">50dp</dimen>
Expand All @@ -16,4 +16,5 @@
<dimen name="stpi_default_label_margin_top">2dp</dimen>

<dimen name="stpi_two_dp">2dp</dimen>
<dimen name="stpi_done_icon_size">18dp</dimen>
</resources>
8 changes: 4 additions & 4 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ apply plugin: 'com.android.application'
def compileLocal = true

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 26
buildToolsVersion "26.0.0"

defaultConfig {
applicationId "com.badoualy.stepperindicator.sample"
minSdkVersion 14
targetSdkVersion 25
targetSdkVersion 26
versionCode 105
versionName "1.1.0"
}
Expand All @@ -24,7 +24,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:appcompat-v7:26.0.0-beta2'

if (compileLocal)
compile project(':library')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.badoualy.stepperindicator.StepperIndicator;

Expand All @@ -21,12 +14,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

final ViewPager pager = (ViewPager) findViewById(R.id.pager);
final ViewPager pager = findViewById(R.id.pager);
assert pager != null;
pager.setAdapter(new EmptyPagerAdapter(getSupportFragmentManager()));
pager.setAdapter(new PagerAdapter(getSupportFragmentManager()));

StepperIndicator indicator = (StepperIndicator) findViewById(R.id.stepper_indicator);
assert indicator != null;
final StepperIndicator indicator = findViewById(R.id.stepper_indicator);
// We keep last page for a "finishing" page
indicator.setViewPager(pager, true);

Expand All @@ -38,58 +30,4 @@ public void onStepClicked(int step) {
});
}

public static class PageFragment extends Fragment {

private TextView lblPage;

public static PageFragment newInstance(int page, boolean isLast) {
Bundle args = new Bundle();
args.putInt("page", page);
if (isLast)
args.putBoolean("isLast", true);
final PageFragment fragment = new PageFragment();
fragment.setArguments(args);
return fragment;
}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_page, container, false);
lblPage = (TextView) view.findViewById(R.id.lbl_page);
return view;
}

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final int page = getArguments().getInt("page", 0);
if (getArguments().containsKey("isLast"))
lblPage.setText("You're done!");
else
lblPage.setText(Integer.toString(page));
}
}

private static class EmptyPagerAdapter extends FragmentPagerAdapter {

public EmptyPagerAdapter(FragmentManager fm) {
super(fm);
}

@Override
public int getCount() {
return 5;
}

@Override
public Fragment getItem(int position) {
return PageFragment.newInstance(position + 1, position == getCount() - 1);
}

@Override
public CharSequence getPageTitle(int position) {
return "Page " + position;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.badoualy.stepperindicator.sample;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class PageFragment extends Fragment {

private TextView lblPage;

public static PageFragment newInstance(int page, boolean isLast) {
Bundle args = new Bundle();
args.putInt("page", page);
if (isLast)
args.putBoolean("isLast", true);
final PageFragment fragment = new PageFragment();
fragment.setArguments(args);
return fragment;
}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_page, container, false);
lblPage = (TextView) view.findViewById(R.id.lbl_page);
return view;
}

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final int page = getArguments().getInt("page", 0);
if (getArguments().containsKey("isLast"))
lblPage.setText("You're done!");
else
lblPage.setText(Integer.toString(page));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.badoualy.stepperindicator.sample;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

class PagerAdapter extends FragmentPagerAdapter {

public PagerAdapter(FragmentManager fm) {
super(fm);
}

@Override
public int getCount() {
return 5;
}

@Override
public Fragment getItem(int position) {
return PageFragment.newInstance(position + 1, position == getCount() - 1);
}

@Override
public CharSequence getPageTitle(int position) {
return "Page " + position;
}
}
5 changes: 4 additions & 1 deletion sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>

<com.badoualy.stepperindicator.StepperIndicator
android:id="@+id/stepper_indicator"
Expand Down

0 comments on commit 8184a05

Please sign in to comment.