From 06eefe4b448bdbcf0c6b8df6e6bc04bfa298919d Mon Sep 17 00:00:00 2001 From: Mohit Mali Date: Thu, 19 Nov 2020 15:03:38 +0530 Subject: [PATCH 1/3] e theme implementation --- res/values/cm_colors.xml | 2 +- res/values/colors.xml | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/res/values/cm_colors.xml b/res/values/cm_colors.xml index 4eb65aead..c1452b3a5 100644 --- a/res/values/cm_colors.xml +++ b/res/values/cm_colors.xml @@ -15,7 +15,7 @@ --> - #333333 + @lineageos.platform:color/color_default_primary_text #000000 #33b5e5 diff --git a/res/values/colors.xml b/res/values/colors.xml index 9388e9898..e6e13a4c7 100755 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -1,5 +1,4 @@ - - - @color/white + @lineageos.platform:color/color_default_primary_text @color/white @@ -89,6 +88,6 @@ @color/black_transparent_3 @color/white - #747474 - @color/white + @lineageos.platform:color/color_default_gray2 + @lineageos.platform:color/color_default_primary -- GitLab From 5a6cf0d5252c4fb59e431d0bce9de0b1344cad72 Mon Sep 17 00:00:00 2001 From: Mohit Mali Date: Tue, 24 Nov 2020 16:27:49 +0530 Subject: [PATCH 2/3] e theme implementation --- res/layout/gallery_main.xml | 1 + res/values/cm_colors.xml | 3 +-- res/values/colors.xml | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/res/layout/gallery_main.xml b/res/layout/gallery_main.xml index 4b4edbd6b..e477fc376 100644 --- a/res/layout/gallery_main.xml +++ b/res/layout/gallery_main.xml @@ -44,6 +44,7 @@ android:id="@+id/gallery_root" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/primary" android:layout_above="@+id/bottom_navigation"> diff --git a/res/values/cm_colors.xml b/res/values/cm_colors.xml index c1452b3a5..9d177b9d6 100644 --- a/res/values/cm_colors.xml +++ b/res/values/cm_colors.xml @@ -1,5 +1,4 @@ - - - @color/white - @color/white + @color/default_background + @color/default_background @color/black @@ -84,8 +84,8 @@ @color/black @color/black #009688 - @color/black_transparent_4 - @color/black_transparent_3 + @color/white + @color/white @color/white @lineageos.platform:color/color_default_gray2 -- GitLab From 1b614001ac73128110d3792a5f914a0ad714e3c6 Mon Sep 17 00:00:00 2001 From: Mohit Mali Date: Thu, 26 Nov 2020 11:41:37 +0530 Subject: [PATCH 3/3] e theme implementation --- res/layout/gl_root_group.xml | 16 ++-- res/layout/main.xml | 38 +++++---- res/values/colors.xml | 8 +- src/com/android/gallery3d/app/AlbumPage.java | 63 +++++++-------- .../android/gallery3d/app/AlbumSetPage.java | 22 +++--- .../android/gallery3d/app/TimeLinePage.java | 78 +++++++++---------- 6 files changed, 117 insertions(+), 108 deletions(-) diff --git a/res/layout/gl_root_group.xml b/res/layout/gl_root_group.xml index 630217153..b8e7a547f 100644 --- a/res/layout/gl_root_group.xml +++ b/res/layout/gl_root_group.xml @@ -1,5 +1,4 @@ - - - @color/white + @color/default_background @color/black_transparent_3 - @color/black_transparent_4 + @color/default_background @color/white @color/white - @color/black_transparent_4 + @color/white @color/black_transparent_5 @@ -86,7 +86,7 @@ #009688 @color/white @color/white - @color/white + @color/default_background @lineageos.platform:color/color_default_gray2 @lineageos.platform:color/color_default_primary diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 4f3f34814..5ddd2dcc1 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -41,6 +41,7 @@ import android.widget.Toast; import android.widget.Toolbar; import org.codeaurora.gallery.R; + import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.DataManager; import com.android.gallery3d.data.MediaDetails; @@ -152,26 +153,26 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster private boolean mShowedEmptyToastForSelf; private PhotoFallbackEffect.PositionProvider mPositionProvider = new PhotoFallbackEffect.PositionProvider() { - @Override - public Rect getPosition(int index) { - Rect rect = mSlotView.getSlotRect(index); - Rect bounds = mSlotView.bounds(); - rect.offset(bounds.left - mSlotView.getScrollX(), - bounds.top - mSlotView.getScrollY()); - return rect; - } + @Override + public Rect getPosition(int index) { + Rect rect = mSlotView.getSlotRect(index); + Rect bounds = mSlotView.bounds(); + rect.offset(bounds.left - mSlotView.getScrollX(), + bounds.top - mSlotView.getScrollY()); + return rect; + } - @Override - public int getItemIndex(Path path) { - int start = mSlotView.getVisibleStart(); - int end = mSlotView.getVisibleEnd(); - for (int i = start; i < end; ++i) { - MediaItem item = mAlbumDataAdapter.get(i); - if (item != null && item.getPath() == path) return i; - } - return -1; - } - }; + @Override + public int getItemIndex(Path path) { + int start = mSlotView.getVisibleStart(); + int end = mSlotView.getVisibleEnd(); + for (int i = start; i < end; ++i) { + MediaItem item = mAlbumDataAdapter.get(i); + if (item != null && item.getPath() == path) return i; + } + return -1; + } + }; @Override protected int getBackgroundColorId() { @@ -266,7 +267,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster } else if (mIsVideoScreen) { super.onBackPressed(); } else { - if(mLaunchedFromPhotoPage) { + if (mLaunchedFromPhotoPage) { mActivity.getTransitionStore().putIfNotPresent( PhotoPage.KEY_ALBUMPAGE_TRANSITION, PhotoPage.MSG_ALBUMPAGE_RESUMED); @@ -397,7 +398,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster mActivity.getStateManager().switchState(this, FilmstripPage.class, data); } else { mActivity.getStateManager().startStateForResult( - SinglePhotoPage.class, REQUEST_PHOTO, data); + SinglePhotoPage.class, REQUEST_PHOTO, data); } } } @@ -417,7 +418,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster activity.finish(); } else { Intent intent = new Intent(null, item.getContentUri()) - .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); activity.setResult(Activity.RESULT_OK, intent); activity.finish(); } @@ -636,7 +637,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster FilterUtils.setupMenuItems(mActionBar, mMediaSetPath, true); menu.findItem(R.id.action_camera).setVisible( - GalleryUtils.isAnyCameraAvailable(mActivity)); + GalleryUtils.isAnyCameraAvailable(mActivity)); menu.findItem(R.id.action_slideshow).setVisible(!mIsVideoScreen); MenuItem item = menu.findItem(R.id.action_view_type); updateMenuTitle(item); @@ -645,7 +646,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster } //actionBar.setSubtitle(null); // remove slideshow if all are videos - if (allVideoFiles() && !mGetContent){ + if (allVideoFiles() && !mGetContent) { menu.findItem(R.id.action_slideshow).setVisible(false); } return true; @@ -698,7 +699,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster targetPhoto = mAlbumDataAdapter.size() - targetPhoto - 1; } prepareAnimationBackToFilmstrip(targetPhoto); - if(mLaunchedFromPhotoPage) { + if (mLaunchedFromPhotoPage) { onBackPressed(); } else { pickPhoto(targetPhoto, true); @@ -742,8 +743,8 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster return true; } case R.id.action_view_type: { - switchView(); - return true; + switchView(); + return true; } default: return false; @@ -957,13 +958,13 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster mCurrentView = LIST_VIEW; GalleryUtils.setIntPref(mActivity, PREF_VIEWTYPE, mCurrentView); mActivity.getStateManager().switchState(this, - AlbumListViewPage.class, mData); + AlbumListViewPage.class, mData); } else { mCurrentView = GRID_VIEW; GalleryUtils.setIntPref(mActivity, PREF_VIEWTYPE, mCurrentView); mActivity.getStateManager().switchState(this, AlbumPage.class, - mData); - } + mData); + } } @@ -974,7 +975,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster if (tvEmptyAlbum == null) { tvEmptyAlbum = new TextView(mActivity); tvEmptyAlbum.setText(R.string.tvEmptyVideos); - tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000")); + tvEmptyAlbum.setTextColor(galleryRoot.getResources().getColor(R.color.white, null)); tvEmptyAlbum.setGravity(Gravity.CENTER); tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java index 7eaa2bc6a..0856cd38e 100755 --- a/src/com/android/gallery3d/app/AlbumSetPage.java +++ b/src/com/android/gallery3d/app/AlbumSetPage.java @@ -42,6 +42,7 @@ import android.widget.TextView; import android.widget.Toast; import org.codeaurora.gallery.R; + import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.DataManager; import com.android.gallery3d.data.MediaDetails; @@ -151,9 +152,7 @@ public class AlbumSetPage extends ActivityState implements paddingBottom = mConfig.paddingBottomLand; paddingRight = mConfig.paddingRightLand; paddingLeft = mConfig.paddingLeftLand; - } - else - { + } else { paddingTop = mConfig.paddingTop; paddingBottom = mConfig.paddingBottom; paddingRight = mConfig.paddingRight; @@ -169,7 +168,7 @@ public class AlbumSetPage extends ActivityState implements } int slotViewBottom = bottom - top - paddingBottom; int slotViewRight = right - left - paddingRight; - int slotViewLeft = paddingLeft ; + int slotViewLeft = paddingLeft; if (mShowDetails) { @@ -254,11 +253,11 @@ public class AlbumSetPage extends ActivityState implements // 'void android.widget.RelativeLayout.addView(android.view.View RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity) .findViewById(R.id.gallery_root); - if (galleryRoot == null) return ; + if (galleryRoot == null) return; if (tvEmptyAlbum == null) { tvEmptyAlbum = new TextView(mActivity); tvEmptyAlbum.setText(R.string.tvEmptyAlbum); - tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000")); + tvEmptyAlbum.setTextColor(galleryRoot.getResources().getColor(R.color.white, null)); tvEmptyAlbum.setGravity(Gravity.CENTER); tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); tvEmptyAlbum.setId(R.id.empty_album); @@ -389,7 +388,8 @@ public class AlbumSetPage extends ActivityState implements pickAlbum(message.arg1); break; } - default: throw new AssertionError(message.what); + default: + throw new AssertionError(message.what); } } }; @@ -589,7 +589,7 @@ public class AlbumSetPage extends ActivityState implements int typeBits = mData.getInt( GalleryActivity.KEY_TYPE_BITS, DataManager.INCLUDE_IMAGE); mActionBar.setTitle(GalleryUtils.getSelectionModePrompt(typeBits)); - } else if (mGetAlbum) { + } else if (mGetAlbum) { inflater.inflate(R.menu.pickup, menu); mActionBar.setTitle(R.string.select_album); } else { @@ -603,8 +603,8 @@ public class AlbumSetPage extends ActivityState implements mActionBar.disableClusterMenu(true); } }*/ - boolean selectAlbums = !inAlbum ;// && - // mActionBar.getClusterTypeAction() == FilterUtils.CLUSTER_BY_ALBUM; + boolean selectAlbums = !inAlbum;// && + // mActionBar.getClusterTypeAction() == FilterUtils.CLUSTER_BY_ALBUM; MenuItem selectItem = menu.findItem(R.id.action_select); selectItem.setTitle(activity.getString( selectAlbums ? R.string.select_album : R.string.select_group)); @@ -665,7 +665,7 @@ public class AlbumSetPage extends ActivityState implements case R.id.action_manage_offline: { Bundle data = new Bundle(); String mediaPath = mActivity.getDataManager().getTopSetPath( - DataManager.INCLUDE_ALL); + DataManager.INCLUDE_ALL); data.putString(AlbumSetPage.KEY_MEDIA_PATH, mediaPath); mActivity.getStateManager().startState(ManageCachePage.class, data); return true; diff --git a/src/com/android/gallery3d/app/TimeLinePage.java b/src/com/android/gallery3d/app/TimeLinePage.java index a9abc81ff..2e09d3ae7 100755 --- a/src/com/android/gallery3d/app/TimeLinePage.java +++ b/src/com/android/gallery3d/app/TimeLinePage.java @@ -72,6 +72,7 @@ import com.android.gallery3d.ui.TimeLineSlotRenderer; import com.android.gallery3d.ui.TimeLineSlotView; import com.android.gallery3d.util.Future; import com.android.gallery3d.util.GalleryUtils; + import org.codeaurora.gallery.R; import java.lang.ref.WeakReference; @@ -175,9 +176,9 @@ public class TimeLinePage extends ActivityState implements } else { slotViewTop = mActivity.getGalleryActionBar().getHeight(); } - int padding =0 ; - if((right - left) > (bottom - top)) { - padding = (int) mActivity.getResources().getDimension(R.dimen.timeline_land_margin); + int padding = 0; + if ((right - left) > (bottom - top)) { + padding = (int) mActivity.getResources().getDimension(R.dimen.timeline_land_margin); } else { padding = (int) mActivity.getResources().getDimension(R.dimen.timeline_port_margin); } @@ -235,10 +236,10 @@ public class TimeLinePage extends ActivityState implements } else if (mSelectionManager.inSelectionMode()) { mSelectionManager.leaveSelectionMode(); } else { - if(mLaunchedFromPhotoPage) { - mActivity.getTransitionStore().putIfNotPresent( - PhotoPage.KEY_ALBUMPAGE_TRANSITION, - PhotoPage.MSG_ALBUMPAGE_RESUMED); + if (mLaunchedFromPhotoPage) { + mActivity.getTransitionStore().putIfNotPresent( + PhotoPage.KEY_ALBUMPAGE_TRANSITION, + PhotoPage.MSG_ALBUMPAGE_RESUMED); } if (mInCameraApp) { super.onBackPressed(); @@ -268,33 +269,33 @@ public class TimeLinePage extends ActivityState implements } } - private void onSingleTapUp(int slotIndex , boolean isTitle) { + private void onSingleTapUp(int slotIndex, boolean isTitle) { if (!mIsActive) return; - if (mSelectionManager.inSelectionMode()) { - if(isTitle){ - MediaSet targetSet = mAlbumDataAdapter.getMediaSet(slotIndex); - if (targetSet == null) return; - ArrayList paths = ((ClusterAlbum)targetSet).getMediaItems(); - if (paths == null || paths.size() <= 0) return; - mSelectionManager.toggleTimeLineSet(paths); - mSlotView.invalidate(); - } else { - MediaItem item = mAlbumDataAdapter.get(slotIndex); - if (item == null) return; // Item not ready yet, ignore the click - if (mSelectionManager.getSelectedCount() > 0) { - if (!ActionModeHandler.isThreadComplete) - return; - } - mSelectionManager.toggle(item.getPath()); - mSlotView.invalidate(); + if (mSelectionManager.inSelectionMode()) { + if (isTitle) { + MediaSet targetSet = mAlbumDataAdapter.getMediaSet(slotIndex); + if (targetSet == null) return; + ArrayList paths = ((ClusterAlbum) targetSet).getMediaItems(); + if (paths == null || paths.size() <= 0) return; + mSelectionManager.toggleTimeLineSet(paths); + mSlotView.invalidate(); + } else { + MediaItem item = mAlbumDataAdapter.get(slotIndex); + if (item == null) return; // Item not ready yet, ignore the click + if (mSelectionManager.getSelectedCount() > 0) { + if (!ActionModeHandler.isThreadComplete) + return; } - } else if(!isTitle){ - // Render transition in pressed state - mAlbumView.setPressedIndex(slotIndex); - mAlbumView.setPressedUp(); - mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PICK_PHOTO, slotIndex, 0), - FadeTexture.DURATION); + mSelectionManager.toggle(item.getPath()); + mSlotView.invalidate(); } + } else if (!isTitle) { + // Render transition in pressed state + mAlbumView.setPressedIndex(slotIndex); + mAlbumView.setPressedUp(); + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PICK_PHOTO, slotIndex, 0), + FadeTexture.DURATION); + } } private void pickPhoto(int slotIndex) { @@ -327,7 +328,7 @@ public class TimeLinePage extends ActivityState implements if (targetset == null || item == null) return; Bundle data = new Bundle(); - data.putInt(PhotoPage.KEY_INDEX_HINT, slotIndex-1); + data.putInt(PhotoPage.KEY_INDEX_HINT, slotIndex - 1); data.putString(PhotoPage.KEY_MEDIA_SET_PATH, targetset.getPath().toString()); data.putParcelable(PhotoPage.KEY_OPEN_ANIMATION_RECT, @@ -368,10 +369,10 @@ public class TimeLinePage extends ActivityState implements public void onLongTap(int slotIndex, boolean isTitle) { if (mGetContent) return; - if(isTitle){ + if (isTitle) { MediaSet targetSet = mAlbumDataAdapter.getMediaSet(slotIndex); if (targetSet == null) return; - ArrayList paths = ((ClusterAlbum)targetSet).getMediaItems(); + ArrayList paths = ((ClusterAlbum) targetSet).getMediaItems(); if (paths == null || paths.size() <= 0) return; mSelectionManager.setAutoLeaveSelectionMode(true); mSelectionManager.toggleTimeLineSet(paths); @@ -620,7 +621,7 @@ public class TimeLinePage extends ActivityState implements targetPhoto = mAlbumDataAdapter.size() - targetPhoto - 1; } prepareAnimationBackToFilmstrip(targetPhoto); - if(mLaunchedFromPhotoPage) { + if (mLaunchedFromPhotoPage) { onBackPressed(); } else { pickPhoto(targetPhoto, true); @@ -670,8 +671,7 @@ public class TimeLinePage extends ActivityState implements @Override protected void onStateResult(int request, int result, Intent data) { switch (request) { - case REQUEST_SLIDESHOW: - { + case REQUEST_SLIDESHOW: { // data could be null, if there is no images in the album if (data == null) return; mFocusIndex = data.getIntExtra(SlideshowPage.KEY_PHOTO_INDEX, 0); @@ -852,7 +852,7 @@ public class TimeLinePage extends ActivityState implements private boolean setupCameraButton() { if (!GalleryUtils.isAnyCameraAvailable(mActivity)) return false; - RelativeLayout galleryRoot = (RelativeLayout)mActivity.findViewById(R.id.gallery_root); + RelativeLayout galleryRoot = (RelativeLayout) mActivity.findViewById(R.id.gallery_root); if (galleryRoot == null) return false; mCameraButton = new Button(mActivity); @@ -878,7 +878,7 @@ public class TimeLinePage extends ActivityState implements if (tvEmptyAlbum == null) { tvEmptyAlbum = new TextView(mActivity); tvEmptyAlbum.setText(R.string.tvEmptyAlbum); - tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000")); + tvEmptyAlbum.setTextColor(galleryRoot.getResources().getColor(R.color.white, null)); tvEmptyAlbum.setGravity(Gravity.CENTER); tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( -- GitLab