python与Android有关的库,这15个Android开源库,只有经常逛Github的才知道!

哈喽,大家好,我是西哥!

又到了大家最喜欢了的环节–

开源库推荐

,前面为大家推荐了我收藏的一些非常酷的开源库,受到大家一致好评,还没看过的,请移步至:

本期又为大家带来了哪些有趣的库呢?本期为大家精选了

15

个有趣又有用的开源,

排名不分先后

,一起来看看吧!

1. Coil

4de57f6879a9422a9b84063b20da65fa.png

Coil是Android上的一个全新的图片加载框架,它的全名叫做

coroutine image loader

,即协程图片加载库。与传统的图片加载库Glide,Picasso或Fresco等相比。该具有轻量(只有大约1500个方法)、快、易于使用、更现代的API等优势。

它支持GIF和SVG,并且可以执行四个默认转换:

模糊

圆形裁剪

灰度

圆角

示例如下:

imageView.load(“https://www.example.com/image.jpg") {

crossfade(true)

placeholder(R.drawable.image)

transformations(CircleCropTransformation())

}1

2

3

4

5

并且是全用Kotlin编写,如果你是纯Kotlin项目的话,那么这个库应该是你的首选。

Github地址:https://github.com/coil-kt/coil

2. MultiSearchView

9be18a86ff671e42f0f1c92baef60944.gif

该库具有一个非常酷的

Search View

动画!

使用非常简单,并且可以自定义,你可以在在

styles.xml

下添加自定义样式。

示例代码:

android:layout_width="match_parent"

android:layout_height="wrap_content"/>1

2

3

multiSearchView.setSearchViewListener(object : MultiSearchView.MultiSearchViewListener{

override fun onItemSelected(index: Int, s: CharSequence) {

}

override fun onTextChanged(index: Int, s: CharSequence) {

}

override fun onSearchComplete(index: Int, s: CharSequence) {

}

override fun onSearchItemRemoved(index: Int) {

}

})1

2

3

4

5

6

7

8

9

10

11

12

13

14

自定义样式:

true

true

true

Search

actionSearch

18sp

15

textCapSentences

>#80999999

#0001

2

3

4

5

6

7

8

9

10

11

12

13

14

然后,您应该将样式设置为

MultiSearchView

下的

app:searchTextStyle

Github地址:https://github.com/iammert/MultiSearchView

3. CalendarView

0f78a74800d0d05d4adc1a60da47f1c1.png

CalendarView

是一个高度可定制化的日历组件库,用recycleView实现。

它有如下特性:

单一或范围选择

周历或者月历模式

边界日期

自定义日历视图

水平或者垂直滚动模式

完全可定制的视图

该库的文档也非常全面,并包含许多示例。此外,还有一个示例应用程序展示了库的所有功能。

它是用纯Kotlin编写的,并在MIT许可下发布。如果您需要在应用程序中使用日历视图,这是一个不错的选择。

注意:该库通过Java 8+ API使用了java.time类,以便向后兼容,因为这些类是在Java 8中添加的。

因此,需要在app的

build.gradle

中添加如下配置:

android {

defaultConfig {

// Required ONLY when setting minSdkVersion to 20 or lower

multiDexEnabled true

}

compileOptions {

// Flag to enable support for the new language APIs

coreLibraryDesugaringEnabled true

// Sets Java compatibility to Java 8

sourceCompatibility JavaVersion.VERSION_1_8

targetCompatibility JavaVersion.VERSION_1_8

}

}

dependencies {

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:'

}1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

Github: https://github.com/kizitonwose/CalendarView

4. Bubble Navigation

FloatingTopBarActivity

TopBarActivity

16958e143f236639245f21ed7984eb1d.gif

cd91e8c3a0db7dafe03cc362b171a271.gif

BottomBarActivity

EqualBottomBarActivity

fa80d70334b95d0753ef88dc036bc8a1.gif

82d05cbf795b3ee2d671403a73061db6.gif

Bubble Navigation

是一个轻巧的库,可通过大量自定义选项轻松制作精美的导航栏。

它有很多非常的特性:

针对不同用例的两种类型的

NavigationViews

BubbleNavigationConstraintView

(支持spread

spread

inside

, 和

packed

莫斯)

BubbleNavigationLinearView

(允许平均分配,使用权重或packed模式)

高度可定制化

您可以添加小红点,它具有

BubbleToggleView

来创建新的UI组件,而不仅仅是导航

示例:

android:id="@+id/top_navigation_constraint"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginBottom="380dp"

android:background="@color/white"

android:elevation="4dp"

android:padding="

12dp"

app:bnc_mode="spread">

android:id="@+id/c_item_rest"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

app:bt_active="true"

app:bt_colorActive="@color/search_active"

app:bt_colorInactive="@color/search_inactive"

app:bt_icon="@drawable/ic_restaurant"

app:bt_shape="@drawable/transition_background_drawable_restaurant"

app:bt_title="@string/restaurant"

app:bt_padding="@dimen/internal_padding"

app:bt_titlePadding="@dimen/title_padding" />

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

Github文档很完善,有很多示例,更多用法和属性可去Github了解。

Github:https://github.com/gauravk95/bubble-navigation

5. FabFilter

748fad4968407548095be96df403462a.gif

这是一个有趣的项目,它不是一个直接可用的库,而是一个示例应用程序,展示了

使用

不使用

MotionLayout

两种方式来实现的高级UI动画。

详细的实现细节可以看看Medium上的系列文章:

Github:https://github.com/nikhilpanju/FabFilter

6.android-showcase

0cedb4b7da20a85f59d434823c5f73bb.gif

android-showcase

是一个非常优秀的开源项目,它是一个展示应用程序,展示了如何使用Kotlin和最新的Jetpack 技术栈来开发一个APP。

该项目为您带来了一系列最佳实践,工具和解决方案:

100% Kotlin

现代架构 (feature modules, clean architecture, Model-View-ViewModel, Model-View-Intent)

Android Jetpack组件

单Activity模式,使用Navigation导航

看完这个项目,在模块化,Clean体系结构,测试、设置CI / CD工具,等方面,你将会受到启发。感谢作者的开源。

Github:https://github.com/igorwojda/android-showcase

7. Croppy

0828d838b70607566aa91e897fa9c7bc.gif

Croppy

是一个Android图片裁剪库。

它有很多强大的特性:

双指缩放

裁剪任意大小

按照长宽比例裁剪

显示裁剪后的Bitmap

自动居中裁剪

全面的动画使用体验

更多使用细节请看Github。

Github: https://github.com/lyrebirdstudio/Croppy

8. RubberPicker

6a085e7e56cd1f1b1249888255ddda52.gif

一个炫酷的、有趣的SeekBar动画库。

RubberPicker

库包含

RubberSeekBar

RubberRangePicker

,其灵感来自

Cuberto

iOS橡胶范围选择器

使用示例:

布局文件中配置

...

app:minValue="20"

app:maxValue="80"

app:elasticBehavior="cubic"

app:dampingRatio="0.3"

app:stiffness="300"

app:stretchRange="24dp"

app:defaultThumbRadius="16dp"

app:normalTrackWidth="4dp"

app:highlightTrackWidth="8dp"

app:normalTrackColor="#AAAAAA"

app:highlightTrackColor="#BA1F33"

app:defaultThumbInsideColor="#FFF"

app:highlightDefaultThumbOnTouchColor="#CD5D67"/>

...

app:minValue="0"

app:maxValue="100"

app:elasticBehavior="linear"

app:dampingRatio="0.4"

app:stiffness="400"

app:stretchRange="36dp"

app:defaultThumbRadius="16dp"

app:normalTrackWidth="4dp"

app:highlightTrackWidth="8dp"

app:normalTrackColor="#AAAAAA"

app:highlightTrackColor="#BA1F33"

app:defaultThumbInsideColor="#CFCD5D67"

app:highlightDefaultThumbOnTouchColor="#CD5D67"/>1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

或者,在代码中动态配置:

val rubberSeekBar = RubberSeekBar(this)

rubberSeekBar.setMin(20)

rubberSeekBar.setMax(80)

rubberSeekBar.setElasticBehavior(ElasticBehavior.CUBIC)

rubberSeekBar.setDampingRatio(0.4F)

rubberSeekBar.setStiffness(1000F)

rubberSeekBar.

setStretchRange(50f)

rubberSeekBar.setThumbRadius(32f)

rubberSeekBar.setNormalTrackWidth(2f)

rubberSeekBar.setHighlightTrackWidth(4f)

rubberSeekBar.setNormalTrackColor(Color.GRAY)

rubberSeekBar.setHighlightTrackColor(Color.BLUE)

rubberSeekBar.setHighlightThumbOnTouchColor(Color.CYAN)

rubberSeekBar.setDefaultThumbInsideColor(Color.WHITE)

val currentValue = rubberSeekBar.getCurrentValue()

rubberSeekBar.setCurrentValue(currentValue + 10)

rubberSeekBar.setOnRubberSeekBarChangeListener(object : RubberSeekBar.OnRubberSeekBarChangeListener {

override fun onProgressChanged(seekBar: RubberSeekBar, value: Int, fromUser: Boolean) {}

override fun onStartTrackingTouch(seekBar: RubberSeekBar) {}

override fun onStopTrackingTouch(seekBar: RubberSeekBar) {}

})

//Similarly for RubberRangePicker

val rubberRangePicker = RubberRangePicker(this)

rubberRangePicker.setMin(20)

...

rubberRangePicker.setHighlightThumbOnTouchColor(Color.CYAN)

val startThumbValue = rubberRangePicker.getCurrentStartValue()

rubberRangePicker.setCurrentStartValue(startThumbValue + 10)

val endThumbValue = rubberRangePicker.getCurrentEndValue()

rubberRangePicker.setCurrentEndValue(endThumbValue + 10)

rubberRangePicker.setOnRubberRangePickerChangeListener(object: RubberRangePicker.OnRubberRangePickerChangeListener{

override fun onProgressChanged(rangePicker: RubberRangePicker, startValue: Int, endValue: Int, fromUser: Boolean) {}

override fun onStartTrackingTouch(rangePicker: RubberRangePicker, isStartThumb: Boolean) {}

override fun onStopTrackingTouch(rangePicker: RubberRangePicker, isStartThumb: Boolean) {}

})1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

更多、更详细的使用请看Github。

Github:https://github.com/Chrisvin/RubberPicker

9. Switcher

12979ddab4a15aaae464925ed3ae63bc.gif

一个炫酷的Switcher 切换动画库,真是的太可爱了,我前面也写过文章专门介绍过:

它的灵感来自于 Dribble上

Oleg Frolov

的设计。

Github: https://github.com/bitvale/Switcher

10. StfalconImageViewer

847abee3b9cd8effc1235f23e8888d5d.gif

StfalconImageViewer

是一个图片查看库,

该库简单且可定制。它包含一个

全屏图像查看器

具有共享的图像过渡支持

捏合缩放功能

以及

滑动手势来关闭

手势。

Github文档说明了如何使用每个功能。同样值得注意的是:该库与所有最受欢迎的图像处理库(例如Picasso,Glide等)兼容。

所有可配置项如下:

StfalconImageViewer.Builder(this, images, ::loadImage)

.withStartPosition(startPosition)

.withBackgroundColor(color)

//.withBackgroundColorResource(R.color.color)

.withOverlayView(view)

.withImagesMargin(R.dimen.margin)

//.withImageMarginPixels(margin)

.withContainerPadding(R.dimen.padding)

//.withContainerPadding(R.dimen.paddingStart, R.dimen.paddingTop, R.dimen.paddingEnd, R.dimen.paddingBottom)

//.withContainerPaddingPixels(padding)

//.withContainerPaddingPixels(paddingStart, paddingTop, paddingEnd, paddingBottom)

.withHiddenStatusBar(shouldHideStatusBar)

.allowZooming(isZoomingAllowed)

.allowSwipeToDismiss(isSwipeToDismissAllowed)

.withTransitionFrom(targeImageView)

.withImageChangeListener(::onImageChanged)

.withDismissListener(::onViewerDismissed)

.withDismissListener(::onViewerDismissed)1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

更详细的使用请看Github。

Github: https://github.com/stfalcon-studio/StfalconImageViewer

11. Broccoli

1ba3a6fcc5f9e7a5303cdb0a35e8e3bf.gif

Broccoli

是一个show View Loading 库,也就是我常说的

骨架屏

,在内容加载的时候,显示一个占位符。

该库带有很平滑的动画效果,你可以配合RecyclerView一起使用,等待加载内容时,再也不枯燥了。

示例:

Broccoli broccoli = new Broccoli();

//add the default style placeholder

broccoli.addPlaceholders('activity', 'view_id', 'view_id');

or

//add the default style placeholder

broccoli.addPlaceholders('view1', 'view2', 'view3');

or

//add the custom style placeholder

broccoli.addPlaceholder(new PlaceholderParameter.Builder()

.setView('view')

.setAnimation('scaleAnimation');

.setDrawable(DrawableUtils.createRectangleDrawable(placeHolderColor, 0))

.build());

or

//add the custom style placeholder with gradient animation

broccoli.addPlaceholder(new PlaceholderParameter.Builder()

.setView('view')

.setDrawable(new BroccoliGradientDrawable(Color.parseColor("#DDDDDD"),

Color.parseColor("#CCCCCC"), 0, 1000, new LinearInterpolator())

.build());

broccoli.show();1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

更多使用请看Github。

Github: https://github.com/samlss/Broccoli

12. Orbit MVI

a8b12535029ee06d70e00287625bd053.png

这是一个用于Kotlin和Android的Model-View-Intent (MVI)框架。它的灵感来自Jake Wharton,RxFeedback和Mosby的“Managing State with RxJava”。

根据ReadMe所说:

Orbit在您的redux实现周围提供了尽可能小的结构,以使其易于使用,但您仍可以使用RxJava的强大功能。

redux系统可能如下所示:

data class State(val total: Int = 0)

data class AddAction(val number: Int)

sealed class SideEffect {

data class Toast(val text: String) : SideEffect()

}

class CalculatorViewModel : OrbitViewModel (State(), {

perform("addition")

.on()

.sideEffect { post(SideEffect.Toast("Adding ${event.number}")) }

.reduce {

currentState.copy(currentState.total + event.number)

}

...

})1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

activity / fragment 中:

// Example of injection using koin, your DI system might differ

private val viewModel by

viewModel()

override fun onCreate() {

...

addButton.setOnClickListener { viewModel.sendAction(AddAction) }

}

override fun onStart() {

viewModel.connect(this, ::handleState, ::handleSideEffect)

}

private fun handleState(state: State) {

...

}

private fun handleSideEffect(sideEffect: SideEffect) {

when (sideEffect) {

is SideEffect.Toast -> toast(sideEffect.text)

}

}1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

详细使用请看Github。

Github: https://github.com/babylonhealth/orbit-mvi

13. IndicatorScrollView

IndicatorScrollView

IndicatorScrollView

16f3f02b25727d1e74e08be583dc6c1a.gif

170c783d368ad6c7dad7bbefa04f6add.gif

该库为

NestedScrollView

添加了逻辑,使它可以在滚动时,更改对指示器进行动态响应。

README文件包含开始项目所需的所有信息,例如如何使用

IndicatorScrollView

IndicatorView

IndicatorItem

。目前,它的版本为

1.0.2

,是根据Apache 2.0许可发布的。它支持API 16及更高版本。

文档示例很详细,更多使用相关请看Github。

Github: https://github.com/skydoves/IndicatorScrollView

14. Cyanea

3cc180e9ffcda67de59215b358b492f8.gif

Cyanea

是一个Android 主题引擎库。

它允许那你动态更换应用主题,它内置了很多主题如:

Theme.Cyanea.Dark

Theme.Cyanea.Dark.LightActionBar

Theme.Cyanea.Dark.NoActionBar

Theme.Cyanea.Light

Theme.Cyanea.Light.DarkActionBar

Theme.Cyanea.Light.NoActionBar

更多详细信息请看Github。

Github: https://github.com/jaredrummler/Cyanea

15. Android MotionLayout Carousel

294cb1ab9bb08f1ef75035f288d4ed18.gif

这是一个示例项目,它展示了如何使用

MotionLayout

来实现一个炫酷的轮播图。

文档几乎没有任何说明,但是如果你最近也在探索MotionLayout,这将是一个很好示例。

Github: https://github.com/faob-dev/MotionLayoutCarousel

总结

以上就是本期的开源项目推荐,如果你也有好玩的、有趣的、强大的开源项目,也可以推荐给西哥,欢迎评论区留言讨论。

最后,求个三连!奥利给!

近期热文

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值