QRリーダを起動する処理を追加しました。
This commit is contained in:
parent
6927b386cd
commit
81209f695d
|
@ -11,6 +11,8 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import com.google.zxing.integration.android.IntentIntegrator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
* Use the {@link QRFragment#newInstance} factory method to
|
* Use the {@link QRFragment#newInstance} factory method to
|
||||||
|
@ -74,12 +76,7 @@ public class QRFragment extends Fragment {
|
||||||
|
|
||||||
cameraButton.setOnClickListener(v -> {
|
cameraButton.setOnClickListener(v -> {
|
||||||
Log.d("QRFragment", "onClick: called");
|
Log.d("QRFragment", "onClick: called");
|
||||||
if (!sharedPreferences.getBoolean("inCar", false)) {
|
new IntentIntegrator(getActivity()).initiateScan();
|
||||||
editor.putBoolean("inCar", true);
|
|
||||||
} else {
|
|
||||||
editor.putBoolean("inCar", false);
|
|
||||||
}
|
|
||||||
editor.apply();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user