Skip to content

Fix issue #138 : not truly 1 second clip #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions lib/lang/ca.dart
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,6 @@ const Map<String, String> ca = {
'useAlternativeCalendarColors': 'Fes servir colors del calendari alternatius',
'useAlternativeCalendarColorsDescription':
'Canvia el verd i el vermell del calendari per blau i groc. Útil per a persones daltòniques.',
'useClipPad': 'Utilitza el temps de marge final',
'useClipPadDescription': 'Afegeix 500 ms extres al final dels clips nous si el clip dura menys de 1,5 segons. Útil per a millors transicions. Només afecta clips nous.'
};
4 changes: 3 additions & 1 deletion lib/lang/cs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,7 @@ const Map<String, String> cs = {
'Pokud je aktivní, výběr minulých dat filtruje videa podle toho data. Pokud je deaktivováno, zobrazí se všechna videa. Funguje pouze s experimentálním výběrem souborů.',
'useAlternativeCalendarColors': 'Použijte alternativní barvy kalendáře',
'useAlternativeCalendarColorsDescription':
'Změní zelenou a červenou v kalendáři na modrou a žlutou. Užitečné pro barvoslepé.'
'Změní zelenou a červenou v kalendáři na modrou a žlutou. Užitečné pro barvoslepé.',
'useClipPad': 'Použít časové odsazení konce',
'useClipPadDescription': 'Přidá dalších 500 ms na konec nových klipů, pokud je klip kratší než 1,5 sekundy. Užitečné pro lepší přechody. Ovlivňuje pouze nové klipy.'
};
4 changes: 3 additions & 1 deletion lib/lang/de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,7 @@ const Map<String, String> de = {
'Wenn aktiviert, filtern die Auswahl vergangener Daten die Videos nach diesem Datum. Wenn deaktiviert, werden alle Videos angezeigt. Funktioniert nur mit dem experimentellen Dateiauswähler.',
'useAlternativeCalendarColors': 'Alternative Kalenderfarben verwenden',
'useAlternativeCalendarColorsDescription':
'Ändert grün und rot im Kalender zu blau und gelb. Nützlich für farbenblinde Menschen.'
'Ändert grün und rot im Kalender zu blau und gelb. Nützlich für farbenblinde Menschen.',
'useClipPad': 'Endzeit-Puffer verwenden',
'useClipPadDescription': 'Fügt am Ende neuer Clips zusätzliche 500 ms hinzu, wenn der Clip weniger als 1,5 Sekunden dauert. Nützlich für bessere Übergänge. Betrifft nur neue Clips.'
};
3 changes: 3 additions & 0 deletions lib/lang/en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,7 @@ const Map<String, String> en = {
'useAlternativeCalendarColors': 'Use alternative calendar colors',
'useAlternativeCalendarColorsDescription':
'Changes green and red in calendar to blue and yellow. Useful for colorblind people.',
'useClipPad': 'Use end clip time padding',
'useClipPadDescription':
'Add an extra 500 ms time at the end of new clips if the clip is less than 1.5 seconds. Useful for better transitions. Only affect new clips.',
};
4 changes: 3 additions & 1 deletion lib/lang/es.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,7 @@ const Map<String, String> es = {
'Cuando está activado, seleccionar fechas pasadas filtrará los vídeos por esa fecha. Si está desactivado, se mostrarán todos los vídeos. Funciona solo con el selector de archivos experimental.',
'useAlternativeCalendarColors': 'Use colores alternativos para el calendario',
'useAlternativeCalendarColorsDescription':
'Cambia el verde y el rojo en el calendario a azul y amarillo. Útil para personas con daltonismo.'
'Cambia el verde y el rojo en el calendario a azul y amarillo. Útil para personas con daltonismo.',
'useClipPad': 'Usar tiempo adicional al final',
'useClipPadDescription': 'Añade 500 ms extra al final de los clips nuevos si el clip dura menos de 1,5 segundos. Útil para mejores transiciones. Solo afecta a clips nuevos.'
};
4 changes: 3 additions & 1 deletion lib/lang/fr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,7 @@ const Map<String, String> fr = {
'Lorsqu\'il est activé, sélectionner des dates passées filtrera les vidéos par cette date. Lorsqu\'il est désactivé, toutes les vidéos seront affichées. Fonctionne uniquement avec le sélecteur de fichiers expérimental.',
'useAlternativeCalendarColors': 'Utilisez des couleurs de calendrier alternatives',
'useAlternativeCalendarColorsDescription':
'Change le vert et le rouge dans le calendrier en bleu et jaune. Utile pour les personnes daltoniennes.'
'Change le vert et le rouge dans le calendrier en bleu et jaune. Utile pour les personnes daltoniennes.',
'useClipPad': 'Utiliser un temps additionnel',
'useClipPadDescription': 'Ajoute 500 ms supplémentaires à la fin des nouveaux clips si le clip dure moins de 1,5 seconde. Utile pour de meilleures transitions. Affecte uniquement les nouveaux clips.'
};
4 changes: 3 additions & 1 deletion lib/lang/id.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,7 @@ const Map<String, String> id = {
'Ketika diaktifkan, memilih tanggal sebelumnya akan memfilter video berdasarkan tanggal tersebut. Ketika dinonaktifkan, semua video akan ditampilkan. Hanya bekerja dengan pemilih file eksperimental.',
'useAlternativeCalendarColors': 'Gunakan warna kalender alternatif',
'useAlternativeCalendarColorsDescription':
'Mengubah hijau dan merah di kalender menjadi biru dan kuning. Berguna untuk orang buta warna.'
'Mengubah hijau dan merah di kalender menjadi biru dan kuning. Berguna untuk orang buta warna.',
'useClipPad': 'Usa il margine temporale finale',
'useClipPadDescription': 'Aggiunge 500 ms extra alla fine dei nuovi clip se il clip dura meno di 1,5 secondi. Utile per transizioni migliori. Influisce solo sui nuovi clip.'
};
4 changes: 3 additions & 1 deletion lib/lang/pt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,7 @@ const Map<String, String> pt = {
'Quando ativado, selecionar datas passadas filtrará os vídeos por essa data. Quando desativado, todos os vídeos serão mostrados. Funciona apenas com o seletor de arquivos experimental.',
'useAlternativeCalendarColors': 'Usar cores alternativas para o calendário',
'useAlternativeCalendarColorsDescription':
'Muda as cores verde e vermelho no calendário para azul e amarelo. Útil para pessoas daltônicas.'
'Muda as cores verde e vermelho no calendário para azul e amarelo. Útil para pessoas daltônicas.',
'useClipPad': 'Usar tempo adicional no final',
'useClipPadDescription': 'Adiciona 500 ms extras ao final de novos clipes se o clipe tiver menos de 1,5 segundos. Útil para melhores transições. Afeta apenas novos clipes.'
};
4 changes: 3 additions & 1 deletion lib/lang/ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,7 @@ const Map<String, String> ru = {
'Когда включено, выбор прошедших дат будет фильтровать видео по этой дате. Когда выключено, будут показаны все видео. Работает только с экспериментальным выбором файлов.',
'useAlternativeCalendarColors': 'Используйте альтернативные цвета календаря',
'useAlternativeCalendarColorsDescription':
'Меняет зеленый и красный в календаре на синий и желтый. Полезно для людей с цветовым слепотой.'
'Меняет зеленый и красный в календаре на синий и желтый. Полезно для людей с цветовым слепотой.',
'useClipPad': 'Использовать временной буфер конца',
'useClipPadDescription': 'Добавляет дополнительные 500 мс в конец новых клипов, если клип короче 1,5 секунд. Полезно для плавных переходов. Влияет только на новые клипы.'
};
4 changes: 3 additions & 1 deletion lib/lang/zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,7 @@ const Map<String, String> zh = {
'useFilterInExperimentalPicker': '使用日期过滤器选择视频',
'useFilterInExperimentalPickerDescription': '启用后,选择过去的日期将按该日期过滤视频。禁用后,将显示所有视频。仅适用于实验性文件选择器。',
'useAlternativeCalendarColors': '使用备用日历颜色',
'useAlternativeCalendarColorsDescription': '将日历中的绿色和红色更改为蓝色和黄色。对色盲者有用。'
'useAlternativeCalendarColorsDescription': '将日历中的绿色和红色更改为蓝色和黄色。对色盲者有用。',
'useClipPad': '使用结束时间缓冲',
'useClipPadDescription': '如果剪辑少于1.5秒,在新剪辑的末尾添加额外的500毫秒时间。对改善过渡效果有帮助。仅影响新剪辑。'
};
46 changes: 46 additions & 0 deletions lib/pages/home/settings/widgets/preferences_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class _PreferencesPageState extends State<PreferencesPage> {
late bool isPickerSwitchToggled;
late bool isPickerFilterSwitchToggled;
late bool isColorsSwitchToggled;
late bool isClipPadSwitchToggled;

@override
void initState() {
Expand All @@ -24,6 +25,7 @@ class _PreferencesPageState extends State<PreferencesPage> {
isPickerSwitchToggled = SharedPrefsUtil.getBool('useExperimentalPicker') ?? true;
isPickerFilterSwitchToggled = SharedPrefsUtil.getBool('useFilterInExperimentalPicker') ?? false;
isColorsSwitchToggled = SharedPrefsUtil.getBool('useAlternativeCalendarColors') ?? false;
isClipPadSwitchToggled = SharedPrefsUtil.getBool('useClipPad') ?? false;
}

@override
Expand Down Expand Up @@ -229,6 +231,50 @@ class _PreferencesPageState extends State<PreferencesPage> {
),
const SizedBox(height: 5.0),
Text('useAlternativeCalendarColorsDescription'.tr),
const Divider(),
Container(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Text(
'useClipPad'.tr,
style: TextStyle(
fontSize: MediaQuery.of(context).size.width * 0.045,
),
),
),
Switch(
value: isClipPadSwitchToggled,
onChanged: (value) async {
if (value) {
Utils.logInfo(
'[PREFERENCES] - Use millisecond padding end clip was enabled',
);

SharedPrefsUtil.putBool('useClipPad', true);
} else {
Utils.logInfo(
'[PREFERENCES] - Use millisecond padding end clip was disabled',
);

SharedPrefsUtil.putBool('useClipPad', false);
}

/// Update switch value
setState(() {
isClipPadSwitchToggled = !isClipPadSwitchToggled;
});
},
activeTrackColor: AppColors.mainColor.withOpacity(0.4),
activeColor: AppColors.mainColor,
),
],
),
),
const SizedBox(height: 5.0),
Text('useClipPadDescription'.tr),
],
),
),
Expand Down
9 changes: 8 additions & 1 deletion lib/pages/save_video/save_video_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1034,8 +1034,15 @@ class _SaveVideoPageState extends State<SaveVideoPage> {
}

double getVideoEndInMilliseconds() {
final double defaultEnd = _videoEndValue + 500;
final isClipPad = SharedPrefsUtil.getBool('useClipPad') ?? false;
double defaultEnd = _videoEndValue;
final double clipDuration = _videoEndValue - _videoStartValue;
final int videoDuration = _trimmer.videoPlayerController!.value.duration.inMilliseconds;

if (clipDuration < 1500 && isClipPad) {
defaultEnd += 500;
}

if (defaultEnd > videoDuration) {
return videoDuration.toDouble();
}
Expand Down