String ISO_SENSITIVITY = "sv";
String EXPREV = "xv";
String FLASH_XV = "flashxv";
+ String SELF_TIMER = "selftimer";
String TAKE_MODE_MOVIE = "movie";
}
{
return (getAvailableResourceArrayItemList(R.array.fuji_x_iso_sensitivity));
}
-
+ if (listKey.matches(ICameraStatus.FLASH_XV))
+ {
+ return (getAvailableResourceArrayItemList(R.array.fuji_x_flash_control));
+ }
+ if (listKey.matches(ICameraStatus.SELF_TIMER))
+ {
+ return (getAvailableResourceArrayItemList(R.array.fuji_x_timer_control));
+ }
///// 選択可能なステータスの一覧を取得する : でも以下はアイテム名の一覧... /////
/*
String[] items = activity.getResources().getStringArray(id);
for (String item : items)
{
+ Log.v(TAG, " SELECTION : " + item);
selection.add(item);
}
return (selection);
return (iso);
}
+ private String getCurrentFlashStatus()
+ {
+ String flash = "";
+ try
+ {
+ int current = statusHolder.get(IFujiXCameraProperties.FLASH);
+ String[] items = activity.getResources().getStringArray(R.array.fuji_x_flash_control);
+ String[] itemValues = activity.getResources().getStringArray(R.array.fuji_x_flash_control_value);
+ int index = 0;
+ for (String itemValue : itemValues)
+ {
+ int itemValueInt = Integer.parseInt(itemValue, 16);
+ if (itemValueInt == current)
+ {
+ return (items[index]);
+ }
+ index++;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (flash);
+ }
+
+ private String getCurrentSelfTimerStatus()
+ {
+ String selfTimer = "";
+ try
+ {
+ int current = statusHolder.get(IFujiXCameraProperties.SELF_TIMER);
+ String[] items = activity.getResources().getStringArray(R.array.fuji_x_timer_control);
+ String[] itemValues = activity.getResources().getStringArray(R.array.fuji_x_timer_control_value);
+ int index = 0;
+ for (String itemValue : itemValues)
+ {
+ int itemValueInt = Integer.parseInt(itemValue, 16);
+ if (itemValueInt == current)
+ {
+ return (items[index]);
+ }
+ index++;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (selfTimer);
+ }
+
private void setEffectItem(String value)
{
try
int index = 0;
for (String item : items)
{
- Log.v(TAG, " ===== ISO : " + value + " " + item + " ===== ");
+ //Log.v(TAG, " ===== ISO : " + value + " " + item + " ===== ");
if (item.matches(value))
{
// 見つかった! この値を設定する
String itemValue = itemValues[index];
int itemValueInt = (int) Long.parseLong(itemValue,16);
logcat(" SET ISO SENSITIVITY : " + value + " " + itemValueInt);
- publisher.enqueueCommand(new SetPropertyValue(new FujiXReplyMessageReceiver(" Set ISO", true), IFujiXCameraProperties.ISO, 8, itemValueInt));
+ publisher.enqueueCommand(new SetPropertyValue(new FujiXReplyMessageReceiver(" Set ISO", true), IFujiXCameraProperties.ISO, 4, itemValueInt));
+ return;
+ }
+ index++;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void setCurrentFlashStatus(String value)
+ {
+ // ISO感度を設定する
+ try
+ {
+ String[] items = activity.getResources().getStringArray(R.array.fuji_x_flash_control);
+ String[] itemValues = activity.getResources().getStringArray(R.array.fuji_x_flash_control_value);
+ int index = 0;
+ for (String item : items)
+ {
+ Log.v(TAG, " ===== FLASH : " + value + " " + item + " ===== ");
+ if (item.matches(value))
+ {
+ // 見つかった! この値を設定する
+ String itemValue = itemValues[index];
+ int itemValueInt = (int) Long.parseLong(itemValue,16);
+ logcat(" SET FLASH : " + value + " " + itemValueInt);
+ publisher.enqueueCommand(new SetPropertyValue(new FujiXReplyMessageReceiver(" Set FLASH", true), IFujiXCameraProperties.FLASH, 4, itemValueInt));
+ return;
+ }
+ index++;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void setSelfTimerStatus(String value)
+ {
+ // セルフタイマーを設定する
+ try
+ {
+ String[] items = activity.getResources().getStringArray(R.array.fuji_x_timer_control);
+ String[] itemValues = activity.getResources().getStringArray(R.array.fuji_x_timer_control_value);
+ int index = 0;
+ for (String item : items)
+ {
+ Log.v(TAG, " ===== SELF-TIMER : " + value + " " + item + " ===== ");
+ if (item.matches(value))
+ {
+ // 見つかった! この値を設定する
+ String itemValue = itemValues[index];
+ int itemValueInt = (int) Long.parseLong(itemValue,16);
+ logcat(" SET SELF-TIMER : " + value + " " + itemValueInt);
+ publisher.enqueueCommand(new SetPropertyValue(new FujiXReplyMessageReceiver(" Set SELF-TIMER", true), IFujiXCameraProperties.SELF_TIMER, 4, itemValueInt));
return;
}
index++;
{
return (getCurrentIsoSensitivityStatus());
}
+ if (key.matches(ICameraStatus.FLASH_XV))
+ {
+ return (getCurrentFlashStatus());
+ }
+ if (key.matches(ICameraStatus.SELF_TIMER))
+ {
+ return (getCurrentSelfTimerStatus());
+ }
if (key.matches(ICameraStatus.TAKE_MODE))
{
return ("");
{
try
{
- if (logcat)
- {
- Log.v(TAG, "setStatus(" + key + ", " + value + ")");
- }
+ logcat(" setStatus(" + key + ", " + value + ")");
if (key.matches(ICameraStatus.EFFECT))
{
setEffectItem(value);
- return;
}
- if (key.matches(ICameraStatus.WHITE_BALANCE))
+ else if (key.matches(ICameraStatus.WHITE_BALANCE))
{
setCurrentWhiteBalanceStatus(value);
- return;
}
- if (key.matches(ICameraStatus.ISO_SENSITIVITY))
+ else if (key.matches(ICameraStatus.ISO_SENSITIVITY))
{
setCurrentIsoSensitivityStatus(value);
- // return;
}
-
- // ここで設定を行う。
+ else if (key.matches(ICameraStatus.FLASH_XV))
+ {
+ setCurrentFlashStatus(value);
+ }
+ else if (key.matches(ICameraStatus.SELF_TIMER))
+ {
+ setSelfTimerStatus(value);
+ }
+ // その他の設定...
}
catch (Exception e)
{
}
}
-
private void dumpStatus()
{
try
package net.osdn.gokigen.gr2control.liveview;
-import android.app.Activity;
import android.content.DialogInterface;
import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
+import androidx.fragment.app.FragmentActivity;
/**
*
class LiveViewControlPanelClickListener implements View.OnClickListener
{
private final String TAG = toString();
- private final Activity activity;
+ private final FragmentActivity activity;
private final IInterfaceProvider interfaceProvider;
- LiveViewControlPanelClickListener(Activity context, IInterfaceProvider interfaceProvider)
+ LiveViewControlPanelClickListener(FragmentActivity context, IInterfaceProvider interfaceProvider)
{
this.activity = context;
this.interfaceProvider = interfaceProvider;
if (fujiXOnKeyPanelClickListener == null)
{
- fujiXOnKeyPanelClickListener = new LiveViewFujiXKeyPanelClickListener(interfaceProvider, vibrator);
+ fujiXOnKeyPanelClickListener = new LiveViewFujiXKeyPanelClickListener(getActivity(), interfaceProvider, vibrator);
}
setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_sv_minus);
setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_sv_plus);
setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_tv_plus);
setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_xv_minus);
setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_xv_plus);
+ setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_flash);
+ setFujiXKeyPanelClickListener(view, R.id.button_fuji_x_timer);
connectStatus = view.findViewById(R.id.connect_disconnect_button);
if (connectStatus != null)
package net.osdn.gokigen.gr2control.liveview;
+import android.content.DialogInterface;
import android.os.Vibrator;
import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.appcompat.app.AlertDialog;
+import androidx.fragment.app.FragmentActivity;
import net.osdn.gokigen.gr2control.R;
+import net.osdn.gokigen.gr2control.camera.ICameraStatus;
import net.osdn.gokigen.gr2control.camera.IInterfaceProvider;
import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandCallback;
import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.IFujiXCommandPublisher;
import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.command.messages.IFujiXCameraCommands;
import net.osdn.gokigen.gr2control.camera.utils.SimpleLogDumper;
+import java.util.List;
+
public class LiveViewFujiXKeyPanelClickListener implements View.OnClickListener, View.OnLongClickListener, IFujiXCommandCallback
{
private final String TAG = toString();
+ private final FragmentActivity activity;
private static final boolean isDumpLog = false;
private final IInterfaceProvider interfaceProvider;
private final Vibrator vibrator;
- LiveViewFujiXKeyPanelClickListener(@NonNull IInterfaceProvider interfaceProvider, @Nullable Vibrator vibrator)
+ LiveViewFujiXKeyPanelClickListener(@NonNull FragmentActivity activity, @NonNull IInterfaceProvider interfaceProvider, @Nullable Vibrator vibrator)
{
+ this.activity = activity;
this.interfaceProvider = interfaceProvider;
this.vibrator = vibrator;
}
case R.id.button_fuji_x_xv_minus:
updateValue(IFujiXCameraCommands.EXPREV, 0);
break;
- case R.id.button_fuji_x_xv_plus:
- updateValue(IFujiXCameraCommands.EXPREV, 1);
+ case R.id.button_fuji_x_flash:
+ updateSelection(ICameraStatus.FLASH_XV);
+ isVibrate = false;
+ break;
+ case R.id.button_fuji_x_timer:
+ updateSelection(ICameraStatus.SELF_TIMER);
+ isVibrate = false;
break;
+
default:
isVibrate = false;
break;
break;
case R.id.button_fuji_x_xv_plus:
break;
+ case R.id.button_fuji_x_flash:
+ break;
+ case R.id.button_fuji_x_timer:
+ break;
default:
break;
}
}
/**
+ * 選択肢を更新する
+ *
+ */
+ private void updateSelection(@NonNull final String key)
+ {
+ try
+ {
+ Log.v(TAG, "updateSelection() : " + key);
+ final ICameraStatus statusList = interfaceProvider.getCameraStatusListHolder();
+ if (statusList == null)
+ {
+ // ステータスリストの保持クラスが取れなかった...
+ Log.w(TAG, "ICameraStatus is NULL...");
+ return;
+ }
+ final String current = statusList.getStatus(key);
+ final List<String> itemList = statusList.getStatusList(key);
+ if (itemList.size() <= 0)
+ {
+ // アイテム(選択肢)が登録されていなければ、何もしない
+ return;
+ }
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+
+ // リストから配列に積み替え...
+ String[] items = new String[itemList.size()];
+ int index = 0;
+ for (String item : itemList)
+ {
+ Log.v(TAG, " (" + index + ") " + item);
+ items[index] = item;
+ index++;
+ }
+ int position = itemList.indexOf(current);
+ Log.v(TAG, " updateSelection() : " + key + " " + itemList.size() + " " + position);
+ builder.setSingleChoiceItems(items, position, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialogInterface, int i)
+ {
+ String choice = itemList.get(i);
+ Log.v(TAG, key + " ITEM CHOICED : " + choice + "(CURRENT : " + current + ")");
+
+ statusList.setStatus(key, choice);
+ dialogInterface.dismiss();
+ }
+ });
+ builder.show();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
* ぶるぶるさせる
*
*/
--- /dev/null
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M7,2v11h3v9l7,-12h-4l4,-8z"/>
+</vector>
android:layout_marginStart="2pt"
android:gravity="center" />
+ <ImageView
+ android:id="@+id/button_fuji_x_dummy"
+ android:layout_width="34pt"
+ android:layout_height="9pt"
+ android:layout_below="@id/label_fuji_x_xv_center"
+ android:layout_alignLeft="@id/label_fuji_x_xv_center"
+ android:layout_alignStart="@id/label_fuji_x_xv_center"
+ android:scaleType="fitCenter"
+ android:visibility="invisible"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_camera_roll_black_24dp"
+ android:layout_marginTop="6pt"
+ android:gravity="center" />
+
+ <ImageView
+ android:id="@+id/button_fuji_x_flash"
+ android:layout_width="20pt"
+ android:layout_height="14pt"
+ android:layout_below="@id/button_fuji_x_dummy"
+ android:layout_alignLeft="@id/button_fuji_x_tv_minus"
+ android:layout_alignStart="@id/button_fuji_x_tv_minus"
+ android:scaleType="fitCenter"
+ android:visibility="visible"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_flash_on_black_24dp"
+ android:layout_marginTop="6pt"
+ android:gravity="center" />
+
+ <ImageView
+ android:id="@+id/button_fuji_x_timer"
+ android:layout_width="34pt"
+ android:layout_height="14pt"
+ android:layout_below="@id/button_fuji_x_dummy"
+ android:layout_alignLeft="@id/button_fuji_x_dummy"
+ android:layout_alignStart="@id/button_fuji_x_dummy"
+ android:scaleType="fitCenter"
+ android:visibility="visible"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_timer_black_24dp"
+ android:layout_marginTop="6pt"
+ android:gravity="center" />
+
<TextView
android:id="@+id/fuji_x_hideKeyPanelTextView"
android:layout_width="48dp"
android:layout_marginStart="2pt"
android:gravity="center" />
+ <ImageView
+ android:id="@+id/button_fuji_x_dummy"
+ android:layout_width="34pt"
+ android:layout_height="9pt"
+ android:layout_below="@id/label_fuji_x_xv_center"
+ android:layout_alignLeft="@id/label_fuji_x_xv_center"
+ android:layout_alignStart="@id/label_fuji_x_xv_center"
+ android:scaleType="fitCenter"
+ android:visibility="invisible"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_camera_roll_black_24dp"
+ android:layout_marginTop="6pt"
+ android:gravity="center" />
+
+ <ImageView
+ android:id="@+id/button_fuji_x_flash"
+ android:layout_width="20pt"
+ android:layout_height="14pt"
+ android:layout_below="@id/button_fuji_x_dummy"
+ android:layout_alignLeft="@id/button_fuji_x_tv_minus"
+ android:layout_alignStart="@id/button_fuji_x_tv_minus"
+ android:scaleType="fitCenter"
+ android:visibility="visible"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_flash_on_black_24dp"
+ android:layout_marginTop="6pt"
+ android:gravity="center" />
+
+ <ImageView
+ android:id="@+id/button_fuji_x_timer"
+ android:layout_width="34pt"
+ android:layout_height="14pt"
+ android:layout_below="@id/button_fuji_x_dummy"
+ android:layout_alignLeft="@id/button_fuji_x_dummy"
+ android:layout_alignStart="@id/button_fuji_x_dummy"
+ android:scaleType="fitCenter"
+ android:visibility="visible"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_timer_black_24dp"
+ android:layout_marginTop="6pt"
+ android:gravity="center" />
+
<TextView
android:id="@+id/fuji_x_hideKeyPanelTextView"
android:layout_width="48dp"
<item>64</item>
</string-array>
+ <string-array name="fuji_x_flash_control">
+ <item>AUTO</item>
+ <item>OFF</item>
+ <item>FILL</item>
+ <item>RedEye AUTO</item>
+ <item>RedEye FILL</item>
+ <item>External Sync</item>
+ <item>ON</item>
+ <item>RedEye</item>
+ <item>RedEye ON</item>
+ <item>RedEye Sync</item>
+ <item>RedEye Rear</item>
+ <item>Slow Sync</item>
+ <item>Rear Sync</item>
+ <item>Commander</item>
+ <item>DISABLE</item>
+ <item>ENABLE</item>
+ </string-array>
+
+ <string-array name="fuji_x_flash_control_value">
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+ <item>8001</item>
+ <item>8002</item>
+ <item>8003</item>
+ <item>8004</item>
+ <item>8005</item>
+ <item>8006</item>
+ <item>8007</item>
+ <item>8008</item>
+ <item>8009</item>
+ <item>800A</item>
+ </string-array>
+
+
+ <string-array name="fuji_x_timer_control">
+ <item>OFF</item>
+ <item>1 Sec.</item>
+ <item>2 Sec.</item>
+ <item>5 Sec.</item>
+ <item>10 Sec.</item>
+ </string-array>
+
+ <string-array name="fuji_x_timer_control_value">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ </string-array>
+
</resources>
<item>64</item>
</string-array>
+ <string-array name="fuji_x_flash_control">
+ <item>AUTO</item>
+ <item>OFF</item>
+ <item>FILL</item>
+ <item>RedEye AUTO</item>
+ <item>RedEye FILL</item>
+ <item>External Sync</item>
+ <item>ON</item>
+ <item>RedEye</item>
+ <item>RedEye ON</item>
+ <item>RedEye Sync</item>
+ <item>RedEye Rear</item>
+ <item>Slow Sync</item>
+ <item>Rear Sync</item>
+ <item>Commander</item>
+ <item>DISABLE</item>
+ <item>ENABLE</item>
+ </string-array>
+
+ <string-array name="fuji_x_flash_control_value">
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+ <item>8001</item>
+ <item>8002</item>
+ <item>8003</item>
+ <item>8004</item>
+ <item>8005</item>
+ <item>8006</item>
+ <item>8007</item>
+ <item>8008</item>
+ <item>8009</item>
+ <item>800A</item>
+ </string-array>
+
+ <string-array name="fuji_x_timer_control">
+ <item>OFF</item>
+ <item>1 Sec.</item>
+ <item>2 Sec.</item>
+ <item>5 Sec.</item>
+ <item>10 Sec.</item>
+ </string-array>
+
+ <string-array name="fuji_x_timer_control_value">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ </string-array>
+
</resources>