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

Support Vietnamese language. Add a selection to users decide whether … #651

Open
wants to merge 4 commits into
base: master
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
2 changes: 1 addition & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
<!--module name="NewlineAtEndOfFile"/-->
Expand Down
10 changes: 10 additions & 0 deletions matisse/src/main/java/com/zhihu/matisse/SelectionCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,16 @@ public SelectionCreator setOnCheckedListener(@Nullable OnCheckedListener listene
return this;
}

/**
* Let users decide whether click on a media thumbnail to preview.
* @param mClickableThumbToPreview
* @return {@link SelectionCreator} for fluent API.
*/
public SelectionCreator setClickableThumbToPreview(boolean mClickableThumbToPreview) {
mSelectionSpec.mClickableThumbToPreview = mClickableThumbToPreview;
return this;
}

/**
* Start to select media and wait for result.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public final class SelectionSpec {
public boolean autoHideToobar;
public int originalMaxSize;
public OnCheckedListener onCheckedListener;
public boolean mClickableThumbToPreview = true;

private SelectionSpec() {
}
Expand Down Expand Up @@ -91,6 +92,7 @@ private void reset() {
originalable = false;
autoHideToobar = false;
originalMaxSize = Integer.MAX_VALUE;
mClickableThumbToPreview = true;
}

public boolean singleSelectionModeEnabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ protected void onBindViewHolder(final RecyclerView.ViewHolder holder, Cursor cur
getImageResize(mediaViewHolder.mMediaGrid.getContext()),
mPlaceholder,
mSelectionSpec.countable,
mSelectionSpec.mClickableThumbToPreview,
holder
));
mediaViewHolder.mMediaGrid.bindMedia(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ private void init(Context context) {
public void onClick(View v) {
if (mListener != null) {
if (v == mThumbnail) {
mListener.onThumbnailClicked(mThumbnail, mMedia, mPreBindInfo.mViewHolder);
if (mPreBindInfo.mClickableThumbToPreview) {
mListener.onThumbnailClicked(mThumbnail, mMedia, mPreBindInfo.mViewHolder);
} else {
mListener.onCheckViewClicked(mCheckView, mMedia, mPreBindInfo.mViewHolder);
}
} else if (v == mCheckView) {
mListener.onCheckViewClicked(mCheckView, mMedia, mPreBindInfo.mViewHolder);
}
Expand Down Expand Up @@ -147,14 +151,19 @@ public static class PreBindInfo {
int mResize;
Drawable mPlaceholder;
boolean mCheckViewCountable;
boolean mClickableThumbToPreview;
RecyclerView.ViewHolder mViewHolder;

public PreBindInfo(int resize, Drawable placeholder, boolean checkViewCountable,
public PreBindInfo(int resize,
Drawable placeholder,
boolean mCheckViewCountable,
boolean mClickableThumbToPreview,
RecyclerView.ViewHolder viewHolder) {
mResize = resize;
mPlaceholder = placeholder;
mCheckViewCountable = checkViewCountable;
mViewHolder = viewHolder;
this.mResize = resize;
this.mPlaceholder = placeholder;
this.mCheckViewCountable = mCheckViewCountable;
this.mClickableThumbToPreview = mClickableThumbToPreview;
this.mViewHolder = viewHolder;
}
}

Expand Down
27 changes: 27 additions & 0 deletions matisse/src/main/res/values-vi-rVN/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
<string name="album_name_all">Tất cả</string>

<string name="button_preview">Xem trước</string>
<string name="button_apply_default">Áp dụng</string>
<string name="button_apply">Áp dụng(%1$d)</string>
<string name="button_back">Quay lại</string>
<string name="photo_grid_capture">Chụp ảnh</string>
<string name="empty_text">Chưa có tệp nào!</string>
<string name="button_ok">OK</string>

<string name="error_over_count_default">Đã chọn tối đa tệp!</string>
<string name="error_over_count">Bạn chỉ có thể chọn tối đa %1$d tệp!</string>
<string name="error_under_quality">Chất lượng ảnh/video quá thấp</string>
<string name="error_over_quality">Chất lượng ảnh/video quá cao</string>
<string name="error_file_type">Loại tệp không được hỗ trợ!</string>
<string name="error_type_conflict">Không thể chọn ảnh và video cùng một thời điểm.</string>
<string name="error_no_video_activity">Không tìm thấy ứng dụng hỗ trợ xem trước video!</string>
<string name="error_over_original_size">Không thể chọn ảnh có dung lượng lớn hơn %1$d MB.</string>
<string name="error_over_original_count">Có %1$d có dung lượng quá %2$d MB. Ảnh gốc sẽ được bỏ chọn!</string>
<string name="button_original">Tệp gốc</string>
<string name="button_sure_default">Chọn</string>
<string name="button_sure">Chọn(%1$d)</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public void onCheck(boolean isChecked) {
.originalEnable(true)
.maxOriginalSize(10)
.imageEngine(new PicassoEngine())
.setClickableThumbToPreview(false)
.forResult(REQUEST_CODE_CHOOSE);
break;
case R.id.only_gif:
Expand Down