public void drawView() { if (mLabels == null) { throw new IllegalArgumentException("labels must not be null."); } if (mCompletedPosition < 0 || mCompletedPosition > mLabels.length - 1) { throw new IndexOutOfBoundsException( String.format("Index : %s, Size : %s", mCompletedPosition, mLabels.length)); } mStepsViewIndicator.invalidate(); }
private void drawLabels() { List<Float> indicatorPosition = mStepsViewIndicator.getThumbContainerXPosition(); if (mLabels != null) { for (int i = 0; i < mLabels.length; i++) { TextView textView = new TextView(getContext()); textView.setText(mLabels[i]); textView.setTextColor(mLabelColorIndicator); textView.setX(indicatorPosition.get(i)); textView.setRotation(45); textView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); if (i <= mCompletedPosition) { textView.setTypeface(null, Typeface.BOLD); } mLabelsLayout.addView(textView); } } }
public StepsView setCompletedPosition(int completedPosition) { mCompletedPosition = completedPosition; mStepsViewIndicator.setCompletedPosition(mCompletedPosition); return this; }
public StepsView setBarColorIndicator(int barColorIndicator) { mBarColorIndicator = barColorIndicator; mStepsViewIndicator.setBarColor(mBarColorIndicator); return this; }
public StepsView setProgressColorIndicator(int progressColorIndicator) { mProgressColorIndicator = progressColorIndicator; mStepsViewIndicator.setProgressColor(mProgressColorIndicator); return this; }
public StepsView setLabels(String[] labels) { mLabels = labels; mStepsViewIndicator.setStepSize(labels.length); return this; }
private void init() { View rootView = LayoutInflater.from(getContext()).inflate(R.layout.widget_steps_view, this); mStepsViewIndicator = (StepsViewIndicator) rootView.findViewById(R.id.steps_indicator_view); mStepsViewIndicator.setDrawListener(this); mLabelsLayout = (FrameLayout) rootView.findViewById(R.id.labels_container); }