Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1、优化部分界面显示细节 #75

Open
wants to merge 1 commit into
base: androidx
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,16 @@ public void onCheckViewClicked(CheckView checkView, MultiMedia item, RecyclerVie
if (checkedNum == CheckView.UNCHECKED) {
// 如果当前数据是未选状态
if (assertAddSelection(holder.itemView.getContext(), item)) {
MediaViewHolder mediaViewHolder = (MediaViewHolder) holder;
mediaViewHolder.mMediaGrid.setSelectMaskVisibility(View.VISIBLE);
// 添加选择了当前数据
mSelectedCollection.add(item);
// 刷新数据源
notifyCheckStateChanged();
}
} else {
MediaViewHolder mediaViewHolder = (MediaViewHolder) holder;
mediaViewHolder.mMediaGrid.setSelectMaskVisibility(View.GONE);
// 删除当前选择
mSelectedCollection.remove(item);
// 刷新数据
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class CheckView : View {
/**
* dp
*/
private const val STROKE_WIDTH = 3.0f
private const val STROKE_WIDTH = 1.5f

/**
* dp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class MediaGrid : SquareFrameLayout, View.OnClickListener {
*/
private lateinit var mVideoDuration: TextView

/**
* 选中文件蒙版
*/
private lateinit var mSelectMask: View

/**
* 值
*/
Expand Down Expand Up @@ -62,6 +67,7 @@ class MediaGrid : SquareFrameLayout, View.OnClickListener {
LayoutInflater.from(context).inflate(R.layout.media_grid_content_zjh, this, true)
mThumbnail = findViewById(R.id.media_thumbnail)
mCheckView = findViewById(R.id.checkView)
mSelectMask = findViewById(R.id.view_mask)
mGifTag = findViewById(R.id.gif)
mVideoDuration = findViewById(R.id.video_duration)
mThumbnail.setOnClickListener(this)
Expand Down Expand Up @@ -137,6 +143,11 @@ class MediaGrid : SquareFrameLayout, View.OnClickListener {
mCheckView.setChecked(checked)
}

fun setSelectMaskVisibility(visibility:Int)
{
mSelectMask.visibility = visibility
}

/**
* 设置图片或者gif图片
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ public void onBindViewHolder(final ViewHolder holder, int position) {
int checkedNum = album.getCheckedNum();
holder.tvSign.setVisibility(checkedNum > 0 ? View.VISIBLE : View.INVISIBLE);
holder.itemView.setSelected(isChecked);
if (isChecked)
{
holder.ivAlbumSelected.setVisibility(View.VISIBLE);
}
else
{
holder.ivAlbumSelected.setVisibility(View.GONE);
}
GlobalSpec.INSTANCE.getImageEngine().loadThumbnail(holder.itemView.getContext(),
holder.itemView.getContext().getResources().getDimensionPixelSize(R.dimen.z_media_grid_size),
holder.placeholder,
Expand All @@ -86,7 +94,7 @@ public int getItemCount() {
}

static class ViewHolder extends RecyclerView.ViewHolder {
ImageView imgFirst;
ImageView imgFirst,ivAlbumSelected;
TextView tvName, tvSign;
/**
* 默认图片
Expand All @@ -98,6 +106,7 @@ public ViewHolder(View itemView) {
imgFirst = itemView.findViewById(R.id.imgFirst);
tvName = itemView.findViewById(R.id.tvName);
tvSign = itemView.findViewById(R.id.tvSign);
ivAlbumSelected = itemView.findViewById(R.id.iv_album_selected);

TypedArray ta = itemView.getContext().getTheme().obtainStyledAttributes(
new int[]{R.attr.album_thumbnail_placeholder});
Expand All @@ -109,9 +118,9 @@ public ViewHolder(View itemView) {
itemView.getContext().getTheme().resolveAttribute(R.attr.album_listPopupWindowStyle, typedValue, true);

// item背景
Drawable backgroundStyle = AttrsUtils.getTypeValueDrawable(itemView.getContext(), typedValue.resourceId,
R.attr.album_backgroundStyle, R.drawable.spinner_item_select_bg_white);
itemView.setBackground(backgroundStyle);
// Drawable backgroundStyle = AttrsUtils.getTypeValueDrawable(itemView.getContext(), typedValue.resourceId,
// R.attr.album_backgroundStyle, R.drawable.spinner_item_select_bg_white);
// itemView.setBackground(backgroundStyle);

// 该专辑里面有图片被选择时
Drawable folderCheckedDotDrawable = AttrsUtils.getTypeValueDrawable(itemView.getContext(), typedValue.resourceId,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions multilibrary/src/main/res/drawable/shape_folder_list_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:bottomLeftRadius="16dp"
android:bottomRightRadius="16dp"/>
<solid android:color="@color/white"/>
</shape>
12 changes: 11 additions & 1 deletion multilibrary/src/main/res/layout/item_album_zjh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/spinner_item_select_bg_white"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:orientation="vertical"
android:padding="6dp">

Expand Down Expand Up @@ -34,4 +35,13 @@
android:textColor="@color/text_color_4d"
android:textSize="16sp" />

<ImageView
android:id="@+id/iv_album_selected"
android:src="@drawable/ic_album_item_selected_zjh"
android:layout_alignParentEnd="true"
android:layout_marginEnd="0dp"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

</RelativeLayout>
21 changes: 18 additions & 3 deletions multilibrary/src/main/res/layout/media_grid_content_zjh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
android:layout_height="match_parent"
android:contentDescription="@string/z_multi_library_show_thumbnails" />

<View
android:id="@+id/view_mask"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:alpha="0.5"
/>

<com.zhongjh.albumcamerarecorder.album.widget.CheckView
android:id="@+id/checkView"
android:layout_width="wrap_content"
Expand All @@ -41,17 +50,23 @@
tools:visibility="visible"
android:visibility="gone" />



<TextView
android:id="@+id/video_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_gravity="start|bottom"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="10dp"
android:drawableLeft="@drawable/ic_album_video_time_zjh"
android:textColor="@android:color/white"
android:textSize="12sp"
android:drawablePadding="7dp"
android:textSize="11sp"
tools:text="12333222222222"
tools:visibility="visible"
android:visibility="gone" />



</merge>
8 changes: 5 additions & 3 deletions multilibrary/src/main/res/layout/view_album_spinner_zjh.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootView"

android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/folder_list"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_folder_list_bg"
android:overScrollMode="never"
android:scrollbars="none" />

<View
android:id="@+id/rootViewBg"
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion multilibrary/src/main/res/values/colors_blue.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<color name="blue_album_empty_view">#4D000000</color>

<color name="blue_item_placeholder">#EAEEF4</color>
<color name="blue_item_checkCircle_backgroundColor">#1E8AE8</color>
<color name="blue_item_checkCircle_backgroundColor">#0099ff</color>
<color name="blue_item_checkCircle_borderColor">#FFFFFF</color>
<color name="blue_capture">#424242</color>

Expand Down