*
*
*/
-public class ImageGridViewFragment extends Fragment implements AdapterView.OnItemClickListener, AdapterView.OnItemSelectedListener, CompoundButton.OnCheckedChangeListener
+public class ImageGridViewFragment extends Fragment implements AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener, CompoundButton.OnCheckedChangeListener, MultiFileDownloadConfirmationDialog.Callback
{
private final String TAG = this.toString();
gridView = view.findViewById(R.id.gridView1);
gridView.setAdapter(adapter);
gridView.setOnItemClickListener(this);
+ gridView.setOnItemLongClickListener(this);
gridView.setOnScrollListener(adapter);
}
return (view);
}
}
+
+ @Override
+ public boolean onItemLongClick(final AdapterView<?> parent, View view, int position, long id)
+ {
+ try
+ {
+ CameraContentEx infoEx = imageContentList.get(position);
+ if (infoEx != null)
+ {
+ boolean isChecked = infoEx.isSelected();
+ infoEx.setSelected(!isChecked);
+ }
+ view.invalidate();
+ runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ ImageGridViewAdapter adapter = (ImageGridViewAdapter) parent.getAdapter();
+ adapter.notifyDataSetChanged();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ return (true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+
// AdapterView.OnItemSelectedListener
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
e.printStackTrace();
}
}
+
+ @Override
+ public void confirmSelection(int selectedButtonId, boolean withRaw)
+ {
+ Log.v(TAG, "confirmSelection : " + selectedButtonId + " (" + withRaw + ")");
+/*
+ float downloadSize;
+ switch (selectedButtonId)
+ {
+ case R.id.radio_download__1024x768:
+ downloadSize = OLYCamera.IMAGE_RESIZE_1024;
+ break;
+ case R.id.radio_download__1600x1200:
+ downloadSize = OLYCamera.IMAGE_RESIZE_1600;
+ break;
+ case R.id.radio_download__1920x1440:
+ downloadSize = OLYCamera.IMAGE_RESIZE_1920;
+ break;
+ case R.id.radio_download__2048x1536:
+ downloadSize = OLYCamera.IMAGE_RESIZE_2048;
+ break;
+
+ case R.id.radio_download__original_size:
+ default:
+ downloadSize = OLYCamera.IMAGE_RESIZE_NONE;
+ break;
+ }
+
+ List<OLYCameraContentInfoEx> contentList = contentListHolder.getSelectedContentList();
+ for (OLYCameraContentInfoEx item : contentList)
+ {
+ Log.v(TAG, " " + item.getFileInfo().getFilename());
+ }
+
+ try
+ {
+ ImageDownloader downloader = new ImageDownloader(getActivity(), camera);
+ downloader.startDownloadMulti(contentList, downloadSize, withRaw, this);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+*/
+ }
}
--- /dev/null
+package net.osdn.gokigen.pkremote.playback;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.RadioGroup;
+import android.widget.TextView;
+
+import net.osdn.gokigen.pkremote.R;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AlertDialog;
+import androidx.fragment.app.DialogFragment;
+
+/**
+ * 複数ファイルの一括ダウンロードを実施することを確認するダイアログ
+ *
+ */
+public class MultiFileDownloadConfirmationDialog extends DialogFragment
+{
+ private final String TAG = this.toString();
+
+ private Callback callback;
+ private int nofPictures;
+
+ public static MultiFileDownloadConfirmationDialog newInstance(@NonNull Callback callback, int nofPictures)
+ {
+ MultiFileDownloadConfirmationDialog instance = new MultiFileDownloadConfirmationDialog();
+ instance.prepare(callback, nofPictures);
+
+ return (instance);
+ }
+
+ private void prepare(Callback callback, int nofPictures)
+ {
+ this.callback = callback;
+ this.nofPictures = nofPictures;
+ }
+
+ @Override
+ public @NonNull Dialog onCreateDialog(Bundle savedInstanceState)
+ {
+ Activity activity = getActivity();
+ LayoutInflater inflater = activity.getLayoutInflater();
+ View view = inflater.inflate(R.layout.dialog_confirmation_batch_download, null, false);
+ final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ builder.setTitle(activity.getString(R.string.dialog_title_batch_download));
+ TextView textView = view.findViewById(R.id.label_batch_download_info);
+ if (textView != null)
+ {
+ String label = getString(R.string.dialog_label_batch_download) + nofPictures;
+ textView.setText(label);
+ }
+ final RadioGroup radio = view.findViewById(R.id.radio_group_select_category);
+ final CheckBox checkWithRaw = view.findViewById(R.id.radio_download__raw);
+
+ // ボタンを設定する(実行ボタン)
+ builder.setPositiveButton(activity.getString(R.string.dialog_positive_download),
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ int buttonId = 0;
+ boolean withRaw = false;
+ try {
+ if (radio != null)
+ {
+ buttonId = radio.getCheckedRadioButtonId();
+ }
+ if (checkWithRaw != null)
+ {
+ withRaw = checkWithRaw.isChecked();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ dialog.dismiss();
+ //Log.v(TAG, "confirmSelection() " + buttonId + " [" + withRaw + "]");
+ callback.confirmSelection(buttonId, withRaw);
+ }
+ });
+
+ // ボタンを設定する (キャンセルボタン)
+ builder.setNegativeButton(activity.getString(R.string.dialog_negative_cancel),
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.cancel();
+ }
+ });
+
+ builder.setView(view);
+ return (builder.create());
+ }
+
+ // コールバックインタフェース
+ public interface Callback
+ {
+ void confirmSelection(int selectedButtonId, boolean withRaw);
+ }
+
+}
private static final String MOVIE_SUFFIX = ".mov";
private String rawSuffix;
private boolean hasRaw;
+ private boolean isSelected;
public CameraContentEx(ICameraContent fileInfo, boolean hasRaw, String rawSuffix)
{
this.fileInfo = fileInfo;
this.hasRaw = hasRaw;
this.rawSuffix = rawSuffix;
+ this.isSelected = false;
}
public void setHasRaw(boolean value, String rawSuffix)
this.rawSuffix = rawSuffix;
}
+ public void setSelected(boolean isSelected)
+ {
+ this.isSelected = isSelected;
+ }
+
public boolean hasRaw()
{
return (hasRaw);
return (contentName.endsWith(MOVIE_SUFFIX));
}
+ public boolean isSelected()
+ {
+ return (isSelected);
+ }
+
public String getRawSuffix()
{
return (rawSuffix);
{
private ImageView imageView;
private ImageView iconView;
+ private ImageView selectView;
- ImageGridCellViewHolder(ImageView image, ImageView icon)
+ ImageGridCellViewHolder(ImageView image, ImageView icon, ImageView selection)
{
this.imageView = image;
this.iconView = icon;
+ this.selectView = selection;
}
ImageView getImageView()
return (iconView);
}
+ ImageView getSelectView()
+ {
+ return (selectView);
+ }
+
}
convertView = inflater.inflate(R.layout.view_grid_cell, parent, false);
if (convertView != null)
{
- viewHolder = new ImageGridCellViewHolder((ImageView) convertView.findViewById(R.id.imageViewY), (ImageView) convertView.findViewById(R.id.imageViewZ));
+ viewHolder = new ImageGridCellViewHolder((ImageView) convertView.findViewById(R.id.imageViewY), (ImageView) convertView.findViewById(R.id.imageViewZ), (ImageView) convertView.findViewById(R.id.imageViewX));
convertView.setTag(viewHolder);
}
else
{
viewHolder.getImageView().setImageResource(R.drawable.ic_satellite_grey_24dp);
viewHolder.getIconView().setImageDrawable(null);
+ viewHolder.getSelectView().setImageDrawable(null);
return (convertView);
}
String path = new File(item.getContentPath(), item.getContentName()).getPath();
{
viewHolder.getImageView().setImageResource(R.drawable.ic_satellite_grey_24dp);
viewHolder.getIconView().setImageDrawable(null);
+ viewHolder.getSelectView().setImageDrawable(null);
if (!gridViewIsScrolling)
{
if (executor.isShutdown())
{
viewHolder.getIconView().setImageDrawable(null);
}
+ if (infoEx.isSelected())
+ {
+ viewHolder.getSelectView().setImageResource(R.drawable.ic_check_green_24dp);
+ }
+ else
+ {
+ viewHolder.getSelectView().setImageDrawable(null);
+ }
}
return (convertView);
}
--- /dev/null
+<vector android:height="24dp" android:tint="#80FA80"
+ android:viewportHeight="24.0" android:viewportWidth="24.0"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="#FF000000" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
+</vector>
--- /dev/null
+<vector android:height="24dp" android:tint="#C0C0C0"
+ android:viewportHeight="24.0" android:viewportWidth="24.0"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="#FF000000" android:pathData="M3,5h2L5,3c-1.1,0 -2,0.9 -2,2zM3,13h2v-2L3,11v2zM7,21h2v-2L7,19v2zM3,9h2L5,7L3,7v2zM13,3h-2v2h2L13,3zM19,3v2h2c0,-1.1 -0.9,-2 -2,-2zM5,21v-2L3,19c0,1.1 0.9,2 2,2zM3,17h2v-2L3,15v2zM9,3L7,3v2h2L9,3zM11,21h2v-2h-2v2zM19,13h2v-2h-2v2zM19,21c1.1,0 2,-0.9 2,-2h-2v2zM19,9h2L21,7h-2v2zM19,17h2v-2h-2v2zM15,21h2v-2h-2v2zM15,5h2L17,3h-2v2zM7,17h10L17,7L7,7v10zM9,9h6v6L9,15L9,9z"/>
+</vector>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:orientation="vertical"
+ >
+ <TextView
+ android:id="@+id/label_batch_download_info_margin"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/blank"
+ />
+ <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/radio_group_select_category"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:orientation="vertical">
+ <RadioButton
+ android:id="@+id/radio_download__original_size"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/action_download_original_size"
+ android:checked="true"
+ android:textSize="8pt"
+ />
+ <RadioButton android:id="@+id/radio_download__2048x1536"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/action_download_2048x1536"
+ android:checked="false"
+ android:textSize="8pt"
+ />
+ <RadioButton android:id="@+id/radio_download__1920x1440"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/action_download_1920x1440"
+ android:checked="false"
+ android:textSize="8pt"
+ />
+ <RadioButton android:id="@+id/radio_download__1600x1200"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/action_download_1600x1200"
+ android:checked="false"
+ android:textSize="8pt"
+ />
+ <RadioButton android:id="@+id/radio_download__1024x768"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/action_download_1024x768"
+ android:checked="false"
+ android:textSize="8pt"
+ />
+ </RadioGroup>
+ <CheckBox android:id="@+id/radio_download__raw"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/action_download_with_raw"
+ android:checked="false"
+ android:textSize="8pt"
+ />
+
+ <TextView
+ android:id="@+id/label_batch_download_info"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/blank"
+ android:layout_gravity="end"
+ android:layout_marginRight="10dp"
+ android:layout_marginEnd="10dp"
+ android:padding="4dp"
+ />
+
+ <TextView
+ android:id="@+id/label_batch_download_message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/blank"
+ />
+
+</LinearLayout>
android:scaleType="centerCrop"
android:src="@null"
tools:ignore="ContentDescription" />
+
+ <ImageView
+ android:id="@+id/imageViewX"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:layout_marginLeft="15dp"
+ android:layout_marginStart="15dp"
+ android:layout_marginTop="15dp"
+ android:scaleType="centerCrop"
+ android:src="@null"
+ tools:ignore="ContentDescription" />
+
+
</RelativeLayout>
\ No newline at end of file
<string name="select_radio_date">Date</string>
<string name="select_radio_path">Path</string>
+
+ <string name="action_download_with_raw">Download with RAW</string>
+ <string name="dialog_title_batch_download">Batch Download(select size)</string>
+ <string name="dialog_positive_download">Download</string>
+ <string name="dialog_label_batch_download">Selected : </string>
+ <string name="dialog_label_select_size"> </string>
+ <string name="message_download_finished_pics">Finished. Number of Pics. : </string>
+ <string name="message_download_finished_pics_with_failure">Finished. # of Pics. : </string>
+ <string name="message_download_failure_count"> Failures : </string>
+ <string name="message_download_finished_but_failed">Download was failed… </string>
</resources>
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.3.1'
+ classpath 'com.android.tools.build:gradle:3.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files