material

设计模式-Chain of Responsibility模式

丶灬走出姿态 提交于 2019-11-30 10:13:19
目录 主要角色 抽象处理者(Handler) 具体处理者(Concrete Handler) 一个例子 一般做法 责任链模式 抽象处理器 具体处理器 总结 责任链模式也叫职责链模式,是一种行为型模式。 该模式中将处理请求的对象串成一条链,当有请求发生时,请求会在链上的各个节点(处理对象)传递,直达有对象能够处理它为止,如果不能处理,则继续向后传递直到结束。 百度百科定义:责任链模式是一种设计模式。在责任链模式里,很多对象由每一个对象对其下家的引用而连接起来形成一条链。请求在这个链上传递,直到链上的某一个对象决定处理此请求。发出这个请求的客户端并不知道链上的哪一个对象最终处理这个请求,这使得系统可以在不影响客户端的情况下动态地重新组织和分配责任。 主要角色 抽象处理者(Handler) 定义一个处理请求的接口,包含抽象处理方法和一个后继连接。 具体处理者(Concrete Handler) 实现抽象处理者的处理方法,判断能否处理本次请求,如果可以处理请求则处理,否则将该请求转给它的后继者。 一个例子 目前需要根据给定的原材料,生产不同的物品。比如,输送进去木头,就会生产出来一把椅子;输送棉花,就会生产出棉布;输送牛奶就会生产出奶酪。 现在要给这个机器编写对应的程序。 /** * 原材料 * @author: xujian * @Date: 2019-09-23 *

Use multiple materials for merged geometries in Three.js

戏子无情 提交于 2019-11-30 09:41:28
I want to create a Pine using 2 meshes, 1 for the trunk and another one for the bush, this what I've done: var pine_geometry = new THREE.Geometry(); var pine_texture_1 = THREE.ImageUtils.loadTexture('./res/textures/4.jpg'); var pine_geometry_1 = new THREE.CylinderGeometry(25, 25, 50, 6); var pine_material_1 = new THREE.MeshBasicMaterial({ map : pine_texture_1 }); var pine_1 = new THREE.Mesh(pine_geometry_1); pine_1.position.x = x; pine_1.position.y = y + 25; pine_1.position.z = z; pine_1.updateMatrix(); pine_geometry.merge(pine_1.geometry, pine_1.matrix); var pine_texture_2 = THREE.ImageUtils

crash - material design android 5.0

怎甘沉沦 提交于 2019-11-30 08:22:15
I have a big problem with my app. It crashes and I don't know why. In my app I have a Activity with a listview and a customlistviewadapter and a second Detailactivity . I want to add the material design from Android Lollipop and there is my problem. I added the nice Activity Transaction between the two Activities . I'm taking the picture and the title from the listviewelement out of the listview and using a SparseArray<Bitmap> to transfer the picture, a intent and ActivityOptions to transfer the rest of my data. The Transaction from my first Activity to the DetailActivity works fine. At my

Angular material layout - expand to fill window

别来无恙 提交于 2019-11-30 05:38:16
I am attempting to create an Angular material layout. My goal is to create a page where it fills the entire browser window without creating a vertical scroll bar. At the top of the page is a toolbar that consumes 100% of the width of the page. Under the toolbar is a title area that also consumes 100% of the width. Under the title area I would like a nav menu on the left and a client area on the right. My goal is to have both the nav menu and the client area fill vertically the entire browser window. To give you a visual of what I am trying to accomplish: I have been experimenting with the

Hide Appbar on Scroll Flutter?

試著忘記壹切 提交于 2019-11-30 02:30:22
Consider this image. As you can see it has an appbar and the appbar has Tabbed buttons. Am trying to animate the appbar so that it hides on scrollup and leaves only the Tab Buttons showing and on scrollup the appbar apears. Please help me out. Sorry for bad english and not American neither am I English If I understood you correctly, following code should make the app bar hide on scroll while TabBar remains visible: new Scaffold( body: new NestedScrollView( controller: _scrollViewController, headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return <Widget>[ new SliverAppBar

Android Material风格的应用(二)--RecyclerView

北慕城南 提交于 2019-11-29 22:44:40
添加RecyclerView Android Material风格的应用(一)--AppBar TabLayout Android Material风格的应用(二)--RecyclerView Android Material风格的应用(三)--DrawerLayout Android Material风格的应用(四)--FloatActionButton Android Material风格的应用(五)--CollapsingToolbar 工程源码 添加对应的支持库 compile 'com.android.support:recyclerview-v7:24.2.1' compile 'com.android.support:cardview-v7:24.2.1' 添加 res/layout/recycler_view.xml <android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"

Android Material风格的应用(四)--FloatActionButton

爱⌒轻易说出口 提交于 2019-11-29 22:44:27
添加 FloatActionButton和SnackBar Android Material风格的应用(一)--AppBar TabLayout Android Material风格的应用(二)--RecyclerView Android Material风格的应用(三)--DrawerLayout Android Material风格的应用(四)--FloatActionButton Android Material风格的应用(五)--CollapsingToolbar 工程源码 在 activity_main.xml 中的 CoordinatorLayout 中添加 FloatActionButton <android.support.design.widget.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/fab" android:layout_gravity="right|bottom" android:layout_marginBottom="@dimen/md_keylines" android:layout_marginRight="@dimen/md_keylines" android:src

Android Material风格的应用(五)--CollapsingToolbar

雨燕双飞 提交于 2019-11-29 22:44:13
Collapsing Toolbar Android Material风格的应用(一)--AppBar TabLayout Android Material风格的应用(二)--RecyclerView Android Material风格的应用(三)--DrawerLayout Android Material风格的应用(四)--FloatActionButton Android Material风格的应用(五)--CollapsingToolbar 工程源码 我们为列表的item创建一个详情页面,创建 DetailActivity.java 对应的布局文件 activity_detail.xml <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="@dimen/app_bar_height" android:fitsSystemWindows="true" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout android:layout_width=

Android Material风格的应用(一)--AppBar TabLayout

大兔子大兔子 提交于 2019-11-29 22:43:48
打造Material风格的Android应用 Android Material风格的应用(一)--AppBar TabLayout Android Material风格的应用(二)--RecyclerView Android Material风格的应用(三)--DrawerLayout Android Material风格的应用(四)--FloatActionButton Android Material风格的应用(五)--CollapsingToolbar 开发环境: JDK 8+ Android Studio 2.2.2 工程源码 Themes And Colors 主题颜色值 res/values/colors.xml <resources> <color name="colorPrimary">#3F51B5</color> <color name="colorPrimaryDark">#303F9F</color> <color name="colorAccent">#FF4081</color> </resources> 如此,添加一个Light主题风格的style res/values/styles.xml <style name="AppThemeBase" parent="Theme.AppCompat.Light.NoActionBar"> <!--

Lollipop RippleDrawable vs Selector for Pre-Lollipop

你说的曾经没有我的故事 提交于 2019-11-29 19:55:42
I have buttons with different draw9patch png as background. Currently the buttons are controlled by selector which look something like this: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/pressed" android:state_pressed="true"/> <item android:drawable="@drawable/disabled" android:state_enabled="false"/> <item android:drawable="@drawable/focused" android:state_focused="true"/> <item android:drawable="@drawable/default"/> </selector> For the Android Lollipop they have a RippleDrawable for the touch effect, which goes something like this: