Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/src/main/java/com/kevalpatel2106/sample/RulerDemoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,19 @@ class RulerDemoActivity : AppCompatActivity() {
}

})

infinite_ruler_value_picker.setValuePickerListener(object : RulerValuePickerListener {
override fun onValueChange(value: Int) {
current_value_tv_infinite.text = "$value"
infinite_ruler_value_picker.setMinMaxValue(0, value + 200)
infinite_ruler_value_picker.selectValue(value)
}

override fun onIntermediateValueChange(selectedValue: Int) {
current_value_tv_infinite.text = "$selectedValue"
}

})
}

override fun onOptionsItemSelected(item: MenuItem?): Boolean {
Expand Down
35 changes: 34 additions & 1 deletion app/src/main/res/layout/activity_ruler_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,39 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/current_value_tv"/>

<TextView
android:id="@+id/infinite_ruler_heading"
style="@style/SettingsHeading"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Infinite Ruler"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ruler_value_picker"/>

<TextView
android:id="@+id/current_value_tv_infinite"
style="@style/TextAppearance.AppCompat.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/infinite_ruler_heading"
tools:text="100"/>

<com.kevalpatel2106.rulerpicker.RulerValuePicker
android:id="@+id/infinite_ruler_value_picker"
android:layout_width="match_parent"
android:layout_height="100dp"
app:min_value="0"
app:indicator_interval="14dp"
app:indicator_width="2dp"
android:background="@android:color/holo_green_dark"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/current_value_tv_infinite"/>

<TextView
android:id="@+id/notch_settings_heading"
Expand All @@ -53,7 +86,7 @@
android:text="Notch"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ruler_value_picker"/>
app:layout_constraintTop_toBottomOf="@+id/infinite_ruler_value_picker"/>

<com.jaredrummler.android.colorpicker.ColorPanelView
android:id="@+id/notch_color_panel"
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
# the specific language governing permissions and limitations under the License.
#
#Wed Mar 28 13:10:59 IST 2018
#Fri Apr 17 16:34:27 IST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ private void parseAttr(@Nullable AttributeSet attributeSet) {
a.recycle();
}
}
refreshPaint();
}

/**
Expand Down Expand Up @@ -464,6 +463,7 @@ void setValueRange(final int minValue, final int maxValue) {
mMinValue = minValue;
mMaxValue = maxValue;
invalidate();
refreshPaint();
}

/**
Expand Down