Loading app/src/main/java/net/fabiszewski/ulogger/WaypointFragment.java +16 −13 Original line number Diff line number Diff line Loading @@ -55,8 +55,6 @@ public class WaypointFragment extends Fragment implements LoggerTask.LoggerTaskC private static final int REQUEST_IMAGE_OPEN = 2; private static final int PERMISSION_WRITE = 1; private static final int PERMISSION_LOCATION = 2; private static final int ACTION_PHOTO = 0; private static final int ACTION_LIBRARY = 1; private static final String KEY_URI = "keyPhotoUri"; private static final String KEY_THUMB = "keyPhotoThumb"; private static final String KEY_LOCATION = "keyLocation"; Loading Loading @@ -375,19 +373,24 @@ public class WaypointFragment extends Fragment implements LoggerTask.LoggerTaskC private void addImage(View view) { clearImage(); if (requireContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)) { final CharSequence[] items = new CharSequence[2]; items[ACTION_PHOTO] = getString(R.string.take_photo); items[ACTION_LIBRARY] = getString(R.string.from_library); AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); builder.setItems(items, (dialog, item) -> { if (item == ACTION_PHOTO) { View dialogView = View.inflate(getContext(), R.layout.image_dialog, null); builder.setView(dialogView); builder.setNegativeButton(getString(R.string.cancel), (dialog, which) -> dialog.dismiss()); TextView photoTextView = dialogView.findViewById(R.id.action_photo); TextView libraryTextView = dialogView.findViewById(R.id.action_library); final AlertDialog dialog = builder.create(); photoTextView.setOnClickListener(v -> { takePhoto(); } else if (item == ACTION_LIBRARY) { dialog.dismiss(); }); libraryTextView.setOnClickListener(v -> { pickImage(); } dialog.dismiss(); }); builder.setNegativeButton(getString(R.string.cancel), (dialog, which) -> dialog.dismiss()); builder.show(); dialog.show(); } else { pickImage(); } Loading app/src/main/res/drawable/ic_baseline_photo_camera_24.xml 0 → 100644 +15 −0 Original line number Diff line number Diff line <!-- ~ Copyright (c) 2021 Bartek Fabiszewski ~ http://www.fabiszewski.net ~ ~ This file is part of μlogger-android. ~ Licensed under GPL, either version 3, or any later. ~ See <http://www.gnu.org/licenses/> --> <vector android:height="48dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="#ffffff" android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/> <path android:fillColor="#ffffff" android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/> </vector> app/src/main/res/drawable/ic_baseline_photo_library_24.xml 0 → 100644 +14 −0 Original line number Diff line number Diff line <!-- ~ Copyright (c) 2021 Bartek Fabiszewski ~ http://www.fabiszewski.net ~ ~ This file is part of μlogger-android. ~ Licensed under GPL, either version 3, or any later. ~ See <http://www.gnu.org/licenses/> --> <vector android:height="48dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="#ffffff" android:pathData="M22,16L22,4c0,-1.1 -0.9,-2 -2,-2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zM11,12l2.03,2.71L16,11l4,5L8,16l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6L2,6z"/> </vector> app/src/main/res/layout/image_dialog.xml 0 → 100644 +43 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (c) 2021 Bartek Fabiszewski ~ http://www.fabiszewski.net ~ ~ This file is part of μlogger-android. ~ Licensed under GPL, either version 3, or any later. ~ See <http://www.gnu.org/licenses/> --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="20dip"> <TextView android:id="@+id/action_photo" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="20dp" android:drawablePadding="15dp" android:gravity="center_vertical" android:text="@string/take_photo" android:textSize="18sp" android:clickable="true" app:drawableStartCompat="@drawable/ic_baseline_photo_camera_24" android:focusable="true" /> <TextView android:id="@+id/action_library" android:layout_width="match_parent" android:layout_height="wrap_content" android:drawablePadding="15dp" android:gravity="center_vertical" android:text="@string/from_library" android:textSize="18sp" android:clickable="true" app:drawableStartCompat="@drawable/ic_baseline_photo_library_24" android:focusable="true" /> </LinearLayout> No newline at end of file Loading
app/src/main/java/net/fabiszewski/ulogger/WaypointFragment.java +16 −13 Original line number Diff line number Diff line Loading @@ -55,8 +55,6 @@ public class WaypointFragment extends Fragment implements LoggerTask.LoggerTaskC private static final int REQUEST_IMAGE_OPEN = 2; private static final int PERMISSION_WRITE = 1; private static final int PERMISSION_LOCATION = 2; private static final int ACTION_PHOTO = 0; private static final int ACTION_LIBRARY = 1; private static final String KEY_URI = "keyPhotoUri"; private static final String KEY_THUMB = "keyPhotoThumb"; private static final String KEY_LOCATION = "keyLocation"; Loading Loading @@ -375,19 +373,24 @@ public class WaypointFragment extends Fragment implements LoggerTask.LoggerTaskC private void addImage(View view) { clearImage(); if (requireContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)) { final CharSequence[] items = new CharSequence[2]; items[ACTION_PHOTO] = getString(R.string.take_photo); items[ACTION_LIBRARY] = getString(R.string.from_library); AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); builder.setItems(items, (dialog, item) -> { if (item == ACTION_PHOTO) { View dialogView = View.inflate(getContext(), R.layout.image_dialog, null); builder.setView(dialogView); builder.setNegativeButton(getString(R.string.cancel), (dialog, which) -> dialog.dismiss()); TextView photoTextView = dialogView.findViewById(R.id.action_photo); TextView libraryTextView = dialogView.findViewById(R.id.action_library); final AlertDialog dialog = builder.create(); photoTextView.setOnClickListener(v -> { takePhoto(); } else if (item == ACTION_LIBRARY) { dialog.dismiss(); }); libraryTextView.setOnClickListener(v -> { pickImage(); } dialog.dismiss(); }); builder.setNegativeButton(getString(R.string.cancel), (dialog, which) -> dialog.dismiss()); builder.show(); dialog.show(); } else { pickImage(); } Loading
app/src/main/res/drawable/ic_baseline_photo_camera_24.xml 0 → 100644 +15 −0 Original line number Diff line number Diff line <!-- ~ Copyright (c) 2021 Bartek Fabiszewski ~ http://www.fabiszewski.net ~ ~ This file is part of μlogger-android. ~ Licensed under GPL, either version 3, or any later. ~ See <http://www.gnu.org/licenses/> --> <vector android:height="48dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="#ffffff" android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/> <path android:fillColor="#ffffff" android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/> </vector>
app/src/main/res/drawable/ic_baseline_photo_library_24.xml 0 → 100644 +14 −0 Original line number Diff line number Diff line <!-- ~ Copyright (c) 2021 Bartek Fabiszewski ~ http://www.fabiszewski.net ~ ~ This file is part of μlogger-android. ~ Licensed under GPL, either version 3, or any later. ~ See <http://www.gnu.org/licenses/> --> <vector android:height="48dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="#ffffff" android:pathData="M22,16L22,4c0,-1.1 -0.9,-2 -2,-2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zM11,12l2.03,2.71L16,11l4,5L8,16l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6L2,6z"/> </vector>
app/src/main/res/layout/image_dialog.xml 0 → 100644 +43 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (c) 2021 Bartek Fabiszewski ~ http://www.fabiszewski.net ~ ~ This file is part of μlogger-android. ~ Licensed under GPL, either version 3, or any later. ~ See <http://www.gnu.org/licenses/> --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="20dip"> <TextView android:id="@+id/action_photo" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="20dp" android:drawablePadding="15dp" android:gravity="center_vertical" android:text="@string/take_photo" android:textSize="18sp" android:clickable="true" app:drawableStartCompat="@drawable/ic_baseline_photo_camera_24" android:focusable="true" /> <TextView android:id="@+id/action_library" android:layout_width="match_parent" android:layout_height="wrap_content" android:drawablePadding="15dp" android:gravity="center_vertical" android:text="@string/from_library" android:textSize="18sp" android:clickable="true" app:drawableStartCompat="@drawable/ic_baseline_photo_library_24" android:focusable="true" /> </LinearLayout> No newline at end of file