Merge branch 'dev' into auto_queue_logic
|
@ -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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
showDetail(h);
|
if(h.mission.finished) viewFile(h);
|
||||||
}
|
}
|
||||||
});*/
|
});
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
@ -200,14 +200,12 @@ public class MissionAdapter extends RecyclerView.Adapter<MissionAdapter.ViewHold
|
||||||
Menu menu = popup.getMenu();
|
Menu menu = popup.getMenu();
|
||||||
MenuItem start = menu.findItem(R.id.start);
|
MenuItem start = menu.findItem(R.id.start);
|
||||||
MenuItem pause = menu.findItem(R.id.pause);
|
MenuItem pause = menu.findItem(R.id.pause);
|
||||||
MenuItem view = menu.findItem(R.id.view);
|
|
||||||
MenuItem delete = menu.findItem(R.id.delete);
|
MenuItem delete = menu.findItem(R.id.delete);
|
||||||
MenuItem checksum = menu.findItem(R.id.checksum);
|
MenuItem checksum = menu.findItem(R.id.checksum);
|
||||||
|
|
||||||
// Set to false first
|
// Set to false first
|
||||||
start.setVisible(false);
|
start.setVisible(false);
|
||||||
pause.setVisible(false);
|
pause.setVisible(false);
|
||||||
view.setVisible(false);
|
|
||||||
delete.setVisible(false);
|
delete.setVisible(false);
|
||||||
checksum.setVisible(false);
|
checksum.setVisible(false);
|
||||||
|
|
||||||
|
@ -222,7 +220,6 @@ public class MissionAdapter extends RecyclerView.Adapter<MissionAdapter.ViewHold
|
||||||
pause.setVisible(true);
|
pause.setVisible(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
view.setVisible(true);
|
|
||||||
delete.setVisible(true);
|
delete.setVisible(true);
|
||||||
checksum.setVisible(true);
|
checksum.setVisible(true);
|
||||||
}
|
}
|
||||||
|
@ -241,27 +238,6 @@ public class MissionAdapter extends RecyclerView.Adapter<MissionAdapter.ViewHold
|
||||||
mBinder.onMissionRemoved(mItemList.get(h.position));
|
mBinder.onMissionRemoved(mItemList.get(h.position));
|
||||||
h.lastTimeStamp = -1;
|
h.lastTimeStamp = -1;
|
||||||
h.lastDone = -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;
|
return true;
|
||||||
case R.id.delete:
|
case R.id.delete:
|
||||||
mDeleteDownloadManager.add(h.mission);
|
mDeleteDownloadManager.add(h.mission);
|
||||||
|
@ -282,6 +258,28 @@ public class MissionAdapter extends RecyclerView.Adapter<MissionAdapter.ViewHold
|
||||||
popup.show();
|
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) {
|
private void viewFileWithFileProvider(File file, String mimetype) {
|
||||||
String ourPackage = mContext.getApplicationContext().getPackageName();
|
String ourPackage = mContext.getApplicationContext().getPackageName();
|
||||||
Uri uri = FileProvider.getUriForFile(mContext, ourPackage + ".provider", file);
|
Uri uri = FileProvider.getUriForFile(mContext, ourPackage + ".provider", file);
|
||||||
|
|
|
@ -7,11 +7,7 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/pause"
|
android:id="@+id/pause"
|
||||||
android:title="@string/pause"/>
|
android:title="@string/pause"/>
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/view"
|
|
||||||
android:title="@string/view"/>
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/delete"
|
android:id="@+id/delete"
|
||||||
android:title="@string/delete"/>
|
android:title="@string/delete"/>
|
||||||
|
|
|
@ -508,4 +508,21 @@
|
||||||
<string name="grid">Сетка</string>
|
<string name="grid">Сетка</string>
|
||||||
<string name="auto">Автоматически</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>
|
</resources>
|
||||||
|
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 170 KiB After Width: | Height: | Size: 170 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |