Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-alpha05'
Browse files Browse the repository at this point in the history
  • Loading branch information
sangcomz committed Jan 6, 2021
2 parents f7721be + 77068d5 commit 9015703
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 49 deletions.
3 changes: 1 addition & 2 deletions FishBun/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.hiya.jacoco-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'de.mobilej.unmock'
apply plugin: 'maven-publish'

Expand Down Expand Up @@ -32,7 +31,7 @@ android {
consumerProguardFile('proguard-rules.pro')
versionCode gradle.versionCode
versionName gradle.versionName

multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class ImageDataSourceImpl(private val contentResolver: ContentResolver) : ImageD
while (c.moveToNext()) {

val bucketId = c.getInt(c.getColumnIndex(BUCKET_ID)).toLong()
val bucketDisplayName = c.getString(c.getColumnIndex(BUCKET_DISPLAY_NAME))
val bucketMimeType = c.getString(c.getColumnIndex(MIME_TYPE))
val bucketDisplayName =
c.getString(c.getColumnIndex(BUCKET_DISPLAY_NAME)) ?: continue
val bucketMimeType = c.getString(c.getColumnIndex(MIME_TYPE)) ?: continue
val imgId = c.getInt(c.getColumnIndex(MediaStore.MediaColumns._ID))

if (isExceptImage(
Expand Down Expand Up @@ -131,15 +132,17 @@ class ImageDataSourceImpl(private val contentResolver: ContentResolver) : ImageD
try {
if (c.moveToFirst()) {
do {
val mimeType = c.getString(c.getColumnIndex(MIME_TYPE))
val folderName = c.getString(c.getColumnIndex(BUCKET_DISPLAY_NAME))
val mimeType = c.getString(c.getColumnIndex(MIME_TYPE)) ?: continue
val folderName =
c.getString(c.getColumnIndex(BUCKET_DISPLAY_NAME)) ?: continue

if (isExceptMemeType(exceptMimeTypeList, mimeType)
|| isNotContainsSpecifyFolderList(specifyFolderList, folderName)
) continue

val imgId = c.getInt(c.getColumnIndex(MediaStore.MediaColumns._ID))
val path = Uri.withAppendedPath(
EXTERNAL_CONTENT_URI,
"" + imgId
EXTERNAL_CONTENT_URI, "" + imgId
)
imageUris.add(path)
} while (c.moveToNext())
Expand Down Expand Up @@ -177,8 +180,8 @@ class ImageDataSourceImpl(private val contentResolver: ContentResolver) : ImageD
try {
if (c.moveToFirst()) {
do {
val mimeType = c.getString(c.getColumnIndex(MIME_TYPE))
val folderName = c.getString(c.getColumnIndex(BUCKET_DISPLAY_NAME))
val mimeType = c.getString(c.getColumnIndex(MIME_TYPE)) ?: continue
val folderName = c.getString(c.getColumnIndex(BUCKET_DISPLAY_NAME)) ?: continue

if (isExceptMemeType(exceptMimeTypeList, mimeType)
|| isNotContainsSpecifyFolderList(specifyFolderList, folderName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import com.sangcomz.fishbun.ui.album.model.Album
import com.sangcomz.fishbun.ui.album.model.AlbumMetaData
import com.sangcomz.fishbun.ui.album.listener.AlbumClickListener
import com.sangcomz.fishbun.util.SquareImageView
import kotlinx.android.synthetic.main.album_item.view.*

class AlbumListAdapter(
private val albumClickListener: AlbumClickListener,
Expand All @@ -33,6 +32,7 @@ class AlbumListAdapter(
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val binding =
return ViewHolder(
parent,
thumbnailSize,
Expand Down Expand Up @@ -74,9 +74,9 @@ class AlbumListAdapter(
) : RecyclerView.ViewHolder(
LayoutInflater.from(parent.context).inflate(R.layout.album_item, parent, false)
) {
private val imgAlbumThumb: SquareImageView = itemView.img_album_thumb
private val txtAlbumName: TextView = itemView.txt_album_name
private val txtAlbumCount: TextView = itemView.txt_album_count
private val imgAlbumThumb: SquareImageView = itemView.findViewById(R.id.img_album_thumb)
private val txtAlbumName: TextView = itemView.findViewById(R.id.txt_album_name)
private val txtAlbumCount: TextView = itemView.findViewById(R.id.txt_album_count)

init {
imgAlbumThumb.layoutParams = LinearLayout.LayoutParams(albumSize, albumSize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import android.view.ViewGroup
import com.sangcomz.fishbun.Fishton
import com.sangcomz.fishbun.R
import com.sangcomz.fishbun.adapter.image.ImageAdapter
import kotlinx.android.synthetic.main.detail_item.view.*

/**
* Created by sangcomz on 15/06/2017.
Expand All @@ -25,7 +24,7 @@ class DetailViewPagerAdapter(private val imageAdapter: ImageAdapter) : PagerAdap
LayoutInflater.from(container.context).inflate(R.layout.detail_item, container, false)
container.addView(itemView)

imageAdapter.loadDetailImage(itemView.img_detail_image, images[position])
imageAdapter.loadDetailImage(itemView.findViewById(R.id.img_detail_image), images[position])

return itemView
}
Expand Down
5 changes: 4 additions & 1 deletion FishBunDemo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

buildscript {
repositories {
Expand Down Expand Up @@ -62,6 +61,10 @@ android {
lintOptions {
abortOnError false
}

buildFeatures {
viewBinding true
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView
import com.sangcomz.fishbundemo.databinding.ItemBinding
import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.item.view.*
import java.util.*

/**
Expand All @@ -21,18 +21,18 @@ class ImageAdapter(
) : RecyclerView.Adapter<ImageAdapter.ViewHolder>() {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item, parent, false)
return ViewHolder(view)
return ViewHolder(ItemBinding.inflate(LayoutInflater.from(context)))
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val imagePath = imagePaths[position]

Picasso.get()
.load(imagePath)
.fit()
.centerCrop()
.into(holder.imageView);
.into(holder.imageView)

holder.imageView.setOnClickListener { imageController.setImgMain(imagePath) }
}

Expand All @@ -44,7 +44,7 @@ class ImageAdapter(

override fun getItemCount(): Int = imagePaths.size

class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val imageView = itemView.img_item as ImageView
class ViewHolder(binding: ItemBinding) : RecyclerView.ViewHolder(binding.root) {
val imageView = binding.imgItem
}
}
22 changes: 16 additions & 6 deletions FishBunDemo/src/main/java/com/sangcomz/fishbundemo/SubFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.sangcomz.fishbun.FishBun
import com.sangcomz.fishbun.adapter.image.impl.CoilAdapter
import kotlinx.android.synthetic.main.fragment_sub.*
import java.util.*
import com.sangcomz.fishbundemo.databinding.FragmentSubBinding
import kotlin.collections.ArrayList

/**
Expand All @@ -23,22 +22,28 @@ class SubFragment : Fragment() {

var path = ArrayList<Uri>()
private lateinit var imageAdapter: ImageAdapter
private var _binding: FragmentSubBinding? = null
private val binding get() = _binding!!


override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View = inflater.inflate(R.layout.fragment_sub, container, false)
): View {
_binding = FragmentSubBinding.inflate(inflater, container, false)
return binding.root
}


override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
with(recyclerview) {
with(binding.recyclerview) {
layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
imageAdapter = ImageAdapter(activity!!, ImageController(img_main), path)
imageAdapter = ImageAdapter(activity!!, ImageController(binding.imgMain), path)
adapter = imageAdapter
}

btn_add_images.setOnClickListener {
binding.btnAddImages.setOnClickListener {
FishBun.with(this@SubFragment)
.setImageAdapter(CoilAdapter())
.setMaxCount(10)
Expand All @@ -59,6 +64,11 @@ class SubFragment : Fragment() {
}
}

override fun onDestroyView() {
super.onDestroyView()
_binding = null
}

companion object {
fun newInstance() = SubFragment()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,31 @@ import com.sangcomz.fishbun.FishBun
import com.sangcomz.fishbun.MimeType
import com.sangcomz.fishbun.adapter.image.impl.GlideAdapter
import com.sangcomz.fishbun.adapter.image.impl.CoilAdapter
import kotlinx.android.synthetic.main.activity_withactivity.*
import com.sangcomz.fishbundemo.databinding.ActivityWithactivityBinding
import java.util.*

class WithActivityActivity : AppCompatActivity() {

var path = ArrayList<Uri>()
private lateinit var imageAdapter: ImageAdapter
private var mode: Int = 0
private lateinit var binding: ActivityWithactivityBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_withactivity)
binding = ActivityWithactivityBinding.inflate(layoutInflater)
setContentView(binding.root)

mode = intent.getIntExtra("mode", -1)

with(recyclerview) {
with(binding.recyclerview) {
layoutManager = LinearLayoutManager(
this@WithActivityActivity,
LinearLayoutManager.HORIZONTAL,
false
)

imageAdapter = ImageAdapter(context, ImageController(img_main), path)
imageAdapter = ImageAdapter(context, ImageController(binding.imgMain), path)
adapter = imageAdapter
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ package com.sangcomz.fishbundemo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_withfragment.*
import com.sangcomz.fishbundemo.databinding.ActivityWithfragmentBinding

class WithFragmentActivity : AppCompatActivity() {

private lateinit var subFragment: SubFragment
private lateinit var binding: ActivityWithfragmentBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_withfragment)
binding = ActivityWithfragmentBinding.inflate(layoutInflater)
setContentView(binding.root)

subFragment = SubFragment.newInstance()
supportFragmentManager.beginTransaction().add(area_container.id, subFragment).commit()
supportFragmentManager.beginTransaction().add(binding.areaContainer.id, subFragment)
.commit()
}
}
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ _FishBun_ is a highly customizable image picker for Android.
<img src="/pic/fishbuns.png">


## What's New in _FishBun_ 1.0.0-alpha04? :tada:
## What's New in _FishBun_ 1.0.0-alpha05? :tada:

- Refactoring for rapid development:rocket::rocket::rocket:
- Change PickerSpanCount default value (`3`->`4`)
Expand All @@ -24,7 +24,8 @@ _FishBun_ is a highly customizable image picker for Android.
- Fix Issue(#215)
- Change DetailView statusBar color
- Removed Picasso and added Coil
- Supprot Chinese
- Support Chinese
- Fix Issue(#223)


## Customizable Styles
Expand Down Expand Up @@ -122,15 +123,19 @@ Setting up _FishBun_ requires to add this Gradle configuration:

dependencies {
// Under the Android Plugin 3.0.0.
compile 'com.sangcomz:FishBun:1.0.0-alpha04'
compile 'com.sangcomz:FishBun:1.0.0-alpha05'
or
compile 'com.sangcomz:FishBun:0.11.4' //stable version
compile 'io.coil-kt:coil:0.11.0'
or
compile 'com.github.bumptech.glide:glide:4.9.0'
// Android plugin 3.0.0 or higher.
implementation 'com.sangcomz:FishBun:1.0.0-alpha04'
implementation 'com.sangcomz:FishBun:1.0.0-alpha05'
or
implementation 'com.sangcomz:FishBun:0.11.4' //stable version
implementation 'io.coil-kt:coil:0.11.0'
or
implementation 'com.github.bumptech.glide:glide:4.11.0'
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

buildscript {
ext {
kotlin_version = '1.3.50'
kotlin_version = '1.4.10'
androidx_version = '1.1.0'
recyclerview_version = '1.1.0'
material_version = '1.2.1'
Expand All @@ -16,7 +16,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'de.mobilej.unmock:UnMockPlugin:0.7.6'
// NOTE: Do not place your application dependencies here; they belong
Expand Down
4 changes: 3 additions & 1 deletion gradle/release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ if (project.rootProject.file('local.properties').isFile()) {
body = """## Release Note
* Refactoring for rapid development:rocket::rocket::rocket:
* Change PickerSpanCount default value (`3`->`4`)
* target SDK 29 support
* target SDK 30 support
* In API 29 or higher, the camera can be used only in the total image folder.
* Fix Issue(#215)
* Change DetailView statusBar color
* Removed Picasso and added Coil
* Support Chinese
* Fix Issue(#223)
"""
name = version
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Jun 26 23:15:45 KST 2020
#Mon Jan 04 21:58:21 KST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include ':FishBunDemo', ':FishBun'

gradle.ext.versionCode = 32
gradle.ext.versionName = '1.0.0-alpha04'
gradle.ext.versionCode = 33
gradle.ext.versionName = '1.0.0-alpha05'

gradle.ext.set('minSdk', 15)
gradle.ext.set('targetSdk', 30)
Expand Down

0 comments on commit 9015703

Please sign in to comment.