Skip to content

Commit 470f96a

Browse files
author
piclabsstudio
committed
Add Range Seekbar
1 parent 563aaf3 commit 470f96a

35 files changed

+2078
-13100
lines changed

.idea/codeStyles/Project.xml

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/dbnavigator.xml

Lines changed: 454 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ you could customize following UI controls in your Android application
4747
* [InputCode (Pincode)](https://github.com/dvinfosys/CustomWidgets/blob/master/app/src/main/java/com/dvinfosys/WidgetsExample/Fragments/InputCodeFragment.java)
4848
* [StickerView](https://github.com/dvinfosys/CustomWidgets/blob/master/app/src/main/java/com/dvinfosys/WidgetsExample/Fragments/StickerViewFragment.java)
4949
* [MSearchBar](https://github.com/dvinfosys/CustomWidgets/blob/master/app/src/main/java/com/dvinfosys/WidgetsExample/Fragments/MSearchbarFragment.java)
50+
* [DToast](https://github.com/dvinfosys/CustomWidgets/blob/master/app/src/main/java/com/dvinfosys/WidgetsExample/Fragments/DToastFragment.java)
51+
* [RangeSeekbar](https://github.com/dvinfosys/CustomWidgets/blob/master/app/src/main/java/com/dvinfosys/WidgetsExample/Fragments/RangeSeekbarFragment.java)
5052

5153
## Author
5254

app/src/main/java/com/dvinfosys/WidgetsExample/Activity/HomeActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.dvinfosys.WidgetsExample.Fragments.ColorPickerFragment;
2020
import com.dvinfosys.WidgetsExample.Fragments.CountdownViewFragment;
2121
import com.dvinfosys.WidgetsExample.Fragments.DAlertFragment;
22+
import com.dvinfosys.WidgetsExample.Fragments.DToastFragment;
2223
import com.dvinfosys.WidgetsExample.Fragments.EditTextFragment;
2324
import com.dvinfosys.WidgetsExample.Fragments.ExpandingCollectionFragment;
2425
import com.dvinfosys.WidgetsExample.Fragments.FoldingCellFragment;
@@ -29,6 +30,7 @@
2930
import com.dvinfosys.WidgetsExample.Fragments.PaperOnboardingFragment;
3031
import com.dvinfosys.WidgetsExample.Fragments.ProgressViewFragment;
3132
import com.dvinfosys.WidgetsExample.Fragments.RadioButtonFragment;
33+
import com.dvinfosys.WidgetsExample.Fragments.RangeSeekbarFragment;
3234
import com.dvinfosys.WidgetsExample.Fragments.RecyclerResizeFragment;
3335
import com.dvinfosys.WidgetsExample.Fragments.SearchableSpinnerFragment;
3436
import com.dvinfosys.WidgetsExample.Fragments.SeekbarFragment;
@@ -147,6 +149,10 @@ public boolean onNavigationItemSelected(MenuItem item) {
147149
fragment = new StickerViewFragment();
148150
}else if (id==R.id.nav_msearchbar){
149151
fragment=new MSearchbarFragment();
152+
}else if (id==R.id.nav_d_toast){
153+
fragment=new DToastFragment();
154+
}else if (id==R.id.nav_range_seekbar){
155+
fragment=new RangeSeekbarFragment();
150156
}
151157
if (fragment != null) {
152158
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.dvinfosys.WidgetsExample.Fragments;
2+
3+
import android.app.Activity;
4+
import android.os.Bundle;
5+
import android.support.v4.app.Fragment;
6+
import android.view.LayoutInflater;
7+
import android.view.View;
8+
import android.view.ViewGroup;
9+
10+
import com.dvinfosys.WidgetsExample.R;
11+
import com.dvinfosys.widgets.TextView.CustomTextView;
12+
import com.dvinfosys.widgets.ToastView.DToast;
13+
14+
public class DToastFragment extends Fragment {
15+
16+
private CustomTextView tvDToast;
17+
18+
@Override
19+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
20+
View v = inflater.inflate(R.layout.fragment_dtoast, container, false);
21+
tvDToast = v.findViewById(R.id.tv_d_toast);
22+
tvDToast.setOnClickListener(new View.OnClickListener() {
23+
@Override
24+
public void onClick(View v) {
25+
new DToast.makeToast((Activity) getContext(), "Some random text here", DToast.LENGTHLONG).show();
26+
}
27+
});
28+
return v;
29+
}
30+
31+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.dvinfosys.WidgetsExample.Fragments;
2+
3+
import android.os.Bundle;
4+
import android.support.annotation.NonNull;
5+
import android.support.annotation.Nullable;
6+
import android.support.v4.app.Fragment;
7+
import android.view.LayoutInflater;
8+
import android.view.View;
9+
import android.view.ViewGroup;
10+
import android.widget.TextView;
11+
12+
import com.dvinfosys.WidgetsExample.R;
13+
import com.dvinfosys.widgets.SeekBar.RangeSeekBar;
14+
15+
import java.text.DecimalFormat;
16+
17+
public class RangeSeekbarFragment extends Fragment {
18+
19+
private RangeSeekBar seekbar1;
20+
private RangeSeekBar seekbar2;
21+
private TextView tv2;
22+
private DecimalFormat df = new DecimalFormat("0.00");
23+
24+
@Override
25+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
26+
View v=inflater.inflate(R.layout.fragment_range_seekbar, container, false);
27+
seekbar1 = (RangeSeekBar)v.findViewById(R.id.seekbar1);
28+
seekbar2 = (RangeSeekBar)v.findViewById(R.id.seekbar2);
29+
tv2 = (TextView)v.findViewById(R.id.progress2_tv);
30+
31+
seekbar1.setValue(10);
32+
seekbar2.setValue(-0.5f,0.8f);
33+
34+
seekbar1.setOnRangeChangedListener(new RangeSeekBar.OnRangeChangedListener() {
35+
@Override
36+
public void onRangeChanged(RangeSeekBar view, float min, float max, boolean isFromUser) {
37+
seekbar1.setProgressDescription((int)min+"%");
38+
}
39+
});
40+
41+
seekbar2.setOnRangeChangedListener(new RangeSeekBar.OnRangeChangedListener() {
42+
@Override
43+
public void onRangeChanged(RangeSeekBar view, float min, float max, boolean isFromUser) {
44+
if (isFromUser) {
45+
tv2.setText(min + "-" + max);
46+
seekbar2.setLeftProgressDescription(df.format(min));
47+
seekbar2.setRightProgressDescription(df.format(max));
48+
}
49+
}
50+
});
51+
52+
return v;
53+
}
54+
55+
@Override
56+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
57+
super.onViewCreated(view, savedInstanceState);
58+
getActivity().setTitle("Range Seekbar Example");
59+
}
60+
61+
}
2.75 KB
Loading
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:orientation="vertical"
7+
tools:context=".Fragments.DToastFragment">
8+
9+
<com.dvinfosys.widgets.TextView.CustomTextView
10+
android:id="@+id/tv_d_toast"
11+
android:layout_width="wrap_content"
12+
android:layout_height="wrap_content"
13+
android:textSize="16sp"
14+
android:layout_gravity="center"
15+
android:gravity="center"
16+
android:text="Simple DToast" />
17+
18+
</LinearLayout>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
xmlns:app="http://schemas.android.com/apk/res-auto"
7+
android:orientation="vertical"
8+
android:padding="8dp"
9+
tools:context=".Fragments.RangeSeekbarFragment">
10+
11+
<com.dvinfosys.widgets.SeekBar.RangeSeekBar
12+
android:id="@+id/seekbar1"
13+
android:layout_width="match_parent"
14+
android:layout_height="wrap_content"
15+
app:markTextArray="@array/markArray"
16+
app:lineColorSelected="@color/colorAccent"
17+
app:seekBarResId="@drawable/seekbar_thumb"
18+
app:lineColorEdge="@color/colorSeekBarDefault"
19+
app:cellMode="number"
20+
app:seekBarMode="single"/>
21+
22+
<TextView
23+
android:id="@+id/progress2_tv"
24+
android:layout_width="match_parent"
25+
android:layout_height="40dp"
26+
android:gravity="center"
27+
/>
28+
29+
<com.dvinfosys.widgets.SeekBar.RangeSeekBar
30+
android:id="@+id/seekbar2"
31+
android:layout_width="match_parent"
32+
android:layout_height="wrap_content"
33+
app:markTextArray="@array/markArray2"
34+
app:lineColorSelected="@color/colorAccent"
35+
app:lineColorEdge="@color/colorSeekBarDefault"
36+
app:textPadding="17dp"
37+
app:min="-1"
38+
app:max="1"
39+
app:thumbPrimaryColor="@color/colorSeekBarDefault"
40+
app:thumbSecondaryColor="@color/colorAccent"
41+
app:seekBarHeight="4dp"
42+
app:thumbSize="20dp"
43+
app:cellMode="number"
44+
app:seekBarMode="range"
45+
/>
46+
<com.dvinfosys.widgets.SeekBar.RangeSeekBar
47+
android:id="@+id/seekbar3"
48+
android:layout_width="match_parent"
49+
android:layout_height="120dp"
50+
app:markTextArray="@array/negativeMarkArray"
51+
app:lineColorSelected="@color/colorAccent"
52+
app:lineColorEdge="@color/colorSeekBarDefault"
53+
app:textPadding="17dp"
54+
app:textSize="16sp"
55+
app:min="-100"
56+
app:max="100"
57+
app:reserve="60"
58+
app:hintBGHeight="50dp"
59+
app:seekBarHeight="2dp"
60+
app:hintBGWith="60dp"
61+
app:thumbSize="26dp"
62+
app:cellMode="other"
63+
app:seekBarMode="range"
64+
/>
65+
<com.dvinfosys.widgets.SeekBar.RangeSeekBar
66+
android:id="@+id/seekbar4"
67+
android:layout_width="match_parent"
68+
android:layout_height="wrap_content"
69+
app:markTextArray="@array/wordsArray"
70+
app:lineColorSelected="@color/colorPrimary"
71+
app:lineColorEdge="@color/colorSeekBarDefault"
72+
app:textPadding="17dp"
73+
app:cells="5"
74+
app:thumbPrimaryColor="@color/colorSeekBarDefault"
75+
app:thumbSecondaryColor="@color/colorAccent"
76+
app:seekBarHeight="4dp"
77+
app:thumbSize="20dp"
78+
app:cellMode="other"
79+
app:seekBarMode="single"
80+
/>
81+
82+
</LinearLayout>

app/src/main/res/menu/activity_home_drawer.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,12 @@
105105
<item android:id="@+id/nav_msearchbar"
106106
android:title="@string/menu_msearch"/>
107107

108+
<item
109+
android:id="@+id/nav_d_toast"
110+
android:icon="@drawable/ic_toastview"
111+
android:title="@string/menu_d_toast" />
112+
<item
113+
android:id="@+id/nav_range_seekbar"
114+
android:title="@string/menu_range_seekbar" />
108115
</group>
109116
</menu>

app/src/main/res/values/array_list.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,36 @@
1414
<item>November</item>
1515
<item>December</item>
1616
</string-array>
17+
18+
<string-array name="markArray">
19+
<item>0</item>
20+
<item>30</item>
21+
<item>60</item>
22+
<item>90</item>
23+
<item>100</item>
24+
</string-array>
25+
26+
<string-array name="markArray2">
27+
<item>-1</item>
28+
<item>-0.5</item>
29+
<item>0.1</item>
30+
<item>0.5</item>
31+
<item>0.9</item>
32+
</string-array>
33+
<string-array name="negativeMarkArray">
34+
<item>-100</item>
35+
<item>Intermediate</item>
36+
<item>0</item>
37+
<item>Intermediate</item>
38+
<item>100</item>
39+
</string-array>
40+
41+
<string-array name="wordsArray">
42+
<item>Very Slow</item>
43+
<item>Slow</item>
44+
<item>Medium</item>
45+
<item>Fast</item>
46+
<item>Very Fast</item>
47+
</string-array>
48+
1749
</resources>

app/src/main/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@
4444
<color name="picker_list_text">#232323</color>
4545
<color name="ds_list_selector_bg">#49067397</color>
4646
<color name="ds_picker_box_bg">#67f45959</color>
47+
<color name="colorSeekBarDefault">#c3c3c3</color>
4748
</resources>

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,7 @@
9090
<string name="menu_sticker">StickerView</string>
9191
<string name="font_name">Smoothy.otf</string>
9292
<string name="menu_msearch">MSeachbar</string>
93+
<string name="menu_d_toast">DToast</string>
94+
<string name="menu_range_seekbar">Range Seekbar</string>
9395

9496
</resources>

0 commit comments

Comments
 (0)