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>'}
<com.gauravk.bubblenavigation.BubbleNavigationConstraintViewandroid: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.BubbleToggleViewandroid: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>
<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"/>
Broccoli broccoli =newBroccoli();//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(newPlaceholderParameter.Builder().setView('view').setAnimation('scaleAnimation');.setDrawable(DrawableUtils.createRectangleDrawable
(placeHolderColor,0)).build());
or
//add the custom style placeholder with gradient animation
broccoli.addPlaceholder(newPlaceholderParameter.Builder().setView('view').setDrawable(newBroccoliGradientDrawable(Color.parseColor("#DDDDDD"),
Color.parseColor("#CCCCCC"),0,1000,newLinearInterpolator()).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
这是一个用于Kotlin和Android的Model-View-Intent (MVI)框架。它的灵感来自Jake Wharton,RxFeedback和Mosby的“Managing State with RxJava”。
// Example of injection using koin, your DI system might differprivateval viewModel by
viewModel<CalculatorViewModel>()overridefunonCreate(){...
addButton.setOnClickListener{ viewModel.sendAction(AddAction)}}overridefunonStart(){
viewModel.connect(this,::handleState,::handleSideEffect)}privatefunhandleState(state: State){...}privatefunhandleSideEffect(sideEffect: SideEffect){when(sideEffect){is SideEffect.Toast ->toast(sideEffect.text)}}