diff --git a/README.md b/README.md index e7fde2b..289a013 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ dependencies { ### Layout XML #### BottomSheetLayout -``` +```xml { - public ApplicationTest() { - super(Application.class); - } + public ApplicationTest() { + super(Application.class); + } } diff --git a/demo/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml index b1e2722..67dec85 100644 --- a/demo/src/main/AndroidManifest.xml +++ b/demo/src/main/AndroidManifest.xml @@ -2,31 +2,31 @@ - - - - + + + + - - - - - - - - - + + + + + + + + + - \ No newline at end of file + diff --git a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/BottomSheetDemoActivity.java b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/BottomSheetDemoActivity.java index 14e12a1..625abf9 100644 --- a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/BottomSheetDemoActivity.java +++ b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/BottomSheetDemoActivity.java @@ -1,77 +1,66 @@ package com.bowyer.fabtransitionlayout.demo; -import com.bowyer.app.fabtransitionlayout.BottomSheetLayout; -import com.bowyer.fabtransitionlayout.demo.adapter.BottomSheetAdapter; -import com.bowyer.fabtransitionlayout.demo.model.BottomSheet; -import com.github.ksoichiro.android.observablescrollview.ObservableListView; - import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.ActionBarActivity; import android.widget.ArrayAdapter; import android.widget.ListView; - -import java.util.ArrayList; -import java.util.List; - import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; +import com.bowyer.app.fabtransitionlayout.BottomSheetLayout; +import com.bowyer.fabtransitionlayout.demo.adapter.BottomSheetAdapter; +import com.bowyer.fabtransitionlayout.demo.model.BottomSheet; +import com.github.ksoichiro.android.observablescrollview.ObservableListView; +import java.util.ArrayList; +import java.util.List; /** * Created by Bowyer on 15/08/07. */ public class BottomSheetDemoActivity extends ActionBarActivity { - @Bind(R.id.list_view) - ObservableListView mObservableListView; - - @Bind(R.id.bottom_sheet) - BottomSheetLayout mBottomSheetLayout; + @Bind(R.id.list_view) ObservableListView mObservableListView; - @Bind(R.id.list_menu) - ListView mMenuList; + @Bind(R.id.bottom_sheet) BottomSheetLayout mBottomSheetLayout; - @Bind(R.id.fab) - FloatingActionButton mFab; + @Bind(R.id.list_menu) ListView mMenuList; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_bottom_sheet); - ButterKnife.bind(this); - initListView(); - initListMenu(); - mBottomSheetLayout.setFab(mFab); - } + @Bind(R.id.fab) FloatingActionButton mFab; - private void initListView() { - List list = new ArrayList(100); - for (int i = 0; i < 100; i++) { - list.add("Item " + i); - } - - ArrayAdapter adapter = new ArrayAdapter(this, - android.R.layout.simple_list_item_1, list); - mObservableListView.setAdapter(adapter); - } - - private void initListMenu() { - ArrayList bottomSheets = new ArrayList<>(); - bottomSheets.add( - BottomSheet.to().setBottomSheetMenuType(BottomSheet.BottomSheetMenuType.EMAIL)); - bottomSheets.add( - BottomSheet.to().setBottomSheetMenuType(BottomSheet.BottomSheetMenuType.ACCOUNT)); - bottomSheets.add( - BottomSheet.to().setBottomSheetMenuType(BottomSheet.BottomSheetMenuType.SETTING)); - BottomSheetAdapter adapter = new BottomSheetAdapter(this, bottomSheets); - mMenuList.setAdapter(adapter); - - } + @Override protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_bottom_sheet); + ButterKnife.bind(this); + initListView(); + initListMenu(); + mBottomSheetLayout.setFab(mFab); + } - @OnClick(R.id.fab) - void onFabClick() { - mBottomSheetLayout.expandFab(); + private void initListView() { + List list = new ArrayList(100); + for (int i = 0; i < 100; i++) { + list.add("Item " + i); } + ArrayAdapter adapter = + new ArrayAdapter(this, android.R.layout.simple_list_item_1, list); + mObservableListView.setAdapter(adapter); + } + + private void initListMenu() { + ArrayList bottomSheets = new ArrayList<>(); + bottomSheets.add( + BottomSheet.to().setBottomSheetMenuType(BottomSheet.BottomSheetMenuType.EMAIL)); + bottomSheets.add( + BottomSheet.to().setBottomSheetMenuType(BottomSheet.BottomSheetMenuType.ACCOUNT)); + bottomSheets.add( + BottomSheet.to().setBottomSheetMenuType(BottomSheet.BottomSheetMenuType.SETTING)); + BottomSheetAdapter adapter = new BottomSheetAdapter(this, bottomSheets); + mMenuList.setAdapter(adapter); + } + + @OnClick(R.id.fab) void onFabClick() { + mBottomSheetLayout.expandFab(); + } } diff --git a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/CoordinatorLayoutActivity.java b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/CoordinatorLayoutActivity.java index ff920ea..b5affa1 100644 --- a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/CoordinatorLayoutActivity.java +++ b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/CoordinatorLayoutActivity.java @@ -9,70 +9,62 @@ import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; - +import butterknife.Bind; +import butterknife.ButterKnife; +import butterknife.OnClick; import com.bowyer.app.fabtransitionlayout.FooterLayout; import com.bowyer.fabtransitionlayout.demo.adapter.RecyclerViewAdapter; - import java.util.ArrayList; import java.util.List; -import butterknife.Bind; -import butterknife.ButterKnife; -import butterknife.OnClick; - public class CoordinatorLayoutActivity extends AppCompatActivity { - @Bind(R.id.toolbar) Toolbar mToolbar; - @Bind(R.id.fabtoolbar) FooterLayout mFabToolbar; - @Bind(R.id.fab) FloatingActionButton mFab; - @Bind(R.id.list_view) RecyclerView mListView; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_coordinator_layout); + @Bind(R.id.toolbar) Toolbar mToolbar; + @Bind(R.id.fabtoolbar) FooterLayout mFabToolbar; + @Bind(R.id.fab) FloatingActionButton mFab; + @Bind(R.id.list_view) RecyclerView mListView; - ButterKnife.bind(this); - setSupportActionBar(mToolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); + @Override protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_coordinator_layout); - initListView(); - mFabToolbar.setFab(mFab); - } + ButterKnife.bind(this); + setSupportActionBar(mToolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); - private void initListView() { - List list = new ArrayList(100); - for (int i = 0; i < 100; i++) { - list.add("Item " + i); - } + initListView(); + mFabToolbar.setFab(mFab); + } - RecyclerViewAdapter adapter = new RecyclerViewAdapter(list,this.getBaseContext()); - mListView.setLayoutManager(new LinearLayoutManager(this.getBaseContext())); - mListView.setAdapter(adapter); + private void initListView() { + List list = new ArrayList(100); + for (int i = 0; i < 100; i++) { + list.add("Item " + i); } - @OnClick(R.id.fab) - void onFabClick() { - mFabToolbar.expandFab(); - } + RecyclerViewAdapter adapter = new RecyclerViewAdapter(list, this.getBaseContext()); + mListView.setLayoutManager(new LinearLayoutManager(this.getBaseContext())); + mListView.setAdapter(adapter); + } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.menu_coordinator, menu); - return true; - } + @OnClick(R.id.fab) void onFabClick() { + mFabToolbar.expandFab(); + } - @Override - public boolean onOptionsItemSelected(MenuItem item) { + @Override public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_coordinator, menu); + return true; + } - int id = item.getItemId(); + @Override public boolean onOptionsItemSelected(MenuItem item) { - if (id == R.id.action_snackbar) { - Snackbar.make(mListView,"This is a snackbar",Snackbar.LENGTH_SHORT).show(); - return true; - } + int id = item.getItemId(); - return super.onOptionsItemSelected(item); + if (id == R.id.action_snackbar) { + Snackbar.make(mListView, "This is a snackbar", Snackbar.LENGTH_SHORT).show(); + return true; } + return super.onOptionsItemSelected(item); + } } diff --git a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/FabToolBarDemoActivity.java b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/FabToolBarDemoActivity.java index 608f621..720ce60 100644 --- a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/FabToolBarDemoActivity.java +++ b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/FabToolBarDemoActivity.java @@ -1,10 +1,5 @@ package com.bowyer.fabtransitionlayout.demo; -import com.bowyer.app.fabtransitionlayout.FooterLayout; -import com.github.ksoichiro.android.observablescrollview.ObservableListView; -import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; -import com.github.ksoichiro.android.observablescrollview.ScrollState; - import android.animation.Animator; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; @@ -14,102 +9,90 @@ import android.view.View; import android.widget.ArrayAdapter; import android.widget.ImageView; - -import java.util.ArrayList; -import java.util.List; - -import butterknife.ButterKnife; import butterknife.Bind; +import butterknife.ButterKnife; import butterknife.OnClick; +import com.bowyer.app.fabtransitionlayout.FooterLayout; +import com.github.ksoichiro.android.observablescrollview.ObservableListView; +import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; +import com.github.ksoichiro.android.observablescrollview.ScrollState; +import java.util.ArrayList; +import java.util.List; /** * Created by Bowyer on 15/08/07. */ -public class FabToolBarDemoActivity extends ActionBarActivity implements ObservableScrollViewCallbacks { +public class FabToolBarDemoActivity extends ActionBarActivity + implements ObservableScrollViewCallbacks { - @Bind(R.id.list_view) - ObservableListView mObservableListView; + @Bind(R.id.list_view) ObservableListView mObservableListView; - @Bind(R.id.fabtoolbar) - FooterLayout mFabToolbar; + @Bind(R.id.fabtoolbar) FooterLayout mFabToolbar; - @Bind(R.id.fab) - FloatingActionButton mFab; + @Bind(R.id.fab) FloatingActionButton mFab; - @Bind(R.id.ic_call) - ImageView mIcCall; + @Bind(R.id.ic_call) ImageView mIcCall; - @Bind(R.id.ic_email) - ImageView mIcEmail; + @Bind(R.id.ic_email) ImageView mIcEmail; - @Bind(R.id.ic_forum) - ImageView mIcForum; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_fab_toolbar); - ButterKnife.bind(this); - initListView(); - mFabToolbar.setFab(mFab); - } + @Bind(R.id.ic_forum) ImageView mIcForum; - private void initListView() { - List list = new ArrayList(100); - for (int i = 0; i < 100; i++) { - list.add("Item " + i); - } + @Override protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_fab_toolbar); + ButterKnife.bind(this); + initListView(); + mFabToolbar.setFab(mFab); + } - ArrayAdapter adapter = new ArrayAdapter(this, - android.R.layout.simple_list_item_1, list); - mObservableListView.setAdapter(adapter); - mObservableListView.setScrollViewCallbacks(this); + private void initListView() { + List list = new ArrayList(100); + for (int i = 0; i < 100; i++) { + list.add("Item " + i); } - @Override - public void onScrollChanged(int i, boolean b, boolean b1) { + ArrayAdapter adapter = + new ArrayAdapter(this, android.R.layout.simple_list_item_1, list); + mObservableListView.setAdapter(adapter); + mObservableListView.setScrollViewCallbacks(this); + } - } - - @Override - public void onDownMotionEvent() { + @Override public void onScrollChanged(int i, boolean b, boolean b1) { - } + } - @Override - public void onUpOrCancelMotionEvent(ScrollState scrollState) { - if (scrollState == ScrollState.UP) { - mFabToolbar.slideOutFab(); - } else if (scrollState == ScrollState.DOWN) { - mFabToolbar.slideInFab(); - } - } + @Override public void onDownMotionEvent() { - @OnClick(R.id.fab) - void onFabClick() { - mFabToolbar.expandFab(); - } - - @OnClick(R.id.call) - void onClickCall() { - iconAnim(mIcCall); - } - - @OnClick(R.id.ic_email) - void onClickEmail() { - iconAnim(mIcEmail); - } - - @OnClick(R.id.ic_forum) - void onClickForum() { - iconAnim(mIcForum); - } + } - private void iconAnim(View icon) { - Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder( - icon, - PropertyValuesHolder.ofFloat("scaleX", 1f, 1.5f, 1f), - PropertyValuesHolder.ofFloat("scaleY", 1f, 1.5f, 1f)); - iconAnim.start(); + @Override public void onUpOrCancelMotionEvent(ScrollState scrollState) { + if (scrollState == ScrollState.UP) { + mFabToolbar.slideOutFab(); + } else if (scrollState == ScrollState.DOWN) { + mFabToolbar.slideInFab(); } + } + + @OnClick(R.id.fab) void onFabClick() { + mFabToolbar.expandFab(); + } + + @OnClick(R.id.call) void onClickCall() { + iconAnim(mIcCall); + } + + @OnClick(R.id.ic_email) void onClickEmail() { + iconAnim(mIcEmail); + } + + @OnClick(R.id.ic_forum) void onClickForum() { + iconAnim(mIcForum); + } + + private void iconAnim(View icon) { + Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(icon, + PropertyValuesHolder.ofFloat("scaleX", 1f, 1.5f, 1f), + PropertyValuesHolder.ofFloat("scaleY", 1f, 1.5f, 1f)); + iconAnim.start(); + } } diff --git a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/MainActivity.java b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/MainActivity.java index 699322b..262d5a3 100644 --- a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/MainActivity.java +++ b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/MainActivity.java @@ -3,34 +3,29 @@ import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; - import butterknife.ButterKnife; import butterknife.OnClick; - public class MainActivity extends ActionBarActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - ButterKnife.bind(this); - } + @Override protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + ButterKnife.bind(this); + } + + @OnClick(R.id.start_bottom_sheet_demo) void startBottomSheetDemo() { + Intent intet = new Intent(this, BottomSheetDemoActivity.class); + startActivity(intet); + } - @OnClick(R.id.start_bottom_sheet_demo) - void startBottomSheetDemo() { - Intent intet = new Intent(this, BottomSheetDemoActivity.class); - startActivity(intet); - } + @OnClick(R.id.start_fab_toolbar_demo) void startFabToolbarDemo() { + Intent intet = new Intent(this, FabToolBarDemoActivity.class); + startActivity(intet); + } - @OnClick(R.id.start_fab_toolbar_demo) - void startFabToolbarDemo() { - Intent intet = new Intent(this, FabToolBarDemoActivity.class); - startActivity(intet); - } - @OnClick(R.id.start_coordinator_demo) - void startCoordinatorDemo() { - Intent intet = new Intent(this, CoordinatorLayoutActivity.class); - startActivity(intet); - } + @OnClick(R.id.start_coordinator_demo) void startCoordinatorDemo() { + Intent intet = new Intent(this, CoordinatorLayoutActivity.class); + startActivity(intet); + } } diff --git a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/BottomSheetAdapter.java b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/BottomSheetAdapter.java index e606ea8..42610aa 100644 --- a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/BottomSheetAdapter.java +++ b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/BottomSheetAdapter.java @@ -1,9 +1,5 @@ package com.bowyer.fabtransitionlayout.demo.adapter; -import com.bowyer.fabtransitionlayout.demo.R; -import com.bowyer.fabtransitionlayout.demo.model.BottomSheet; -import com.squareup.picasso.Picasso; - import android.content.Context; import android.view.LayoutInflater; import android.view.View; @@ -11,72 +7,68 @@ import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; - -import java.util.ArrayList; - import butterknife.Bind; import butterknife.ButterKnife; +import com.bowyer.fabtransitionlayout.demo.R; +import com.bowyer.fabtransitionlayout.demo.model.BottomSheet; +import com.squareup.picasso.Picasso; +import java.util.ArrayList; /** * Created by Bowyer on 15/08/06. */ public class BottomSheetAdapter extends BaseAdapter { - Context mContext; + Context mContext; - LayoutInflater mLayoutInflater = null; + LayoutInflater mLayoutInflater = null; - ArrayList mBottomSheets; - - public BottomSheetAdapter(Context context, ArrayList bottomSheets) { - mContext = context; - mBottomSheets = bottomSheets; - mLayoutInflater = (LayoutInflater) context - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - } + ArrayList mBottomSheets; - @Override - public int getCount() { - return mBottomSheets.size(); - } + public BottomSheetAdapter(Context context, ArrayList bottomSheets) { + mContext = context; + mBottomSheets = bottomSheets; + mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } - @Override - public Object getItem(int position) { - return mBottomSheets.get(position); - } + @Override public int getCount() { + return mBottomSheets.size(); + } - @Override - public long getItemId(int position) { - return 0; - } + @Override public Object getItem(int position) { + return mBottomSheets.get(position); + } - @Override - public View getView(int position, View convertView, ViewGroup parent) { - ViewHolder viewHolder; - if (convertView == null) { - convertView = mLayoutInflater.inflate(R.layout.row_item_bottom_sheet, parent, false); - viewHolder = new ViewHolder(convertView); - convertView.setTag(viewHolder); - } else { - viewHolder = (ViewHolder) convertView.getTag(); - } + @Override public long getItemId(int position) { + return 0; + } - BottomSheet sheet = (BottomSheet) getItem(position); - Picasso.with(mContext).load(sheet.getBottomSheetMenuType().getResId()).into(viewHolder.mMenuIcon); - viewHolder.mMenuTitle.setText(sheet.getBottomSheetMenuType().getName()); - return convertView; + @Override public View getView(int position, View convertView, ViewGroup parent) { + ViewHolder viewHolder; + if (convertView == null) { + convertView = mLayoutInflater.inflate(R.layout.row_item_bottom_sheet, parent, false); + viewHolder = new ViewHolder(convertView); + convertView.setTag(viewHolder); + } else { + viewHolder = (ViewHolder) convertView.getTag(); } - static class ViewHolder { + BottomSheet sheet = (BottomSheet) getItem(position); + Picasso.with(mContext) + .load(sheet.getBottomSheetMenuType().getResId()) + .into(viewHolder.mMenuIcon); + viewHolder.mMenuTitle.setText(sheet.getBottomSheetMenuType().getName()); + return convertView; + } + + static class ViewHolder { - @Bind(R.id.menu_icon) - ImageView mMenuIcon; + @Bind(R.id.menu_icon) ImageView mMenuIcon; - @Bind(R.id.menu_title) - TextView mMenuTitle; + @Bind(R.id.menu_title) TextView mMenuTitle; - public ViewHolder(View view) { - ButterKnife.bind(this, view); - } + public ViewHolder(View view) { + ButterKnife.bind(this, view); } + } } diff --git a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/RecyclerViewAdapter.java b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/RecyclerViewAdapter.java index 56fd48f..48ca9c7 100644 --- a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/RecyclerViewAdapter.java +++ b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/RecyclerViewAdapter.java @@ -6,41 +6,37 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; - import java.util.List; public class RecyclerViewAdapter extends RecyclerView.Adapter { - List mList; - - public RecyclerViewAdapter(List list, Context context) { - this.mList = list; - } + List mList; - @Override - public RecyclerViewAdapter.RecyclerHolder onCreateViewHolder(ViewGroup parent, int viewType) { - View v= LayoutInflater.from(parent.getContext()).inflate(android.R.layout.simple_list_item_1,parent,false); - RecyclerHolder viewHolder=new RecyclerHolder(v); - return viewHolder; - } + public RecyclerViewAdapter(List list, Context context) { + this.mList = list; + } - @Override - public void onBindViewHolder(RecyclerViewAdapter.RecyclerHolder holder, int position) { - TextView tv = (TextView) holder.itemView; - tv.setText(mList.get(position)); - } - - @Override - public int getItemCount() { - return mList.size(); - } + @Override + public RecyclerViewAdapter.RecyclerHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View v = LayoutInflater.from(parent.getContext()) + .inflate(android.R.layout.simple_list_item_1, parent, false); + RecyclerHolder viewHolder = new RecyclerHolder(v); + return viewHolder; + } - public static class RecyclerHolder extends RecyclerView.ViewHolder { + @Override public void onBindViewHolder(RecyclerViewAdapter.RecyclerHolder holder, int position) { + TextView tv = (TextView) holder.itemView; + tv.setText(mList.get(position)); + } + @Override public int getItemCount() { + return mList.size(); + } - public RecyclerHolder(View itemView) { - super(itemView); + public static class RecyclerHolder extends RecyclerView.ViewHolder { - } + public RecyclerHolder(View itemView) { + super(itemView); } + } } diff --git a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/model/BottomSheet.java b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/model/BottomSheet.java index 012361b..1d14684 100644 --- a/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/model/BottomSheet.java +++ b/demo/src/main/java/com/bowyer/fabtransitionlayout/demo/model/BottomSheet.java @@ -7,44 +7,40 @@ */ public class BottomSheet { + public enum BottomSheetMenuType { + EMAIL(R.drawable.ic_drafts_white_24dp, "Mail"), ACCOUNT(R.drawable.ic_account_circle_white_24dp, + "Acount"), SETTING(R.drawable.ic_build_white_24dp, "Setitng"); - public enum BottomSheetMenuType { - EMAIL(R.drawable.ic_drafts_white_24dp, "Mail"), ACCOUNT( - R.drawable.ic_account_circle_white_24dp, "Acount"), SETTING(R.drawable.ic_build_white_24dp, - "Setitng"); + int resId; - int resId; + String name; - String name; - - BottomSheetMenuType(int resId, String name) { - this.resId = resId; - this.name = name; - } - - - public int getResId() { - return resId; - } - - public String getName() { - return name; - } + BottomSheetMenuType(int resId, String name) { + this.resId = resId; + this.name = name; } - BottomSheetMenuType bottomSheetMenuType; - - public static BottomSheet to() { - return new BottomSheet(); + public int getResId() { + return resId; } - public BottomSheetMenuType getBottomSheetMenuType() { - return bottomSheetMenuType; + public String getName() { + return name; } + } - public BottomSheet setBottomSheetMenuType(BottomSheetMenuType bottomSheetMenuType) { - this.bottomSheetMenuType = bottomSheetMenuType; - return this; - } + BottomSheetMenuType bottomSheetMenuType; + + public static BottomSheet to() { + return new BottomSheet(); + } + + public BottomSheetMenuType getBottomSheetMenuType() { + return bottomSheetMenuType; + } + public BottomSheet setBottomSheetMenuType(BottomSheetMenuType bottomSheetMenuType) { + this.bottomSheetMenuType = bottomSheetMenuType; + return this; + } } diff --git a/demo/src/main/res/layout/activity_bottom_sheet.xml b/demo/src/main/res/layout/activity_bottom_sheet.xml index 47202b8..f5794e1 100644 --- a/demo/src/main/res/layout/activity_bottom_sheet.xml +++ b/demo/src/main/res/layout/activity_bottom_sheet.xml @@ -1,43 +1,44 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + > - + - + - + - - + + diff --git a/demo/src/main/res/layout/activity_coordinator_layout.xml b/demo/src/main/res/layout/activity_coordinator_layout.xml index 1ebb45b..c54f257 100644 --- a/demo/src/main/res/layout/activity_coordinator_layout.xml +++ b/demo/src/main/res/layout/activity_coordinator_layout.xml @@ -5,46 +5,51 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" - tools:context=".CoordinatorLayoutActivity"> + tools:context=".CoordinatorLayoutActivity" + > - + - + - + - + - + - - + + diff --git a/demo/src/main/res/layout/activity_fab_toolbar.xml b/demo/src/main/res/layout/activity_fab_toolbar.xml index 44c271d..6be5744 100644 --- a/demo/src/main/res/layout/activity_fab_toolbar.xml +++ b/demo/src/main/res/layout/activity_fab_toolbar.xml @@ -1,93 +1,102 @@ + xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".MainActivity" + > - + - + - + - + - + - + - - + + - + - - + + - + - - - + - + + + diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml index 8d42d15..0c0f005 100644 --- a/demo/src/main/res/layout/activity_main.xml +++ b/demo/src/main/res/layout/activity_main.xml @@ -1,26 +1,32 @@ - -