if ((ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) ||
(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_NETWORK_STATE) != PackageManager.PERMISSION_GRANTED) ||
(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_WIFI_STATE) != PackageManager.PERMISSION_GRANTED) ||
+ (ContextCompat.checkSelfPermission(this, Manifest.permission.VIBRATE) != PackageManager.PERMISSION_GRANTED) ||
(ContextCompat.checkSelfPermission(this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED)) {
ActivityCompat.requestPermissions(this,
new String[]{
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.ACCESS_NETWORK_STATE,
Manifest.permission.ACCESS_WIFI_STATE,
+ Manifest.permission.VIBRATE,
Manifest.permission.INTERNET,
},
REQUEST_NEED_PERMISSIONS);
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
+import android.os.Vibrator;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.content.res.ResourcesCompat;
import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor;
import net.osdn.gokigen.gr2control.scene.IChangeScene;
+import static android.content.Context.VIBRATOR_SERVICE;
+
/**
* 撮影用ライブビュー画面
*
{
Log.v(TAG, "interfaceInjector is NULL...");
}
- if (onClickTouchListener == null)
+ Activity activity = this.getActivity();
+ Vibrator vibrator = (activity != null) ? (Vibrator) activity.getSystemService(VIBRATOR_SERVICE) : null;
+ if ((onClickTouchListener == null)&&(activity != null))
{
- onClickTouchListener = new LiveViewClickTouchListener(this.getActivity(), imageView, this, changeScene, interfaceProvider, this);
+ onClickTouchListener = new LiveViewClickTouchListener(activity, imageView, this, changeScene, interfaceProvider, this);
}
imageView.setOnClickListener(onClickTouchListener);
imageView.setOnTouchListener(onClickTouchListener);
if (onPanelClickListener == null)
{
- onPanelClickListener = new LiveViewControlPanelClickListener(this.getActivity(), interfaceProvider);
+ onPanelClickListener = new LiveViewControlPanelClickListener(activity, interfaceProvider);
}
setPanelClickListener(view, R.id.takemodeTextView);
setPanelClickListener(view, R.id.shutterSpeedTextView);
if (onKeyPanelClickListener == null)
{
- onKeyPanelClickListener = new LiveViewKeyPanelClickListener(interfaceProvider);
+ onKeyPanelClickListener = new LiveViewKeyPanelClickListener(interfaceProvider, vibrator);
}
setKeyPanelClickListener(view, R.id.button_front_left);
setKeyPanelClickListener(view, R.id.button_front_right);
package net.osdn.gokigen.gr2control.liveview;
+import android.os.Vibrator;
import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
{
private final String TAG = toString();
private final IInterfaceProvider interfaceProvider;
+ private final Vibrator vibrator;
- LiveViewKeyPanelClickListener(@NonNull IInterfaceProvider interfaceProvider)
+ LiveViewKeyPanelClickListener(@NonNull IInterfaceProvider interfaceProvider, @Nullable Vibrator vibrator)
{
this.interfaceProvider = interfaceProvider;
+ this.vibrator = vibrator;
}
@Override
if (buttonControl != null)
{
buttonControl.pushedButton(keyId);
+ if (vibrator != null)
+ {
+ vibrator.vibrate(30);
+ }
}
}
}