-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
317ebf6
commit 00f3a63
Showing
28 changed files
with
332 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.bowyer.fabtransitionlayout.demo" > | ||
package="com.bowyer.fabtransitionlayout.demo"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" > | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name" > | ||
android:name=".MainActivity" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".BottomSheetDemoActivity"/> | ||
</application> | ||
|
||
</manifest> |
77 changes: 77 additions & 0 deletions
77
demo/src/main/java/com/bowyer/fabtransitionlayout/demo/BottomSheetDemoActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
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.ButterKnife; | ||
import butterknife.InjectView; | ||
import butterknife.OnClick; | ||
|
||
/** | ||
* Created by Bowyer on 15/08/07. | ||
*/ | ||
public class BottomSheetDemoActivity extends ActionBarActivity { | ||
|
||
@InjectView(R.id.list_view) | ||
ObservableListView mObservableListView; | ||
|
||
@InjectView(R.id.bottom_sheet) | ||
BottomSheetLayout mBottomSheetLayout; | ||
|
||
@InjectView(R.id.list_menu) | ||
ListView mMenuList; | ||
|
||
@InjectView(R.id.fab) | ||
FloatingActionButton mFab; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_bottom_sheet); | ||
ButterKnife.inject(this); | ||
initListView(); | ||
initListMenu(); | ||
mBottomSheetLayout.setFab(mFab); | ||
} | ||
|
||
private void initListView() { | ||
List<String> list = new ArrayList<String>(100); | ||
for (int i = 0; i < 100; i++) { | ||
list.add("Item " + i); | ||
} | ||
|
||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, | ||
android.R.layout.simple_list_item_1, list); | ||
mObservableListView.setAdapter(adapter); | ||
} | ||
|
||
private void initListMenu() { | ||
ArrayList<BottomSheet> 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(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/BottomSheetAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.bowyer.fabtransitionlayout.demo.adapter; | ||
|
||
import com.bowyer.fabtransitionlayout.demo.R; | ||
import com.bowyer.fabtransitionlayout.demo.model.BottomSheet; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.BaseAdapter; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
import java.util.ArrayList; | ||
|
||
import butterknife.ButterKnife; | ||
import butterknife.InjectView; | ||
|
||
/** | ||
* Created by Bowyer on 15/08/06. | ||
*/ | ||
public class BottomSheetAdapter extends BaseAdapter { | ||
|
||
Context mContext; | ||
|
||
LayoutInflater mLayoutInflater = null; | ||
|
||
ArrayList<BottomSheet> mBottomSheets; | ||
|
||
public BottomSheetAdapter(Context context, ArrayList<BottomSheet> bottomSheets) { | ||
mContext = context; | ||
mBottomSheets = bottomSheets; | ||
mLayoutInflater = (LayoutInflater) context | ||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return mBottomSheets.size(); | ||
} | ||
|
||
@Override | ||
public Object getItem(int position) { | ||
return mBottomSheets.get(position); | ||
} | ||
|
||
@Override | ||
public long getItemId(int position) { | ||
return 0; | ||
} | ||
|
||
@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(); | ||
} | ||
|
||
BottomSheet sheet = (BottomSheet) getItem(position); | ||
viewHolder.mMenuIcon | ||
.setBackground(mContext.getDrawable(sheet.getBottomSheetMenuType().getResId())); | ||
viewHolder.mMenuTitle.setText(sheet.getBottomSheetMenuType().getName()); | ||
return convertView; | ||
} | ||
|
||
static class ViewHolder { | ||
|
||
@InjectView(R.id.menu_icon) | ||
ImageView mMenuIcon; | ||
|
||
@InjectView(R.id.menu_title) | ||
TextView mMenuTitle; | ||
|
||
public ViewHolder(View view) { | ||
ButterKnife.inject(this, view); | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
demo/src/main/java/com/bowyer/fabtransitionlayout/demo/model/BottomSheet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.bowyer.fabtransitionlayout.demo.model; | ||
|
||
import com.bowyer.fabtransitionlayout.demo.R; | ||
|
||
/** | ||
* Created by Bowyer on 15/08/06. | ||
*/ | ||
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"); | ||
|
||
int resId; | ||
|
||
String name; | ||
|
||
BottomSheetMenuType(int resId, String name) { | ||
this.resId = resId; | ||
this.name = name; | ||
} | ||
|
||
|
||
public int getResId() { | ||
return resId; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
} | ||
|
||
BottomSheetMenuType bottomSheetMenuType; | ||
|
||
public static BottomSheet to() { | ||
return new BottomSheet(); | ||
} | ||
|
||
public BottomSheetMenuType getBottomSheetMenuType() { | ||
return bottomSheetMenuType; | ||
} | ||
|
||
public BottomSheet setBottomSheetMenuType(BottomSheetMenuType bottomSheetMenuType) { | ||
this.bottomSheetMenuType = bottomSheetMenuType; | ||
return this; | ||
} | ||
|
||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
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" | ||
> | ||
|
||
<com.github.ksoichiro.android.observablescrollview.ObservableListView | ||
android:id="@+id/list_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
/> | ||
|
||
<android.support.design.widget.FloatingActionButton | ||
android:id="@+id/fab" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="bottom|end" | ||
android:layout_marginBottom="32dp" | ||
android:layout_marginRight="32dp" | ||
android:src="@drawable/ic_add_white_24dp" | ||
app:borderWidth="0dp" | ||
app:fabSize="normal" | ||
app:rippleColor="@color/primary" | ||
/> | ||
|
||
<com.bowyer.app.fabtransitionlayout.BottomSheetLayout | ||
android:id="@+id/bottom_sheet" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_gravity="bottom" | ||
app:ft_container_gravity="end" | ||
app:ft_color="@color/primary"> | ||
|
||
<ListView | ||
android:id="@+id/list_menu" | ||
android:background="@color/primary" | ||
android:divider="@null" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"/> | ||
</com.bowyer.app.fabtransitionlayout.BottomSheetLayout> | ||
|
||
</FrameLayout> |
Oops, something went wrong.