Commit 1d816306 authored by Krishna Bhilare's avatar Krishna Bhilare

Initial commit

parents
Pipeline #40 failed with stages
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
apply plugin: 'com.android.application'
ext.versionMajor = 1
ext.versionMinor = 1
ext.versionPatch = 4
ext.minSdkVersion = 21
android {
compileSdkVersion 28
defaultConfig {
applicationId "ibase.android.visionselfie"
minSdkVersion 21
targetSdkVersion 28
versionCode generateVersionCode()//1 //210010000
versionName generateVersionName()//"1.0"//1.0.0"1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
private Integer generateVersionCode() {
return ext.minSdkVersion * 10000000 + ext.versionMajor * 10000 + ext.versionMinor * 100 + ext.versionPatch
}
private String generateVersionName() {
String versionName = "${ext.versionMajor}.${ext.versionMinor}.${ext.versionPatch}"
return versionName
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//Support Design Library
implementation 'com.android.support:design:28.0.0'
//glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
// implementation 'com.android.support:exifinterface:28.0.0'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package ibase.android.visionselfie;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("ibase.android.visionselfie", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="ibase.android.visionselfie">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".SampleActivity">
<intent-filter
android:autoVerify="true"
tools:targetApi="m">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="proteusvision.com"
android:scheme="https" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter> <!-- Define your supported deeplinks -->
</activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<meta-data
android:name="com.google.android.actions"
android:resource="@xml/actions" />
</application>
</manifest>
\ No newline at end of file
package ibase.android.visionselfie;
import android.content.Context;
import android.util.AttributeSet;
import android.view.TextureView;
/**
* A {@link TextureView} that can be adjusted to a specified aspect ratio.
*/
public class AutoFitTextureView extends TextureView {
private static final String TAG = "AutoFitTextureView";
private int mRatioWidth = 0;
private int mRatioHeight = 0;
private int mScreenWidth = 0;
private int mScreenHeight = 0;
public AutoFitTextureView(Context context) {
this(context, null);
}
public AutoFitTextureView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public AutoFitTextureView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public AutoFitTextureView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
/**
* Sets the aspect ratio for this view. The size of the view will be measured based on the ratio
* calculated from the parameters. Note that the actual sizes of parameters don't matter, that
* is, calling setAspectRatio(2, 3) and setAspectRatio(4, 6) make the same result.
*
* @param width Relative horizontal size
* @param height Relative vertical size
*/
// public void setAspectRatio(int width, int height, int screenWidth, int screenHeight) {
public void setAspectRatio(int width, int height) {
if (width < 0 || height < 0) {
throw new IllegalArgumentException("Size cannot be negative.");
}
mRatioWidth = width;
mRatioHeight = height;
requestLayout();
// mScreenWidth = screenWidth;
// mScreenHeight = screenHeight;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
// final int width = resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec);
// final int height = resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec);
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
if (0 == mRatioWidth || 0 == mRatioHeight) {
setMeasuredDimension(width, height);
} else {
if (width < height * mRatioWidth / mRatioHeight) {
setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
} else {
setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
}
}
// setMeasuredDimension(mScreenWidth,mScreenHeight);
}
}
package ibase.android.visionselfie;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.ImageFormat;
import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
import android.graphics.drawable.Drawable;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CameraMetadata;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.TotalCaptureResult;
import android.hardware.camera2.params.OutputConfiguration;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.media.ExifInterface;
import android.media.Image;
import android.media.ImageReader;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.HandlerThread;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Size;
import android.util.SparseIntArray;
import android.view.LayoutInflater;
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.MimeTypeMap;
import android.widget.ImageButton;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URI;
import java.nio.ByteBuffer;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
/**
* A simple {@link Fragment} subclass.
*/
public class CameraFragment extends Fragment implements View.OnClickListener {
private static final String TAG = "CameraFragment";
private static final int REQUEST_CAMERA_PERMISSION = 1;
private static final String FRAGMENT_DIALOG = "dialog";
private static final SparseIntArray ORIENTATIONS = new SparseIntArray();
static {
ORIENTATIONS.append(Surface.ROTATION_0, 90);
ORIENTATIONS.append(Surface.ROTATION_90, 0);
ORIENTATIONS.append(Surface.ROTATION_180, 270);
ORIENTATIONS.append(Surface.ROTATION_270, 180);
}
private int SCREEN_WIDTH = 0;
private int SCREEN_HEIGHT = 0;
/**
* An {@link AutoFitTextureView} for camera preview.
*/
private AutoFitTextureView mTextureView;
/**
* An additional thread for running tasks that shouldn't block the UI.
*/
private HandlerThread mBackgroundThread;
/**
* A {@link Handler} for running tasks in the background.
*/
private Handler mBackgroundHandler;
/**
* ID of the current {@link CameraDevice}.
*/
private String mCameraId;
private float ASPECT_RATIO_ERROR_RANGE = 0.1f;
/**
* Orientation of the camera sensor
*/
private int mSensorOrientation;
/**
* Max preview width that is guaranteed by Camera2 API
*/
private int MAX_PREVIEW_WIDTH = 1920;
// private int MAX_PREVIEW_WIDTH = 1280;
/**
* Max preview height that is guaranteed by Camera2 API
*/
private int MAX_PREVIEW_HEIGHT = 1080;
// private int MAX_PREVIEW_HEIGHT = 720;
/**
* The {@link android.util.Size} of camera preview.
*/
private Size mPreviewSize;
/**
* A {@link Semaphore} to prevent the app from exiting before closing the camera.
*/
private Semaphore mCameraOpenCloseLock = new Semaphore(1);
/**
* A reference to the opened {@link CameraDevice}.
*/
private CameraDevice mCameraDevice;
/**
* {@link CaptureRequest.Builder} for the camera preview
*/
private CaptureRequest.Builder mPreviewRequestBuilder;
/**
* A {@link CameraCaptureSession } for camera preview.
*/
private CameraCaptureSession mCaptureSession;
/**
* {@link CaptureRequest} generated by {@link #mPreviewRequestBuilder}
*/
private CaptureRequest mPreviewRequest;
/**
* Camera state: Showing camera preview.
*/
private static final int STATE_PREVIEW = 0;
/**
* Camera state: Waiting for the focus to be locked.
*/
private static final int STATE_WAITING_LOCK = 1;
/**
* Camera state: Waiting for the exposure to be precapture state.
*/
private static final int STATE_WAITING_PRECAPTURE = 2;
/**
* Camera state: Waiting for the exposure state to be something other than precapture.
*/
private static final int STATE_WAITING_NON_PRECAPTURE = 3;
/**
* Camera state: Picture was taken.
*/
private static final int STATE_PICTURE_TAKEN = 4;
/**
* The current state of camera state for taking pictures.
*
* @see #mCaptureCallback
*/
private int mState = STATE_PREVIEW;
/**
* An {@link ImageReader} that handles still image capture.
*/
private ImageReader mImageReader;
private boolean mIsImageAvailable = false;
private Image mCapturedImage;
private IMainActivity mIMainActivity;
private ImageView mStillShotImageViewClose;
private ImageButton mBtnStillshot, mBtnInitSticker;
private View viewOrientationBg, viewInitStickerBg, viewStillShotBg, viewBgSave,viewBgShare;
private ImageButton mBtnSwitchOrientation, mBtnSave,mBtnShare;
private Bitmap mCapturedBitmap;
private BackgroundImageRotator mBackgroundImageRotater;
public DrawableImageView mStillshotImageView;
private View view_orientation_bg_close;
private boolean mIsCurrentlyDrawing = false;
// view_orientation_bg_save
// ibtn_save
public static String imageName;
private boolean mImageIsSaved;
private boolean wantToShare;
// private String imageName;
/*
* view_orientation_bg_close
iv_close_stillshot_view
* */
public static CameraFragment newInstance() {
return new CameraFragment();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.d(TAG, "onCreateView: ");
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_camera, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
Log.d(TAG, "onViewCreated: ");
view.findViewById(R.id.stillshot).setOnClickListener(this);
view.findViewById(R.id.switch_orientation).setOnClickListener(this);
view.findViewById(R.id.ibtn_save).setOnClickListener(this);
view.findViewById(R.id.init_sticker_icon).setOnClickListener(this);
mStillshotImageView = view.findViewById(R.id.stillshot_imageview);
mBtnStillshot = view.findViewById(R.id.stillshot);
viewStillShotBg = view.findViewById(R.id.view_stillshot_bg);
mBtnInitSticker = view.findViewById(R.id.init_sticker_icon);
viewInitStickerBg = view.findViewById(R.id.view_orientation_bg_sticker_icon);
viewOrientationBg = view.findViewById(R.id.view_orientation_bg);
mBtnSwitchOrientation = view.findViewById(R.id.switch_orientation);
mStillShotImageViewClose = view.findViewById(R.id.iv_close_stillshot_view);
mStillShotImageViewClose.setOnClickListener(this);
view_orientation_bg_close = view.findViewById(R.id.view_orientation_bg_close);
mBtnSave = view.findViewById(R.id.ibtn_save);
viewBgSave = view.findViewById(R.id.view_orientation_bg_save);
mBtnShare = view.findViewById(R.id.ibtn_share);
mBtnShare.setOnClickListener(this);
viewBgShare = view.findViewById(R.id.view_orientation_bg_share);
mTextureView = view.findViewById(R.id.texture);
setMaxSizes();
resetIconVisibilities();
}
private void resetIconVisibilities() {
Log.d(TAG, "resetIconVisibilities: ");
viewOrientationBg.setVisibility(View.VISIBLE);
mBtnSwitchOrientation.setVisibility(View.VISIBLE);
// mStillshotImageView.setVisibility(View.INVISIBLE);
mBtnStillshot.setVisibility(View.VISIBLE);
viewStillShotBg.setVisibility(View.VISIBLE);
mBtnInitSticker.setVisibility(View.VISIBLE);
viewInitStickerBg.setVisibility(View.VISIBLE);
mStillShotImageViewClose.setVisibility(View.INVISIBLE);
view_orientation_bg_close.setVisibility(View.INVISIBLE);
mBtnSave.setVisibility(View.INVISIBLE);
viewBgSave.setVisibility(View.INVISIBLE);
mBtnShare.setVisibility(View.INVISIBLE);
viewBgShare.setVisibility(View.INVISIBLE);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.stillshot:
Log.d(TAG, "onClick: taking picture");
takePicture();
break;
case R.id.switch_orientation:
Log.d(TAG, "onClick: switching camera orientation");
toggleCameraDisplayOrientation();
break;
case R.id.iv_close_stillshot_view:
hideStillShotContainer();
break;
case R.id.ibtn_save:
saveCapturedStillShotToDisk();
break;
case R.id.init_sticker_icon:
toggleStickers();
break;
case R.id.ibtn_share:
shareSavedImage();
break;
}
}
private void shareSavedImage() {
wantToShare = true;
if (mImageIsSaved) {
Log.d(TAG, "shareSavedImage: ");
// File myFile = Environment.getExternalStoragePublicDirectory("/VisionSelfie/" + imageName);
File myFile = Environment.getExternalStoragePublicDirectory("/VisionMoments/" + imageName);
MimeTypeMap mime = MimeTypeMap.getSingleton();
String ext = myFile.getName().substring(myFile.getName().lastIndexOf(".") + 1);
String type = mime.getMimeTypeFromExtension(ext);
Intent sharingIntent = new Intent("android.intent.action.SEND");
sharingIntent.setType(type);
// sharingIntent.putExtra("android.intent.extra.STREAM", Uri.fromFile(myFile));
sharingIntent.putExtra("android.intent.extra.STREAM", FileProvider.getUriForFile(getActivity().getApplicationContext(), BuildConfig.APPLICATION_ID + ".provider", myFile));
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(sharingIntent, "Share using"));
} else {
saveCapturedStillShotToDisk();
}
}
private void shareCapturedStillShotToSocialMedia(Bitmap bitmap, String fileName) {
// private void shareBitmap(Bitmap bitmap) {
// final String shareText = getString(R.string.share_text) + " "
// + getString(R.string.app_name) + " developed by "
// + "https://play.google.com/store/apps/details?id=" + getPackageName() + ": \n\n";
try {
File file = new File(getActivity().getExternalCacheDir(), "share.png");
FileOutputStream fOut = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
fOut.flush();
fOut.close();
file.setReadable(true, false);
final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_TEXT, fileName);
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
intent.setType("image/png");
startActivity(Intent.createChooser(intent, "Share image via"));
} catch (Exception e) {
e.printStackTrace();
}
// }
/*try {
// File file = new File(getContext().getCacheDir(), fileName + ".png");
File file = new File(getContext().getCacheDir(), fileName );
FileOutputStream fOut = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
fOut.flush();
fOut.close();
file.setReadable(true, false);
final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
intent.setType("image/png");
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
*/
/* Bitmap icon = mBitmap;
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
icon.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
File f = new File(Environment.getExternalStorageDirectory() + File.separator + "temporary_file.jpg");
try {
f.createNewFile();
FileOutputStream fo = new FileOutputStream(f);
fo.write(bytes.toByteArray());
} catch (IOException e) {
e.printStackTrace();
}
share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/temporary_file.jpg"));
startActivity(Intent.createChooser(share, "Share Image"));*/
}
private void toggleStickers() {
Log.d(TAG, "toggleStickers: Display Sticker called");
mIMainActivity.toggleViewStickersFragment();
}
private void saveCapturedStillShotToDisk() {
Log.d(TAG, "saveCapturedStillShotToDisk: saving image to disk.");
if (mIsImageAvailable) {
final ICallBack callBack = new ICallBack() {
@Override
public void done(Exception e) {
if (e == null) {
Log.d(TAG, "onImageSavedCallback: image saved!");
showSnackBar("Image saved", Snackbar.LENGTH_SHORT);
mImageIsSaved = true;
if (wantToShare) {
shareSavedImage();
}
// File imageFile = Environment.getExternalStoragePublicDirectory("/VisionSelfie/" + imageName);
File imageFile = Environment.getExternalStoragePublicDirectory("/VisionMoments/" + imageName);
MediaScannerConnection.scanFile(getActivity(), new String[]{imageFile.getPath()}, new String[]{"image/jpeg"}, null);
Log.d(TAG, "done: MediaScannerConnection");
/*--------------------*/
/*Log.d(TAG, "doInBackground: adjusting image for display...");
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES+"/VisionSelfie/"+imageName);
// File file = new File(getActivity().getExternalFilesDir(null), "temp_image.jpg");
Log.d(TAG, "done: path: "+path);
final Uri tempImageUri = Uri.fromFile(path);
Bitmap bitmap = null;
try {
bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), tempImageUri);
// shareCapturedStillShotToSocialMedia(bitmap,"Vision Selfie");
} catch (IOException e1) {
e1.printStackTrace();
}*/
/*--------------------*/
} else {
Log.d(TAG, "done: error saving image " + e.getMessage());
showSnackBar("Error saving image", Snackbar.LENGTH_SHORT);
}
}
};
if (mCapturedImage != null) {
Log.d(TAG, "saveCapturedStillShotToDisk: Saving image to disk");
mStillshotImageView.invalidate();
Log.d(TAG, "saveCapturedStillShotToDisk: width: "+mStillshotImageView.getDrawable().getIntrinsicWidth());
Log.d(TAG, "saveCapturedStillShotToDisk: height: "+mStillshotImageView.getDrawable().getIntrinsicHeight());
Bitmap bitmap = Bitmap.createBitmap(mStillshotImageView.getDrawingCache());
Log.d(TAG, "saveCapturedStillShotToDisk: bitmap: w*h "+ bitmap.getWidth() +" : "+ bitmap.getHeight());
File path = Environment.getExternalStoragePublicDirectory("/VisionMoments");
// File path = Environment.getExternalStoragePublicDirectory("/VisionSelfie");
// File path = new File(Environment.getExternalStorageDirectory() + "/VisionSelfie");
// File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM+"/VisionSelfie");
// File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES+"/VisionSelfie");
if (!path.exists()) {
path.mkdirs();
}
File file = new File(String.valueOf(path));
ImageSaver imageSaver = new ImageSaver(
bitmap,
// getActivity().getExternalFilesDir(null),
file,
callBack
);
mBackgroundHandler.post(imageSaver);
}
}
}
private void hideStillShotContainer() {
mIMainActivity.showStatusBar();
if (mIsImageAvailable) {
mIsImageAvailable = false;
mCapturedBitmap = null;
mStillshotImageView.setImageBitmap(null);
mStillshotImageView.reset();
resetIconVisibilities();
reopenCamera();
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
try {
mIMainActivity = (IMainActivity) getActivity();
} catch (ClassCastException e) {
Log.e(TAG, "onAttach: ClassCastException: " + e.getMessage());
}
}
private void toggleCameraDisplayOrientation() {
if (mCameraId.equals(mIMainActivity.getBackCameraId())) {
mCameraId = mIMainActivity.getFrontCameraId();
mIMainActivity.setCameraFrontFacing();
closeCamera();
reopenCamera();
Log.d(TAG, "toggleCameraDisplayOrientation: switching to front-facing camera");
} else if (mCameraId.equals(mIMainActivity.getFrontCameraId())) {
mCameraId = mIMainActivity.getBackCameraId();
mIMainActivity.setCameraBackFacing();
closeCamera();
reopenCamera();
Log.d(TAG, "toggleCameraDisplayOrientation: switching to back-facing camera");
} else {
Log.d(TAG, "toggleCameraDisplayOrientation: error");
}
}
/**
* Initiate a still image capture.
*/
private void takePicture() {
lockFocus();
}
private void lockFocus() {
Log.d(TAG, "lockFocus: ");
try {
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_START);
mState = STATE_WAITING_LOCK;
// mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback, mBackgroundHandler);
//
captureStillPicture();
// } catch (CameraAccessException e) {
// e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
}
private void setMaxSizes() {
Point displaySize = new Point();
getActivity().getWindowManager().getDefaultDisplay().getSize(displaySize);
SCREEN_HEIGHT = displaySize.x;
SCREEN_WIDTH = displaySize.y;
Log.d(TAG, "setMaxSizes: screen width: " + SCREEN_WIDTH);
Log.d(TAG, "setMaxSizes: screen height: " + SCREEN_HEIGHT);
}
@Override
public void onResume() {
Log.d(TAG, "onResume: ");
super.onResume();
startBackgroundThread();
if (mIsImageAvailable) {
mIMainActivity.hideStatusBar();
} else {
// mIMainActivity.showStatusBar();
mIMainActivity.hideStatusBar();
// When the screen is turned off and turned back on, the SurfaceTexture is already
// available, and "onSurfaceTextureAvailable" will not be called. In that case, we can open
// a camera and start preview from here (otherwise, we wait until the surface is ready in
// the SurfaceTextureListener).
reopenCamera();
}
}
@Override
public void onPause() {
Log.d(TAG, "onPause: ");
super.onPause();
closeCamera();
stopBackgroundThread();
if (mBackgroundImageRotater != null) {
mBackgroundImageRotater.cancel(true);
}
}
/**
* Starts a background thread and its {@link Handler}.
*/
private void startBackgroundThread() {
if (mBackgroundThread == null) {
Log.d(TAG, "startBackgroundThread: called.");
mBackgroundThread = new HandlerThread("CameraBackground");
mBackgroundThread.start();
mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
}
}
/**
* Stops the background thread and its {@link Handler}.
*/
private void stopBackgroundThread() {
if (mBackgroundThread != null) {
mBackgroundThread.quitSafely();
try {
mBackgroundThread.join();
mBackgroundThread = null;
mBackgroundHandler = null;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void reopenCamera() {
Log.d(TAG, "reopenCamera: ");
if (mTextureView.isAvailable()) {
Log.d(TAG, "reopenCamera: a surface is available");
openCamera(mTextureView.getWidth(), mTextureView.getHeight());
} else {
Log.d(TAG, "reopenCamera: no surface is available");
mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
}
}
/**
* Closes the current {@link CameraDevice}.
*/
private void closeCamera() {
Log.d(TAG, "closeCamera: ");
try {
mCameraOpenCloseLock.acquire();
if (null != mCaptureSession) {
mCaptureSession.close();
mCaptureSession = null;
Log.d(TAG, "closeCamera: mCaptureSession.close();");
}
if (null != mCameraDevice) {
mCameraDevice.close();
mCameraDevice = null;
Log.d(TAG, "closeCamera: mCameraDevice.close();");
}
if (null != mImageReader) {
mImageReader.close();
mImageReader = null;
Log.d(TAG, "closeCamera: mImageReader.close();");
}
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted while trying to lock camera closing.", e);
} finally {
Log.d(TAG, "closeCamera: mCameraOpenCloseLock.release()");
mCameraOpenCloseLock.release();
}
}
private final TextureView.SurfaceTextureListener mSurfaceTextureListener = new TextureView.SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
Log.d(TAG, "onSurfaceTextureAvailable: w: " + width + " h: " + height);
openCamera(width, height);
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
Log.d(TAG, "onSurfaceTextureSizeChanged: w: " + width + " h: " + height);
configureTransform(width, height);
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture texture) {
return true;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
}
};
/**
* Configures the necessary {@link android.graphics.Matrix} transformation to `mTextureView`.
* This method should be called after the camera preview size is determined in
* setUpCameraOutputs and also the size of `mTextureView` is fixed.
*
* @param viewWidth The width of `mTextureView`
* @param viewHeight The height of `mTextureView`
*/
private void configureTransform(int viewWidth, int viewHeight) {
Activity activity = getActivity();
if (null == mTextureView || null == mPreviewSize || null == activity) {
return;
}
int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
Matrix matrix = new Matrix();
RectF viewRect = new RectF(0, 0, viewWidth, viewHeight);
Log.d(TAG, "configureTransform: viewWidth: " + viewWidth + ", viewHeight: " + viewHeight);
Log.d(TAG, "configureTransform: previewWidth: " + mPreviewSize.getWidth() + ", previewHeight: " + mPreviewSize.getHeight());
RectF bufferRect = new RectF(0, 0, mPreviewSize.getHeight(), mPreviewSize.getWidth());
float centerX = viewRect.centerX();
float centerY = viewRect.centerY();
if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) {
Log.d(TAG, "configureTransform: rotating from 90 or 270");
bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);
float scale = Math.max(
(float) viewHeight / mPreviewSize.getHeight(),
(float) viewWidth / mPreviewSize.getWidth());
matrix.postScale(scale, scale, centerX, centerY);
matrix.postRotate(90 * (rotation - 2), centerX, centerY);
} else if (Surface.ROTATION_180 == rotation) {
Log.d(TAG, "configureTransform: rotating 180.");
matrix.postRotate(180, centerX, centerY);
}
/*for strange device accounting start*/
float screenAspectRatio = (float) SCREEN_WIDTH / (float) SCREEN_HEIGHT;
float previewAspectRatio = (float) mPreviewSize.getWidth() / (float) mPreviewSize.getHeight();
String roundedScreenAspectRatio = String.format("%.2f", screenAspectRatio);
String roundedPreviewAspectRatio = String.format("%.2f", previewAspectRatio);
if (!roundedPreviewAspectRatio.equals(roundedScreenAspectRatio)) {
float scaleFactor = (screenAspectRatio / previewAspectRatio);
Log.d(TAG, "configureTransform: scale factor: " + scaleFactor);
float heightCorrection = (((float) SCREEN_HEIGHT * scaleFactor) - (float) SCREEN_HEIGHT) / 2;
matrix.postScale(scaleFactor, 1);
matrix.postTranslate(-heightCorrection, 0);
}
/*for strange device accounting start*/
mTextureView.setTransform(matrix);
}
private void openCamera(int width, int height) {
if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
requestCameraPermission();
return;
}
/*original code working*/
setupCameraOutputs(width, height);
configureTransform(width, height);
Activity activity = getActivity();
CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
try {
if (!mCameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) {
throw new RuntimeException("Time out waiting to lock camera opening.");
}
manager.openCamera(mCameraId, mStateCallback, mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted while trying to lock camera opening.", e);
}
/*setupCameraOutputs(width, height);
configureTransform(width, height);
mTextureView.post(new Runnable() {
@Override
public void run() {
mBackgroundHandler.post(new Runnable() {
@Override
public void run() {
Activity activity = getActivity();
CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
try {
if (!mCameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) {
throw new RuntimeException("Time out waiting to lock camera opening.");
}
if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
manager.openCamera(mCameraId, mStateCallback, mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted while trying to lock camera opening.", e);
}
}
});
}
});*/
}
/**
* {@link CameraDevice.StateCallback} is called when {@link CameraDevice} changes its state.
*/
private CameraDevice.StateCallback mStateCallback = new CameraDevice.StateCallback() {
@Override
public void onOpened(@NonNull CameraDevice camera) {
// This method is called when the camera is opened. We start camera preview here.
mCameraOpenCloseLock.release();
mCameraDevice = camera;
createCameraPreviewSession();
}
@Override
public void onDisconnected(@NonNull CameraDevice camera) {
mCameraOpenCloseLock.release();
camera.close();
mCameraDevice = null;
}
@Override
public void onError(@NonNull CameraDevice camera, int error) {
Log.d(TAG, "onError: " + error);
mCameraOpenCloseLock.release();
camera.close();
mCameraDevice = null;
Activity activity = getActivity();
if (null != activity) {
activity.finish();
}
}
};
/**
* Creates a new {@link CameraCaptureSession} for camera preview.
*/
private void createCameraPreviewSession() {
try {
SurfaceTexture texture = mTextureView.getSurfaceTexture();
assert texture != null;
// We configure the size of default buffer to be the size of camera preview we want.
texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());
// This is the output Surface we need to start preview.
Surface surface = new Surface(texture);
// We set up a CaptureRequest.Builder with the output Surface.
mPreviewRequestBuilder
= mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
mPreviewRequestBuilder.addTarget(surface);
// Here, we create a CameraCaptureSession for camera preview.
mCameraDevice.createCaptureSession(Arrays.asList(surface, mImageReader.getSurface()),
new CameraCaptureSession.StateCallback() {
@Override
public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {
// The camera is already closed
if (null == mCameraDevice) {
return;
}
// When the session is ready, we start displaying the preview.
mCaptureSession = cameraCaptureSession;
try {
// Auto focus should be continuous for camera preview.
// Most new-ish phones can auto focus
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,
CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
// Finally, we start displaying the camera preview.
mPreviewRequest = mPreviewRequestBuilder.build();
mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback, mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
@Override
public void onConfigureFailed(
@NonNull CameraCaptureSession cameraCaptureSession) {
showSnackBar("Failed", Snackbar.LENGTH_LONG);
}
}, null
);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
private CameraCaptureSession.CaptureCallback mCaptureCallback = new CameraCaptureSession.CaptureCallback() {
private void process(CaptureResult result) {
switch (mState) {
case STATE_PREVIEW: {
// We have nothing to do when the camera preview is working normally.
break;
}
case STATE_WAITING_LOCK: {
Integer afState = result.get(CaptureResult.CONTROL_AF_STATE);
if (afState == null) {
captureStillPicture();
} else if (CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED == afState ||
CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED == afState) {
// CONTROL_AE_STATE can be null on some devices
Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
if (aeState == null ||
aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
mState = STATE_PICTURE_TAKEN;
captureStillPicture();
} else {
runPrecaptureSequence();
}
} else if (afState == CaptureResult.CONTROL_AF_STATE_INACTIVE) {
mState = STATE_PICTURE_TAKEN;
captureStillPicture();
}
break;
}
case STATE_WAITING_PRECAPTURE: {
// CONTROL_AE_STATE can be null on some devices
Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
if (aeState == null ||
aeState == CaptureResult.CONTROL_AE_STATE_PRECAPTURE ||
aeState == CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED) {
mState = STATE_WAITING_NON_PRECAPTURE;
}
break;
}
case STATE_WAITING_NON_PRECAPTURE: {
// CONTROL_AE_STATE can be null on some devices
Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
if (aeState == null || aeState != CaptureResult.CONTROL_AE_STATE_PRECAPTURE) {
mState = STATE_PICTURE_TAKEN;
captureStillPicture();
}
break;
}
}
}
@Override
public void onCaptureProgressed(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull CaptureResult partialResult) {
super.onCaptureProgressed(session, request, partialResult);
process(partialResult);
}
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
super.onCaptureCompleted(session, request, result);
process(result);
}
};
/**
* Run the precapture sequence for capturing a still image. This method should be called when
* we get a response in {@link #mCaptureCallback} from {@link #lockFocus()}.
*/
private void runPrecaptureSequence() {
try {
// This is how to tell the camera to trigger.
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER, CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_START);
// Tell #mCaptureCallback to wait for the precapture sequence to be set.
mState = STATE_WAITING_PRECAPTURE;
mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback, mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
/**
* Capture a still picture. This method should be called when we get a response in
* {@link #mCaptureCallback} from both {@link #lockFocus()}.
*/
private void captureStillPicture() {
Log.d(TAG, "captureStillPicture: capturing picture");
try {
final Activity activity = getActivity();
if (null == activity || null == mCameraDevice) {
return;
}
// This is the CaptureRequest.Builder that we use to take a picture.
CaptureRequest.Builder captureBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
captureBuilder.addTarget(mImageReader.getSurface());
// Use the same AE and AF modes as the preview.
captureBuilder.set(CaptureRequest.CONTROL_AF_MODE,
CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
// Orientation
// Rotate the image from screen orientation to image orientation
int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));
CameraCaptureSession.CaptureCallback captureCallback = new CameraCaptureSession.CaptureCallback() {
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
unlockFocus();
}
};
mCaptureSession.stopRepeating();
mCaptureSession.abortCaptures();
mCaptureSession.capture(captureBuilder.build(), captureCallback, null);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
/**
* Unlock the focus. This method should be called when still image capture sequence is
* finished.
*/
private void unlockFocus() {
try {
// Reset the auto-focus trigger
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_CANCEL);
mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback, mBackgroundHandler);
// After this, the camera will go back to the normal state of preview.
mState = STATE_PREVIEW;
mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback, mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
}
/**
* This a callback object for the {@link ImageReader}. "onImageAvailable" will be called when a
* still image is ready to be saved.
*/
private final ImageReader.OnImageAvailableListener mOnImageAvailableListener = new ImageReader.OnImageAvailableListener() {
@Override
public void onImageAvailable(ImageReader reader) {
Log.d(TAG, "onImageAvailable: called.");
if (!mIsImageAvailable) {
mCapturedImage = reader.acquireLatestImage();
Log.d(TAG, "onImageAvailable: captured image width : " + mCapturedImage.getWidth());
Log.d(TAG, "onImageAvailable: captured image height : " + mCapturedImage.getHeight());
saveTempImageToStorage();
/*final Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Glide.with(activity)
.load(mCapturedImage)
.into(mStillshotImageView);
showStillShotContainer();
}
});
}*/
}
}
};
private void saveTempImageToStorage() {
Log.d(TAG, "saveTempImageToStorage: saving temp image to disk.");
final ICallBack callBack = new ICallBack() {
@Override
public void done(Exception e) {
if (e == null) {
Log.d(TAG, "done: onImageSavedCallback: image saved!");
mBackgroundImageRotater = new BackgroundImageRotator(getActivity());
mBackgroundImageRotater.execute();
mIsImageAvailable = true;
mCapturedImage.close();
} else {
Log.d(TAG, "done: onImageSavedCallback: error saving image: " + e.getMessage());
showSnackBar("Error displaying image", Snackbar.LENGTH_SHORT);
}
}
};
if (getActivity() != null) {
ImageSaver imageSaver = new ImageSaver(getActivity().getExternalFilesDir(null), mCapturedImage, callBack);
// ImageSaver imageSaver = new ImageSaver(Environment.getExternalStorageDirectory(), mCapturedImage, callBack);
mBackgroundHandler.post(imageSaver);
}
}
public void addSticker(Drawable sticker) {
// Log.d(TAG, "addSticker: sticker "+sticker.toString()+" sticker"+ sticker.getIntrinsicHeight() + " width "+sticker.getIntrinsicWidth());
mStillshotImageView.reset();
mStillshotImageView.addNewSticker(sticker);
}
public void drawingStarted() {
if(!mIsCurrentlyDrawing){
mIsCurrentlyDrawing = true;
}
}
public void drawingStopped() {
if(mIsCurrentlyDrawing){
mIsCurrentlyDrawing = false;
}
}
/**
* Saves a JPEG {@link Image} into the specified {@link File}.
*/
private static class ImageSaver implements Runnable {
/**
* The file we save the image into.
*/
private final File mFile;
/**
* Original image that was captured
*/
private Image mImage;
private ICallBack mCallback;
private Bitmap bitmap;
public ImageSaver(File mFile, Image mImage, ICallBack mCallback) {
this.mFile = mFile;
this.mImage = mImage;
this.mCallback = mCallback;
}
public ImageSaver(Bitmap bitmap, File mFile, ICallBack mCallback) {
this.bitmap = bitmap;
this.mFile = mFile;
this.mCallback = mCallback;
}
@Override
public void run() {
if (mImage != null) {
ByteBuffer buffer = mImage.getPlanes()[0].getBuffer();
byte[] bytes = new byte[buffer.remaining()];
buffer.get(bytes);
FileOutputStream output = null;
try {
File file = new File(mFile, "temp_image.jpg");
// File file = new File(mFile, "VS_"+getCurrentDateTime()+".jpg");
output = new FileOutputStream(file);
output.write(bytes);
} catch (FileNotFoundException e) {
e.printStackTrace();
mCallback.done(e);
} catch (IOException e) {
e.printStackTrace();
mCallback.done(e);
} finally {
mImage.close();
if (null != output) {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
mCallback.done(null);
}
} else if (bitmap != null) {
ByteArrayOutputStream stream = null;
byte[] imageByteArray = null;
stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
imageByteArray = stream.toByteArray();
SimpleDateFormat s = new SimpleDateFormat("ddMMyyyyhhmmss");
String format = s.format(new Date());
File file = new File(mFile, "image_" + format + ".jpg");
Log.d(TAG, "run: file: "+file.getAbsolutePath());
imageName = file.getAbsolutePath();
imageName = imageName.substring(file.getAbsolutePath().lastIndexOf("/")+1);
//file: /storage/emulated/0/Pictures/VisionSelfie/image_28062019065752.jpg
// imageName = String.valueOf(file.getAbsolutePath().lastIndexOf("/"));
// imageName = file.getAbsolutePath().lastIndexOf("/");
Log.d(TAG, "run:imageName "+ imageName);
// save the mirrored byte array
FileOutputStream output = null;
try {
output = new FileOutputStream(file);
output.write(imageByteArray);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
mCallback.done(e);
e.printStackTrace();
}finally {
if (null != output) {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
}
mCallback.done(null);
}
}
}
}
private String getCurrentDateTime() {
long date = System.currentTimeMillis();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss", Locale.ENGLISH);
return simpleDateFormat.format(date);
}
}
/**
* WARNING!
* Can cause memory leaks! To prevent this the object is a global and CANCEL is being called
* in "OnPause".
*/
private class BackgroundImageRotator extends AsyncTask<Void, Integer, Integer> {
Activity mActivity;
public BackgroundImageRotator(Activity mActivity) {
this.mActivity = mActivity;
}
@Override
protected Integer doInBackground(Void... voids) {
Log.d(TAG, "doInBackground: adjusting image for display...");
File file = new File(mActivity.getExternalFilesDir(null), "temp_image.jpg");
final Uri tempImageUri = Uri.fromFile(file);
Bitmap bitmap = null;
try {
ExifInterface exifInterface = new ExifInterface(tempImageUri.getPath());
bitmap = MediaStore.Images.Media.getBitmap(mActivity.getContentResolver(), tempImageUri);
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);
mCapturedBitmap = rotateBitmap(bitmap, orientation);
} catch (IOException e) {
e.printStackTrace();
return 0;
}
return 1;
}
@Override
protected void onPostExecute(Integer integer) {
super.onPostExecute(integer);
if (integer == 1) {
displayCapturedImage();
} else {
showSnackBar("Error preparing image", Snackbar.LENGTH_SHORT);
}
}
}
private void displayCapturedImage() {
Log.d(TAG, "displayCapturedImage: displaying stillshot image");
final Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
RequestOptions requestOptions = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
.dontTransform()
.centerCrop();
// Glide.with(activity)
GlideApp.with(activity)
.setDefaultRequestOptions(requestOptions)
.load(mCapturedBitmap)
// .load(mStillshotImageView.scaleToActualAspectRatio(mCapturedBitmap))
.into(mStillshotImageView);
showStillShotContainer();
}
});
}
}
private void showStillShotContainer() {
mBtnSwitchOrientation.setVisibility(View.INVISIBLE);
mBtnStillshot.setVisibility(View.INVISIBLE);
viewStillShotBg.setVisibility(View.INVISIBLE);
viewOrientationBg.setVisibility(View.INVISIBLE);
mBtnInitSticker.setVisibility(View.INVISIBLE);
viewInitStickerBg.setVisibility(View.INVISIBLE);
mStillShotImageViewClose.setVisibility(View.VISIBLE);
view_orientation_bg_close.setVisibility(View.VISIBLE);
mBtnSave.setVisibility(View.VISIBLE);
viewBgSave.setVisibility(View.VISIBLE);
mBtnShare.setVisibility(View.VISIBLE);
viewBgShare.setVisibility(View.VISIBLE);
mIMainActivity.hideStatusBar();
closeCamera();
}
private Bitmap rotateBitmap(Bitmap bitmap, int orientation) {
Matrix matrix = new Matrix();
switch (orientation) {
case ExifInterface.ORIENTATION_TRANSPOSE:
Log.d(TAG, "rotateBitmap: transpose");
matrix.setRotate(90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_NORMAL:
Log.d(TAG, "rotateBitmap: normal.");
return bitmap;
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
Log.d(TAG, "rotateBitmap: flip horizontal");
matrix.setScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_180:
Log.d(TAG, "rotateBitmap: rotate 180");
matrix.setRotate(180);
break;
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
Log.d(TAG, "rotateBitmap: rotate vertical");
matrix.setRotate(180);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_90:
Log.d(TAG, "rotateBitmap: rotate 90");
matrix.setRotate(90);
break;
case ExifInterface.ORIENTATION_TRANSVERSE:
Log.d(TAG, "rotateBitmap: transverse");
matrix.setRotate(-90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_270:
Log.d(TAG, "rotateBitmap: rotate 270");
matrix.setRotate(-90);
break;
}
try {
if (mIMainActivity.isCameraFrontFacing()) {
Log.d(TAG, "rotateBitmap: MIRRORING IMAGE.");
matrix.postScale(-1.0f, 1.0f);
}
Bitmap bmRotated = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
// bitmap.recycle();
return bmRotated;
} catch (OutOfMemoryError e) {
e.printStackTrace();
return null;
}
}
/**
* Retrieves the JPEG orientation from the specified screen rotation.
*
* @param rotation The screen rotation.
* @return The JPEG orientation (one of 0, 90, 270, and 360)
*/
private int getOrientation(int rotation) {
// Sensor orientation is 90 for most devices, or 270 for some devices (eg. Nexus 5X)
// We have to take that into account and rotate JPEG properly.
// For devices with orientation of 90, we simply return our mapping from ORIENTATIONS.
// For devices with orientation of 270, we need to rotate the JPEG 180 degrees.
return (ORIENTATIONS.get(rotation) + mSensorOrientation + 270) % 360;
}
/**
* Sets up member variables related to camera.
*
* @param width The width of available size for camera preview
* @param height The height of available size for camera preview
*/
private void setupCameraOutputs(int width, int height) {
Activity activity = getActivity();
CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
try {
Log.d(TAG, "setupCameraOutputs: called");
if (!mIMainActivity.isCameraFrontFacing() && !mIMainActivity.isCameraBackFacing()) {
Log.d(TAG, "setupCameraOutputs: finding camera id's");
findCameraIds();
}
CameraCharacteristics characteristics = manager.getCameraCharacteristics(mCameraId);
Log.d(TAG, "setupCameraOutputs: camera id: " + mCameraId);
StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
assert map != null;
Size largest = null;
float screenAspectRatio = (float) SCREEN_WIDTH / (float) SCREEN_HEIGHT;
List<Size> sizes = new ArrayList<>();
for (Size size : Arrays.asList(map.getOutputSizes(ImageFormat.JPEG))) {
float temp = (float) size.getWidth() / (float) size.getHeight();
Log.d(TAG, "setupCameraOutputs: temp: " + temp);
Log.d(TAG, "setupCameraOutputs: w: " + size.getWidth() + " h: " + size.getHeight());
if (temp > (screenAspectRatio - screenAspectRatio * ASPECT_RATIO_ERROR_RANGE) && temp < (screenAspectRatio + screenAspectRatio * ASPECT_RATIO_ERROR_RANGE)) {
sizes.add(size);
Log.d(TAG, "setUpCameraOutputs: found a valid size: w: " + size.getWidth() + ", h: " + size.getHeight());
}
}
if (sizes.size() > 0) {
largest = Collections.max(sizes, new Utility.CompareSizesByArea());
Log.d(TAG, "setUpCameraOutputs: largest width: " + largest.getWidth());
Log.d(TAG, "setUpCameraOutputs: largest height: " + largest.getHeight());
}
// Find out if we need to swap dimension to get the preview size relative to sensor
// coordinate.
int displayRotation = activity.getWindowManager().getDefaultDisplay().getRotation();
//noinspection ConstantConditions
mSensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
boolean swappedDimensions = false;
switch (displayRotation) {
case Surface.ROTATION_0:
case Surface.ROTATION_180:
if (mSensorOrientation == 90 || mSensorOrientation == 270) {
swappedDimensions = true;
}
break;
case Surface.ROTATION_90:
case Surface.ROTATION_270:
if (mSensorOrientation == 0 || mSensorOrientation == 180) {
swappedDimensions = true;
}
break;
default:
Log.e(TAG, "Display rotation is invalid: " + displayRotation);
}
Point displaySize = new Point();
activity.getWindowManager().getDefaultDisplay().getSize(displaySize);
int rotatedPreviewWidth = width;
int rotatedPreviewHeight = height;
int maxPreviewWidth = displaySize.x;
int maxPreviewHeight = displaySize.y;
if (swappedDimensions) {
rotatedPreviewWidth = height;
rotatedPreviewHeight = width;
maxPreviewWidth = displaySize.y;
maxPreviewHeight = displaySize.x;
}
if (maxPreviewWidth > MAX_PREVIEW_WIDTH) {
maxPreviewWidth = MAX_PREVIEW_WIDTH;
}
if (maxPreviewHeight > MAX_PREVIEW_HEIGHT) {
maxPreviewHeight = MAX_PREVIEW_HEIGHT;
}
Log.d(TAG, "setUpCameraOutputs: max preview width: " + maxPreviewWidth);
Log.d(TAG, "setUpCameraOutputs: max preview height: " + maxPreviewHeight);
/*if (largest != null) {
mPreviewSize = Utility.chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth,
maxPreviewHeight, largest);
}*/
mImageReader = ImageReader.newInstance(largest.getWidth(), largest.getHeight(), ImageFormat.JPEG, 2);
mImageReader.setOnImageAvailableListener(mOnImageAvailableListener, mBackgroundHandler);
mPreviewSize = Utility.chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth,
maxPreviewHeight, largest);
/*mPreviewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth,
maxPreviewHeight, largest);*/
Log.d(TAG, "setUpCameraOutputs: preview width: " + mPreviewSize.getWidth());
Log.d(TAG, "setUpCameraOutputs: preview height: " + mPreviewSize.getHeight());
// We fit the aspect ratio of TextureView to the size of preview we picked.
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
mTextureView.setAspectRatio(
// mPreviewSize.getWidth(), mPreviewSize.getHeight(), SCREEN_WIDTH, SCREEN_HEIGHT);
mPreviewSize.getWidth(), mPreviewSize.getHeight());
} else {
mTextureView.setAspectRatio(
// mPreviewSize.getHeight(), mPreviewSize.getWidth(), SCREEN_HEIGHT, SCREEN_WIDTH);
mPreviewSize.getHeight(), mPreviewSize.getWidth());
}
Log.d(TAG, "setUpCameraOutputs: cameraId: " + mCameraId);
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (NullPointerException e) {
// Currently an NPE is thrown when the Camera2API is used but not supported on the
// device this code runs.
ErrorDialog.newInstance(getString(R.string.camera_error))
.show(getChildFragmentManager(), FRAGMENT_DIALOG);
}
}
private void findCameraIds() {
Activity activity = getActivity();
if (activity != null) {
CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
try {
for (String cameraId : manager.getCameraIdList()) {
Log.d(TAG, "setCameraOrientation: CAMERA ID: " + cameraId);
if (cameraId == null) continue;
CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
int facing = characteristics.get(CameraCharacteristics.LENS_FACING);
if (facing == CameraCharacteristics.LENS_FACING_FRONT) {
// mCameraId = cameraId;
mIMainActivity.setFrontCameraId(cameraId);
} else if (facing == CameraCharacteristics.LENS_FACING_BACK) {
// mCameraId = cameraId;
mIMainActivity.setBackCameraId(cameraId);
}
}
// mIMainActivity.setCameraBackFacing();
mIMainActivity.setCameraFrontFacing();
mCameraId = mIMainActivity.getFrontCameraId();
// mCameraId = mIMainActivity.getBackCameraId();
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
}
private void requestCameraPermission() {
if (shouldShowRequestPermissionRationale(Manifest.permission.CAMERA)) {
new ConfirmationDialog().show(getChildFragmentManager(), FRAGMENT_DIALOG);
} else {
requestPermissions(new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION);
}
}
/**
* Shows an error message dialog.
*/
public static class ErrorDialog extends DialogFragment {
private static final String ARG_MESSAGE = "message";
public static ErrorDialog newInstance(String message) {
ErrorDialog dialog = new ErrorDialog();
Bundle args = new Bundle();
args.putString(ARG_MESSAGE, message);
dialog.setArguments(args);
return dialog;
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Activity activity = getActivity();
return new AlertDialog.Builder(activity)
.setMessage(getArguments().getString(ARG_MESSAGE))
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
activity.finish();
}
})
.create();
}
}
/**
* Shows OK/Cancel confirmation dialog about camera permission.
*/
public static class ConfirmationDialog extends DialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Fragment parent = getParentFragment();
return new AlertDialog.Builder(getActivity())
.setMessage(R.string.request_permission)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
parent.requestPermissions(new String[]{Manifest.permission.CAMERA},
REQUEST_CAMERA_PERMISSION);
}
})
.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Activity activity = parent.getActivity();
if (activity != null) {
activity.finish();
}
}
})
.create();
}
}
/**
* Shows a {@link Snackbar} on the UI thread.
*
* @param text The message to show
*/
private void showSnackBar(final String text, final int length) {
final Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
View view = activity.findViewById(android.R.id.content).getRootView();
Snackbar.make(view, text, length).show();
}
});
}
}
/*/////////////////////////////////////////////////////////////*/
//Samsung-S6-choices[0]
//Samsung-S7-edge-choices[6]
//OnePlus-5T-choices[15]
/*
* Given {@code choices} of {@code Size}s supported by a camera, chooses the smallest one whose
* width and height are at least as large as the respective requested values, and whose aspect
* ratio matches with the specified value.
*
* @param choices The list of sizes that the camera supports for the intended output class
* @param width The minimum desired width
* @param height The minimum desired height
* @param aspectRatio The aspect ratio
* @return The optimal {@code Size}, or an arbitrary one if none were big enough
*/
private Size chooseOptimalSize(Size[] choices, int screenWidth, int screenHeight, int width, int height, Size aspectRatio) {
// Collect the supported resolutions that are at least as big as the preview Surface
List<Size> bigEnough = new ArrayList<>();
int w = aspectRatio.getWidth();
int h = aspectRatio.getHeight();
double ratio = (double) h / w;
int loopCounter=0;
for (Size size : choices) {
int orientation = getActivity().getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
//if((size.getWidth()/16) == (size.getHeight()/9) && size.getWidth() <=720) {
//if((size.getWidth()/16) == (size.getHeight()/9) && size.getWidth() <=3840 ) {
//if((size.getWidth()/16) == (size.getHeight()/9) && size.getWidth() <=5120 ) {//Retina 5K
if((size.getWidth()/16) == (size.getHeight()/9) && size.getWidth() <=7680 ) {//8K UHDTV Super Hi-Vision
Log.e(TAG, "chooseOptimalSize:"+size);
return size;
}
} else {
Log.e(TAG, "chooseOptimalSize:--given--"+size);
DisplayMetrics metrics = getActivity().getResources().getDisplayMetrics();
float mCameraAspectRatio = ((float)metrics.heightPixels / (float)metrics.widthPixels);
Log.e(TAG, "chooseOptimalSize:--AspectRatio--"+mCameraAspectRatio);
if((size.getWidth()/16) == (size.getHeight()/9) && ((size.getWidth() <=1280)||(size.getHeight()<=1920))) {
//if((size.getWidth()/16) == (size.getHeight()/9) && (size.getWidth() <=4320 ) ) {//8K UHDTV Super Hi-Vision
//if((size.getWidth()/16) == (size.getHeight()/9) && (size.getWidth() <=2880 ) ) {//Retina 5K
//if((size.getWidth()/16) == (size.getHeight()/9) && (size.getWidth() <=2160 ) ) {
//if((size.getWidth()/16) == (size.getHeight()/9) && (size.getWidth() <=1280 ) ) {
//if((size.getWidth()/16) == (size.getHeight()/9) && (size.getWidth() <=4480 && size.getWidth() >=1280) ) {
Log.e(TAG, "chooseOptimalSize:"+size+"-16:9");
return size;
}else if((size.getWidth()/18) == (size.getHeight()/9) && ((size.getWidth() <=3840)||(size.getHeight()<=2160))) {
Log.e(TAG, "chooseOptimalSize:"+size+"-18:9");
return size;
}else if((size.getWidth()/18.5) == (size.getHeight()/9) && ((size.getWidth() <=3840)||(size.getHeight()<=2160))) {
Log.e(TAG, "chooseOptimalSize:"+size+"-18.5:9");
return size;
}else if((size.getWidth()/19) == (size.getHeight()/9) && ((size.getWidth() <=3840)||(size.getHeight()<=2160))) {
Log.e(TAG, "chooseOptimalSize:"+size+"-19:9");
return size;
}else if((size.getWidth()/19.5) == (size.getHeight()/9) && ((size.getWidth() <=3840)||(size.getHeight()<=2160))) {
Log.e(TAG, "chooseOptimalSize:"+size+"-19.5:9");
return size;
}else{
Log.e(TAG, "chooseOptimalSize"+" not proper aspect resolution");
Log.e(TAG, "chooseOptimalSize"+" ---=>Width---=>"+size.getWidth());
Log.e(TAG, "chooseOptimalSize"+" ---=>Height---=>"+size.getHeight());
}
//2340
}
if(screenWidth==size.getWidth()){
Log.e(TAG, loopCounter+".choose:width Matched:"+screenWidth+"="+size.getWidth());
}else{
Log.e(TAG, loopCounter+".choose:width Not Matched:"+screenWidth+"="+size.getWidth());
}
if(screenHeight==size.getHeight()){
Log.e(TAG, loopCounter+".choose:height Matched:"+screenHeight+"="+size.getHeight());
}else{
Log.e(TAG, loopCounter+".choose:height Not Matched:"+screenHeight+"="+size.getHeight());
}
loopCounter++;
}
// Pick the smallest of those, assuming we found any
if (bigEnough.size() > 0) {
return Collections.min(bigEnough, new CompareSizesByArea());
} else {
Log.e(TAG, "Couldn't find any suitable preview size");
return choices[0];
}
}
/*
* Compares two {@code Size}s based on their areas.
*/
static class CompareSizesByArea implements Comparator<Size> {
@Override
public int compare(Size lhs, Size rhs) {
// We cast here to ensure the multiplications won't overflow
return Long.signum((long) lhs.getWidth() * lhs.getHeight() -
(long) rhs.getWidth() * rhs.getHeight());
}
}
}
package ibase.android.visionselfie;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import java.util.ArrayList;
public class DrawableImageView extends AppCompatImageView {
private static final String TAG = "DrawableImageView";
private static final int STICKER_STARTING_WIDTH = 300;
private static final int STICKER_STARTING_HEIGHT = 300;
private static final int MIN_STICKER_WIDTH = 50;
private static final int MIN_STICKER_HEIGHT = 50;
private Activity mHostActivity;
// Stickers
private ArrayList<Sticker> mStickers = new ArrayList<>();
private class Sticker {
Paint paint;
Bitmap bitmap;
Drawable drawable;
int x, y;
Rect rect;
Sticker(Bitmap bitmap, Drawable drawable, int x, int y) {
paint = new Paint();
this.x = x;
this.y = y;
this.bitmap = bitmap;
this.drawable = drawable;
// rect = new Rect(x, y, x + STICKER_STARTING_WIDTH, y + STICKER_STARTING_HEIGHT);
rect = new Rect(x, y, x + 1080, y + 1920);
}
}
public DrawableImageView(Context context) {
super(context);
init(context);
}
public DrawableImageView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public DrawableImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
Log.d(TAG, "init: ");
// setWillNotDraw(false);
setDrawingCacheEnabled(true);
if (context instanceof Activity) {
mHostActivity = (Activity) context;
}
}
public void reset() {
mStickers.clear();
invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Log.d(TAG, "onDraw: ");
if (mStickers.size() > 0) {
for (Sticker sticker : mStickers) {
Log.d(TAG, "onDraw: ");
// Rect frameToDraw = new Rect(0, 0, 1000, 1000);
Rect frameToDraw = new Rect();
// RectF whereToDraw = new RectF(0, 0, 200, 200);
canvas.getClipBounds(frameToDraw); // get canvas size base screen size
// canvas.drawBitmap(sticker.bitmap, new Rect(0,0,40,40), new Rect(0,0,24,13) , null);
canvas.drawBitmap(sticker.bitmap, null, frameToDraw,null);
// canvas.drawBitmap(sticker.bitmap, sticker.x, sticker.y, sticker.paint);
// canvas.drawBitmap(scaleToActualAspectRatio(sticker.bitmap), sticker.x, sticker.y, sticker.paint);
}
}
}
public void addNewSticker(Drawable drawable) {
if (mHostActivity != null) {
if (mHostActivity instanceof MainActivity) {
Log.d(TAG, "addNewSticker: adding new sticker to canvas.");
Log.d(TAG, "addNewSticker: drawable: " + drawable);
Bitmap newStickerBitmap = drawableToBitmap(drawable);
Log.d(TAG, "addNewSticker: newStickerBitmap:Width " + newStickerBitmap.getWidth() + " Height " + newStickerBitmap.getHeight());
// Sticker sticker = new Sticker(newStickerBitmap, drawable, 0, 200);
DisplayMetrics displayMetrics = new DisplayMetrics();
// getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;
int leftPercentage = width * 60 / 100;
int bottomPercentage = height * 60 / 100;
Log.d(TAG, "addNewSticker: height: " + height + " width : " + width);
Log.d(TAG, "addNewSticker: leftPercentage: "+leftPercentage+" bottomPercentage: "+bottomPercentage);
Sticker sticker = new Sticker(newStickerBitmap, drawable, 0, 0);
mStickers.add(sticker);
invalidate();
}
}
}
public static Bitmap drawableToBitmap(Drawable drawable) {
Bitmap bitmap = null;
if (drawable instanceof BitmapDrawable) {
Log.d(TAG, "drawableToBitmap: ");
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
if (bitmapDrawable.getBitmap() != null) {
// return Bitmap.createScaledBitmap(bitmapDrawable.getBitmap(), STICKER_STARTING_WIDTH, STICKER_STARTING_HEIGHT, false);
// return Bitmap.createScaledBitmap(bitmapDrawable.getBitmap(), (drawable.getIntrinsicWidth() / 2), (drawable.getIntrinsicHeight()/2), false);
// return Bitmap.createScaledBitmap(bitmapDrawable.getBitmap(), (drawable.getIntrinsicWidth() / 4), (drawable.getIntrinsicHeight()/4), false);
// return Bitmap.createScaledBitmap(bitmapDrawable.getBitmap(), 1080,1776, false);
// return Bitmap.createScaledBitmap(bitmapDrawable.getBitmap(), 800,1232, false);
// return Bitmap.createScaledBitmap(bitmapDrawable.getBitmap(), drawable.getIntrinsicWidth() , drawable.getIntrinsicHeight(), false);
// return Bitmap.createScaledBitmap(bitmapDrawable.getBitmap(), drawable.getMinimumWidth() , drawable.getMinimumHeight(), false);
return Bitmap.createScaledBitmap(bitmapDrawable.getBitmap(), 1080 , 1920, false);
}
}
if (drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) {
bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); // Single color bitmap will be created of 1x1 pixel
Log.d(TAG, "drawableToBitmap: if ");
} else {
// bitmap = Bitmap.createBitmap(STICKER_STARTING_WIDTH, STICKER_STARTING_WIDTH, Bitmap.Config.ARGB_8888);
// bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
bitmap = Bitmap.createBitmap(1080, 1920, Bitmap.Config.ARGB_8888);
Log.d(TAG, "drawableToBitmap: else ");
}
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
drawable.draw(canvas);
return bitmap;
}
public Bitmap scaleToActualAspectRatio(Bitmap bitmap) {
Log.d(TAG, "scaleToActualAspectRatio: ");
if (bitmap != null) {
boolean flag = true;
int deviceWidth = mHostActivity.getWindowManager().getDefaultDisplay()
.getWidth();
int deviceHeight = mHostActivity.getWindowManager().getDefaultDisplay()
.getHeight();
int bitmapHeight = bitmap.getHeight();
int bitmapWidth = bitmap.getWidth();
if (bitmapWidth > deviceWidth) {
flag = false;
// scale According to WIDTH
int scaledWidth = deviceWidth;
int scaledHeight = (scaledWidth * bitmapHeight) / bitmapWidth;
try {
if (scaledHeight > deviceHeight)
scaledHeight = deviceHeight;
bitmap = Bitmap.createScaledBitmap(bitmap, scaledWidth,
scaledHeight, true);
} catch (Exception e) {
e.printStackTrace();
}
}
if (flag) {
if (bitmapHeight > deviceHeight) {
// scale According to HEIGHT
int scaledHeight = deviceHeight;
int scaledWidth = (scaledHeight * bitmapWidth) / bitmapHeight;
try {
if (scaledWidth > deviceWidth)
scaledWidth = deviceWidth;
bitmap = Bitmap.createScaledBitmap(bitmap, scaledWidth,
scaledHeight, true);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
return bitmap;
}
}
package ibase.android.visionselfie;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
@GlideModule
public class GlideAppModuleClass extends AppGlideModule {
}
package ibase.android.visionselfie;
public interface ICallBack {
void done(Exception e);
}
package ibase.android.visionselfie;
import android.graphics.drawable.Drawable;
public interface IMainActivity {
void setCameraFrontFacing();
void setCameraBackFacing();
boolean isCameraFrontFacing();
boolean isCameraBackFacing();
void setFrontCameraId(String cameraId);
void setBackCameraId(String cameraId);
String getFrontCameraId();
String getBackCameraId();
void hideStatusBar();
void showStatusBar();
void hideStillShotWidgets();
void showStillShotWidgets();
void toggleViewStickersFragment();
void addSticker(Drawable sticker);
}
package ibase.android.visionselfie;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
public class ImageNicer {
public static int calculateInSampleSize(
BitmapFactory.Options options, int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
final int halfHeight = height / 2;
final int halfWidth = width / 2;
// Calculate the largest inSampleSize value that is a power of 2 and keeps both
// height and width larger than the requested height and width.
while ((halfHeight / inSampleSize) >= reqHeight
&& (halfWidth / inSampleSize) >= reqWidth) {
inSampleSize *= 2;
}
}
return inSampleSize;
}
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId,
int reqWidth, int reqHeight) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(res, resId, options);
// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
return BitmapFactory.decodeResource(res, resId, options);
}
}
package ibase.android.visionselfie;
public class Item {
private int image;
public Item(int image) {
this.image = image;
}
public int getImage() {
return image;
}
public void setImage(int image) {
this.image = image;
}
}
package ibase.android.visionselfie;
import android.Manifest;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity implements IMainActivity {
private static final String TAG = "MainActivity";
private static final int REQUEST_CODE = 9001;
private boolean mHasPermission;
public String mCameraOrientation = "none"; // Front-facing or back-facing
public static String CAMERA_POSITION_FRONT;
public static String CAMERA_POSITION_BACK;
private String fixed_sticker = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Toast.makeText(getApplicationContext(), data.toString(), Toast.LENGTH_SHORT).show();
/*if (data == Uri.parse("https://proteusvision.com")) {
fixed_sticker = "work_place";
inflateViewStickersFragmemt();
}*/
init(fixed_sticker);
// forActions();
}
private void forActions() {
init(fixed_sticker);
}
private void init(String fixed_sticker) {
if (mHasPermission) {
if (checkCameraHardware(this)) {
Log.d(TAG, "init: open camera fragment");
startCamera();
} else {
showSnackBar("You need a camera to use this application", Snackbar.LENGTH_INDEFINITE);
}
} else {
// showPermissionExplanationDialog();
verifyPermissions();
}
}
private void showPermissionExplanationDialog() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle("").setMessage("The app would like to access the Storage to save photos.").setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
verifyPermissions();
}
}).setCancelable(false).show();
}
private void startCamera() {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.camera_container, CameraFragment.newInstance(), getString(R.string.fragment_camera2));
transaction.commit();
}
private void verifyPermissions() {
Log.d(TAG, "verifyPermissions: asking user for permission");
final String[] permissions = {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA};
if (ContextCompat.checkSelfPermission(this.getApplicationContext(), permissions[0]) == PackageManager.PERMISSION_GRANTED
&& ContextCompat.checkSelfPermission(this.getApplicationContext(), permissions[1]) == PackageManager.PERMISSION_GRANTED) {
mHasPermission = true;
init(fixed_sticker);
} else {
// AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
// alertDialogBuilder.setTitle("").setMessage("The app would like to access the Storage to save photos.").setPositiveButton("Ok", new DialogInterface.OnClickListener() {
// public void onClick(DialogInterface dialog, int which) {
// dialog.dismiss();
ActivityCompat.requestPermissions(MainActivity.this, permissions, REQUEST_CODE);
// }
// }).show();
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_CODE) {
if (mHasPermission) {
init(fixed_sticker);
} else {
verifyPermissions();
}
}
}
/**
* Check if this device has a camera
*/
private boolean checkCameraHardware(Context context) {
if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
// this device has a camera
return true;
} else {
// no camera on this device
return false;
}
}
private void showSnackBar(String text, int length) {
View view = this.findViewById(android.R.id.content).getRootView();
Snackbar.make(view, text, length);
}
@Override
public void setCameraFrontFacing() {
Log.d(TAG, "setCameraFrontFacing: setting camera to front facing");
mCameraOrientation = CAMERA_POSITION_FRONT;
}
@Override
public void setCameraBackFacing() {
Log.d(TAG, "setCameraBackFacing: setting camera to back facing");
mCameraOrientation = CAMERA_POSITION_BACK;
}
@Override
public boolean isCameraFrontFacing() {
if (mCameraOrientation.equals(CAMERA_POSITION_FRONT)) {
return true;
}
return false;
}
@Override
public boolean isCameraBackFacing() {
if (mCameraOrientation.equals(CAMERA_POSITION_BACK)) {
return true;
}
return false;
}
@Override
public void setFrontCameraId(String cameraId) {
CAMERA_POSITION_FRONT = cameraId;
}
@Override
public void setBackCameraId(String cameraId) {
CAMERA_POSITION_BACK = cameraId;
}
@Override
public String getFrontCameraId() {
return CAMERA_POSITION_FRONT;
}
@Override
public String getBackCameraId() {
return CAMERA_POSITION_BACK;
}
@Override
public void hideStatusBar() {
View decorView = getWindow().getDecorView();
//Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
@Override
public void showStatusBar() {
View decorView = getWindow().getDecorView();
//show the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
@Override
public void hideStillShotWidgets() {
CameraFragment cameraFragment = (CameraFragment) getSupportFragmentManager().findFragmentByTag(getString(R.string.fragment_camera2));
if (cameraFragment != null) {
if (cameraFragment.isVisible()) {
// cameraFragment.d
cameraFragment.drawingStarted();
}
}
}
@Override
public void showStillShotWidgets() {
CameraFragment cameraFragment = (CameraFragment) getSupportFragmentManager().findFragmentByTag(getString(R.string.fragment_camera2));
if (cameraFragment != null) {
if (cameraFragment.isVisible()) {
// cameraFragment.d
cameraFragment.drawingStopped();
}
}
}
@Override
public void toggleViewStickersFragment() {
ViewStickersFragment viewStickersFragment = (ViewStickersFragment) getSupportFragmentManager().findFragmentByTag(getString(R.string.view_stickers));
if (viewStickersFragment != null) {
if (viewStickersFragment.isVisible()) {
hideViewStickersFragment(viewStickersFragment);
} else {
showViewStickersFragment(viewStickersFragment);
}
} else {
inflateViewStickersFragmemt();
}
}
@Override
public void addSticker(Drawable sticker) {
Log.d(TAG, "addSticker: ");
CameraFragment cameraFragment = (CameraFragment) getSupportFragmentManager().findFragmentByTag(getString(R.string.fragment_camera2));
if (cameraFragment != null) {
Log.d(TAG, "addSticker: cameraFragment != null ");
if (cameraFragment.isVisible()) {
cameraFragment.addSticker(sticker);
}
} else {
Log.d(TAG, "addSticker: cameraFragment == null ");
}
}
private void hideViewStickersFragment(ViewStickersFragment viewStickersFragment) {
Log.d(TAG, "hideViewStickersFragment: ");
hideStillShotWidgets();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
// transaction.setCustomAnimations(R.anim.slide_in_up, R.anim.slide_in_down, R.anim.slide_out_down, R.anim.slide_out_up);
transaction.setCustomAnimations(R.anim.slide_down_from_top, R.anim.slide_up_out_of_the_screen);
transaction.hide(viewStickersFragment);
transaction.commit();
}
private void showViewStickersFragment(ViewStickersFragment viewStickersFragment) {
Log.d(TAG, "showViewStickersFragment: ");
showStillShotWidgets();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
// transaction.setCustomAnimations(R.anim.slide_in_up, R.anim.slide_in_down, R.anim.slide_out_down, R.anim.slide_out_up);
transaction.setCustomAnimations(R.anim.slide_down_from_top, R.anim.slide_up_out_of_the_screen);
transaction.show(viewStickersFragment);
transaction.commit();
}
private void inflateViewStickersFragmemt() {
Log.d(TAG, "inflateViewStickersFragmemt: ");
hideStillShotWidgets();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
// transaction.setCustomAnimations(R.anim.slide_in_up, R.anim.slide_in_down, R.anim.slide_out_down, R.anim.slide_out_up);
transaction.setCustomAnimations(R.anim.slide_down_from_top, R.anim.slide_up_out_of_the_screen);
transaction.add(R.id.camera_container, ViewStickersFragment.newInstance(), (getString(R.string.view_stickers)));
transaction.commit();
}
@Override
public void onBackPressed() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle("Exit Alert").setMessage("Are you sure want to exit?").setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// super.onBackPressed();
finish();
}
}).setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).show();
}
}
package ibase.android.visionselfie;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class SampleActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
/*Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();*/
}
}
\ No newline at end of file
package ibase.android.visionselfie;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import java.util.ArrayList;
public class StickerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final String TAG = "StickerAdapter";
private ArrayList<Drawable> mStickers = new ArrayList<>();
private ArrayList<Item> items;
private RecyclerViewClickListener clickListener;
private Context context;
public StickerAdapter(ArrayList<Item> items, RecyclerViewClickListener clickListener, Context context) {
this.items = items;
this.clickListener = clickListener;
this.context = context;
}
public StickerAdapter(Context context, ArrayList<Drawable> mStickers, RecyclerViewClickListener clickListener) {
this.mStickers = mStickers;
this.clickListener = clickListener;
this.context = context;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.layout_sticker_list_item, viewGroup, false);
ViewHolder viewHolder = new ViewHolder(view, clickListener);
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
ImageView imageView = viewHolder.itemView.findViewById(R.id.iv_sticker_list_item);
RequestOptions requestOptions = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
.dontTransform()
.centerCrop();
// GlideApp.with(context)
Glide.with(context)
// .setDefaultRequestOptions(requestOptions)
// .load(mStickers.get(i))
.load(items.get(i).getImage())
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.mipmap.ic_launcher)
.into(imageView);
/* Glide.with(context)
.load(ImageNicer.decodeSampledBitmapFromResource(context.getResources(),R.id.iv_sticker_list_item,100,100))
.into(imageView);*/
// .into(((ViewHolder) viewHolder).imageView);
// .load(ImageNicer.decodeSampledBitmapFromResource(context.getResources(),mStickers.get(i),100,100))
// imageView.setImageBitmap(ImageNicer.decodeSampledBitmapFromResource(context.getResources(),mStickers,100,100));
/*Glide.with(context)
.load(mStickers.get(i))
.diskCacheStrategy(DiskCacheStrategy.ALL)
.skipMemoryCache(true)
.thumbnail(0.1f)
.into(((ViewHolder) viewHolder).imageView);
// .load(ImageNicer.decodeSampledBitmapFromResource(context.getResources(),mStickers.get(i),100,100))*/
}
@Override
public int getItemCount()
{
return items.size();
// return mStickers.size();
}
// public RecyclerView.ViewHolder
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
ImageView imageView;
RecyclerViewClickListener clickListener;
public ViewHolder(@NonNull View itemView, RecyclerViewClickListener clickListener) {
super(itemView);
imageView = itemView.findViewById(R.id.iv_sticker_list_item);
this.clickListener = clickListener;
itemView.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (clickListener != null) {
Log.d(TAG, "onClick: ");
clickListener.onStickerClicked(getAdapterPosition());
}
}
}
public interface RecyclerViewClickListener {
void onStickerClicked(int position);
}
}
package ibase.android.visionselfie;
import android.util.Size;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class Utility {
/**
* Compares two {@code Size}s based on their areas.
*/
static class CompareSizesByArea implements Comparator<Size> {
public static CompareSizesByArea newInstance(){
return new CompareSizesByArea();
}
@Override
public int compare(Size lhs, Size rhs) {
// We cast here to ensure the multiplications won't overflow
return Long.signum((long) lhs.getWidth() * lhs.getHeight() -
(long) rhs.getWidth() * rhs.getHeight());
}
}
/**
* Given {@code choices} of {@code Size}s supported by a camera, choose the smallest one that
* is at least as large as the respective texture view size, and that is at most as large as the
* respective max size, and whose aspect ratio matches with the specified value. If such size
* doesn't exist, choose the largest one that is at most as large as the respective max size,
* and whose aspect ratio matches with the specified value.
*
* @param choices The list of sizes that the camera supports for the intended output
* class
* @param textureViewWidth The width of the texture view relative to sensor coordinate
* @param textureViewHeight The height of the texture view relative to sensor coordinate
* @param maxWidth The maximum width that can be chosen
* @param maxHeight The maximum height that can be chosen
* @param aspectRatio The aspect ratio
* @return The optimal {@code Size}, or an arbitrary one if none were big enough
*/
static Size chooseOptimalSize(Size[] choices, int textureViewWidth,
int textureViewHeight, int maxWidth, int maxHeight, Size aspectRatio) {
// Collect the supported resolutions that are at least as big as the preview Surface
List<Size> bigEnough = new ArrayList<>();
// Collect the supported resolutions that are smaller than the preview Surface
List<Size> notBigEnough = new ArrayList<>();
int w = aspectRatio.getWidth();
int h = aspectRatio.getHeight();
for (Size option : choices) {
// Log.d(TAG, "chooseOptimalSize: w: " + option.getWidth() + ", h: " + option.getHeight());
if (option.getWidth() <= maxWidth && option.getHeight() <= maxHeight &&
option.getHeight() == option.getWidth() * h / w) {
if (option.getWidth() >= textureViewWidth &&
option.getHeight() >= textureViewHeight) {
bigEnough.add(option);
} else {
notBigEnough.add(option);
}
}
}
// Pick the smallest of those big enough. If there is no one big enough, pick the
// largest of those not big enough.
if (bigEnough.size() > 0) {
return Collections.min(bigEnough, new CompareSizesByArea());
} else if (notBigEnough.size() > 0) {
return Collections.max(notBigEnough, new CompareSizesByArea());
} else {
return choices[0];
}
}
}
package ibase.android.visionselfie;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
/**
* A simple {@link Fragment} subclass.
*/
public class ViewStickersFragment extends Fragment implements View.OnClickListener, StickerAdapter.RecyclerViewClickListener {
private static final String TAG = "ViewStickersFragment";
public static final int NUM_OF_COLUMN = 1;
private RecyclerView mRecyclerView;
private ArrayList<Item> items;
private ArrayList<Drawable> mStickers = new ArrayList<>();
private IMainActivity mIMainActivity;
private StickerAdapter mStickerAdapter;
public static ViewStickersFragment newInstance() {
return new ViewStickersFragment();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_view_stickers, container, false);
view.findViewById(R.id.init_sticker_icon).setOnClickListener(this);
mRecyclerView = view.findViewById(R.id.recycler_view);
items = new ArrayList<>();
initRecyclerView();
// getStickers();
getStickersNew();
return view;
}
private void getStickersNew() {
int images[] = {
// R.drawable.ic_great_place,
/*R.drawable.a_great_place_frame,
R.drawable.b_smartwork_not_hard_frame,
R.drawable.c_we_love_proteus_frame,
R.drawable.d_small_team_doing_big_things_frame*/
// R.drawable.ac_we_love_proteus_frame,
R.drawable.aa_fun_at_proteus,
R.drawable.ab_great_place_to_work,
R.drawable.we_love_proteus_frame,
R.drawable.great_placeto_work_frame,
R.drawable.ad_work_smart_not_hard,
R.drawable.i_love_base_blue_frame,
R.drawable.i_love_base_white_frame
};
int i = 0;
while (i < images.length) {
items.add(new Item(images[i]));
i++;
}
mRecyclerView.setAdapter(new StickerAdapter(items,this,getActivity()));
}
private void initRecyclerView() {
if (mStickerAdapter == null) {
// mStickerAdapter = new StickerAdapter(getActivity(), mStickers, this);
mStickerAdapter = new StickerAdapter(items,this,getActivity());
}
mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), NUM_OF_COLUMN));
mRecyclerView.setAdapter(mStickerAdapter);
mStickerAdapter.notifyDataSetChanged();
}
private void getStickers() {
if (getActivity() != null) {
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfieapp_sicker_01));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfieapp_sicker_0200));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfieapp_sicker_03));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfieapp_sicker_01));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfie_app02));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.a1));
/* mStickers.add(getActivity().getResources().getDrawable(R.drawable.a2));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.ic_great_place));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfie_sticker2));*/
/*thumbnails*/
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.a_great_place_thumb));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.b_smartwork_not_hard_thumb));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.c_we_love_proteus_frame_thumb));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.d_fun_at_proteus_thumb));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.e_i_love_base_blue_thumb));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.f_we_love_proteus_frame_thumb));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.a_great_place_frame));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.b_smartwork_not_hard_frame));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.c_we_love_proteus_frame));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfie_sticker1));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfie_sticker2));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfie_sticker2));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.ic_small_team_doing_big_things));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.small_team_doing_big_things));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.work_smart_not_hard));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.ic_work_smart_not_hard));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfie_sticker1));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfie_sticker1));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfie_sticker1));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfie_sticker1));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfie_sticker1));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfie_sticker1));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.selfisti));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.ic_vision_selfie_app_one));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.ic_vision_selfie_app_two));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.slightly_smiling_face_emoji));
/* mStickers.add(getActivity().getResources().getDrawable(R.drawable.smiley_face_emoji));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.smiley_smiling_eyes_emoji));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.smiley_face_tightly_closed_eyes_emoji));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.smiley_with_sweat_emoji));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.tears_of_joy_emoji));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.sunglasses_emoji));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.nerd_emoji));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.smirking_emoji));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.unamused_emoji));
mStickers.add(getActivity().getResources().getDrawable(R.drawable.penguin_emoji));*/
/**/
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.upside_down_face_emoji));
// mStickers.add(getActivity().getResources().getDrawable(R.drawable.sad_emoji));
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.init_sticker_icon: {
mIMainActivity.toggleViewStickersFragment();
break;
}
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
try {
mIMainActivity = (IMainActivity) getActivity();
} catch (Exception e) {
Log.e(TAG, "onAttach: " + e.getMessage());
}
}
@Override
public void onStickerClicked(int position) {
// mIMainActivity.addSticker(mStickers.get(position));
mIMainActivity.addSticker(getResources().getDrawable(items.get(position).getImage()));
mIMainActivity.toggleViewStickersFragment();
}
}
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="-100%" android:toYDelta="0%" android:duration="200"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_shortAnimTime"
android:fromYDelta="0%p"
android:toYDelta="100%p" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_shortAnimTime"
android:fromYDelta="100%p"
android:toYDelta="0%p" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_shortAnimTime"
android:fromXDelta="0"
android:toYDelta="-100%" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_shortAnimTime"
android:fromXDelta="0"
android:toYDelta="100%" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0%" android:toYDelta="-100%" android:duration="100"/>
</set>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#000000">
<path
android:fillColor="#FF000000"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="1280dp"
android:height="1920dp"
android:viewportWidth="1440"
android:viewportHeight="2960">
<path
android:pathData="M1032.8,2893.75c4.94,-1.76 8.55,-4.61 10.81,-9.46a15,15 0,0 0,1.17 -6.57,15.86 15.86,0 0,0 -5.39,-11.92c-3.55,-3.24 -8.2,-4.72 -14,-4.61l-16.3,0.33 1.17,59.1 8.8,-0.18 -0.49,-24.76 2.53,0a40.59,40.59 0,0 0,11.74 -1.88ZM1033.93,2884.75a10.34,10.34 0,0 1,-5.14 4.1,31.45 31.45,0 0,1 -7.85,0.87l-2.53,0.05 -0.45,-22.68 5.5,-0.11c3.22,-0.06 5.59,0.34 7.09,1.17a8.45,8.45 0,0 1,3.66 3.86,12 12,0 0,1 1.49,5.82 12.26,12.26 0,0 1,-1.77 6.92ZM1090.34,2919.02 L1071.09,2893.94a26.58,26.58 0,0 0,3.64 -0.94c4.94,-1.85 8.53,-4.7 10.7,-9.54a14.49,14.49 0,0 0,1.27 -6.49,15.94 15.94,0 0,0 -5.37,-11.92c-3.55,-3.24 -8.29,-4.81 -14.14,-4.69l-16.21,0.32 1.18,59.1 8.79,-0.17 -0.49,-24.68 2.71,0 18.71,24.31ZM1059.89,2866.26 L1065.4,2866.15c3.13,-0.06 5.58,0.33 7.07,1.17a9.11,9.11 0,0 1,3.65 3.86,12.35 12.35,0 0,1 1.52,5.81 12.07,12.07 0,0 1,-1.78 6.92,9.77 9.77,0 0,1 -5.25,4.11c-1.46,0.56 -4.07,0.79 -7.82,0.87l-2.45,0ZM1123.08,2859.26a29.56,29.56 0,1 0,1.17 59.1c16.64,-0.33 29.81,-13.86 29.49,-30.14a29.81,29.81 0,0 0,-30.66 -29ZM1124.15,2912.96c-11.69,0.23 -21.5,-10.39 -21.76,-23.72s9.11,-24.35 20.79,-24.59 21.48,10.4 21.74,23.74 -9,24.34 -20.77,24.57ZM1199.15,2857.74 L1157.04,2858.58 1157.16,2864.33 1173.55,2864.01 1174.61,2917.36 1183.94,2917.17 1182.88,2863.82 1199.27,2863.49ZM1206.42,2916.74 L1245.73,2915.96 1245.62,2910.21 1215.62,2910.8 1215.16,2887.53 1245.16,2886.93 1245.05,2881.18 1215.05,2881.77 1214.69,2863.21 1244.94,2862.6 1244.82,2856.85 1205.24,2857.64ZM1291.82,2855.92 L1292.44,2887.21c0.27,13.35 -3,22.48 -14.72,22.71s-15.35,-8.76 -15.62,-22.11l-0.62,-31.29 -8.82,0.18 0.63,31.29c0.32,16.3 7.88,27.66 24.53,27.33s23.65,-12 23.33,-28.28l-0.62,-31.3ZM1353.67,2896.72c-0.26,-3.92 -2.28,-9.37 -10,-12.62a69.06,69.06 0,0 0,-12.8 -3.41c-6.91,-1.35 -11.91,-3.52 -12,-10 -0.09,-4.26 1.78,-11.19 11.19,-11.38 9.07,-0.18 11.36,5.53 12.54,12.31l8.6,-2a17.36,17.36 0,0 0,-2.67 -6.75,16.72 16.72,0 0,0 -7.62,-5.87 28.44,28.44 0,0 0,-11.28 -1.78,27.4 27.4,0 0,0 -10.43,2.12 15,15 0,0 0,-7 5.9,14.16 14.16,0 0,0 -2.37,8.09c0.13,6.62 5.6,9.55 8.32,11 2.2,1.09 5.89,2.06 11.16,3.35 10.85,2.48 15.28,5.27 15.41,11.9 0.13,6.46 -4.13,12.3 -12.24,12.46 -8.71,0.17 -14.56,-4.78 -15.52,-14.09l-8.52,2.08a20.16,20.16 0,0 0,3 7.63,18.25 18.25,0 0,0 8.4,6.63 33.34,33.34 0,0 0,13 2,26.17 26.17,0 0,0 11,-2.49 16.93,16.93 0,0 0,7.45 -6.43,14.78 14.78,0 0,0 2.45,-8.59Z"
android:fillColor="#04639d"/>
<path
android:pathData="M971.38,2920.36l25.54,-25.52 -0.93,-46.59 44.53,-0.89 25.85,-26.9 -96.6,1.93S971.72,2920.36 971.38,2920.36Z"
android:fillColor="#34c5f3"/>
<path
android:pathData="M1362.91,2912.22l36.59,-38.76l0.76,38.36l-37.35,0.4z"
android:fillColor="#34c5f3"/>
<path
android:pathData="M67.14,2740.1l549.21,130.71l-80.66,-203.17l-468.55,72.46z"
android:fillColor="#ff3a65"/>
<path
android:fillColor="#FF000000"
android:pathData="M632,2851.39a2.53,2.53 0,0 1,-2.37 -1.62l-33.6,-86.92a2.54,2.54 0,0 1,2.36 -3.45l362.91,-0.9h0a2.54,2.54 0,0 1,0 5.07l-359.22,0.89 32.27,83.48a2.55,2.55 0,0 1,-1.45 3.28A2.44,2.44 0,0 1,632 2851.39Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M199.68,2799a2.64,2.64 0,0 1,-0.62 -0.08L44.93,2760.36a2.53,2.53 0,0 1,-1.92 -2.44l-0.89,-140.69a2.53,2.53 0,0 1,2.51 -2.55h0a2.52,2.52 0,0 1,2.53 2.52l0.89,138.72 152.22,38a2.54,2.54 0,0 1,-0.61 5Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M1413.42,2764.92h0l-161.74,-1.35a2.54,2.54 0,0 1,0 -5.07h0l159.19,1.33v-146.2a2.54,2.54 0,0 1,5.07 0v148.75a2.52,2.52 0,0 1,-0.75 1.8A2.56,2.56 0,0 1,1413.42 2764.92Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M1329,2433.26a15.78,15.78 0,1 1,15.78 -15.77A15.8,15.8 0,0 1,1329 2433.26ZM1329,2406.78a10.71,10.71 0,1 0,10.71 10.71A10.71,10.71 0,0 0,1329 2406.78Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M1283.21,2354.51a15.78,15.78 0,1 1,15.77 -15.78A15.8,15.8 0,0 1,1283.21 2354.51ZM1283.21,2328.03a10.71,10.71 0,1 0,10.7 10.7A10.71,10.71 0,0 0,1283.21 2328Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M241.21,2424.76A15.78,15.78 0,1 1,257 2409,15.8 15.8,0 0,1 241.21,2424.76ZM241.21,2398.28a10.71,10.71 0,1 0,10.7 10.7A10.71,10.71 0,0 0,241.21 2398.28Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M1017.16,2219a15.78,15.78 0,1 1,15.77 -15.78A15.79,15.79 0,0 1,1017.16 2219ZM1017.16,2192.52a10.71,10.71 0,1 0,10.71 10.7A10.72,10.72 0,0 0,1017.16 2192.53Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M2.53,2579.43a2.59,2.59 0,0 1,-1.26 -0.34,2.54 2.54,0 0,1 -1.27,-2.2v-23.62a2.51,2.51 0,0 1,1.27 -2.19,2.49 2.49,0 0,1 2.53,0l20.46,11.81a2.53,2.53 0,0 1,0 4.39L3.8,2579.09A2.6,2.6 0,0 1,2.53 2579.43ZM5.07,2557.66v14.85l12.85,-7.43Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M1127,2798.1a2.49,2.49 0,0 1,-1.26 -0.34L1105.26,2786a2.53,2.53 0,0 1,0 -4.39l20.46,-11.81a2.54,2.54 0,0 1,3.8 2.19v23.63a2.54,2.54 0,0 1,-1.27 2.19A2.49,2.49 0,0 1,1127 2798.1ZM1111.61,2783.75 L1124.47,2791.18v-14.85Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M783,2787.77a2.54,2.54 0,1 1,0 -5.07l248.21,-0.9h0a2.54,2.54 0,0 1,0 5.07l-248.22,0.9Z"/>
<path
android:pathData="M1398.51,2741.29l-1327.91,-0.99l-1.88,-237.22l1329.79,-34.87l0,273.08z"
android:fillColor="#09ced6"/>
<path
android:pathData="M605.66,2279.08l36.91,-0.8q35.73,-0.77 48.4,2.24t19.39,10.36a34.16,34.16 0,0 1,8.56 16.52q1.85,9.17 2.42,36.11l1.44,66.43q0.56,25.54 -1.66,34.21A25.68,25.68 0,0 1,713 2457.8a34.94,34.94 0,0 1,-14.62 7.12q-8.74,2.11 -26.44,2.5l-62.21,1.35ZM655.66,2310.47 L658.36,2435.25c7.11,-0.16 11.45,-1.67 13,-4.56s2.23,-10.66 2,-23.31l-1.6,-73.7q-0.27,-12.88 -1.18,-16.5a7.85,7.85 0,0 0,-3.86 -5.25Q663.77,2310.3 655.69,2310.47Z"
android:fillColor="#09ced6"/>
<path
android:pathData="M853.41,2384.84q0.62,28.59 -0.47,40.51a45.38,45.38 0,0 1,-26.79 37.44q-12,5.53 -28,5.88a71.41,71.41 0,0 1,-27.47 -4.38,45.61 45.61,0 0,1 -29.08,-36q-1.67,-11.68 -2.3,-41l-0.7,-32.45q-0.63,-28.59 0.47,-40.51a45.32,45.32 0,0 1,26.79 -37.45q12,-5.54 28,-5.88a71.33,71.33 0,0 1,27.46 4.39,45.6 45.6,0 0,1 29.09,36q1.67,11.68 2.3,41ZM802.73,2323.57q-0.29,-13.23 -1.83,-16.89t-6.11,-3.56a6.74,6.74 0,0 0,-5.86 3.11q-2,3 -1.66,17.68l1.92,88.58q0.34,16.52 1.78,20.35c1,2.56 3.08,3.81 6.36,3.73s5.47,-1.6 6.34,-4.59 1.19,-10.06 1,-21.24Z"
android:fillColor="#09ced6"/>
<path
android:pathData="M918.72,2272.3 L922.83,2462l-49.32,1.07 -4.11,-189.69Z"
android:fillColor="#09ced6"/>
<path
android:pathData="M1048.66,2269.48l4.11,189.69 -43.23,0.94L982,2374.43l1.87,86.23 -41.25,0.9 -4.11,-189.69 41.24,-0.9 29.51,84.82 -1.85,-85.41Z"
android:fillColor="#09ced6"/>
<path
android:pathData="M1183.15,2336.43l-49.32,1.07 -0.38,-17.22q-0.35,-16.29 -1.84,-20.36t-6.77,-4c-3,0.07 -5.09,1.29 -6.14,3.65s-1.45,8.4 -1.24,18.08l2,91q0.27,12.76 2,16.78t6.65,3.9q5.39,-0.12 7.23,-4.73t1.54,-17.85l-0.48,-22.5 -10,0.22 -0.63,-28.83 57.76,-1.25 2.21,101.82 -31,0.67 -4.85,-13.49a34.5,34.5 0,0 1,-12.44 13.45,35.87 35.87,0 0,1 -18,4.79 47.09,47.09 0,0 1,-23.41 -5.53q-11,-5.79 -16.79,-14.58a47.31,47.31 0,0 1,-7.44 -18.53q-1.62,-9.75 -2,-29.32l-1.22,-56.36q-0.58,-27.18 2.08,-39.55t16.32,-22.92q13.66,-10.55 35.69,-11 21.68,-0.46 36.16,8.13t19.09,20.74q4.59,12.15 5.1,35.47Z"
android:fillColor="#09ced6"/>
<path
android:fillColor="#FF000000"
android:pathData="M144.09,2459.34l66.09,-1.81q31.32,-0.86 47.58,3.58t26.58,19q10.32,14.6 11.22,47.61 0.62,22.34 -6.15,31.33t-27.24,14.28q23.11,4.58 31.62,16.39t9.2,36.7l0.64,23.61q0.71,25.83 -4.85,38.43A31.85,31.85 0,0 1,280.44 2706q-12.78,4.92 -52.75,6l-76.63,2.1ZM211.53,2501.11 L213.08,2557.76q4.24,-0.27 6.61,-0.33 9.75,-0.27 12.29,-5.14t1.93,-27.54q-0.33,-12 -2.66,-16.69t-5.91,-5.91Q221.77,2501 211.53,2501.11ZM214.16,2597.42 L216.16,2668.7q14,-0.85 17.74,-4.89t3.33,-19.46l-0.65,-23.76q-0.45,-16.37 -4,-19.74T214.16,2597.42Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M369.16,2513.35l0.69,25.37 -50,1.37 -0.69,-25.37ZM370.16,2548.46L374.48,2708l-50,1.37 -4.36,-159.53Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M497.91,2545l3.36,122.86q0.68,24.89 -0.26,32.19t-7.7,15.61q-6.75,8.31 -19.07,12.92t-31.2,5.12q-23.21,0.63 -37.49,-6.86t-15.39,-30.56l47.13,-1.28q0.29,10.58 8,10.36c3.68,-0.1 6.1,-1.25 7.24,-3.45s1.62,-6.74 1.43,-13.64l-0.32,-12a46.32,46.32 0,0 1,-12.93 8.92,37.13 37.13,0 0,1 -14.41,3.29q-13.11,0.36 -21.73,-4.7a27.07,27.07 0,0 1,-12 -13.57q-3.36,-8.51 -3.79,-24.38l-1.59,-58q-0.62,-22.71 7.29,-32.92t24.61,-10.66a37,37 0,0 1,16.75 3.28,39.47 39.47,0 0,1 13.71,10.84l3.16,-12.15ZM450.38,2588.64q-0.3,-10.93 -1.64,-13.91t-5.68,-2.85a6.12,6.12 0,0 0,-5.85 3.59q-1.65,3.48 -1.38,13.57l1.47,53.62q0.29,10.7 1.7,13.85t5.62,3q4.8,-0.12 6.14,-4t1,-17.47Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M661.05,2505.37l1.07,39 -30.06,0.82 4.26,155.68 -50.61,1.39 -4.26,-155.69 -29.93,0.82 -1.07,-38.95Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M719.72,2503.77l1.2,43.79a43.54,43.54 0,0 1,13.29 -9,41.72 41.72,0 0,1 15.49,-3.31q12.74,-0.36 21.87,5.89t11.35,14.67q2.22,8.43 2.83,30.91l3,110L740.19,2698l-3.07,-112.28q-0.37,-14 -1.87,-17.88c-1,-2.62 -3.1,-3.88 -6.3,-3.8a5.92,5.92 0,0 0,-5.9 4.26q-1.45,4.13 -1.12,16.27L725,2698.41l-48.57,1.33 -5.32,-194.64Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M850.16,2500.2l0.7,25.37 -50,1.37 -0.69,-25.37ZM851.16,2535.31 L855.52,2694.84 805.52,2696.21 801.16,2536.68Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M918,2533.48l-0.44,14.72a36.53,36.53 0,0 1,12.57 -13.54,34.65 34.65,0 0,1 17.49,-4.87q12.49,-0.35 20.6,5.33a26.15,26.15 0,0 1,10.62 14.57q2.54,8.89 3.1,29.81L985,2691.3l-48.57,1.33 -3,-110.48q-0.45,-16.47 -1.63,-20.05c-0.79,-2.38 -2.82,-3.53 -6.11,-3.44 -3.45,0.09 -5.57,1.53 -6.38,4.32s-1,10.2 -0.71,22.22L921.48,2693l-48.57,1.33 -4.36,-159.54Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M1107.67,2528.3l3.36,122.86q0.67,24.89 -0.26,32.19t-7.7,15.61q-6.75,8.31 -19.07,12.92t-31.2,5.12q-23.21,0.63 -37.49,-6.86t-15.39,-30.55l47.13,-1.29q0.29,10.57 8,10.37c3.68,-0.1 6.1,-1.25 7.24,-3.45s1.62,-6.75 1.44,-13.65l-0.33,-12a46.11,46.11 0,0 1,-12.93 8.92,37.13 37.13,0 0,1 -14.41,3.29q-13.11,0.36 -21.72,-4.7a27,27 0,0 1,-12 -13.57q-3.36,-8.5 -3.79,-24.38L997,2571.15q-0.63,-22.72 7.28,-32.93t24.61,-10.66a37,37 0,0 1,16.75 3.28,39.59 39.59,0 0,1 13.71,10.84l3.16,-12.15ZM1060.14,2572c-0.2,-7.3 -0.75,-11.93 -1.64,-13.92s-2.79,-2.93 -5.68,-2.85a6.13,6.13 0,0 0,-5.85 3.59q-1.65,3.48 -1.38,13.57l1.47,53.62q0.29,10.71 1.7,13.85t5.62,3q4.8,-0.13 6.14,-4t1,-17.47Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M1225.56,2576.09l-43,1.17 -0.24,-8.65q-0.3,-11.07 -1.64,-14t-6.39,-2.78a7.21,7.21 0,0 0,-6.06 2.88c-1.31,1.83 -1.92,4.56 -1.82,8.17q0.2,7.34 1.31,10.73T1174,2581q5.22,4 21.31,11.33 21.43,9.77 28.3,18.72t7.34,26.39q0.52,19.47 -4.25,29.53t-16.47,15.73q-11.7,5.67 -28.41,6.13 -18.51,0.51 -31.84,-4.91t-18.52,-15.13q-5.19,-9.72 -5.74,-29.68l-0.21,-7.69 43,-1.18 0.28,10.1q0.35,12.87 2.08,16.67t6.53,3.67c3.45,-0.1 5.83,-1 7.14,-2.79s1.9,-5.4 1.75,-10.93q-0.31,-11.43 -3,-14.24t-28.72,-16.29q-21.74,-11.44 -26.69,-21.11t-5.32,-23.14q-0.52,-19.11 4.28,-28.33t16.74,-14.47q12,-5.27 27.94,-5.7t27.1,3.29q11.24,3.74 17.36,10.18t7.55,12.06q1.43,5.63 1.75,17.64Z"/>
<path
android:pathData="M381,2393.18l0.5,17.24 -14.41,0.42 2,68.9 -24.28,0.7 -2,-68.9 -14.36,0.42 -0.5,-17.24Z"
android:fillColor="#050505"/>
<path
android:pathData="M386.56,2393l40.48,-1.18 0.5,17.24 -16.2,0.47 0.47,16.34 15.17,-0.44 0.47,16.38 -15.16,0.44 0.55,18.94 17.82,-0.51 0.5,17.23 -42.1,1.23Z"
android:fillColor="#050505"/>
<path
android:pathData="M477.6,2390.38 L494,2476.11l-24.81,0.72 -1.76,-15.44 -8.68,0.25 -1,15.52 -25.1,0.73 9.88,-86.5ZM482.74,2531.87q-2.26,-14.59 -4.74,-36.08 -3,24.86 -3.61,36.32Z"
android:fillColor="#050505"/>
<path
android:pathData="M570.52,2387.68l2.5,86.14 -21.22,0.61 -1.72,-58.15 -6.76,58.4 -15.05,0.43 -10.56,-56.56 1.62,56.82 -21.22,0.62 -2.5,-86.14 31.41,-0.91q1.63,7.72 3.42,18.23l4.08,21.81 4.41,-40.38Z"
android:fillColor="#050505"/>
<path
android:pathData="M371.8,2314.82l-18.55,0.54 -0.17,-5.87q-0.12,-4.09 -0.86,-5.2a2.59,2.59 0,0 0,-2.41 -1.05,3 3,0 0,0 -2.68,1.59 9,9 0,0 0,-0.79 4.62,13.28 13.28,0 0,0 1.21,5.93q1.05,2 5.78,4.67 13.57,7.77 17.19,12.89t4,16.74q0.25,8.46 -1.56,12.51t-7.23,6.93a28.67,28.67 0,0 1,-12.73 3.09,28.1 28.1,0 0,1 -13.78,-2.73c-3.83,-2 -6.39,-4.56 -7.65,-7.75s-2,-7.74 -2.15,-13.67l-0.15,-5.17 18.55,-0.54L348,2352q0.13,4.44 0.95,5.69a3,3 0,0 0,2.82 1.19,3.23 3.23,0 0,0 2.91,-1.7 9.41,9.41 0,0 0,0.84 -4.82c-0.14,-4.65 -0.84,-7.68 -2.12,-9.07s-4.49,-3.7 -9.55,-6.91a89.47,89.47 0,0 1,-10.08 -7.09,17.29 17.29,0 0,1 -4.2,-6.23 28.62,28.62 0,0 1,-1.89 -10.31q-0.25,-9.07 1.87,-13.35a15.27,15.27 0,0 1,7.09 -6.77,28.18 28.18,0 0,1 12.08,-2.72 30.69,30.69 0,0 1,13.33 2.2q5.57,2.43 7.45,6.31t2.17,13.3Z"
android:fillColor="#050505"/>
<path
android:pathData="M440.65,2288.87l2.3,79.06 -17.46,0.51 -1.57,-53.38 -5.4,53.58 -12.38,0.36 -8.85,-51.94 1.49,52.15 -17.46,0.51L379,2290.66l25.84,-0.75q1.36,7.1 2.86,16.74l3.42,20 3.52,-37.06Z"
android:fillColor="#050505"/>
<path
android:pathData="M483.2,2287.63l13.72,78.73 -20.42,0.6L475,2352.78l-7.15,0.2 -0.78,14.25 -20.65,0.6 7.89,-79.36ZM474.09,2338.78q-1.9,-13.4 -4,-33.12 -2.38,22.8 -2.87,33.32Z"
android:fillColor="#050505"/>
<path
android:pathData="M518,2286.62l1.83,63.24 12.15,-0.35 0.46,15.82 -32.12,0.93L498,2287.2Z"
android:fillColor="#050505"/>
<path
android:pathData="M554.94,2285.55l1.84,63.24 12.14,-0.35 0.46,15.82 -32.11,0.93 -2.3,-79.06Z"
android:fillColor="#050505"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="1440dp"
android:height="2960dp"
android:viewportWidth="1440"
android:viewportHeight="2960">
<path
android:pathData="M1014.2,161.28c5.09,-1.73 8.82,-4.6 11.2,-9.53a15.32,15.32 0,0 0,1.31 -6.72,16.31 16.31,0 0,0 -5.35,-12.28c-3.6,-3.36 -8.34,-5 -14.32,-4.91l-16.7,0.1 0.36,60.54 9,-0.06 -0.15,-25.36 2.59,0c2.33,0 8,-0.3 12.05,-1.76ZM1015.49,152.08a10.6,10.6 0,0 1,-5.33 4.13,32.61 32.61,0 0,1 -8,0.78h-2.59l-0.14,-23.22 5.63,0c3.3,0 5.72,0.42 7.25,1.3a8.55,8.55 0,0 1,3.68 4,12.28 12.28,0 0,1 1.45,6 12.5,12.5 0,0 1,-1.91 7.06ZM1072.77,187.98L1053.41,162a26.67,26.67 0,0 0,3.75 -0.92c5.08,-1.82 8.8,-4.69 11.09,-9.62a14.94,14.94 0,0 0,1.39 -6.62,16.32 16.32,0 0,0 -5.33,-12.28c-3.59,-3.37 -8.43,-5 -14.41,-5l-16.61,0.1 0.37,60.54 9,-0.06 -0.15,-25.27 2.77,0L1064.1,188ZM1042.34,133.52 L1047.98,133.52c3.21,0 5.71,0.42 7.22,1.3a9.33,9.33 0,0 1,3.69 4,12.69 12.69,0 0,1 1.47,6 12.39,12.39 0,0 1,-1.92 7.06A10,10 0,0 1,1053 156c-1.5,0.56 -4.19,0.75 -8,0.78h-2.5ZM1107.14,127.23a30.27,30.27 0,1 0,0.37 60.54c17,-0.1 30.72,-13.76 30.62,-30.44s-14,-30.2 -31,-30.1ZM1107.47,182.23c-12,0.08 -21.86,-10.94 -21.94,-24.6s9.68,-24.8 21.64,-24.88 21.85,11 21.93,24.62 -9.59,24.79 -21.63,24.86ZM1185.09,126.75L1142,127l0,5.9 16.79,-0.1 0.33,54.64 9.55,-0.05 -0.33,-54.65 16.79,-0.1ZM1191.69,187.26L1232,187l0,-5.89 -30.71,0.19 -0.15,-23.85 30.72,-0.18 0,-5.89 -30.71,0.18 -0.12,-19 31,-0.18 0,-5.9 -40.55,0.25ZM1280,126.19l0.2,32.06c0.08,13.67 -3.35,23 -15.4,23.05s-15.6,-9.19 -15.68,-22.86l-0.19,-32.06 -9,0.05 0.19,32.06c0.1,16.7 7.68,28.44 24.74,28.34s24.39,-11.94 24.29,-28.63l-0.19,-32.06ZM1342.76,168.86c-0.2,-4 -2.2,-9.63 -10.09,-13.07a71,71 0,0 0,-13.05 -3.67c-7.07,-1.48 -12.16,-3.77 -12.2,-10.46 0,-4.37 2,-11.44 11.63,-11.5 9.28,0 11.55,5.83 12.66,12.78l8.84,-1.94a17.74,17.74 0,0 0,-2.64 -6.94,17.26 17.26,0 0,0 -7.72,-6.12 29.11,29.11 0,0 0,-11.53 -2,27.83 27.83,0 0,0 -10.7,2 15.41,15.41 0,0 0,-7.29 5.94,14.63 14.63,0 0,0 -2.55,8.25c0,6.78 5.61,9.86 8.38,11.37 2.23,1.15 6,2.19 11.37,3.59 11.08,2.69 15.57,5.62 15.61,12.4 0,6.62 -4.4,12.54 -12.7,12.59 -8.93,0 -14.85,-5.1 -15.7,-14.65l-8.75,2a20.65,20.65 0,0 0,3 7.86,18.67 18.67,0 0,0 8.51,6.91 34.19,34.19 0,0 0,13.32 2.24,26.77 26.77,0 0,0 11.25,-2.39 17.36,17.36 0,0 0,7.72 -6.48,15.14 15.14,0 0,0 2.63,-8.76Z"
android:fillColor="#04639d"/>
<path
android:pathData="M950.93,187.66l26.51,-25.77 -0.28,-47.72 45.61,-0.28 26.86,-27.18 -99,0.6S951.28,187.66 950.93,187.66Z"
android:fillColor="#34c5f3"/>
<path
android:pathData="M1351.99,184.9l38.01,-39.18l0.24,39.3l-38.25,-0.12z"
android:fillColor="#34c5f3"/>
<path
android:pathData="M139.59,158.5l-139.59,2204.25l0,-2362.75l1440,0l-1300.41,158.5z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M1300.41,2801.5l139.59,-2204.25l0,2362.75l-1440,0l1300.41,-158.5z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M477.4,2301.09a28.29,28.29 0,0 0,-7.46 -1.2,27.1 27.1,0 0,0 -7.47,1.19q-5.31,-18.9 -12.68,-44.35l-24.85,-83.91L383.3,2301.1a33,33 0,0 0,-7.58 -1.21,30 30,0 0,0 -7.79,1.2L332.29,2174q-5.51,-19 -8.65,-28.52a63.56,63.56 0,0 0,11.16 1.2,51.37 51.37,0 0,0 10.85,-1.21q11.46,50.35 35.17,132.61l21.07,-66.63q7.37,-22.17 19.74,-66a24,24 0,0 0,7.26 1.2,24.68 24.68,0 0,0 7.26,-1.2q6.24,24.8 20.67,73 3.06,10.16 18.2,59.65l19.85,-66.2q15.35,-51 18.41,-66.42a30.84,30.84 0,0 0,7.77 1.2,41.58 41.58,0 0,0 8.19,-1.2Q517.08,2176.11 477.4,2301.09Z"
android:fillColor="#424141"/>
<path
android:pathData="M623.75,2247q0,28.39 -16.87,43.59 -14,12.67 -35,12.67T537,2290.61Q520.94,2275.85 521,2247q0,-28.51 16.78,-43.59 14,-12.66 35,-12.67 21.18,0 34.88,12.67Q623.76,2218.3 623.75,2247ZM604.32,2247q0,-20.43 -6.14,-32.44 -8,-15.63 -25.47,-15.63 -32.33,0 -32.32,48.07t31.5,48Q604.32,2295 604.32,2247Z"
android:fillColor="#424141"/>
<path
android:pathData="M686,2192.29q-1.74,4.49 -1.74,18.79l-2,1.53q-3,-3.83 -10.16,-3.82 -10.28,0 -16.07,10.16 -4.87,8.63 -4.87,20.42v61.72a42.06,42.06 0,0 0,-8.8 -1.2,45.61 45.61,0 0,0 -9.31,1.2q1.34,-14.64 1.33,-54.07 0,-12.67 -0.1,-26l-0.31,-28.18a45.15,45.15 0,0 0,9.31 1.31,38 38,0 0,0 9,-1.31 191,191 0,0 0,-1.33 21.19q12,-23.27 27.72,-23.27A18.61,18.61 0,0 1,686 2192.29Z"
android:fillColor="#424141"/>
<path
android:pathData="M778.93,2301.2a107.61,107.61 0,0 0,-13.28 -1.31,53.2 53.2,0 0,0 -10.93,1.31q-19,-27.09 -41.67,-53.63a5.87,5.87 0,0 0,-2.76 -2.08c-1.09,0 -1.63,0.73 -1.63,2.19v13.46q-0.21,21.68 1.22,40.06a43,43 0,0 0,-10 -1.31,43.63 43.63,0 0,0 -9.92,1.31q0.91,-10.82 1.73,-27.87 0.21,-9.84 0.41,-37.27l0.41,-40.45q0.1,-11.47 -0.41,-31.48l-0.81,-33.67a46.53,46.53 0,0 0,10 1.2,47.21 47.21,0 0,0 9.92,-1.2q-1.74,23.05 -2.15,65.11l-0.4,40.63c0,2.48 0.64,3.72 1.94,3.72q1.42,0 7.88,-5 12.67,-9.93 39.07,-42a26.17,26.17 0,0 0,8.18 1.31q2.57,0 12.18,-1.31 -29.77,25.53 -49.61,45.72 5.21,6.66 12.58,15.83 5.72,7.09 16.87,20.84Z"
android:fillColor="#424141"/>
<path
android:pathData="M200.57,2552.15q-39.23,0 -69.71,-24.39 5.49,-14.62 8.53,-38.41h6.51q20.11,43.29 64.63,43.29 26.22,0 42.68,-16.56t16.46,-42.79q0,-32.92 -33.13,-48.37l-62.61,-29q-34.12,-22.17 -34.13,-64 0,-38.42 27.44,-60 25,-19.92 64.43,-19.93 37.8,0 62.8,20.53 -6.3,12.2 -12,36.18h-6.3q-14.64,-39.43 -48.58,-39.43 -23.37,0 -38.21,13.74t-14.83,36.95q0,34.2 33.12,49.26l62.4,28.3q34.35,20.72 34.35,60 0,43.29 -30.69,69.72Q244.67,2552.15 200.57,2552.15Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M564.74,2428 L562,2501.56q-0.33,7 0.16,18.5 0.5,14.13 0.49,18.68a78.48,78.48 0,0 0,-15.1 -1.79,71.88 71.88,0 0,0 -15.58,1.79q4.38,-37.66 4.38,-106 0,-39.13 -33.45,-39.13 -21.92,0 -32.63,15.42a40.91,40.91 0,0 0,-6.66 17.86q-1.93,14 -1.94,58.12 0,8.94 0.65,26.87t0.65,26.88a79.71,79.71 0,0 0,-15.43 -1.79,75 75,0 0,0 -15.58,1.79q3.24,-38.16 3.73,-76.47l0.32,-27.93q0.17,-14.93 -5.81,-25.81 -8.25,-14.94 -26.68,-14.94 -41.87,0 -41.86,53.74 0,71.93 1.46,91.41a83.68,83.68 0,0 0,-15.67 -1.79,78 78,0 0,0 -16,1.79q3.74,-32.8 3.73,-97.74 0,-39.95 -2.27,-63.16a79.78,79.78 0,0 0,16 1.95,75.39 75.39,0 0,0 14.2,-1.95q0,4.38 -0.73,12.91t-0.73,12.91q18.18,-28.9 49.68,-28.9a55.73,55.73 0,0 1,30.2 8.44q14.61,9.09 18.5,24.52 16.08,-33 53.26,-33 26.13,0 38.8,13.15Q565.71,2402 564.74,2428Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M721.57,2533.38a56.78,56.78 0,0 1,-22.08 4.87q-20.44,0 -23.38,-19.65Q651.77,2542 624.32,2542q-18.83,0 -31.49,-11.36 -13.16,-11.7 -13.15,-30.36 0,-39 47.89,-46.44 34.59,-5.36 42.86,-9.41 6.5,-3.09 6.5,-13 0,-41.07 -35.23,-41.08 -29.4,0 -41.73,22.57h-5l0.16,-18.51q26.46,-19.64 54.55,-19.64 23.86,0 38.8,12.85a42.93,42.93 0,0 1,11.86 15.94,52 52,0 0,1 3.73,21.32l-2.11,77.61q-0.64,23.92 11.85,23.92a12.63,12.63 0,0 0,7.79 -2.44ZM676.93,2455l-42.32,9.9q-26,8.78 -26,30.69 0,13.3 7.14,21.75 7.63,9.1 20.62,9.1 23.86,0 38.8,-22.9Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M820.93,2377q-2.76,6.66 -2.76,27.92l-3.22,2.28q-4.85,-5.68 -16.14,-5.68 -16.3,0 -25.49,15.1 -7.76,12.82 -7.75,30.35v91.74a70.16,70.16 0,0 0,-14 -1.79,76.29 76.29,0 0,0 -14.77,1.79q2.11,-21.76 2.11,-80.37 0,-18.82 -0.16,-38.64l-0.48,-41.89a75.67,75.67 0,0 0,14.77 1.95,63.76 63.76,0 0,0 14.29,-1.95 266.93,266.93 0,0 0,-2.11 31.5q19,-34.58 44,-34.58A31.3,31.3 0,0 1,820.93 2377Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M896.26,2536.79Q881,2542 869.8,2542q-20.94,0 -31,-10.55 -10.87,-11 -10.23,-31.82l3.09,-102.93q3.9,0 -22.73,0.64l1,-8.44a44.17,44.17 0,0 0,-0.81 -7.46l22.08,1 -1,-36.86 28.41,-12h2.6l-2.28,26.93q-0.81,12.42 -0.81,21.94 6,0 10.07,-0.11 20,-0.54 25.33,-0.54l-0.65,8.28 0.48,7.3 -35.55,-0.64q-2.92,18 -2.92,83.61 0,24.67 3.4,34.25 5.37,15.11 22.25,15.1a53.38,53.38 0,0 0,15.74 -2.6Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M209.21,2624q0,8.33 -0.35,16.38l-0.14,3.2 -0.29,13.26q-0.08,3.72 0,23.39a47,47 0,0 0,-7.88 -0.95,36.05 36.05,0 0,0 -7.71,0.95q0.25,-3.72 0.87,-20l0.69,-20 0.08,-10.83q0.09,-11 -3.72,-17.93 -4.86,-8.66 -15,-8.66 -17,0 -21.74,15.16 -2.09,6.68 -2.08,28.59 0,22.17 1.12,33.7a45,45 0,0 0,-8.4 -0.95,42.54 42.54,0 0,0 -8.49,0.95q1.9,-17.16 1.9,-52.16 0,-22 -1.12,-33.7a41.33,41.33 0,0 0,8.4 1,41.73 41.73,0 0,0 7.63,-1c0,1.85 -0.06,3.61 -0.18,5.29 -0.34,5.08 -0.52,7.91 -0.52,8.49q10.49,-15.42 28.33,-15.42Q209.21,2592.72 209.21,2624Z"
android:fillColor="#424141"/>
<path
android:pathData="M304.43,2637.34q0,22.51 -14.3,34.56 -11.86,10 -29.63,10t-29.54,-10q-13.61,-11.68 -13.6,-34.56 0,-22.62 14.2,-34.57 11.88,-10 29.63,-10.05 17.94,0 29.55,10.05Q304.42,2614.55 304.43,2637.34ZM287.96,2637.34q0,-16.2 -5.19,-25.74 -6.76,-12.37 -21.58,-12.38 -27.37,0 -27.37,38.12t26.68,38Q288,2675.37 288,2637.34Z"
android:fillColor="#424141"/>
<path
android:pathData="M348.87,2679.18a44.83,44.83 0,0 1,-14.12 2.77q-11.17,0 -16.55,-5.63 -5.81,-5.9 -5.46,-17l1.65,-54.93q2.08,0 -12.13,0.35l0.52,-4.51a23.47,23.47 0,0 0,-0.43 -4l11.78,0.52 -0.52,-19.67 15.16,-6.41h1.39l-1.22,14.37q-0.44,6.63 -0.43,11.71 3.21,0 5.37,-0.06 10.67,-0.29 13.52,-0.29l-0.35,4.42 0.26,3.9 -19,-0.35q-1.56,9.62 -1.56,44.62 0,13.17 1.82,18.28 2.85,8.05 11.87,8.06a28.45,28.45 0,0 0,8.4 -1.39Z"
android:fillColor="#424141"/>
<path
android:pathData="M577.05,2650.09l-0.45,40q0,1.69 0.91,35.69 0.45,16.6 0.45,25.24a77.11,77.11 0,0 0,-11.94 -1.25,70 70,0 0,0 -12.16,1.25q0,-15.47 1.82,-44.56 0.57,-9.78 0.68,-16.37l0.23,-20.47H460.41v20.47q0,1.69 0.76,35.69 0.38,16.71 0.37,25.24a77.12,77.12 0,0 0,-11.93 -1.25,70.09 70.09,0 0,0 -12.17,1.25q0,-15.47 1.82,-44.45v-2.5q0.63,-8.07 0.8,-14l0.34,-40q0,-4.22 -0.34,-16.94l-0.8,-23q-0.35,-11.59 -0.34,-21.14a94.64,94.64 0,0 0,12.05 1.25,65 65,0 0,0 11.94,-1.25q0,10.58 -0.68,22.05 -0.21,3.42 -0.8,17.62v5.91q-0.82,9.9 -1,15.47v7.5l48.14,0.68 48.15,-0.68 0.12,-7.5q0,1.59 -1.14,-38.66 -0.34,-12.27 -0.34,-22.39a94.3,94.3 0,0 0,12 1.25,65 65,0 0,0 11.94,-1.25q0,13.41 -1.48,42.52Q577.16,2644.4 577.05,2650.09Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M700.52,2747.29a39.82,39.82 0,0 1,-15.47 3.41q-14.32,0 -16.37,-13.76 -17.05,16.38 -36.26,16.37 -13.2,0 -22.06,-7.95 -9.21,-8.19 -9.21,-21.26 0,-27.29 33.54,-32.52 24.21,-3.75 30,-6.59 4.56,-2.16 4.55,-9.1 0,-28.76 -24.67,-28.76 -20.58,0 -29.22,15.8h-3.52l0.11,-13q18.54,-13.75 38.2,-13.75 16.71,0 27.17,9a29.86,29.86 0,0 1,8.3 11.16,36.24 36.24,0 0,1 2.62,14.93l-1.48,54.34q-0.45,16.76 8.3,16.75a8.84,8.84 0,0 0,5.46 -1.71ZM669.25,2692.38 L639.62,2699.31q-18.23,6.15 -18.23,21.49 0,9.33 5,15.23 5.34,6.38 14.44,6.37 16.71,0 27.17,-16Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M770.09,2637.81q-1.94,4.67 -1.93,19.55L765.9,2659q-3.39,-4 -11.3,-4 -11.42,0 -17.85,10.58 -5.43,9 -5.43,21.26V2751a49.83,49.83 0,0 0,-9.78 -1.25A54.16,54.16 0,0 0,711.2 2751q1.49,-15.23 1.48,-56.27 0,-13.18 -0.11,-27.06l-0.34,-29.33a52.87,52.87 0,0 0,10.34 1.36,44.69 44.69,0 0,0 10,-1.36 186.32,186.32 0,0 0,-1.48 22q13.3,-24.21 30.81,-24.21A21.85,21.85 0,0 1,770.09 2637.81Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M875.82,2573.46q-4.32,38.31 -4,121.08L871.82,2751l-9.66,-1.25 -9.44,1.25 1,-21.83q-12.27,24.11 -39.4,24.1 -22.83,0 -35.88,-18 -11.36,-15.69 -11.35,-39.9 0,-27.85 16.48,-44.68a46.73,46.73 0,0 1,34.56 -14.55q25.35,0 35.59,22.28v-85l11,1.25ZM854.45,2692.46q0,-45.3 -33.08,-45.3 -17.18,0 -25.81,17.19 -6.94,13.89 -6.94,32.55 0,46.78 31.27,46.78 16.59,0 26.15,-16.05Q854.44,2713.38 854.45,2692.43Z"
android:fillColor="#0c6aaf"/>
<path
android:fillColor="#FF000000"
android:pathData="M917.61,2792.63h0L755.86,2790a2.53,2.53 0,0 1,0.06 -5.06h0l159.17,2.56 1.15,-146.18a2.54,2.54 0,1 1,5.07 0l-1.17,148.74a2.53,2.53 0,0 1,-2.55 2.51Z"/>
<path
android:pathData="M1055.05,2642.21a39.38,39.38 0,1 1,39.38 -39.38A39.42,39.42 0,0 1,1055.05 2642.21ZM1055.05,2580.15a22.68,22.68 0,1 0,22.68 22.68A22.71,22.71 0,0 0,1055.05 2580.15Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M364.94,2800.21a6.85,6.85 0,0 1,-4.92 -2.08l-19.36,-20a6.83,6.83 0,0 1,0.16 -9.67l20,-19.37a6.84,6.84 0,1 1,9.5 9.83l-15.1,14.61 14.61,15.11a6.83,6.83 0,0 1,-4.91 11.59Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M329.42,2799.62a6.82,6.82 0,0 1,-4.91 -2.08l-19.37,-20a6.84,6.84 0,0 1,0.16 -9.66l20,-19.37a6.84,6.84 0,0 1,9.51 9.83l-15.1,14.61L334.34,2788a6.83,6.83 0,0 1,-4.92 11.59Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M293.91,2799a6.83,6.83 0,0 1,-4.92 -2.09l-19.36,-20a6.84,6.84 0,0 1,0.16 -9.67l20,-19.36a6.84,6.84 0,0 1,9.51 9.83l-15.11,14.61 14.61,15.11a6.84,6.84 0,0 1,-4.91 11.59Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M258.4,2798.43a6.81,6.81 0,0 1,-4.92 -2.08l-19.36,-20a6.83,6.83 0,0 1,0.16 -9.67l20,-19.36a6.84,6.84 0,0 1,9.51 9.83l-15.11,14.61 14.61,15.1a6.83,6.83 0,0 1,-4.91 11.59Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M222.88,2797.84a6.8,6.8 0,0 1,-4.91 -2.08l-19.37,-20a6.84,6.84 0,0 1,0.17 -9.67l20,-19.37a6.84,6.84 0,0 1,9.5 9.83l-15.1,14.61 14.61,15.11a6.83,6.83 0,0 1,-4.92 11.59Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M187.37,2797.25a6.82,6.82 0,0 1,-4.91 -2.08l-19.37,-20a6.85,6.85 0,0 1,0.16 -9.67l20,-19.37a6.84,6.84 0,0 1,9.51 9.83l-15.1,14.61 14.61,15.11a6.84,6.84 0,0 1,-4.92 11.59Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M151.86,2796.66a6.82,6.82 0,0 1,-4.92 -2.09l-19.36,-20a6.84,6.84 0,0 1,0.16 -9.67l20,-19.36a6.84,6.84 0,0 1,9.51 9.83L142.16,2770l14.61,15.11a6.83,6.83 0,0 1,-4.91 11.59Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M116.35,2796.07a6.82,6.82 0,0 1,-4.92 -2.09l-19.36,-20a6.82,6.82 0,0 1,0.16 -9.67l20,-19.36a6.84,6.84 0,0 1,9.51 9.83l-15.11,14.61 14.61,15.1a6.85,6.85 0,0 1,-4.91 11.6Z"
android:fillColor="#0c6aaf"/>
<path
android:pathData="M88.73,2527.46a6.67,6.67 0,0 1,-4.72 -1.95l-21.13,-21.13a6.68,6.68 0,1 1,9.44 -9.44l21.13,21.13a6.67,6.67 0,0 1,-4.72 11.39Z"
android:fillColor="#424141"/>
<path
android:pathData="M67.6,2527.46a6.67,6.67 0,0 1,-4.72 -11.39L84,2494.94a6.68,6.68 0,1 1,9.44 9.44l-21.13,21.13A6.65,6.65 0,0 1,67.6 2527.46Z"
android:fillColor="#424141"/>
<path
android:pathData="M1134.1,2334.83a17.68,17.68 0,1 1,17.69 -17.68A17.7,17.7 0,0 1,1134.1 2334.83ZM1134.1,2306.97a10.19,10.19 0,1 0,10.19 10.18A10.2,10.2 0,0 0,1134.1 2307Z"
android:fillColor="#424141"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#cc0000">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<corners android:radius="50dp" />
<solid android:color="#cc0000" />
</shape>
</item>
</ripple>
<!--
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#cc0000">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<solid android:color="#cc0000" />
</shape>
</item>
</ripple>-->
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/darkGrey">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<solid android:color="@color/darkGrey" />
</shape>
</item>
</ripple>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke android:width="1dp" android:color="#000" />
<!--<solid android:color="#fff" />-->
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
android:width="1dp"
android:color="#111" />
<!--<solid android:color="#11aaaaaa" />-->
<solid android:color="#3F51B5" />
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke android:width="1dp" android:color="@android:color/black" />
<solid android:color="@color/darkTransparentGrey" />
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke android:width="1dp" android:color="#000" />
<solid android:color="#fff" />
</shape>
</item>
</layer-list>
This source diff could not be displayed because it is too large. You can view the blob instead.
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:tint="#FFFFFF"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M9.4,10.5l4.77,-8.26C13.47,2.09 12.75,2 12,2c-2.4,0 -4.6,0.85 -6.32,2.25l3.66,6.35 0.06,-0.1zM21.54,9c-0.92,-2.92 -3.15,-5.26 -6,-6.34L11.88,9h9.66zM21.8,10h-7.49l0.29,0.5 4.76,8.25C21,16.97 22,14.61 22,12c0,-0.69 -0.07,-1.35 -0.2,-2zM8.54,12l-3.9,-6.75C3.01,7.03 2,9.39 2,12c0,0.69 0.07,1.35 0.2,2h7.49l-1.15,-2zM2.46,15c0.92,2.92 3.15,5.26 6,6.34L12.12,15L2.46,15zM13.73,15l-3.9,6.76c0.7,0.15 1.42,0.24 2.17,0.24 2.4,0 4.6,-0.85 6.32,-2.25l-3.66,-6.35 -0.93,1.6z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:fillColor="#666"
android:pathData="M23.71,11.71l-8,8a1,1 0,0 1,-1.42 0l-8,-8a1,1 0,0 1,-0.21 -1.09A1,1 0,0 1,7 10H23a1,1 0,0 1,0.92 0.62A1,1 0,0 1,23.71 11.71Z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#000000"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" />
</vector>
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="40dp"
android:tint="#E83CF7"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
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="#FF000000"
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>
<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="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z"/>
</vector>
<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="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
</vector>
<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="M4,4h7L11,2L4,2c-1.1,0 -2,0.9 -2,2v7h2L4,4zM10,13l-4,5h12l-3,-4 -2.03,2.71L10,13zM17,8.5c0,-0.83 -0.67,-1.5 -1.5,-1.5S14,7.67 14,8.5s0.67,1.5 1.5,1.5S17,9.33 17,8.5zM20,2h-7v2h7v7h2L22,4c0,-1.1 -0.9,-2 -2,-2zM20,20h-7v2h7c1.1,0 2,-0.9 2,-2v-7h-2v7zM4,13L2,13v7c0,1.1 0.9,2 2,2h7v-2L4,20v-7z"/>
</vector>
<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="#e83cf7"
android:pathData="M20,4h-3.17L15,2L9,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,-2zM15,15.5L15,13L9,13v2.5L5.5,12 9,8.5L9,11h6L15,8.5l3.5,3.5 -3.5,3.5z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:tint="#FFFFFF"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20,4h-3.17L15,2L9,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,-2zM15,15.5L15,13L9,13v2.5L5.5,12 9,8.5L9,11h6L15,8.5l3.5,3.5 -3.5,3.5z" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<FrameLayout
android:id="@+id/camera_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
tools:context=".SampleActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="OnDeepLinking" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/parent_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".CameraFragment">
<!--android:background="#03A9F4"-->
<ibase.android.visionselfie.AutoFitTextureView
android:id="@+id/texture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ibase.android.visionselfie.DrawableImageView
android:id="@+id/stillshot_imageview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--android:background="@drawable/circle_opaque"-->
<View
android:id="@+id/view_stillshot_bg"
android:layout_width="61dp"
android:layout_height="61dp"
android:background="@drawable/circle_white"
app:layout_constraintBottom_toBottomOf="@+id/stillshot"
app:layout_constraintEnd_toEndOf="@+id/stillshot"
app:layout_constraintStart_toStartOf="@+id/stillshot"
app:layout_constraintTop_toTopOf="@+id/stillshot" />
<ImageButton
android:id="@+id/stillshot"
style="@android:style/Widget.Material.Light.Button.Borderless"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="24dp"
android:background="@drawable/cam_circle_selector"
android:keepScreenOn="true"
android:src="@drawable/ic_photo_camera_pink_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!--android:src="@drawable/ic_camera_white"-->
<View
android:id="@+id/view_orientation_bg"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="@drawable/circle_white"
app:layout_constraintBottom_toBottomOf="@+id/stillshot"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/stillshot"
app:layout_constraintTop_toTopOf="@+id/stillshot" />
<ImageButton
android:id="@+id/switch_orientation"
style="@android:style/Widget.Material.Light.Button.Borderless"
android:layout_width="44dp"
android:layout_height="44dp"
android:background="@drawable/cam_grey_circle_selector"
android:padding="1dp"
android:src="@drawable/ic_switch_camera_black_24dp"
app:layout_constraintBottom_toBottomOf="@+id/view_orientation_bg"
app:layout_constraintEnd_toEndOf="@+id/view_orientation_bg"
app:layout_constraintStart_toStartOf="@+id/view_orientation_bg"
app:layout_constraintTop_toTopOf="@+id/view_orientation_bg" />
<!--<ImageView
android:id="@+id/stillshot_imageview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />-->
<View
android:id="@+id/view_orientation_bg_close"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="@drawable/circle_white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_close_stillshot_view"
android:layout_width="40dp"
android:layout_height="40dp"
android:keepScreenOn="true"
android:padding="12dp"
android:src="@drawable/ic_close"
app:layout_constraintBottom_toBottomOf="@+id/view_orientation_bg_close"
app:layout_constraintEnd_toEndOf="@+id/view_orientation_bg_close"
app:layout_constraintStart_toStartOf="@+id/view_orientation_bg_close"
app:layout_constraintTop_toTopOf="@+id/view_orientation_bg_close" />
<View
android:id="@+id/view_orientation_bg_save"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginStart="16dp"
android:background="@drawable/circle_white"
app:layout_constraintBottom_toBottomOf="@+id/stillshot"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/stillshot" />
<ImageButton
android:id="@+id/ibtn_save"
style="@android:style/Widget.Material.Light.Button.Borderless"
android:layout_width="44dp"
android:layout_height="44dp"
android:src="@drawable/ic_save_black_24dp"
app:layout_constraintBottom_toBottomOf="@+id/view_orientation_bg_save"
app:layout_constraintEnd_toEndOf="@+id/view_orientation_bg_save"
app:layout_constraintStart_toStartOf="@+id/view_orientation_bg_save"
app:layout_constraintTop_toTopOf="@+id/view_orientation_bg_save" />
<View
android:id="@+id/view_orientation_bg_sticker_icon"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginTop="85dp"
android:layout_marginEnd="8dp"
android:background="@drawable/circle_white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/stillshot_imageview" />
<ImageButton
android:id="@+id/init_sticker_icon"
style="@android:style/Widget.Material.Light.Button.Borderless"
android:layout_width="44dp"
android:layout_height="44dp"
android:src="@drawable/ic_sticker_small"
app:layout_constraintBottom_toBottomOf="@+id/view_orientation_bg_sticker_icon"
app:layout_constraintEnd_toEndOf="@+id/view_orientation_bg_sticker_icon"
app:layout_constraintStart_toStartOf="@+id/view_orientation_bg_sticker_icon"
app:layout_constraintTop_toTopOf="@+id/view_orientation_bg_sticker_icon" />
<View
android:id="@+id/view_orientation_bg_share"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="@drawable/circle_white"
app:layout_constraintBottom_toTopOf="@+id/ibtn_save"
app:layout_constraintEnd_toEndOf="@+id/view_orientation_bg_save"
app:layout_constraintStart_toStartOf="@+id/ibtn_save" />
<ImageButton
android:id="@+id/ibtn_share"
style="@android:style/Widget.Material.Light.Button.Borderless"
android:layout_width="44dp"
android:layout_height="44dp"
android:src="@drawable/ic_share_black_24dp"
app:layout_constraintBottom_toBottomOf="@+id/view_orientation_bg_share"
app:layout_constraintEnd_toEndOf="@+id/view_orientation_bg_share"
app:layout_constraintStart_toStartOf="@+id/view_orientation_bg_share"
app:layout_constraintTop_toTopOf="@+id/view_orientation_bg_share" />
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:orientation="vertical">
<!--android:background="@color/darkTransparentGrey"-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:id="@+id/sticker_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginTop="85dp"
android:layout_marginRight="8dp"
android:animateLayoutChanges="true"
android:background="@drawable/circle_white"
android:padding="1dp">
<ImageButton
android:id="@+id/init_sticker_icon"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:background="@drawable/circle_white"
android:padding="10dp"
android:scaleType="fitXY"
android:src="@drawable/ic_close"
tools:ignore="ContentDescription" />
<!--android:src="@drawable/ic_sticker_small"-->
</RelativeLayout>
</RelativeLayout>
<!--android:layout_marginTop="?attr/actionBarSize"-->
<!--android:layout_marginTop="130dp"-->
<!--android:background="@color/darkTransparentGrey"-->
<android.support.v7.widget.RecyclerView
android:paddingLeft="4dp"
android:layout_marginRight="8dp"
android:layout_gravity="right"
android:id="@+id/recycler_view"
android:layout_width="50dp"
android:layout_height="400dp">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="44dp"
android:layout_height="44dp"
android:background="@drawable/circle_shape_new"
android:padding="2dp">
<ImageView
android:id="@+id/iv_sticker_list_item"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:scaleType="centerInside"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<!--app:srcCompat="@drawable/smiley_face_tightly_closed_eyes_emoji" />-->
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">never</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="White">#fff</color>
<color name="darkGrey">#a6a6a6 </color>
<color name="Grey">#c3c3c3 </color>
<color name="lightGrey">#f2f2f2 </color>
<color name="transparentGrey">#21737373 </color>
<color name="darkTransparentGrey">#a0737373 </color>
<color name="DarkGrey">#737373 </color>
<color name="Black">#000 </color>
</resources>
<resources>
<string name="app_name">Vision Moments</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<!-- fragment tags -->
<string name="fragment_camera2">Camera2</string>
<string name="request_permission">Need Camera Permission</string>
<string name="camera_error">This device doesn\'t support Camera2 API.</string>
<string name="view_stickers">View Stickers</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
<!--<item name="android:windowFullscreen">true</item>-->
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2019 Google LLC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ https://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<actions>
<!-- This file describes the supported actions by this app -->
<action intentName="android.intent.action.VIEW">
<!-- Each action requires at least one fulfillment that defines how the app will handle this action -->
<!-- Define the urlTemplate in the format you define your deeplinks in AndroidManifest.xml -->
<fulfillment urlTemplate="https://proteusvision.com/start{?type}">
<!-- Define how the actions parameters (intentParameter) is mapped in the urlTemplate above -->
<parameter-mapping
intentParameter="parameter.name"
urlParameter="type" />
</fulfillment>
<!-- Map a parameter to an entity set reference -->
<parameter name="parameter.name">
<entity-set-reference entitySetId="VisionEntitySet" />
</parameter>
</action>
<!-- Define an inline inventory -->
<!-- This sample maps supported entities with the class Activity.Type -->
<entity-set entitySetId="VisionEntitySet">
<entity
name="image capturing"
identifier="CAPTURE" />
</entity-set>
</actions>
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
\ No newline at end of file
package ibase.android.visionselfie;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Tue May 28 10:48:49 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
include ':app'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment