• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

这15个Android开源库只有经常逛Github的才知道

android 搞代码 3年前 (2022-03-02) 21次浏览 已收录 0个评论

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

又到了大家最喜爱了的环节–开源库举荐,后面为大家举荐了我珍藏的一些十分酷的开源库,受到大家统一好评,还没看过的,请移步至:

【Android收藏】举荐10个炫酷的开源库

【开源举荐】进阶实战,从一款音乐播放器开始

【2020年GitHub 上那些优良Android开源库,这里是Top10!】

本期又为大家带来了哪些乏味的库呢?本期为大家精选了15个乏味又有用的开源,排名不分先后,一起来看看吧!

1. Coil

Coil是Android上的一个全新的图片加载框架,它的全名叫做 coroutine image loader,即协程图片加载库。与传统的图片加载库Glide,Picasso或Fresco等相比。该具备轻量(只有大概1500个办法)、快、易于应用、更古代的API等劣势。

它反对GIF和SVG,并且能够执行四个默认转换:含糊圆形裁剪灰度圆角

示例如下:

<code class="kotlin">imageView.load(“https://www.example.com/image.jpg") {
 crossfade(true)
 placeholder(R.drawable.image)
 transformations(CircleCropTransformation())
}

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

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

2. MultiSearchView

该库具备一个十分酷的Search View 动画!

应用非常简单,并且能够自定义,你能够在在styles.xml下增加自定义款式。

示例代码:

<code class="xml"><com.iammert.library.ui.multisearchviewlib.MultiSearchView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>     
<code class="kotlin">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) {
    }

})

自定义款式:

<code class="xml">  <!-- Search Text Style. -->
    <style name="SearchTextStyle">
        <!-- Custom values write to here for SearchEditText. -->
        <item name="android:focusable">true</item>
        <item name="android:focusableInTouchMode">true</item>
        <item name="android:enabled">true</item>
        <item name="android:hint">Search</item>
        <item name="android:imeOptions">actionSearch</item>
        <item name="android:textSize">18sp</item>
        <item name="android:maxLength">15</item>
        <item name="android:inputType">textCapSentences</item>
        <item name="android:textColorHint">#80999999</item>
        <item name="android:textColor">#000</item>
    </style>

而后,您应该将款式设置为MultiSearchView下的app:searchTextStyle

Github地址:https://github.com/iammert/Mu…

3. CalendarView

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

它有如下个性:

  • 繁多或范畴抉择
  • 周历或者月历模式
  • 边界日期
  • 自定义日历视图
  • 程度或者垂直滚动模式
  • 齐全可定制的视图

该库的文档也十分全面,并蕴含许多示例。此外,还有一个示例应用程序展现了库的所有性能。

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

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

因而,须要在app的build.gradle 中增加如下配置:

<code class="java">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:<latest-version>'
}

Github: https://github.com/kizitonwos&#8230;

4. Bubble Navigation

FloatingTopBarActivity TopBarActivity
BottomBarActivity EqualBottomBarActivity

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

它有很多十分的个性:

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

    • BubbleNavigationConstraintView(反对spreadspreadinside, 和 packed莫斯)
    • BubbleNavigationLinearView(容许平均分配,使用权重或packed模式)
  • 高度可定制化
  • 您能够增加小红点,它具备BubbleToggleView来创立新的UI组件,而不仅仅是导航

示例:

<code class="xml"><com.gauravk.bubblenavigation.BubbleNavigationConstraintView
        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">

        <com.gauravk.bubblenavigation.BubbleToggleView
            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" />

         <!-- Add more child items here - max upto 5 -->
    
    </com.gauravk.bubblenavigation.BubbleNavigationConstraintView>

Github文档很欠缺,有很多示例,更多用法和属性可去Github理解。

Github:https://github.com/gauravk95/&#8230;

5. FabFilter

这是一个乏味的我的项目,它不是一个间接可用的库,而是一个示例应用程序,展现了应用不应用 MotionLayout两种形式来实现的高级UI动画。

具体的实现细节能够看看Medium上的系列文章:

“Complex UI/Animations on Android”

“Complex UI/Animations on Android — featuring MotionLayout”

Github:https://github.com/nikhilpanj&#8230;

6.android-showcase

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/…

7. Croppy

Croppy是一个Android图片裁剪库。

它有很多弱小的个性:

  • 双指缩放
  • 裁剪任意大小
  • 依照长宽比例裁剪
  • 显示裁剪后的Bitmap
  • 主动居中裁剪
  • 全面的动画应用体验

更多应用细节请看Github。

Github: https://github.com/lyrebirdst&#8230;

8. RubberPicker

一个炫酷的、乏味的SeekBar动画库。

RubberPicker库蕴含RubberSeekBarRubberRangePicker,其灵感来自CubertoiOS橡胶范畴选择器

应用示例:

布局文件中配置

<code class="xml"><com.jem.rubberpicker.RubberSeekBar
  ...
  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"/>

<!-- Similar attributes can be applied for RubberRangePicker as well-->
<com.jem.rubberpicker.RubberRangePicker
  ...
  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"/>

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

<code class="kotlin">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) {}
})

更多、更具体的应用请看Github。

Github:https://github.com/Chrisvin/R…

9. Switcher

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

炫酷!从未见过如此Q弹的Switcher

它的灵感来自于 Dribble上Oleg Frolov 的设计。

Github: https://github.com/bitvale/Sw&#8230;

10. StfalconImageViewer

StfalconImageViewer是一个图片查看库,
该库简略且可定制。它蕴含一个全屏图像查看器具备共享的图像过渡反对捏合缩放性能以及滑动手势来敞开手势。

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

所有可配置项如下:

<code class="kotlin">StfalconImageViewer.Builder<String>(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)

更具体的应用请看Github。

Github: https://github.com/stfalcon-s&#8230;

11. Broccoli

Broccoli是一个show View Loading 库,也就是我常说的骨架屏,在内容加载的时候,显示一个占位符。

该库带有很平滑的动画成果,你能够配合RecyclerView一起应用,期待加载内容时,再也不干燥了。

示例:

<code class="java">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();

更多应用请看Github。

Github: https://github.com/samlss/Bro&#8230;

12. Orbit MVI

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

依据ReadMe所说:

Orbit在您的redux实现四周提供了尽可能小的构造,以使其易于应用,但您仍能够应用RxJava的弱小性能。

redux零碎可能如下所示:

<code class="kotlin">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, SideEffect> (State(), {

    perform("addition")
        .on<AddAction>()
        .sideEffect { post(SideEffect.Toast("Adding ${event.number}")) }
        .reduce {
            currentState.copy(currentState.total + event.number)
        }

    ...
})

activity / fragment 中:

<code class="kotlin">// Example of injection using koin, your DI system might differ
private val viewModel by viewModel<CalculatorViewModel>()

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)
    }
}

具体应用请看Github。

Github: https://github.com/babylonhea&#8230;

13. IndicatorScrollView

IndicatorScrollView IndicatorScrollView

该库为NestedScrollView增加了逻辑,使它能够在滚动时,更改对指示器进行动静响应。

README文件蕴含开始我的项目所需的所有信息,例如如何应用IndicatorScrollViewIndicatorViewIndicatorItem。目前,它的版本为1.0.2,是依据Apache 2.0许可公布的。它反对API 16及更高版本。

文档示例很具体,更多应用相干请看Github。

Github: https://github.com/skydoves/I&#8230;

14. Cyanea

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/jaredrumml&#8230;

15. Android MotionLayout Carousel

这是一个示例我的项目,它展现了如何应用MotionLayout来实现一个炫酷的轮播图。

文档简直没有任何阐明,然而如果你最近也在摸索MotionLayout,这将是一个很好示例。

Github: https://github.com/faob-dev/M&#8230;

总结

以上就是本期的开源我的项目举荐,如果你也有好玩的、乏味的、弱小的开源我的项目,也能够举荐给西哥,欢送评论区留言探讨。


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:这15个Android开源库只有经常逛Github的才知道

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址