diff --git a/app/build.gradle b/app/build.gradle index de48a52858ab25c3a742eeccf6d97fd47d899670..c2ae63e51a74efe725e2a8943232ae3a0f6d01ff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -36,9 +36,15 @@ android { useLibrary 'android.test.runner' useLibrary 'android.test.base' //useLibrary 'android.test.mock' + + aaptOptions { + additionalParameters '-I', 'e-ui-sdk.jar' + } + } dependencies { + compileOnly files("../e-ui-sdk.jar") //noinspection GradleCompatible implementation 'com.android.support:support-v4:28.0.0' testImplementation 'junit:junit:4.13' diff --git a/app/src/main/java/net/sourceforge/opencamera/MainActivity.java b/app/src/main/java/net/sourceforge/opencamera/MainActivity.java index b1bfe7078a8202f23d1f127d1f02c84cad9cc5c7..f3b2d5c73ecfc3a3065b9b61e42f10b9e965c962 100644 --- a/app/src/main/java/net/sourceforge/opencamera/MainActivity.java +++ b/app/src/main/java/net/sourceforge/opencamera/MainActivity.java @@ -6,6 +6,7 @@ import net.sourceforge.opencamera.cameracontroller.CameraControllerManager2; import net.sourceforge.opencamera.preview.Preview; import net.sourceforge.opencamera.preview.VideoProfile; import net.sourceforge.opencamera.remotecontrol.BluetoothRemoteControl; +import net.sourceforge.opencamera.ui.CircleImageView; import net.sourceforge.opencamera.ui.FolderChooserDialog; import net.sourceforge.opencamera.ui.MainUI; import net.sourceforge.opencamera.ui.ManualSeekbars; @@ -35,6 +36,7 @@ import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.PorterDuff; +import android.graphics.drawable.GradientDrawable; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; @@ -383,7 +385,7 @@ public class MainActivity extends Activity { // initialise on-screen button visibility ImageButton switchCameraButton = findViewById(R.id.switch_camera); - // switchCameraButton.setImageTintList(ColorStateList.valueOf(accentColor)); + switchCameraButton.setVisibility(n_cameras > 1 ? View.VISIBLE : View.GONE); // switchMultiCameraButton visibility updated below in mainUI.updateOnScreenIcons(), as it also depends on user preference View speechRecognizerButton = findViewById(R.id.audio_control); @@ -396,7 +398,7 @@ public class MainActivity extends Activity { takePhotoVideoButton.setImageTintList(ColorStateList.valueOf(accentColor)); switchVideoButton = (ImageButton) findViewById(R.id.switch_video); - switchVideoButton.setImageTintList(ColorStateList.valueOf(accentColor)); + //switchVideoButton.setImageTintList(ColorStateList.valueOf(getResources().getColor(R.color.color_default_foreground))); takePhotoVideoButton.setVisibility(View.GONE); @@ -2958,7 +2960,7 @@ public class MainActivity extends Activity { private void updateGalleryIconToBlank() { if( MyDebug.LOG ) Log.d(TAG, "updateGalleryIconToBlank"); - ImageButton galleryButton = this.findViewById(R.id.gallery); + CircleImageView galleryButton = this.findViewById(R.id.gallery); int bottom = galleryButton.getPaddingBottom(); int top = galleryButton.getPaddingTop(); int right = galleryButton.getPaddingRight(); @@ -2972,14 +2974,16 @@ public class MainActivity extends Activity { gallery_bitmap = null; } + /** Shows a thumbnail for the gallery icon. /** Shows a thumbnail for the gallery icon. */ void updateGalleryIcon(Bitmap thumbnail) { if( MyDebug.LOG ) Log.d(TAG, "updateGalleryIcon: " + thumbnail); - ImageButton galleryButton = this.findViewById(R.id.gallery); - galleryButton.setImageBitmap(thumbnail); - gallery_bitmap = thumbnail; + CircleImageView galleryButton = this.findViewById(R.id.gallery); + galleryButton.setImageBitmap(thumbnail); + gallery_bitmap = thumbnail; + } /** Updates the gallery icon by searching for the most recent photo. @@ -3153,7 +3157,7 @@ public class MainActivity extends Activity { this.runOnUiThread(new Runnable() { public void run() { - final ImageButton galleryButton = findViewById(R.id.gallery); + final CircleImageView galleryButton = findViewById(R.id.gallery); if( started ) { //galleryButton.setColorFilter(0x80ffffff, PorterDuff.Mode.MULTIPLY); if( gallery_save_anim == null ) { @@ -4075,6 +4079,7 @@ public class MainActivity extends Activity { // note we zoom even if !fromUser, as various other UI controls (multitouch, volume key zoom, -/+ zoomcontrol) // indirectly set zoom via this method, from setting the zoom slider preview.zoomTo(preview.getMaxZoom() - progress); + } @Override @@ -5019,15 +5024,7 @@ public class MainActivity extends Activity { * */ private int fetchAccentColor(Context context) { - TypedValue typedValue = new TypedValue(); - ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(this, - android.R.style.Theme_DeviceDefault); - contextThemeWrapper.getTheme().resolveAttribute(android.R.attr.colorAccent, - typedValue, true); - int color_accent = typedValue.data; - Log.e("TAG", "accent Colour #"+Integer.toHexString(color_accent)); - - return color_accent; + return context.getResources().getColor(R.color.color_default_blue1); } diff --git a/app/src/main/java/net/sourceforge/opencamera/MyApplicationInterface.java b/app/src/main/java/net/sourceforge/opencamera/MyApplicationInterface.java index 1ae3a3eaaceab2caaa581abc234e0a9683febf83..cea868107b348a2c183bb8a479a168913f91a54f 100644 --- a/app/src/main/java/net/sourceforge/opencamera/MyApplicationInterface.java +++ b/app/src/main/java/net/sourceforge/opencamera/MyApplicationInterface.java @@ -19,6 +19,7 @@ import net.sourceforge.opencamera.preview.ApplicationInterface; import net.sourceforge.opencamera.preview.BasicApplicationInterface; import net.sourceforge.opencamera.preview.Preview; import net.sourceforge.opencamera.preview.VideoProfile; +import net.sourceforge.opencamera.ui.CircleImageView; import net.sourceforge.opencamera.ui.DrawPreview; import android.annotation.TargetApi; @@ -2202,7 +2203,7 @@ public class MyApplicationInterface extends BasicApplicationInterface { } } if( thumbnail != null ) { - ImageButton galleryButton = main_activity.findViewById(R.id.gallery); + CircleImageView galleryButton = main_activity.findViewById(R.id.gallery); int width = thumbnail.getWidth(); int height = thumbnail.getHeight(); if( MyDebug.LOG ) diff --git a/app/src/main/java/net/sourceforge/opencamera/ui/CircleImageView.java b/app/src/main/java/net/sourceforge/opencamera/ui/CircleImageView.java new file mode 100644 index 0000000000000000000000000000000000000000..651fcc3c1660bc1a8d1c3ff3045417ca1ea7410e --- /dev/null +++ b/app/src/main/java/net/sourceforge/opencamera/ui/CircleImageView.java @@ -0,0 +1,499 @@ +package net.sourceforge.opencamera.ui; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Bitmap; +import android.graphics.BitmapShader; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.ColorFilter; +import android.graphics.Matrix; +import android.graphics.Outline; +import android.graphics.Paint; +import android.graphics.Rect; +import android.graphics.RectF; +import android.graphics.Shader; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.os.Build; +import android.support.annotation.ColorInt; +import android.support.annotation.ColorRes; +import android.support.annotation.DrawableRes; +import android.support.annotation.NonNull; +import android.support.annotation.RequiresApi; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewOutlineProvider; +import android.widget.ImageView; + +import foundation.e.camera.R; + +@SuppressWarnings("UnusedDeclaration") +public class CircleImageView extends ImageView { + + private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP; + + private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888; + private static final int COLORDRAWABLE_DIMENSION = 2; + + private static final int DEFAULT_BORDER_WIDTH = 0; + private static final int DEFAULT_BORDER_COLOR = Color.BLACK; + private static final int DEFAULT_CIRCLE_BACKGROUND_COLOR = Color.TRANSPARENT; + private static final int DEFAULT_IMAGE_ALPHA = 255; + private static final boolean DEFAULT_BORDER_OVERLAY = false; + + private final RectF mDrawableRect = new RectF(); + private final RectF mBorderRect = new RectF(); + + private final Matrix mShaderMatrix = new Matrix(); + private final Paint mBitmapPaint = new Paint(); + private final Paint mBorderPaint = new Paint(); + private final Paint mCircleBackgroundPaint = new Paint(); + + private int mBorderColor = DEFAULT_BORDER_COLOR; + private int mBorderWidth = DEFAULT_BORDER_WIDTH; + private int mCircleBackgroundColor = DEFAULT_CIRCLE_BACKGROUND_COLOR; + private int mImageAlpha = DEFAULT_IMAGE_ALPHA; + + private Bitmap mBitmap; + private Canvas mBitmapCanvas; + + private float mDrawableRadius; + private float mBorderRadius; + + private ColorFilter mColorFilter; + + private boolean mInitialized; + private boolean mRebuildShader; + private boolean mDrawableDirty; + + private boolean mBorderOverlay; + private boolean mDisableCircularTransformation; + + public CircleImageView(Context context) { + super(context); + + init(); + } + + public CircleImageView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public CircleImageView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0); + + mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_civ_border_width, DEFAULT_BORDER_WIDTH); + mBorderColor = a.getColor(R.styleable.CircleImageView_civ_border_color, DEFAULT_BORDER_COLOR); + mBorderOverlay = a.getBoolean(R.styleable.CircleImageView_civ_border_overlay, DEFAULT_BORDER_OVERLAY); + mCircleBackgroundColor = a.getColor(R.styleable.CircleImageView_civ_circle_background_color, DEFAULT_CIRCLE_BACKGROUND_COLOR); + + a.recycle(); + + init(); + } + + private void init() { + mInitialized = true; + + super.setScaleType(SCALE_TYPE); + + mBitmapPaint.setAntiAlias(true); + mBitmapPaint.setDither(true); + mBitmapPaint.setFilterBitmap(true); + mBitmapPaint.setAlpha(mImageAlpha); + mBitmapPaint.setColorFilter(mColorFilter); + + mBorderPaint.setStyle(Paint.Style.STROKE); + mBorderPaint.setAntiAlias(true); + mBorderPaint.setColor(mBorderColor); + mBorderPaint.setStrokeWidth(mBorderWidth); + + mCircleBackgroundPaint.setStyle(Paint.Style.FILL); + mCircleBackgroundPaint.setAntiAlias(true); + mCircleBackgroundPaint.setColor(mCircleBackgroundColor); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + setOutlineProvider(new OutlineProvider()); + } + } + + @Override + public void setScaleType(ScaleType scaleType) { + if (scaleType != SCALE_TYPE) { + throw new IllegalArgumentException(String.format("ScaleType %s not supported.", scaleType)); + } + } + + @Override + public void setAdjustViewBounds(boolean adjustViewBounds) { + if (adjustViewBounds) { + throw new IllegalArgumentException("adjustViewBounds not supported."); + } + } + + @SuppressLint("CanvasSize") + @Override + protected void onDraw(Canvas canvas) { + if (mDisableCircularTransformation) { + super.onDraw(canvas); + return; + } + + if (mCircleBackgroundColor != Color.TRANSPARENT) { + canvas.drawCircle(mDrawableRect.centerX(), mDrawableRect.centerY(), mDrawableRadius, mCircleBackgroundPaint); + } + + if (mBitmap != null) { + if (mDrawableDirty && mBitmapCanvas != null) { + mDrawableDirty = false; + Drawable drawable = getDrawable(); + drawable.setBounds(0, 0, mBitmapCanvas.getWidth(), mBitmapCanvas.getHeight()); + drawable.draw(mBitmapCanvas); + } + + if (mRebuildShader) { + mRebuildShader = false; + + BitmapShader bitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); + bitmapShader.setLocalMatrix(mShaderMatrix); + + mBitmapPaint.setShader(bitmapShader); + } + + canvas.drawCircle(mDrawableRect.centerX(), mDrawableRect.centerY(), mDrawableRadius, mBitmapPaint); + } + + if (mBorderWidth > 0) { + canvas.drawCircle(mBorderRect.centerX(), mBorderRect.centerY(), mBorderRadius, mBorderPaint); + } + } + + @Override + public void invalidateDrawable(@NonNull Drawable dr) { + mDrawableDirty = true; + invalidate(); + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + updateDimensions(); + invalidate(); + } + + @Override + public void setPadding(int left, int top, int right, int bottom) { + super.setPadding(left, top, right, bottom); + updateDimensions(); + invalidate(); + } + + @Override + public void setPaddingRelative(int start, int top, int end, int bottom) { + super.setPaddingRelative(start, top, end, bottom); + updateDimensions(); + invalidate(); + } + + public int getBorderColor() { + return mBorderColor; + } + + public void setBorderColor(@ColorInt int borderColor) { + if (borderColor == mBorderColor) { + return; + } + + mBorderColor = borderColor; + mBorderPaint.setColor(borderColor); + invalidate(); + } + + public int getCircleBackgroundColor() { + return mCircleBackgroundColor; + } + + public void setCircleBackgroundColor(@ColorInt int circleBackgroundColor) { + if (circleBackgroundColor == mCircleBackgroundColor) { + return; + } + + mCircleBackgroundColor = circleBackgroundColor; + mCircleBackgroundPaint.setColor(circleBackgroundColor); + invalidate(); + } + + /** + * @deprecated Use {@link #setCircleBackgroundColor(int)} instead + */ + @Deprecated + public void setCircleBackgroundColorResource(@ColorRes int circleBackgroundRes) { + setCircleBackgroundColor(getContext().getResources().getColor(circleBackgroundRes)); + } + + public int getBorderWidth() { + return mBorderWidth; + } + + public void setBorderWidth(int borderWidth) { + if (borderWidth == mBorderWidth) { + return; + } + + mBorderWidth = borderWidth; + mBorderPaint.setStrokeWidth(borderWidth); + updateDimensions(); + invalidate(); + } + + public boolean isBorderOverlay() { + return mBorderOverlay; + } + + public void setBorderOverlay(boolean borderOverlay) { + if (borderOverlay == mBorderOverlay) { + return; + } + + mBorderOverlay = borderOverlay; + updateDimensions(); + invalidate(); + } + + public boolean isDisableCircularTransformation() { + return mDisableCircularTransformation; + } + + public void setDisableCircularTransformation(boolean disableCircularTransformation) { + if (disableCircularTransformation == mDisableCircularTransformation) { + return; + } + + mDisableCircularTransformation = disableCircularTransformation; + + if (disableCircularTransformation) { + mBitmap = null; + mBitmapCanvas = null; + mBitmapPaint.setShader(null); + } else { + initializeBitmap(); + } + + invalidate(); + } + + @Override + public void setImageBitmap(Bitmap bm) { + super.setImageBitmap(bm); + initializeBitmap(); + invalidate(); + } + + @Override + public void setImageDrawable(Drawable drawable) { + super.setImageDrawable(drawable); + initializeBitmap(); + invalidate(); + } + + @Override + public void setImageResource(@DrawableRes int resId) { + super.setImageResource(resId); + initializeBitmap(); + invalidate(); + } + + @Override + public void setImageURI(Uri uri) { + super.setImageURI(uri); + initializeBitmap(); + invalidate(); + } + + @Override + public void setImageAlpha(int alpha) { + alpha &= 0xFF; + + if (alpha == mImageAlpha) { + return; + } + + mImageAlpha = alpha; + + // This might be called during ImageView construction before + // member initialization has finished on API level >= 16. + if (mInitialized) { + mBitmapPaint.setAlpha(alpha); + invalidate(); + } + } + + @Override + public int getImageAlpha() { + return mImageAlpha; + } + + @Override + public void setColorFilter(ColorFilter cf) { + if (cf == mColorFilter) { + return; + } + + mColorFilter = cf; + + // This might be called during ImageView construction before + // member initialization has finished on API level <= 19. + if (mInitialized) { + mBitmapPaint.setColorFilter(cf); + invalidate(); + } + } + + @Override + public ColorFilter getColorFilter() { + return mColorFilter; + } + + private Bitmap getBitmapFromDrawable(Drawable drawable) { + if (drawable == null) { + return null; + } + + if (drawable instanceof BitmapDrawable) { + return ((BitmapDrawable) drawable).getBitmap(); + } + + try { + Bitmap bitmap; + + if (drawable instanceof ColorDrawable) { + bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG); + } else { + bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), BITMAP_CONFIG); + } + + Canvas canvas = new Canvas(bitmap); + drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); + drawable.draw(canvas); + return bitmap; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + private void initializeBitmap() { + mBitmap = getBitmapFromDrawable(getDrawable()); + + if (mBitmap != null && mBitmap.isMutable()) { + mBitmapCanvas = new Canvas(mBitmap); + } else { + mBitmapCanvas = null; + } + + if (!mInitialized) { + return; + } + + if (mBitmap != null) { + updateShaderMatrix(); + } else { + mBitmapPaint.setShader(null); + } + } + + private void updateDimensions() { + mBorderRect.set(calculateBounds()); + mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2.0f, (mBorderRect.width() - mBorderWidth) / 2.0f); + + mDrawableRect.set(mBorderRect); + if (!mBorderOverlay && mBorderWidth > 0) { + mDrawableRect.inset(mBorderWidth - 1.0f, mBorderWidth - 1.0f); + } + mDrawableRadius = Math.min(mDrawableRect.height() / 2.0f, mDrawableRect.width() / 2.0f); + + updateShaderMatrix(); + } + + private RectF calculateBounds() { + int availableWidth = getWidth() - getPaddingLeft() - getPaddingRight(); + int availableHeight = getHeight() - getPaddingTop() - getPaddingBottom(); + + int sideLength = Math.min(availableWidth, availableHeight); + + float left = getPaddingLeft() + (availableWidth - sideLength) / 2f; + float top = getPaddingTop() + (availableHeight - sideLength) / 2f; + + return new RectF(left, top, left + sideLength, top + sideLength); + } + + private void updateShaderMatrix() { + if (mBitmap == null) { + return; + } + + float scale; + float dx = 0; + float dy = 0; + + mShaderMatrix.set(null); + + int bitmapHeight = mBitmap.getHeight(); + int bitmapWidth = mBitmap.getWidth(); + + if (bitmapWidth * mDrawableRect.height() > mDrawableRect.width() * bitmapHeight) { + scale = mDrawableRect.height() / (float) bitmapHeight; + dx = (mDrawableRect.width() - bitmapWidth * scale) * 0.5f; + } else { + scale = mDrawableRect.width() / (float) bitmapWidth; + dy = (mDrawableRect.height() - bitmapHeight * scale) * 0.5f; + } + + mShaderMatrix.setScale(scale, scale); + mShaderMatrix.postTranslate((int) (dx + 0.5f) + mDrawableRect.left, (int) (dy + 0.5f) + mDrawableRect.top); + + mRebuildShader = true; + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public boolean onTouchEvent(MotionEvent event) { + if (mDisableCircularTransformation) { + return super.onTouchEvent(event); + } + + return inTouchableArea(event.getX(), event.getY()) && super.onTouchEvent(event); + } + + private boolean inTouchableArea(float x, float y) { + if (mBorderRect.isEmpty()) { + return true; + } + + return Math.pow(x - mBorderRect.centerX(), 2) + Math.pow(y - mBorderRect.centerY(), 2) <= Math.pow(mBorderRadius, 2); + } + + @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) + private class OutlineProvider extends ViewOutlineProvider { + + @Override + public void getOutline(View view, Outline outline) { + if (mDisableCircularTransformation) { + ViewOutlineProvider.BACKGROUND.getOutline(view, outline); + } else { + Rect bounds = new Rect(); + mBorderRect.roundOut(bounds); + outline.setRoundRect(bounds, bounds.width() / 2.0f); + } + } + + } + +} \ No newline at end of file diff --git a/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java b/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java index 4e43dd2ccfbcfccd63ec8cb8600d6431e4f95351..eb5fa8a109effae535ea66380a878824048b356f 100644 --- a/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java +++ b/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java @@ -309,7 +309,7 @@ public class MainUI { layoutParams.addRule(below, 0); layoutParams.addRule(left_of, 0); layoutParams.addRule(right_of, 0); - layoutParams.setMargins(0, 0, navigation_gap, 0); + layoutParams.setMargins(20, 20, navigation_gap, 20); view.setLayoutParams(layoutParams); setViewRotation(view, ui_rotation); } @@ -502,7 +502,7 @@ public class MainUI { view.setLayoutParams(layoutParams); view.setRotation(180.0f); // should always match the zoom_seekbar, so that zoom in and out are in the same directions - view = main_activity.findViewById(R.id.zoom_seekbar); + // view = main_activity.findViewById(R.id.zoom_seekbar); layoutParams = (RelativeLayout.LayoutParams)view.getLayoutParams(); // if we are showing the zoom control, the align next to that; otherwise have it aligned close to the edge of screen if( sharedPreferences.getBoolean(PreferenceKeys.ShowZoomControlsPreferenceKey, false) ) { @@ -535,7 +535,7 @@ public class MainUI { layoutParams = (RelativeLayout.LayoutParams)view.getLayoutParams(); layoutParams.addRule(align_left, R.id.preview); layoutParams.addRule(align_right, 0); - layoutParams.addRule(left_of, R.id.zoom_seekbar); + // layoutParams.addRule(left_of, R.id.zoom_seekbar); layoutParams.addRule(right_of, 0); layoutParams.addRule(align_parent_top, 0); layoutParams.addRule(align_parent_bottom, RelativeLayout.TRUE); @@ -545,7 +545,7 @@ public class MainUI { layoutParams = (RelativeLayout.LayoutParams)view.getLayoutParams(); layoutParams.addRule(align_left, R.id.preview); layoutParams.addRule(align_right, 0); - layoutParams.addRule(left_of, R.id.zoom_seekbar); + //layoutParams.addRule(left_of, R.id.zoom_seekbar); layoutParams.addRule(right_of, 0); layoutParams.addRule(above, R.id.focus_seekbar); layoutParams.addRule(below, 0); @@ -848,7 +848,7 @@ public class MainUI { view = main_activity.findViewById(R.id.switch_video); view.setContentDescription( main_activity.getResources().getString(switch_video_content_description) ); - resource = main_activity.getPreview().isVideo() ? R.drawable.take_photo : R.drawable.take_video; + resource = main_activity.getPreview().isVideo() ? lineageos.platform.R.drawable.ic_camera_photo : lineageos.platform.R.drawable.ic_camera_video; view.setImageResource(resource); view.setTag(resource); // for testing } diff --git a/app/src/main/res/drawable/ic_shutter.xml b/app/src/main/res/drawable/ic_shutter.xml new file mode 100644 index 0000000000000000000000000000000000000000..2e3375f9038c02c0884e3cc9c76af7307f3c978a --- /dev/null +++ b/app/src/main/res/drawable/ic_shutter.xml @@ -0,0 +1,19 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_switch.xml b/app/src/main/res/drawable/ic_switch.xml new file mode 100644 index 0000000000000000000000000000000000000000..37a20f93521d0b49fc68651dcf4befc6f30c3233 --- /dev/null +++ b/app/src/main/res/drawable/ic_switch.xml @@ -0,0 +1,16 @@ + + + + diff --git a/app/src/main/res/drawable/ic_video.xml b/app/src/main/res/drawable/ic_video.xml new file mode 100644 index 0000000000000000000000000000000000000000..5c849dc6f972b6b4130b0467f9a248ea45bd8ee7 --- /dev/null +++ b/app/src/main/res/drawable/ic_video.xml @@ -0,0 +1,16 @@ + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index ba69625243bd1e431fcca23791552452c68b47b8..62a2cd8a1d4e8f2c67ccdee1da808f31613694d5 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -13,30 +13,33 @@ + + - + + + - --> + + diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000000000000000000000000000000000000..4223de2c88ac71ac78bbf2ce9c61e50978f0ea94 --- /dev/null +++ b/app/src/main/res/values/attrs.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 565681788a053f83f10bc8823619f6cc7f6d130a..1cf324d641c018702541845cd9e9d5f0bea0537b 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -3,4 +3,12 @@ #20000000 #20000000 #ff000000 + #ffffff + + + #ffffff + @lineageos.platform:color/color_default_blue1 + + + diff --git a/e-ui-sdk.jar b/e-ui-sdk.jar new file mode 100644 index 0000000000000000000000000000000000000000..c97c6d53b17bfd3762a0f2414890ead1a14b41d8 Binary files /dev/null and b/e-ui-sdk.jar differ