mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-24 22:48:34 +00:00
Merge branch 'bug4884'
Change-Id: I6a007134268a7b16e1ee1016f765d13a56e198c5
This commit is contained in:
@@ -116,7 +116,7 @@ fi
|
||||
echo "Now go to https://git.wdf.sap.corp/#/dashboard/self and vote on your change, using the \"Reply\" button."
|
||||
echo "Remove the pMiosVoter because it has nothing good to say on Android. Then \"Submit\" your change to merge it to $RELEASE_BRANCH."
|
||||
echo "After successful merge, launch a customer stage build here: https://xmake-ldi.wdf.sap.corp:8443/view/SAPSail/job/sapsailingcapture-Release/"
|
||||
echo "When done, create a BCP update ticket. See https://wiki.wdf.sap.corp/wiki/display/NAAS/Mobile+Patch+Releases (remove the saprole parameter from the URL)"
|
||||
echo "When done, create a BCP update ticket. See https://wiki.wdf.sap.corp/wiki/display/NAAS/Mobile+Patch+Releases \(remove the saprole parameter from the URL\)"
|
||||
echo "Copy the description of, e.g., https://support.wdf.sap.corp/sap/support/message/1670304244 to start with and adjust versions and commit IDs."
|
||||
echo "Make sure you have your Metaman stuff updated, particularly the Release Notes section."
|
||||
echo "Then wait for feedback on the release build being ready for smoke testing, do the smoke tests and report back in BCP. That's it :-)"
|
||||
echo "Then wait for feedback on the release build being ready for smoke testing, do the smoke tests and report back in BCP. That\'s it :-\)"
|
||||
|
||||
+63
-30
@@ -1,31 +1,18 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.fragments.raceinfo;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.android.shared.logging.ExLog;
|
||||
import com.sap.sailing.android.shared.util.ViewHelper;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.PhotoListAdapter;
|
||||
import com.sap.sailing.racecommittee.app.ui.layouts.HeaderLayout;
|
||||
import com.sap.sailing.racecommittee.app.ui.views.decoration.PaddingItemDecoration;
|
||||
import com.sap.sailing.racecommittee.app.utils.CameraHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.MailHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.RaceHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.StringHelper;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -35,9 +22,30 @@ import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.sap.sailing.android.shared.logging.ExLog;
|
||||
import com.sap.sailing.android.shared.util.ViewHelper;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.BuildConfig;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.PhotoListAdapter;
|
||||
import com.sap.sailing.racecommittee.app.ui.layouts.HeaderLayout;
|
||||
import com.sap.sailing.racecommittee.app.ui.views.decoration.PaddingItemDecoration;
|
||||
import com.sap.sailing.racecommittee.app.utils.CameraHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.MailHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.RaceHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.StringHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class PhotoListFragment extends BaseFragment {
|
||||
|
||||
private final static String TAG = PhotoListFragment.class.getName();
|
||||
private static final int RC_PERMISSION = 2;
|
||||
private final static int PHOTO_SHOOTING = 9000;
|
||||
|
||||
private ArrayList<Uri> mPhotos;
|
||||
@@ -67,17 +75,11 @@ public class PhotoListFragment extends BaseFragment {
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
CameraHelper cameraHelper = CameraHelper.on(getActivity());
|
||||
Uri photoUri = cameraHelper.getOutputMediaFileUri(CameraHelper.MEDIA_TYPE_IMAGE,
|
||||
cameraHelper.getSubFolder(getRace()));
|
||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
PackageManager manager = getActivity().getPackageManager();
|
||||
List<ResolveInfo> activities = manager.queryIntentActivities(intent, 0);
|
||||
if (activities.size() > 0) {
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
|
||||
startActivityForResult(intent, PHOTO_SHOOTING);
|
||||
if (ContextCompat.checkSelfPermission(requireContext(),
|
||||
Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
|
||||
dispatchTakePictureIntent();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getString(R.string.no_camera), Toast.LENGTH_LONG).show();
|
||||
requestPermissions(new String[]{Manifest.permission.CAMERA}, RC_PERMISSION);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -129,6 +131,16 @@ public class PhotoListFragment extends BaseFragment {
|
||||
refreshPhotoList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||
@NonNull int[] grantResults) {
|
||||
if (requestCode == RC_PERMISSION) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
dispatchTakePictureIntent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
@@ -148,6 +160,25 @@ public class PhotoListFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchTakePictureIntent() {
|
||||
CameraHelper cameraHelper = CameraHelper.on(getActivity());
|
||||
Uri photoUri = cameraHelper.getOutputMediaFileUri(CameraHelper.MEDIA_TYPE_IMAGE,
|
||||
cameraHelper.getSubFolder(getRace()));
|
||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
PackageManager manager = getActivity().getPackageManager();
|
||||
List<ResolveInfo> activities = manager.queryIntentActivities(intent, 0);
|
||||
if (activities.size() > 0) {
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
|
||||
intent.setClipData(ClipData.newRawUri("", photoUri));
|
||||
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
}
|
||||
startActivityForResult(intent, PHOTO_SHOOTING);
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getString(R.string.no_camera), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshPhotoList() {
|
||||
mPhotos.clear();
|
||||
CameraHelper cameraHelper = CameraHelper.on(getActivity());
|
||||
@@ -178,7 +209,9 @@ public class PhotoListFragment extends BaseFragment {
|
||||
for (File file : files) {
|
||||
if (file.getName().endsWith(CameraHelper.MEDIA_TYPE_IMAGE_EXT)
|
||||
|| file.getName().endsWith(CameraHelper.MEDIA_TYPE_VIDEO_EXT)) {
|
||||
retValue.add(Uri.fromFile(file));
|
||||
String authority = BuildConfig.APPLICATION_ID + ".fileprovider";
|
||||
Uri contentUri = FileProvider.getUriForFile(requireContext(), authority, file);
|
||||
retValue.add(contentUri);
|
||||
}
|
||||
}
|
||||
Collections.sort(retValue, new Comparator<Uri>() {
|
||||
|
||||
Reference in New Issue
Block a user