This commit is contained in:
Ilia Kurtov 2016-09-14 13:48:01 +00:00 committed by GitHub
commit c28cfd7b8d
25 changed files with 297 additions and 245 deletions

View File

@ -1,12 +1,12 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 23 compileSdkVersion 24
buildToolsVersion "23.0.3" buildToolsVersion "24.0.1"
defaultConfig { defaultConfig {
applicationId "me.nereo.multiimageselector" applicationId "me.nereo.multiimageselector"
minSdkVersion 12 minSdkVersion 14
targetSdkVersion 23 targetSdkVersion 23
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
@ -21,6 +21,8 @@ android {
dependencies { dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs') compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:support-compat:24.2.0'
compile 'com.android.support:design:24.2.0'
compile project(':multi-image-selector') compile project(':multi-image-selector')
} }

View File

@ -1,19 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}

View File

@ -1,6 +1,6 @@
#Wed May 18 11:49:16 CST 2016 #Tue Aug 23 14:55:54 MSK 2016
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

View File

@ -1,20 +1,27 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
allprojects {
repositories {
jcenter()
}
}
android { android {
compileSdkVersion 23 compileSdkVersion 24
buildToolsVersion "23.0.3" buildToolsVersion "24.0.1"
defaultConfig { defaultConfig {
minSdkVersion 12 minSdkVersion 14
//noinspection OldTargetApi
targetSdkVersion 23 targetSdkVersion 23
versionCode 1
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
resourcePrefix "mis_" resourcePrefix "mis_"
@ -22,6 +29,9 @@ android {
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-compat:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.squareup.picasso:picasso:2.4.0' compile 'com.squareup.picasso:picasso:2.4.0'
} }

View File

@ -5,13 +5,13 @@ import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -22,43 +22,52 @@ import java.util.ArrayList;
* Updated by nereo on 2016/1/19. * Updated by nereo on 2016/1/19.
* Updated by nereo on 2016/5/18. * Updated by nereo on 2016/5/18.
*/ */
public class MultiImageSelectorActivity extends AppCompatActivity public class MultiImageSelectorActivity extends AppCompatActivity implements MultiImageSelectorFragment.Callback {
implements MultiImageSelectorFragment.Callback{
// Single choice // Single choice
public static final int MODE_SINGLE = 0; public static final int MODE_SINGLE = 0;
// Multi choice // Multi choice
public static final int MODE_MULTI = 1; public static final int MODE_MULTI = 1;
/** Max image sizeint{@link #DEFAULT_IMAGE_SIZE} by default */ /**
* Max image sizeint{@link #DEFAULT_IMAGE_SIZE} by default
*/
public static final String EXTRA_SELECT_COUNT = "max_select_count"; public static final String EXTRA_SELECT_COUNT = "max_select_count";
/** Select mode{@link #MODE_MULTI} by default */ /**
* Select mode{@link #MODE_MULTI} by default
*/
public static final String EXTRA_SELECT_MODE = "select_count_mode"; public static final String EXTRA_SELECT_MODE = "select_count_mode";
/** Whether show cameratrue by default */ /**
* Whether show cameratrue by default
*/
public static final String EXTRA_SHOW_CAMERA = "show_camera"; public static final String EXTRA_SHOW_CAMERA = "show_camera";
/** Result data setArrayList<String>*/ /**
* Result data setArrayList<String>
*/
public static final String EXTRA_RESULT = "select_result"; public static final String EXTRA_RESULT = "select_result";
/** Original data set */ /**
* Original data set
*/
public static final String EXTRA_DEFAULT_SELECTED_LIST = "default_list"; public static final String EXTRA_DEFAULT_SELECTED_LIST = "default_list";
// Default image size // Default image size
private static final int DEFAULT_IMAGE_SIZE = 9; private static final int DEFAULT_IMAGE_SIZE = 9;
@NonNull
private ArrayList<String> resultList = new ArrayList<>(); private ArrayList<String> resultList = new ArrayList<>();
private Button mSubmitButton;
private int mDefaultCount = DEFAULT_IMAGE_SIZE; private View submitButton;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setTheme(R.style.MIS_NO_ACTIONBAR);
setContentView(R.layout.mis_activity_default); setContentView(R.layout.mis_activity_default);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(Color.BLACK); getWindow().setStatusBarColor(Color.BLACK);
} }
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if(toolbar != null){ if (toolbar != null) {
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
} }
@ -68,37 +77,36 @@ public class MultiImageSelectorActivity extends AppCompatActivity
} }
final Intent intent = getIntent(); final Intent intent = getIntent();
mDefaultCount = intent.getIntExtra(EXTRA_SELECT_COUNT, DEFAULT_IMAGE_SIZE); final int mDefaultCount = intent.getIntExtra(EXTRA_SELECT_COUNT, DEFAULT_IMAGE_SIZE);
final int mode = intent.getIntExtra(EXTRA_SELECT_MODE, MODE_MULTI); final int mode = intent.getIntExtra(EXTRA_SELECT_MODE, MODE_MULTI);
final boolean isShow = intent.getBooleanExtra(EXTRA_SHOW_CAMERA, true); final boolean isShow = intent.getBooleanExtra(EXTRA_SHOW_CAMERA, true);
if(mode == MODE_MULTI && intent.hasExtra(EXTRA_DEFAULT_SELECTED_LIST)) { if (mode == MODE_MULTI && intent.hasExtra(EXTRA_DEFAULT_SELECTED_LIST)) {
resultList = intent.getStringArrayListExtra(EXTRA_DEFAULT_SELECTED_LIST); resultList = intent.getStringArrayListExtra(EXTRA_DEFAULT_SELECTED_LIST);
} }
mSubmitButton = (Button) findViewById(R.id.commit); submitButton = findViewById(R.id.multi_image_selector_submit_button);
if(mode == MODE_MULTI){ if (mode == MODE_MULTI) {
updateDoneText(resultList); updateSubmitButton();
mSubmitButton.setVisibility(View.VISIBLE); submitButton.setOnClickListener(new View.OnClickListener() {
mSubmitButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(final View v) {
if(resultList != null && resultList.size() >0){ if (!resultList.isEmpty()) {
// Notify success // Notify success
Intent data = new Intent(); Intent data = new Intent();
data.putStringArrayListExtra(EXTRA_RESULT, resultList); data.putStringArrayListExtra(EXTRA_RESULT, resultList);
setResult(RESULT_OK, data); setResult(RESULT_OK, data);
}else{ } else {
setResult(RESULT_CANCELED); setResult(RESULT_CANCELED);
} }
finish(); finish();
} }
}); });
}else{ } else {
mSubmitButton.setVisibility(View.GONE); submitButton.setVisibility(View.GONE);
} }
if(savedInstanceState == null){ if (savedInstanceState == null) {
Bundle bundle = new Bundle(); final Bundle bundle = new Bundle();
bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_COUNT, mDefaultCount); bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_COUNT, mDefaultCount);
bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_MODE, mode); bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_MODE, mode);
bundle.putBoolean(MultiImageSelectorFragment.EXTRA_SHOW_CAMERA, isShow); bundle.putBoolean(MultiImageSelectorFragment.EXTRA_SHOW_CAMERA, isShow);
@ -122,26 +130,13 @@ public class MultiImageSelectorActivity extends AppCompatActivity
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
/** private void updateSubmitButton() {
* Update done button by select image data submitButton.setEnabled(!resultList.isEmpty());
* @param resultList selected image data
*/
private void updateDoneText(ArrayList<String> resultList){
int size = 0;
if(resultList == null || resultList.size()<=0){
mSubmitButton.setText(R.string.mis_action_done);
mSubmitButton.setEnabled(false);
}else{
size = resultList.size();
mSubmitButton.setEnabled(true);
}
mSubmitButton.setText(getString(R.string.mis_action_button_string,
getString(R.string.mis_action_done), size, mDefaultCount));
} }
@Override @Override
public void onSingleImageSelected(String path) { public void onSingleImageSelected(final String path) {
Intent data = new Intent(); final Intent data = new Intent();
resultList.add(path); resultList.add(path);
data.putStringArrayListExtra(EXTRA_RESULT, resultList); data.putStringArrayListExtra(EXTRA_RESULT, resultList);
setResult(RESULT_OK, data); setResult(RESULT_OK, data);
@ -149,24 +144,24 @@ public class MultiImageSelectorActivity extends AppCompatActivity
} }
@Override @Override
public void onImageSelected(String path) { public void onImageSelected(final String path) {
if(!resultList.contains(path)) { if (!resultList.contains(path)) {
resultList.add(path); resultList.add(path);
} }
updateDoneText(resultList); updateSubmitButton();
} }
@Override @Override
public void onImageUnselected(String path) { public void onImageUnselected(final String path) {
if(resultList.contains(path)){ if (resultList.contains(path)) {
resultList.remove(path); resultList.remove(path);
} }
updateDoneText(resultList); updateSubmitButton();
} }
@Override @Override
public void onCameraShot(File imageFile) { public void onCameraShot(final File imageFile) {
if(imageFile != null) { if (imageFile != null) {
// notify system the image has change // notify system the image has change
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(imageFile))); sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(imageFile)));
@ -177,4 +172,4 @@ public class MultiImageSelectorActivity extends AppCompatActivity
finish(); finish();
} }
} }
} }

View File

@ -41,7 +41,7 @@ public class ImageGridAdapter extends BaseAdapter {
final int mGridWidth; final int mGridWidth;
public ImageGridAdapter(Context context, boolean showCamera, int column){ public ImageGridAdapter(Context context, boolean showCamera, int column) {
mContext = context; mContext = context;
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.showCamera = showCamera; this.showCamera = showCamera;
@ -51,38 +51,41 @@ public class ImageGridAdapter extends BaseAdapter {
Point size = new Point(); Point size = new Point();
wm.getDefaultDisplay().getSize(size); wm.getDefaultDisplay().getSize(size);
width = size.x; width = size.x;
}else{ } else {
width = wm.getDefaultDisplay().getWidth(); width = wm.getDefaultDisplay().getWidth();
} }
mGridWidth = width / column; mGridWidth = width / column;
} }
/** /**
* 显示选择指示器 * 显示选择指示器
*
* @param b * @param b
*/ */
public void showSelectIndicator(boolean b) { public void showSelectIndicator(boolean b) {
showSelectIndicator = b; showSelectIndicator = b;
} }
public void setShowCamera(boolean b){ public void setShowCamera(boolean b) {
if(showCamera == b) return; if (showCamera == b) return;
showCamera = b; showCamera = b;
notifyDataSetChanged(); notifyDataSetChanged();
} }
public boolean isShowCamera(){ public boolean isShowCamera() {
return showCamera; return showCamera;
} }
/** /**
* 选择某个图片改变选择状态 * 选择某个图片改变选择状态
*
* @param image * @param image
*/ */
public void select(Image image) { public void select(Image image) {
if(mSelectedImages.contains(image)){ if (mSelectedImages.contains(image)) {
mSelectedImages.remove(image); mSelectedImages.remove(image);
}else{ } else {
mSelectedImages.add(image); mSelectedImages.add(image);
} }
notifyDataSetChanged(); notifyDataSetChanged();
@ -90,24 +93,25 @@ public class ImageGridAdapter extends BaseAdapter {
/** /**
* 通过图片路径设置默认选择 * 通过图片路径设置默认选择
*
* @param resultList * @param resultList
*/ */
public void setDefaultSelected(ArrayList<String> resultList) { public void setDefaultSelected(ArrayList<String> resultList) {
for(String path : resultList){ for (String path : resultList) {
Image image = getImageByPath(path); Image image = getImageByPath(path);
if(image != null){ if (image != null) {
mSelectedImages.add(image); mSelectedImages.add(image);
} }
} }
if(mSelectedImages.size() > 0){ if (mSelectedImages.size() > 0) {
notifyDataSetChanged(); notifyDataSetChanged();
} }
} }
private Image getImageByPath(String path){ private Image getImageByPath(String path) {
if(mImages != null && mImages.size()>0){ if (mImages != null && mImages.size() > 0) {
for(Image image : mImages){ for (Image image : mImages) {
if(image.path.equalsIgnoreCase(path)){ if (image.path.equalsIgnoreCase(path)) {
return image; return image;
} }
} }
@ -117,14 +121,15 @@ public class ImageGridAdapter extends BaseAdapter {
/** /**
* 设置数据集 * 设置数据集
*
* @param images * @param images
*/ */
public void setData(List<Image> images) { public void setData(List<Image> images) {
mSelectedImages.clear(); mSelectedImages.clear();
if(images != null && images.size()>0){ if (images != null && images.size() > 0) {
mImages = images; mImages = images;
}else{ } else {
mImages.clear(); mImages.clear();
} }
notifyDataSetChanged(); notifyDataSetChanged();
@ -137,25 +142,25 @@ public class ImageGridAdapter extends BaseAdapter {
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
if(showCamera){ if (showCamera) {
return position==0 ? TYPE_CAMERA : TYPE_NORMAL; return position == 0 ? TYPE_CAMERA : TYPE_NORMAL;
} }
return TYPE_NORMAL; return TYPE_NORMAL;
} }
@Override @Override
public int getCount() { public int getCount() {
return showCamera ? mImages.size()+1 : mImages.size(); return showCamera ? mImages.size() + 1 : mImages.size();
} }
@Override @Override
public Image getItem(int i) { public Image getItem(int i) {
if(showCamera){ if (showCamera) {
if(i == 0){ if (i == 0) {
return null; return null;
} }
return mImages.get(i-1); return mImages.get(i - 1);
}else{ } else {
return mImages.get(i); return mImages.get(i);
} }
} }
@ -168,22 +173,22 @@ public class ImageGridAdapter extends BaseAdapter {
@Override @Override
public View getView(int i, View view, ViewGroup viewGroup) { public View getView(int i, View view, ViewGroup viewGroup) {
if(isShowCamera()){ if (isShowCamera()) {
if(i == 0){ if (i == 0) {
view = mInflater.inflate(R.layout.mis_list_item_camera, viewGroup, false); view = mInflater.inflate(R.layout.mis_list_item_camera, viewGroup, false);
return view; return view;
} }
} }
ViewHolder holder; ViewHolder holder;
if(view == null){ if (view == null) {
view = mInflater.inflate(R.layout.mis_list_item_image, viewGroup, false); view = mInflater.inflate(R.layout.mis_list_item_image, viewGroup, false);
holder = new ViewHolder(view); holder = new ViewHolder(view);
}else{ } else {
holder = (ViewHolder) view.getTag(); holder = (ViewHolder) view.getTag();
} }
if(holder != null) { if (holder != null) {
holder.bindData(getItem(i)); holder.bindData(getItem(i));
} }
@ -193,30 +198,30 @@ public class ImageGridAdapter extends BaseAdapter {
class ViewHolder { class ViewHolder {
ImageView image; ImageView image;
ImageView indicator; ImageView indicator;
View mask; // View mask;
ViewHolder(View view){ ViewHolder(View view) {
image = (ImageView) view.findViewById(R.id.image); image = (ImageView) view.findViewById(R.id.image);
indicator = (ImageView) view.findViewById(R.id.checkmark); indicator = (ImageView) view.findViewById(R.id.checkmark);
mask = view.findViewById(R.id.mask); // mask = view.findViewById(R.id.mask);
view.setTag(this); view.setTag(this);
} }
void bindData(final Image data){ void bindData(final Image data) {
if(data == null) return; if (data == null) return;
// 处理单选和多选状态 // 处理单选和多选状态
if(showSelectIndicator){ if (showSelectIndicator) {
indicator.setVisibility(View.VISIBLE); indicator.setVisibility(View.VISIBLE);
if(mSelectedImages.contains(data)){ if (mSelectedImages.contains(data)) {
// 设置选中状态 // 设置选中状态
indicator.setImageResource(R.drawable.mis_btn_selected); indicator.setImageResource(R.drawable.mis_checked_button);
mask.setVisibility(View.VISIBLE); // mask.setVisibility(View.VISIBLE);
}else{ } else {
// 未选择 // 未选择
indicator.setImageResource(R.drawable.mis_btn_unselected); indicator.setImageResource(R.drawable.mis_unchecked_button);
mask.setVisibility(View.GONE); // mask.setVisibility(View.GONE);
} }
}else{ } else {
indicator.setVisibility(View.GONE); indicator.setVisibility(View.GONE);
} }
File imageFile = new File(data.path); File imageFile = new File(data.path);
@ -229,7 +234,7 @@ public class ImageGridAdapter extends BaseAdapter {
.resize(mGridWidth, mGridWidth) .resize(mGridWidth, mGridWidth)
.centerCrop() .centerCrop()
.into(image); .into(image);
}else{ } else {
image.setImageResource(R.drawable.mis_default_error); image.setImageResource(R.drawable.mis_default_error);
} }
} }

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#999" android:state_enabled="false"/>
<item android:color="@color/mis_global_main_dark_blue"/>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/mis_global_black_12">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
</shape>
</item>
</ripple>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/mis_global_white_12">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
</shape>
</item>
</ripple>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 959 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/mis_global_white_12" android:state_pressed="true"/>
</selector>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/mis_global_black_12" android:state_pressed="true"/>
</selector>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/mis_global_white_12" android:state_pressed="true"/>
</selector>

View File

@ -1,47 +1,45 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:background="@android:color/black" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent">
android:layout_height="match_parent">
<GridView <GridView
android:id="@+id/grid" android:id="@+id/grid"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:horizontalSpacing="@dimen/mis_space_size"
android:verticalSpacing="@dimen/mis_space_size"
android:paddingBottom="?android:attr/actionBarSize"
android:clipToPadding="false" android:clipToPadding="false"
android:columnWidth="@dimen/mis_image_size"
android:horizontalSpacing="@dimen/mis_space_size"
android:numColumns="auto_fit" android:numColumns="auto_fit"
android:columnWidth="@dimen/mis_image_size"/> android:paddingBottom="?android:attr/actionBarSize"
android:verticalSpacing="@dimen/mis_space_size"/>
<RelativeLayout <RelativeLayout
android:clickable="true"
android:id="@+id/footer" android:id="@+id/footer"
android:background="#cc000000"
android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"> android:layout_height="?android:attr/actionBarSize"
android:layout_alignParentBottom="true"
android:background="#cc000000"
android:clickable="true">
<Button <Button
android:id="@+id/category_btn" android:id="@+id/category_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:background="@null"
android:drawablePadding="5dp"
android:drawableRight="@drawable/mis_text_indicator"
android:ellipsize="end"
android:gravity="center_vertical"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" android:paddingRight="16dp"
android:layout_centerVertical="true"
android:textColor="@color/mis_folder_text_color"
tools:text="所有图片"
android:textSize="16sp"
android:gravity="center_vertical"
android:drawableRight="@drawable/mis_text_indicator"
android:drawablePadding="5dp"
android:background="@null"
android:singleLine="true" android:singleLine="true"
android:ellipsize="end"
android:textAllCaps="false" android:textAllCaps="false"
android:layout_width="wrap_content" android:textColor="#cfcfcf"
android:layout_height="match_parent" /> android:textSize="16sp"/>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -1,40 +1,60 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:background="#181819" android:layout_height="match_parent"
android:layout_width="match_parent" android:orientation="vertical">
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar <android.support.design.widget.AppBarLayout
android:id="@+id/toolbar" android:id="@+id/main_app_bar_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="56dp"
android:background="@color/mis_actionbar_color" android:background="@color/mis_global_main_gray">
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:minHeight="?android:attr/actionBarSize">
<Button <android.support.v7.widget.Toolbar
android:id="@+id/commit" android:id="@+id/toolbar"
android:background="@drawable/mis_action_btn" android:layout_width="match_parent"
android:minHeight="1dp" android:layout_height="match_parent"
android:minWidth="1dp" app:contentInsetLeft="17dp"
android:layout_marginRight="16dp" app:contentInsetStart="17dp">
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textColor="@color/mis_default_text_color"
android:textSize="14sp"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.v7.widget.Toolbar> <LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:textColor="@color/mis_global_main_dark_gray"
android:textSize="20sp"
android:text="@string/mis_toolbar_title"/>
<TextView
android:id="@+id/multi_image_selector_submit_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:background="@drawable/mis_global_dark_selector"
android:textColor="@color/mis_main_menu_button_selector"
android:textSize="14sp"
android:text="@string/mis_toolbar_submit_button_text"
android:paddingRight="19dp"
android:paddingLeft="19dp"
android:textAllCaps="true"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<FrameLayout <FrameLayout
android:id="@+id/image_grid" android:id="@+id/image_grid"
android:background="@color/mis_global_main_gray"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent"/>
</LinearLayout> </LinearLayout>

View File

@ -1,45 +1,43 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:background="@android:color/black" android:layout_height="match_parent"
android:layout_width="match_parent" android:background="@android:color/black">
android:layout_height="match_parent">
<GridView <GridView
android:id="@+id/grid" android:id="@+id/grid"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:horizontalSpacing="@dimen/mis_space_size"
android:verticalSpacing="@dimen/mis_space_size"
android:paddingBottom="?android:attr/actionBarSize"
android:clipToPadding="false" android:clipToPadding="false"
android:numColumns="3"/> android:horizontalSpacing="@dimen/mis_space_size"
android:numColumns="3"
android:paddingBottom="?android:attr/actionBarSize"
android:verticalSpacing="@dimen/mis_space_size"/>
<RelativeLayout <RelativeLayout
android:clickable="true"
android:id="@+id/footer" android:id="@+id/footer"
android:background="#cc000000"
android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"> android:layout_height="?android:attr/actionBarSize"
android:layout_alignParentBottom="true"
android:background="#cc000000"
android:clickable="true">
<Button <Button
android:id="@+id/category_btn" android:id="@+id/category_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:background="@null"
android:drawablePadding="5dp"
android:drawableRight="@drawable/mis_text_indicator"
android:ellipsize="end"
android:gravity="center_vertical"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" android:paddingRight="16dp"
android:layout_centerVertical="true"
android:textColor="@color/mis_folder_text_color"
tools:text="所有图片"
android:textSize="16sp"
android:gravity="center_vertical"
android:drawableRight="@drawable/mis_text_indicator"
android:drawablePadding="5dp"
android:background="@null"
android:singleLine="true" android:singleLine="true"
android:ellipsize="end" android:textColor="@color/mis_folder_text_color"
android:layout_width="wrap_content" android:textSize="16sp"/>
android:layout_height="match_parent" />
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -1,17 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<me.nereo.multi_image_selector.view.SquareFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <me.nereo.multi_image_selector.view.SquareFrameLayout
android:background="#343535" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"> android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#343535">
<TextView <TextView
android:drawableTop="@drawable/mis_asy"
android:drawablePadding="10dp"
android:layout_gravity="center"
android:text="@string/mis_tip_take_photo"
android:textSize="14sp"
android:textColor="#CDCECE"
android:gravity="center_horizontal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="4dp"
android:drawablePadding="7dp"
android:drawableTop="@drawable/mis_photo_icon"
android:gravity="center_horizontal"
android:text="@string/mis_tip_take_photo"
android:textColor="#fff"
android:textSize="14sp"/>
</me.nereo.multi_image_selector.view.SquareFrameLayout> </me.nereo.multi_image_selector.view.SquareFrameLayout>

View File

@ -1,28 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<me.nereo.multi_image_selector.view.SquareFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <me.nereo.multi_image_selector.view.SquareFrameLayout
android:layout_width="match_parent" android:layout_height="match_parent"> xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<me.nereo.multi_image_selector.view.SquaredImageView <me.nereo.multi_image_selector.view.SquaredImageView
android:id="@+id/image" android:id="@+id/image"
android:scaleType="centerInside"
android:src="@drawable/mis_default_error"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent"
android:scaleType="centerCrop"
<View android:src="@drawable/mis_default_error"/>
android:visibility="gone"
android:id="@+id/mask"
android:background="#88000000"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView <ImageView
android:id="@+id/checkmark" android:id="@+id/checkmark"
android:layout_gravity="top|right"
android:layout_marginTop="5.5dp"
android:layout_marginRight="5.5dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/mis_btn_unselected"/> android:layout_gravity="top|right"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:src="@drawable/mis_unchecked_button"/>
</me.nereo.multi_image_selector.view.SquareFrameLayout> </me.nereo.multi_image_selector.view.SquareFrameLayout>

View File

@ -1,4 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="mis_actionbar_color">#21282C</color> <color name="mis_actionbar_color">#21282C</color>
<color name="mis_global_main_gray">#e8e8e8</color>
<color name="mis_global_main_dark_gray">#333</color>
<color name="mis_global_black_12">#1e000000</color>
<color name="mis_global_white_12">#1effffff</color>
<color name="mis_global_main_dark_blue">#205090</color>
<color name="mis_camera_item_background">#343535</color>
</resources> </resources>

View File

@ -1,17 +1,19 @@
<resources> <resources>
<string name="mis_folder_all">All Images</string> <string name="mis_folder_all">Все изображения</string>
<string name="mis_preview">Preview</string> <string name="mis_preview">Предпросмотр</string>
<string name="mis_msg_no_camera">No system camera found</string> <string name="mis_msg_no_camera">Не найдена камера</string>
<string name="mis_msg_amount_limit">Select images amount is limit</string> <string name="mis_msg_amount_limit">Выбрано максимум изображений</string>
<string name="mis_action_done">Done</string> <string name="mis_action_done">Done</string>
<string name="mis_action_button_string">%1$s(%2$d/%3$d)</string> <string name="mis_action_button_string">%1$s(%2$d/%3$d)</string>
<string name="mis_photo_unit">Shot</string> <string name="mis_photo_unit">Снять</string>
<string name="mis_tip_take_photo">Take photo</string> <string name="mis_tip_take_photo">Сделать фото</string>
<string name="mis_error_image_not_exist">Image error</string> <string name="mis_error_image_not_exist">Ошибка изображения</string>
<string name="mis_error_no_permission">Has no permission</string> <string name="mis_error_no_permission">Нет разрешения</string>
<string name="mis_permission_dialog_title">Permission Deny</string> <string name="mis_permission_dialog_title">Permission Deny</string>
<string name="mis_permission_dialog_ok">OK</string> <string name="mis_permission_dialog_ok">ОК</string>
<string name="mis_permission_dialog_cancel">CANCEL</string> <string name="mis_permission_dialog_cancel">ОТМЕНА</string>
<string name="mis_permission_rationale">Storage read permission is needed to pick files.</string> <string name="mis_permission_rationale">Storage read permission is needed to pick files.</string>
<string name="mis_permission_rationale_write_storage">Storage write permission is needed to save the image.</string> <string name="mis_permission_rationale_write_storage">Storage write permission is needed to save the image.</string>
<string name="mis_toolbar_title">Галерея</string>
<string name="mis_toolbar_submit_button_text">Добавить</string>
</resources> </resources>