Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Convert some class Java to Kotlin with Refactoring #175

Merged
merged 6 commits into from
Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions FishBun/src/main/java/com/sangcomz/fishbun/BaseProperty.java

This file was deleted.

24 changes: 24 additions & 0 deletions FishBun/src/main/java/com/sangcomz/fishbun/BaseProperty.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.sangcomz.fishbun

import android.net.Uri

/**
* Created by sangcomz on 13/05/2017.
*/
interface BaseProperty {
fun setSelectedImages(selectedImages: ArrayList<Uri>): FishBunCreator

fun setPickerCount(count: Int): FishBunCreator

fun setMaxCount(count: Int): FishBunCreator

fun setMinCount(count: Int): FishBunCreator

fun setRequestCode(requestCode: Int): FishBunCreator

fun setReachLimitAutomaticClose(isAutomaticClose: Boolean): FishBunCreator

fun exceptGif(isExcept: Boolean): FishBunCreator

fun startAlbum()
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.sangcomz.fishbun

import android.graphics.drawable.Drawable

/**
* Created by sangcomz on 13/05/2017.
*/
interface CustomizationProperty {
fun setAlbumThumbnailSize(size: Int): FishBunCreator

fun setPickerSpanCount(spanCount: Int): FishBunCreator

fun setActionBarColor(actionbarColor: Int): FishBunCreator

fun setActionBarTitleColor(actionbarTitleColor: Int): FishBunCreator

fun setActionBarColor(actionbarColor: Int, statusBarColor: Int): FishBunCreator

fun setActionBarColor(actionbarColor: Int, statusBarColor: Int, isStatusBarLight: Boolean): FishBunCreator

fun setCamera(isCamera: Boolean): FishBunCreator

fun textOnNothingSelected(message: String?): FishBunCreator

fun textOnImagesSelectionLimitReached(message: String?): FishBunCreator

fun setButtonInAlbumActivity(isButton: Boolean): FishBunCreator

fun setAlbumSpanCount(portraitSpanCount: Int, landscapeSpanCount: Int): FishBunCreator

fun setAlbumSpanCountOnlyLandscape(landscapeSpanCount: Int): FishBunCreator

fun setAlbumSpanCountOnlPortrait(portraitSpanCount: Int): FishBunCreator

fun setAllViewTitle(allViewTitle: String?): FishBunCreator

fun setActionBarTitle(actionBarTitle: String?): FishBunCreator

fun setHomeAsUpIndicatorDrawable(icon: Drawable?): FishBunCreator

fun setDoneButtonDrawable(icon: Drawable?): FishBunCreator

fun setAllDoneButtonDrawable(icon: Drawable?): FishBunCreator

fun setIsUseAllDoneButton(isUse: Boolean): FishBunCreator

fun setMenuDoneText(text: String?): FishBunCreator

fun setMenuAllDoneText(text: String?): FishBunCreator

fun setMenuTextColor(color: Int): FishBunCreator

fun setIsUseDetailView(isUse: Boolean): FishBunCreator

fun setIsShowCount(isShow: Boolean): FishBunCreator

fun setSelectCircleStrokeColor(strokeColor: Int): FishBunCreator

fun isStartInAllView(isStartInAllView: Boolean): FishBunCreator
}
38 changes: 0 additions & 38 deletions FishBun/src/main/java/com/sangcomz/fishbun/FishBun.java

This file was deleted.

30 changes: 30 additions & 0 deletions FishBun/src/main/java/com/sangcomz/fishbun/FishBun.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.sangcomz.fishbun

import android.app.Activity
import androidx.fragment.app.Fragment
import com.sangcomz.fishbun.adapter.image.ImageAdapter
import java.lang.ref.WeakReference

class FishBun private constructor(context: Activity?) {

private val _context: WeakReference<Activity?> = WeakReference(context)

val context: Activity?
get() = _context.get()

fun setImageAdapter(imageAdapter: ImageAdapter): FishBunCreator {
val fishton = Fishton.getInstance().apply {
refresh()
this.imageAdapter = imageAdapter
}
return FishBunCreator(this, fishton)
}

companion object {
@JvmStatic
fun with(activity: Activity) = FishBun(activity)

@JvmStatic
fun with(fragment: Fragment) = FishBun(fragment.activity)
}
}
Loading