├── .gitignore ├── .idea ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── lqg │ │ └── Image │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── lqg │ │ │ └── Image │ │ │ ├── FlexBoxAdapter.java │ │ │ ├── FlexboxActivity.java │ │ │ ├── GalleryAdapter.java │ │ │ ├── GridLayoutActivity.java │ │ │ ├── LabelActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── ScreenUtils.java │ │ │ ├── SizeUtils.java │ │ │ └── bean │ │ │ ├── ImageBean.java │ │ │ └── LabelBean.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── corner_13_bg.xml │ │ ├── corner_13_light_black_bg.xml │ │ ├── corner_13_stroke_bg.xml │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_flexbox.xml │ │ ├── activity_grid_layout.xml │ │ ├── activity_label.xml │ │ ├── activity_main.xml │ │ ├── adater_details_works_item.xml │ │ ├── adater_gallery_bottom.xml │ │ ├── adater_gallery_header.xml │ │ └── label_edt_item.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── girl1.jpg │ │ ├── girl2.jpg │ │ ├── girl3.jpg │ │ ├── girl4.jpg │ │ ├── girl5.jpg │ │ ├── girl6.jpg │ │ ├── girl7.jpg │ │ ├── girl8.jpg │ │ ├── girl9.jpg │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── lqg │ └── Image │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 26 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 1.8 38 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ImageRelateProject 2 | 图片相关的工程 3 | 4 | #LabelActivity 标签功能的视图 5 | 6 | #GridLayoutActivity 用GridLayoutManager实现错落有致布局 7 | 8 | #FlexboxActivity 用FlexboxLayoutManager实现错落有致布局 9 | 10 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | applicationId "com.lqg.Image" 7 | minSdkVersion 22 8 | targetSdkVersion 27 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation 'com.android.support:appcompat-v7:27.1.1' 24 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 25 | testImplementation 'junit:junit:4.12' 26 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 28 | implementation 'com.android.support:recyclerview-v7:27.0.0' 29 | //图片 30 | implementation 'com.github.bumptech.glide:glide:4.5.0' 31 | implementation 'com.google.android:flexbox:0.3.0-alpha2'//流式布局 32 | } 33 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/lqg/Image/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.lqg.Image; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.lqg.Image", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/lqg/Image/FlexBoxAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lqg.Image; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | 11 | import com.bumptech.glide.Glide; 12 | import com.bumptech.glide.request.RequestOptions; 13 | import com.lqg.Image.bean.ImageBean; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * Created by Administrator on 2019/7/28. 19 | */ 20 | 21 | public class FlexBoxAdapter extends RecyclerView.Adapter { 22 | private List mPicturesBeanList; 23 | private Context mContext; 24 | private float screenWidth; 25 | 26 | public FlexBoxAdapter(Context context, List imageBeans) { 27 | this.mPicturesBeanList = imageBeans; 28 | this.mContext = context; 29 | filterData(); 30 | } 31 | 32 | private void filterData() { 33 | screenWidth = (float) ScreenUtils.getScreenWidth(mContext); 34 | int i = 0; 35 | while (i < this.mPicturesBeanList.size()) { 36 | if (i % 2 == 0 && i + 1 < this.mPicturesBeanList.size()) { 37 | long divisor = (long) (screenWidth * (this.mPicturesBeanList.get(i + 1).getHeight()) * (this.mPicturesBeanList.get(i).getWidth())); 38 | long beDivisor = this.mPicturesBeanList.get(i + 1).getWidth() * this.mPicturesBeanList.get(i).getHeight() + this.mPicturesBeanList.get(i).getWidth() * this.mPicturesBeanList.get(i + 1).getHeight(); 39 | int w = (int) (divisor / beDivisor); 40 | int h = w * this.mPicturesBeanList.get(i).getHeight() / this.mPicturesBeanList.get(i).getWidth(); 41 | this.mPicturesBeanList.get(i).setChangeWidth(w); 42 | this.mPicturesBeanList.get(i).setChangeHeight(h); 43 | 44 | int tW = (int) (screenWidth - screenWidth * this.mPicturesBeanList.get(i + 1).getHeight() * this.mPicturesBeanList.get(i).getWidth() / (this.mPicturesBeanList.get(i + 1).getWidth() * this.mPicturesBeanList.get(i).getHeight() + this.mPicturesBeanList.get(i).getWidth() * this.mPicturesBeanList.get(i + 1).getHeight())); 45 | int tH = tW * this.mPicturesBeanList.get(i + 1).getHeight() / this.mPicturesBeanList.get(i + 1).getWidth(); 46 | this.mPicturesBeanList.get(i + 1).setChangeWidth(tW); 47 | this.mPicturesBeanList.get(i + 1).setChangeHeight(tH); 48 | } 49 | 50 | if (i == mPicturesBeanList.size() - 1 && mPicturesBeanList.size() % 2 == 1) { 51 | int w = (int) screenWidth; 52 | int h = w * mPicturesBeanList.get(i).getHeight() / mPicturesBeanList.get(i).getWidth(); 53 | this.mPicturesBeanList.get(i).setChangeWidth(w); 54 | this.mPicturesBeanList.get(i).setChangeHeight(h); 55 | } 56 | i++; 57 | } 58 | } 59 | 60 | 61 | @NonNull 62 | @Override 63 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { 64 | View view = LayoutInflater.from(mContext).inflate(R.layout.adater_details_works_item, null, false); 65 | FlexBoxAdapter.ViewHolder viewHolder = new FlexBoxAdapter.ViewHolder(view); 66 | return viewHolder; 67 | } 68 | 69 | @Override 70 | public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { 71 | int height = mPicturesBeanList.get(i).getChangeHeight(); 72 | int width = mPicturesBeanList.get(i).getChangeWidth(); 73 | if (mPicturesBeanList.size() % 2 == 1 && i == mPicturesBeanList.size() - 1) { 74 | height = mPicturesBeanList.get(i).getChangeHeight() >= SizeUtils.dp2px(100) ? SizeUtils.dp2px(100) : mPicturesBeanList.get(i).getChangeHeight(); 75 | width = (int) screenWidth; 76 | } 77 | 78 | RequestOptions options = new RequestOptions().override(width, height).centerCrop(); 79 | Glide.with(mContext).load(mPicturesBeanList.get(i).getResourceId()).apply(options).into(viewHolder.mImageView); 80 | } 81 | 82 | 83 | @Override 84 | public int getItemCount() { 85 | return this.mPicturesBeanList.size(); 86 | } 87 | 88 | public class ViewHolder extends RecyclerView.ViewHolder { 89 | private ImageView mImageView; 90 | 91 | public ViewHolder(@NonNull View itemView) { 92 | super(itemView); 93 | mImageView = itemView.findViewById(R.id.mine_photo_iv); 94 | } 95 | } 96 | } 97 | 98 | -------------------------------------------------------------------------------- /app/src/main/java/com/lqg/Image/FlexboxActivity.java: -------------------------------------------------------------------------------- 1 | package com.lqg.Image; 2 | 3 | import android.graphics.BitmapFactory; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.RecyclerView; 7 | 8 | import com.google.android.flexbox.AlignItems; 9 | import com.google.android.flexbox.FlexDirection; 10 | import com.google.android.flexbox.FlexboxLayoutManager; 11 | import com.google.android.flexbox.JustifyContent; 12 | import com.lqg.Image.bean.ImageBean; 13 | 14 | import java.util.ArrayList; 15 | import java.util.Arrays; 16 | import java.util.List; 17 | 18 | public class FlexboxActivity extends AppCompatActivity { 19 | private List imageList; 20 | private List mImageBeanList; 21 | private RecyclerView gallleryRecyclerView; 22 | private FlexboxLayoutManager mFlexboxLayoutManager; 23 | private FlexBoxAdapter mFlexBoxAdapter; 24 | 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_flexbox); 29 | initView(); 30 | initData(); 31 | 32 | } 33 | 34 | private void initView() { 35 | gallleryRecyclerView = findViewById(R.id.gallery_recyclerview); 36 | mFlexboxLayoutManager = new FlexboxLayoutManager(); 37 | mFlexboxLayoutManager.setFlexDirection(FlexDirection.ROW); 38 | mFlexboxLayoutManager.setJustifyContent(JustifyContent.SPACE_BETWEEN); 39 | // mFlexboxLayoutManager.setAlignContent(AlignContent.SPACE_BETWEEN); 40 | mFlexboxLayoutManager.setAlignItems(AlignItems.FLEX_START); 41 | gallleryRecyclerView.setLayoutManager(mFlexboxLayoutManager); 42 | 43 | } 44 | 45 | private void initData() { 46 | imageList = new ArrayList<>(Arrays.asList(R.mipmap.girl1,R.mipmap.girl2,R.mipmap.girl3,R.mipmap.girl4,R.mipmap.girl5 47 | ,R.mipmap.girl6,R.mipmap.girl7,R.mipmap.girl8,R.mipmap.girl9)); 48 | mImageBeanList = new ArrayList<>(); 49 | for (int i=0;i { 20 | private List mPicturesBeanList; 21 | private Context mContext; 22 | public static final int TYPE_HEADER = 0; 23 | public static final int TYPE_NORMAL = 1; 24 | public static final int TYPE_BOTTOM = 2; 25 | private View mHeaderView; 26 | private View mBottomView; 27 | private float screenWidth; 28 | 29 | 30 | public GalleryAdapter(Context context, List imageBeans) { 31 | this.mContext = context; 32 | this.mPicturesBeanList = imageBeans; 33 | filterData(); 34 | } 35 | 36 | 37 | @Override 38 | public void onAttachedToRecyclerView(RecyclerView recyclerView) { 39 | super.onAttachedToRecyclerView(recyclerView); 40 | RecyclerView.LayoutManager manager = recyclerView.getLayoutManager(); 41 | if (manager instanceof GridLayoutManager) { 42 | final GridLayoutManager gridManager = ((GridLayoutManager) manager); 43 | gridManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { 44 | @Override 45 | public int getSpanSize(int position) { 46 | return getItemViewType(position) == TYPE_HEADER || getItemViewType(position) == TYPE_BOTTOM 47 | ? gridManager.getSpanCount() : mPicturesBeanList.get(position - 1).getChangeWidth(); 48 | } 49 | }); 50 | } 51 | } 52 | 53 | 54 | public void setHeaderView(View headerView) { 55 | mHeaderView = headerView; 56 | notifyItemInserted(0); 57 | } 58 | 59 | public View getHeaderView() { 60 | return mHeaderView; 61 | } 62 | 63 | public void setBottomView(View bottomView) { 64 | mBottomView = bottomView; 65 | notifyItemInserted(mPicturesBeanList.size() + 1); 66 | } 67 | 68 | 69 | public View getBottomView() { 70 | return mBottomView; 71 | } 72 | 73 | @Override 74 | public int getItemViewType(int position) { 75 | if (mHeaderView == null) return TYPE_NORMAL; 76 | if (mBottomView == null) return TYPE_NORMAL; 77 | if (position == 0) return TYPE_HEADER; 78 | if (position == this.getItemCount() - 1) return TYPE_BOTTOM; 79 | return TYPE_NORMAL; 80 | } 81 | 82 | 83 | private void filterData() { 84 | screenWidth = (float) ScreenUtils.getScreenWidth(mContext); 85 | int i = 0; 86 | while (i < this.mPicturesBeanList.size()) { 87 | if (i % 2 == 0 && i + 1 < this.mPicturesBeanList.size()) { 88 | long divisor = (long) (screenWidth * (this.mPicturesBeanList.get(i + 1).getHeight()) * (this.mPicturesBeanList.get(i).getWidth())); 89 | long beDivisor = this.mPicturesBeanList.get(i + 1).getWidth() * this.mPicturesBeanList.get(i).getHeight() + this.mPicturesBeanList.get(i).getWidth() * this.mPicturesBeanList.get(i + 1).getHeight(); 90 | int w = (int) (divisor / beDivisor); 91 | int h = w * this.mPicturesBeanList.get(i).getHeight() / this.mPicturesBeanList.get(i).getWidth(); 92 | this.mPicturesBeanList.get(i).setChangeWidth(w); 93 | this.mPicturesBeanList.get(i).setChangeHeight(h); 94 | 95 | int tW = (int) (screenWidth - screenWidth * this.mPicturesBeanList.get(i + 1).getHeight() * this.mPicturesBeanList.get(i).getWidth() / (this.mPicturesBeanList.get(i + 1).getWidth() * this.mPicturesBeanList.get(i).getHeight() + this.mPicturesBeanList.get(i).getWidth() * this.mPicturesBeanList.get(i + 1).getHeight())); 96 | int tH = tW * this.mPicturesBeanList.get(i + 1).getHeight() / this.mPicturesBeanList.get(i + 1).getWidth(); 97 | this.mPicturesBeanList.get(i + 1).setChangeWidth(tW); 98 | this.mPicturesBeanList.get(i + 1).setChangeHeight(tH); 99 | } 100 | 101 | if (i == mPicturesBeanList.size() - 1 && mPicturesBeanList.size() % 2 == 1) { 102 | int w = (int) screenWidth; 103 | int h = w * mPicturesBeanList.get(i).getHeight() / mPicturesBeanList.get(i).getWidth(); 104 | this.mPicturesBeanList.get(i).setChangeWidth(w); 105 | this.mPicturesBeanList.get(i).setChangeHeight(h); 106 | } 107 | i++; 108 | } 109 | } 110 | 111 | 112 | @NonNull 113 | @Override 114 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { 115 | if (mHeaderView != null && i == TYPE_HEADER) return new ViewHolder(mHeaderView); 116 | if (mBottomView != null && i == TYPE_BOTTOM) return new ViewHolder(mBottomView); 117 | View view = LayoutInflater.from(mContext).inflate(R.layout.adater_details_works_item, null, false); 118 | ViewHolder viewHolder = new ViewHolder(view); 119 | return viewHolder; 120 | } 121 | 122 | @Override 123 | public void onBindViewHolder(@NonNull ViewHolder viewHolder, final int i) { 124 | if (getItemViewType(i) == TYPE_HEADER) return; 125 | if (getItemViewType(i) == TYPE_BOTTOM) return; 126 | final int position = getRealPosition(viewHolder); 127 | int height = mPicturesBeanList.get(position).getChangeHeight(); 128 | int width = mPicturesBeanList.get(position).getChangeWidth(); 129 | //TODO 最后一张图片高度最高设置100dp,宽度铺满全屏 130 | if (mPicturesBeanList.size() % 2 == 1 && position == mPicturesBeanList.size() - 1) { 131 | height = mPicturesBeanList.get(position).getChangeHeight() >= SizeUtils.dp2px(100) ? SizeUtils.dp2px(100) : mPicturesBeanList.get(position).getChangeHeight(); 132 | width = (int) screenWidth; 133 | } 134 | 135 | RequestOptions options = new RequestOptions().override(width, height).centerCrop(); 136 | Glide.with(mContext).load(mPicturesBeanList.get(position).getResourceId()).apply(options).into(viewHolder.mImageView); 137 | // Glide.with(mContext).load(R.mipmap.girl1).apply(options).into(viewHolder.mImageView); 138 | } 139 | 140 | public int getRealPosition(RecyclerView.ViewHolder holder) { 141 | int position = holder.getLayoutPosition(); 142 | return mHeaderView == null ? position : position - 1; 143 | } 144 | 145 | 146 | @Override 147 | public int getItemCount() { 148 | return mPicturesBeanList.size() + 2; 149 | } 150 | 151 | public class ViewHolder extends RecyclerView.ViewHolder { 152 | private ImageView mImageView; 153 | 154 | public ViewHolder(@NonNull View itemView) { 155 | super(itemView); 156 | if (itemView == mHeaderView) return; 157 | mImageView = itemView.findViewById(R.id.mine_photo_iv); 158 | } 159 | } 160 | 161 | } 162 | -------------------------------------------------------------------------------- /app/src/main/java/com/lqg/Image/GridLayoutActivity.java: -------------------------------------------------------------------------------- 1 | package com.lqg.Image; 2 | 3 | import android.graphics.BitmapFactory; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.GridLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | 11 | import com.lqg.Image.bean.ImageBean; 12 | 13 | import java.util.ArrayList; 14 | import java.util.Arrays; 15 | import java.util.List; 16 | 17 | public class GridLayoutActivity extends AppCompatActivity { 18 | private GridLayoutManager mGirdLayoutManager; 19 | private GalleryAdapter mGalleryAdapter; 20 | private List imageList; 21 | private List mImageBeanList; 22 | private RecyclerView gallleryRecyclerView; 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.activity_grid_layout); 27 | initView(); 28 | initData(); 29 | addHeaderView(); 30 | addBottomView(); 31 | gallleryRecyclerView.setAdapter(mGalleryAdapter); 32 | } 33 | 34 | private void addBottomView() { 35 | View view = LayoutInflater.from(GridLayoutActivity.this).inflate(R.layout.adater_gallery_bottom, gallleryRecyclerView, false); 36 | mGalleryAdapter.setBottomView(view); 37 | } 38 | 39 | private void addHeaderView() { 40 | View view = LayoutInflater.from(GridLayoutActivity.this).inflate(R.layout.adater_gallery_header, gallleryRecyclerView, false); 41 | mGalleryAdapter.setHeaderView(view); 42 | } 43 | 44 | private void initView() { 45 | gallleryRecyclerView = findViewById(R.id.gallery_recyclerview); 46 | } 47 | 48 | private void initData() { 49 | imageList = new ArrayList<>(Arrays.asList(R.mipmap.girl1,R.mipmap.girl2,R.mipmap.girl3,R.mipmap.girl4,R.mipmap.girl5 50 | ,R.mipmap.girl6,R.mipmap.girl7,R.mipmap.girl8,R.mipmap.girl9)); 51 | mImageBeanList = new ArrayList<>(); 52 | for (int i=0;i labelData = new ArrayList(Arrays.asList("十年爱情长跑", "羡慕", "嫉妒", "柠檬酸", "祝福", "长长久久", "早生贵子", "幸福美满")); 21 | private List selectLabelData = new ArrayList(); 22 | private FlexboxLayout unSelectedFlexLayout ; 23 | private FlexboxLayout selectedFlexLayout; 24 | private EditText editLabelET; 25 | 26 | @Override 27 | protected void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | setContentView(R.layout.activity_label); 30 | initView(); 31 | initLabelData(); 32 | initselectLabelData(); 33 | } 34 | 35 | private void initView() { 36 | selectedFlexLayout = findViewById(R.id.selected_flex_layout); 37 | unSelectedFlexLayout = findViewById(R.id.unselected_flex_layout); 38 | } 39 | 40 | private void initLabelData() { 41 | unSelectedFlexLayout.removeAllViews(); 42 | for (int i = 0; i < labelData.size(); i++) { 43 | TextView textView = ScreenUtils.createFlexItemView(LabelActivity.this, labelData.get(i), false); 44 | textView.setLayoutParams(ScreenUtils.createDefaultLayoutParams()); 45 | unSelectedFlexLayout.addView(textView); 46 | final int finalI = i; 47 | textView.setOnClickListener(new View.OnClickListener() { 48 | @Override 49 | public void onClick(View v) { 50 | selectLabelData.add(labelData.get(finalI)); 51 | labelData.remove(labelData.get(finalI)); 52 | initselectLabelData(); 53 | initLabelData(); 54 | } 55 | }); 56 | } 57 | } 58 | 59 | private void initselectLabelData() { 60 | selectedFlexLayout.removeAllViews(); 61 | for (int i = 0; i < selectLabelData.size(); i++) { 62 | TextView textView = ScreenUtils.createFlexItemView(LabelActivity.this, selectLabelData.get(i), true); 63 | final int finalI = i; 64 | textView.setOnClickListener(new View.OnClickListener() { 65 | @Override 66 | public void onClick(View v) { 67 | String content = selectLabelData.get(finalI); 68 | labelData.add(content); 69 | selectLabelData.remove(content); 70 | initselectLabelData(); 71 | initLabelData(); 72 | } 73 | }); 74 | textView.setLayoutParams(ScreenUtils.createDefaultLayoutParams()); 75 | selectedFlexLayout.addView(textView); 76 | } 77 | addEditLabel(); 78 | } 79 | 80 | private void addEditLabel() { 81 | View view = LayoutInflater.from(LabelActivity.this).inflate(R.layout.label_edt_item, null); 82 | editLabelET = view.findViewById(R.id.lable_tip_et); 83 | FlexboxLayout.LayoutParams lp = new FlexboxLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 84 | lp.setMargins(0, SizeUtils.dp2px(8), SizeUtils.dp2px(8), 0); 85 | editLabelET.setLayoutParams(lp); 86 | selectedFlexLayout.addView(editLabelET); 87 | editLabelET.setOnEditorActionListener(new TextView.OnEditorActionListener() { 88 | @Override 89 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { 90 | if (actionId == EditorInfo.IME_ACTION_DONE) { 91 | String content = editLabelET.getText().toString().trim().replace(" ", ""); 92 | if (!isRepaetContent(content)) { 93 | selectLabelData.add(content); 94 | initselectLabelData(); 95 | } 96 | } 97 | return false; 98 | } 99 | }); 100 | } 101 | 102 | private boolean isRepaetContent(String content) { 103 | for (int i = 0; i < selectLabelData.size(); i++) { 104 | if (selectLabelData.get(i).equals(content)) { 105 | return true; 106 | } 107 | } 108 | return false; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /app/src/main/java/com/lqg/Image/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.lqg.Image; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | 8 | public class MainActivity extends AppCompatActivity { 9 | 10 | @Override 11 | protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | setContentView(R.layout.activity_main); 14 | } 15 | 16 | public void onGridLayout(View view){ 17 | startActivity(new Intent(MainActivity.this,GridLayoutActivity.class)); 18 | } 19 | 20 | public void onFlexLayout(View view){ 21 | startActivity(new Intent(MainActivity.this,FlexboxActivity.class)); 22 | } 23 | 24 | public void onLabelLayout(View view){ 25 | startActivity(new Intent(MainActivity.this, LabelActivity.class)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/lqg/Image/ScreenUtils.java: -------------------------------------------------------------------------------- 1 | package com.lqg.Image; 2 | 3 | import android.content.Context; 4 | import android.graphics.Point; 5 | import android.os.Build; 6 | import android.view.Gravity; 7 | import android.view.ViewGroup; 8 | import android.view.WindowManager; 9 | import android.widget.TextView; 10 | 11 | import com.google.android.flexbox.FlexboxLayout; 12 | 13 | 14 | /** 15 | * Created by Administrator on 2019/5/15. 16 | */ 17 | 18 | public class ScreenUtils { 19 | 20 | /** 21 | * Return the width of screen, in pixel. 22 | * 23 | * @return the width of screen, in pixel 24 | */ 25 | public static int getScreenWidth(Context context) { 26 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); 27 | Point point = new Point(); 28 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 29 | //noinspection ConstantConditions 30 | wm.getDefaultDisplay().getRealSize(point); 31 | } else { 32 | //noinspection ConstantConditions 33 | wm.getDefaultDisplay().getSize(point); 34 | } 35 | return point.x; 36 | } 37 | 38 | /** 39 | * Return the height of screen, in pixel. 40 | * 41 | * @return the height of screen, in pixel 42 | */ 43 | public static int getScreenHeight(Context context) { 44 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); 45 | Point point = new Point(); 46 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 47 | //noinspection ConstantConditions 48 | wm.getDefaultDisplay().getRealSize(point); 49 | } else { 50 | //noinspection ConstantConditions 51 | wm.getDefaultDisplay().getSize(point); 52 | } 53 | return point.y; 54 | } 55 | 56 | /** 57 | * @param content 内容 58 | * @param selected 是否被选中 59 | * 60 | */ 61 | public static TextView createFlexItemView(Context context, String content, boolean selected) { 62 | TextView textView = new TextView(context); 63 | textView.setTextSize(12); 64 | textView.setPadding(30, 10, 30, 10); 65 | if (selected) { 66 | textView.setText(content + " ×"); 67 | textView.setTextColor(context.getResources().getColor(R.color.btn_text_color)); 68 | textView.setBackgroundResource(R.drawable.corner_13_bg); 69 | } else { 70 | textView.setText(content); 71 | textView.setTextColor(context.getResources().getColor(R.color.normal_text_color)); 72 | textView.setBackgroundResource(R.drawable.corner_13_light_black_bg); 73 | } 74 | 75 | // if (addItem) { 76 | // textView.setText("+ " + content); 77 | // textView.setTextColor(context.getResources().getColor(R.color.btn_presss_text)); 78 | // textView.setBackgroundResource(R.drawable.corner_13_stroke_bg); 79 | // } 80 | textView.setClickable(true); 81 | textView.setGravity(Gravity.CENTER); 82 | return textView; 83 | } 84 | 85 | 86 | public static ViewGroup.LayoutParams createDefaultLayoutParams() { 87 | FlexboxLayout.LayoutParams lp = new FlexboxLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 88 | //它假设每个子项的 layout_flexGrow 属性的值设为 1,那么剩余空间将均匀分配到每个子项。默认为0 89 | lp.setMargins(0, SizeUtils.dp2px(8), SizeUtils.dp2px(8), 0); 90 | return lp; 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/lqg/Image/SizeUtils.java: -------------------------------------------------------------------------------- 1 | package com.lqg.Image; 2 | 3 | import android.content.res.Resources; 4 | 5 | /** 6 | * Created by Administrator on 2019/7/28. 7 | */ 8 | 9 | public class SizeUtils { 10 | /** 11 | * Value of dp to value of px. 12 | * 13 | * @param dpValue The value of dp. 14 | * @return value of px 15 | */ 16 | public static int dp2px(final float dpValue) { 17 | final float scale = Resources.getSystem().getDisplayMetrics().density; 18 | return (int) (dpValue * scale + 0.5f); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/lqg/Image/bean/ImageBean.java: -------------------------------------------------------------------------------- 1 | package com.lqg.Image.bean; 2 | 3 | /** 4 | * Created by Administrator on 2019/7/28. 5 | */ 6 | 7 | public class ImageBean { 8 | private int resourceId; 9 | private int width; 10 | private int height; 11 | private int changeWidth; 12 | private int changeHeight; 13 | 14 | public int getWidth() { 15 | return width; 16 | } 17 | 18 | public void setWidth(int width) { 19 | this.width = width; 20 | } 21 | 22 | public int getHeight() { 23 | return height; 24 | } 25 | 26 | public void setHeight(int height) { 27 | this.height = height; 28 | } 29 | 30 | public int getChangeWidth() { 31 | return changeWidth; 32 | } 33 | 34 | public void setChangeWidth(int changeWidth) { 35 | this.changeWidth = changeWidth; 36 | } 37 | 38 | public int getChangeHeight() { 39 | return changeHeight; 40 | } 41 | 42 | public void setChangeHeight(int changeHeight) { 43 | this.changeHeight = changeHeight; 44 | } 45 | 46 | public int getResourceId() { 47 | return resourceId; 48 | } 49 | 50 | public void setResourceId(int resourceId) { 51 | this.resourceId = resourceId; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/lqg/Image/bean/LabelBean.java: -------------------------------------------------------------------------------- 1 | package com.lqg.Image.bean; 2 | 3 | /** 4 | * Created by Administrator on 2019/8/4. 5 | */ 6 | 7 | public class LabelBean { 8 | private String id; 9 | private String type; 10 | private String name; 11 | 12 | public String getId() { 13 | return id; 14 | } 15 | 16 | public void setId(String id) { 17 | this.id = id; 18 | } 19 | 20 | 21 | public String getType() { 22 | return type; 23 | } 24 | 25 | public void setType(String type) { 26 | this.type = type; 27 | } 28 | 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | public void setName(String name) { 34 | this.name = name; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/corner_13_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/corner_13_light_black_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/corner_13_stroke_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_flexbox.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_grid_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_label.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 23 | 24 | 25 | 26 | 35 | 36 | 47 | 48 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 17 | 18 | 27 | 28 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/adater_details_works_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/adater_gallery_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/adater_gallery_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/label_edt_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/girl1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxhdpi/girl1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/girl2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxhdpi/girl2.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/girl3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxhdpi/girl3.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/girl4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxhdpi/girl4.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/girl5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxhdpi/girl5.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/girl6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxhdpi/girl6.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/girl7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxhdpi/girl7.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/girl8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxhdpi/girl8.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/girl9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxhdpi/girl9.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | #ff363437 8 | #ffcacaca 9 | #ff232225 10 | #ffe131 11 | #FFE131 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ImageRelateProject 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/lqg/Image/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.lqg.Image; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.0' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LQG24/ImageRelateProject/d1d0b198c03c23476c9f3f3378c5238ffb7daa48/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Jul 28 21:30:11 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------