1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

Merge branch 'dev' into auto_queue_logic

This commit is contained in:
Shivanju Awasthi 2018-11-14 00:17:54 +05:30 committed by GitHub
commit 2856fb029f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 43 additions and 32 deletions

View File

@ -96,12 +96,12 @@ public class MissionAdapter extends RecyclerView.Adapter<MissionAdapter.ViewHold
}
});
/*h.itemView.setOnClickListener(new View.OnClickListener() {
h.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDetail(h);
if(h.mission.finished) viewFile(h);
}
});*/
});
return h;
}
@ -200,14 +200,12 @@ public class MissionAdapter extends RecyclerView.Adapter<MissionAdapter.ViewHold
Menu menu = popup.getMenu();
MenuItem start = menu.findItem(R.id.start);
MenuItem pause = menu.findItem(R.id.pause);
MenuItem view = menu.findItem(R.id.view);
MenuItem delete = menu.findItem(R.id.delete);
MenuItem checksum = menu.findItem(R.id.checksum);
// Set to false first
start.setVisible(false);
pause.setVisible(false);
view.setVisible(false);
delete.setVisible(false);
checksum.setVisible(false);
@ -222,7 +220,6 @@ public class MissionAdapter extends RecyclerView.Adapter<MissionAdapter.ViewHold
pause.setVisible(true);
}
} else {
view.setVisible(true);
delete.setVisible(true);
checksum.setVisible(true);
}
@ -241,27 +238,6 @@ public class MissionAdapter extends RecyclerView.Adapter<MissionAdapter.ViewHold
mBinder.onMissionRemoved(mItemList.get(h.position));
h.lastTimeStamp = -1;
h.lastDone = -1;
return true;
case R.id.view:
File f = new File(h.mission.location, h.mission.name);
String ext = Utility.getFileExt(h.mission.name);
Log.d(TAG, "Viewing file: " + f.getAbsolutePath() + " ext: " + ext);
if (ext == null) {
Log.w(TAG, "Can't view file because it has no extension: " +
h.mission.name);
return false;
}
String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext.substring(1));
Log.v(TAG, "Mime: " + mime + " package: " + mContext.getApplicationContext().getPackageName() + ".provider");
if (f.exists()) {
viewFileWithFileProvider(f, mime);
} else {
Log.w(TAG, "File doesn't exist");
}
return true;
case R.id.delete:
mDeleteDownloadManager.add(h.mission);
@ -282,6 +258,28 @@ public class MissionAdapter extends RecyclerView.Adapter<MissionAdapter.ViewHold
popup.show();
}
private boolean viewFile(ViewHolder h) {
File f = new File(h.mission.location, h.mission.name);
String ext = Utility.getFileExt(h.mission.name);
Log.d(TAG, "Viewing file: " + f.getAbsolutePath() + " ext: " + ext);
if (ext == null) {
Log.w(TAG, "Can't view file because it has no extension: " +
h.mission.name);
return true;
}
String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext.substring(1));
Log.v(TAG, "Mime: " + mime + " package: " + mContext.getApplicationContext().getPackageName() + ".provider");
if (f.exists()) {
viewFileWithFileProvider(f, mime);
} else {
Log.w(TAG, "File doesn't exist");
}
return false;
}
private void viewFileWithFileProvider(File file, String mimetype) {
String ourPackage = mContext.getApplicationContext().getPackageName();
Uri uri = FileProvider.getUriForFile(mContext, ourPackage + ".provider", file);

View File

@ -7,11 +7,7 @@
<item
android:id="@+id/pause"
android:title="@string/pause"/>
<item
android:id="@+id/view"
android:title="@string/view"/>
<item
android:id="@+id/delete"
android:title="@string/delete"/>

View File

@ -508,4 +508,21 @@
<string name="grid">Сетка</string>
<string name="auto">Автоматически</string>
<string name="brightness_gesture_control_summary">Менять яркость плеера жестом</string>
<string name="brightness_gesture_control_title">Жест яркости</string>
<string name="download_to_sdcard_error_message">Загрузка на внешний накопитель невозможна. Сбросить расположение папки загрузки?</string>
<string name="download_to_sdcard_error_title">Внешний накопитель недоступен</string>
<string name="main_page_content_summary">Вкладки, видимые на главной странице</string>
<string name="restore_defaults">По умолчанию</string>
<string name="restore_defaults_confirmation">Хотите восстановить умолчания?</string>
<string name="saved_tabs_invalid_json">Ошибка чтения сохранённых вкладок. Используются вкладки по умолчанию</string>
<string name="selection">Выбор</string>
<string name="subscribers_count_not_available">Количество подписчиков недоступно</string>
<string name="switch_view">Переключить вид</string>
<string name="tab_choose">Выберите вкладку</string>
<string name="tab_new">Новая вкладка</string>
<string name="unsubscribe">Отписаться</string>
<string name="volume_gesture_control_summary">Менять громкость плеера жестом</string>
<string name="volume_gesture_control_title">Жест громкости</string>
</resources>

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 170 KiB

After

Width:  |  Height:  |  Size: 170 KiB

View File

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB