Skip to content

Commit 8f1d643

Browse files
committed
Change to using a CrystalRangeSeekbar
This range seeker has better documentation and can be made simpler.
1 parent c71078c commit 8f1d643

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies {
4040
compile 'com.android.support:appcompat-v7:27.0.2'
4141
compile 'com.android.support:design:27.0.2'
4242
compile 'com.writingminds:FFmpegAndroid:0.3.2'
43-
compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
43+
compile 'com.crystal:crystalrangeseekbar:1.1.3'
4444
compile 'commons-io:commons-io:2.5'
4545
compile group: 'com.google.guava', name: 'guava', version: '20.0'
4646
testCompile 'junit:junit:4.12'

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
package="protect.videotranscoder">
45
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
56
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
67
<application
78
android:allowBackup="false"
9+
tools:replace="android:allowBackup"
810
android:icon="@mipmap/ic_launcher"
911
android:label="@string/app_name"
1012
android:largeHeap="true"

app/src/main/java/protect/videotranscoder/activity/MainActivity.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@
3030
import android.widget.TextView;
3131
import android.widget.VideoView;
3232

33+
import com.crystal.crystalrangeseekbar.interfaces.OnRangeSeekbarChangeListener;
3334
import com.google.common.collect.ImmutableMap;
3435

35-
import org.florescu.android.rangeseekbar.RangeSeekBar;
36+
import com.crystal.crystalrangeseekbar.widgets.CrystalRangeSeekbar;
3637

3738
import java.io.File;
3839
import java.util.ArrayList;
@@ -51,7 +52,7 @@ public class MainActivity extends AppCompatActivity
5152
{
5253
private static final int REQUEST_TAKE_GALLERY_VIDEO = 100;
5354
private VideoView videoView;
54-
private RangeSeekBar rangeSeekBar;
55+
private CrystalRangeSeekbar rangeSeekBar;
5556
private Runnable r;
5657
private ProgressDialog progressDialog;
5758
private Uri selectedVideoUri;
@@ -280,23 +281,20 @@ public void onPrepared(MediaPlayer mp)
280281
tvRight.setVisibility(View.VISIBLE);
281282
tvRight.setText(getTime(durationMs / 1000));
282283
mp.setLooping(true);
283-
rangeSeekBar.setRangeValues(0, durationMs / 1000);
284-
rangeSeekBar.setSelectedMinValue(0);
285-
rangeSeekBar.setSelectedMaxValue(durationMs / 1000);
284+
285+
rangeSeekBar.setMinValue(0);
286+
rangeSeekBar.setMaxValue(durationMs / 1000f);
286287
rangeSeekBar.setEnabled(true);
287288
rangeSeekBar.setVisibility(View.VISIBLE);
288289

289-
rangeSeekBar.setOnRangeSeekBarChangeListener(new RangeSeekBar.OnRangeSeekBarChangeListener()
290+
rangeSeekBar.setOnRangeSeekbarChangeListener(new OnRangeSeekbarChangeListener()
290291
{
291292
@Override
292-
public void onRangeSeekBarValuesChanged(RangeSeekBar bar, Object minValue, Object maxValue)
293+
public void valueChanged(Number minValue, Number maxValue)
293294
{
294-
videoView.seekTo((int) minValue * 1000);
295-
296-
tvLeft.setText(getTime((int) bar.getSelectedMinValue()));
297-
298-
tvRight.setText(getTime((int) bar.getSelectedMaxValue()));
299-
295+
videoView.seekTo(minValue.intValue() * 1000);
296+
tvLeft.setText(getTime(minValue.intValue()));
297+
tvRight.setText(getTime(maxValue.intValue()));
300298
}
301299
});
302300

@@ -650,7 +648,7 @@ private void displayAboutDialog()
650648
"FFmpeg", "https://www.ffmpeg.org/",
651649
"FFmpeg Android", "http://writingminds.github.io/ffmpeg-android/",
652650
"Guava", "https://github.com/google/guava",
653-
"Range SeekBar", "https://github.com/anothem/android-range-seek-bar"
651+
"Crystal Range Seekbar", "https://github.com/syedowaisali/crystal-range-seekbar"
654652
);
655653

656654
final Map<String, String> USED_ASSETS = ImmutableMap.of

app/src/main/res/layout/activity_main.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@
2424
android:layout_marginRight="@dimen/dp20"
2525
android:layout_marginTop="@dimen/dp5" />
2626

27-
<org.florescu.android.rangeseekbar.RangeSeekBar
27+
<com.crystal.crystalrangeseekbar.widgets.CrystalRangeSeekbar
2828
android:id="@+id/rangeSeekBar"
2929
android:layout_width="match_parent"
3030
android:layout_height="wrap_content"
31-
android:layout_marginTop="@dimen/dp5"
32-
app:showLabels="true"
31+
app:data_type="_integer"
3332
android:visibility="invisible"
34-
rsb:activeColor="#ED1C24"
35-
rsb:textAboveThumbsColor="#000000" />
33+
/>
3634

3735
<RelativeLayout
3836
android:layout_width="match_parent"

0 commit comments

Comments
 (0)