简体   繁体   English

Android Time Range Seek Bar

[英]Android Time Range Seek Bar

I want to allow the user of my app to trim a specific part from a video. 我想允许我的应用的用户修剪视频中的特定部分。 And i'm looking for a solution that can help me make a time selection slider with two thumbs(Max and Min time). 我正在寻找一种解决方案,可以帮助我用两个拇指(最大和最小时间)制作时间选择滑块。

This is a sample of what i want to achieve . 这是我想要实现的样本。

在此输入图像描述

I know that there is already some librarys that can help: 我知道已经有一些图书馆可以提供帮助:

android-range-seek-bar Android的范围,寻求酒吧

Material Range Bar 材料范围栏

But they work only with floats and integers. 但它们只适用于浮点数和整数。 My question is how can i make it work with time values ? 我的问题是如何使它与时间值一起工作?

Basically you can represent time with a numeric type! 基本上你可以用数字类型表示时间! With integer you can have a range time from 0 to Integer.MAX_VALUE seconds (for example) 对于整数,您可以具有从0Integer.MAX_VALUE秒的范围时间(例如)

What do you need is display this int value in a mm:ss format. 你需要的是以mm:ss格式显示这个int值。

I don't know if the libs up here already do this, however I suggest to fork one on that and work on the values displayed on screen. 我不知道这里的lib是否已经这样做了,但是我建议在它上面加一个并处理屏幕上显示的值。

Example from another (using millis) SO link 来自另一个(使用millis) SO链接的示例

String hms = String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(millis),
    TimeUnit.MILLISECONDS.toMinutes(millis) % TimeUnit.HOURS.toMinutes(1),
    TimeUnit.MILLISECONDS.toSeconds(millis) % TimeUnit.MINUTES.toSeconds(1));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM