-
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
00f3a63
commit 87cb552
Showing
6 changed files
with
236 additions
and
250 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
115 changes: 115 additions & 0 deletions
115
demo/src/main/java/com/bowyer/fabtransitionlayout/demo/FabToolBarDemoActivity.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,115 @@ | ||
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; | ||
import android.os.Bundle; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.v7.app.ActionBarActivity; | ||
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.InjectView; | ||
import butterknife.OnClick; | ||
|
||
/** | ||
* Created by Bowyer on 15/08/07. | ||
*/ | ||
public class FabToolBarDemoActivity extends ActionBarActivity implements ObservableScrollViewCallbacks { | ||
|
||
@InjectView(R.id.list_view) | ||
ObservableListView mObservableListView; | ||
|
||
@InjectView(R.id.fabtoolbar) | ||
FooterLayout mFabToolbar; | ||
|
||
@InjectView(R.id.fab) | ||
FloatingActionButton mFab; | ||
|
||
@InjectView(R.id.ic_call) | ||
ImageView mIcCall; | ||
|
||
@InjectView(R.id.ic_email) | ||
ImageView mIcEmail; | ||
|
||
@InjectView(R.id.ic_forum) | ||
ImageView mIcForum; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_fab_toolbar); | ||
ButterKnife.inject(this); | ||
initListView(); | ||
mFabToolbar.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); | ||
mObservableListView.setScrollViewCallbacks(this); | ||
} | ||
|
||
@Override | ||
public void onScrollChanged(int i, boolean b, boolean b1) { | ||
|
||
} | ||
|
||
@Override | ||
public void onDownMotionEvent() { | ||
|
||
} | ||
|
||
@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(); | ||
} | ||
} |
138 changes: 7 additions & 131 deletions
138
demo/src/main/java/com/bowyer/fabtransitionlayout/demo/MainActivity.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 |
---|---|---|
@@ -1,155 +1,31 @@ | ||
package com.bowyer.fabtransitionlayout.demo; | ||
|
||
import com.bowyer.app.fabtransitionlayout.BottomSheetLayout; | ||
import com.bowyer.app.fabtransitionlayout.FooterLayout; | ||
import com.bowyer.fabtransitionlayout.demo.adapter.BottomSheetAdapter; | ||
import com.bowyer.fabtransitionlayout.demo.model.BottomSheet; | ||
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; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.v7.app.ActionBarActivity; | ||
import android.view.View; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.ImageView; | ||
import android.widget.ListView; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import butterknife.ButterKnife; | ||
import butterknife.InjectView; | ||
import butterknife.OnClick; | ||
|
||
|
||
public class MainActivity extends ActionBarActivity implements ObservableScrollViewCallbacks { | ||
|
||
@InjectView(R.id.list_view) | ||
ObservableListView mObservableListView; | ||
|
||
@InjectView(R.id.fabtoolbar) | ||
FooterLayout mFabToolbar; | ||
|
||
@InjectView(R.id.fablist) | ||
BottomSheetLayout mFooterLayout; | ||
|
||
@InjectView(R.id.list_menu) | ||
ListView mListView; | ||
|
||
@InjectView(R.id.fab) | ||
FloatingActionButton mFab; | ||
|
||
@InjectView(R.id.fab_left) | ||
FloatingActionButton mFabLeft; | ||
|
||
@InjectView(R.id.ic_call) | ||
ImageView mIcCall; | ||
|
||
@InjectView(R.id.ic_email) | ||
ImageView mIcEmail; | ||
|
||
@InjectView(R.id.ic_forum) | ||
ImageView mIcForum; | ||
public class MainActivity extends ActionBarActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
ButterKnife.inject(this); | ||
initListView(); | ||
initListMenu(); | ||
mFabToolbar.setFab(mFab); | ||
mFooterLayout.setFab(mFabLeft); | ||
} | ||
|
||
private void callBottomSheetActivity() { | ||
@OnClick(R.id.start_bottom_sheet_demo) | ||
void startBottomSheetDemo() { | ||
Intent intet = new Intent(this, BottomSheetDemoActivity.class); | ||
startActivity(intet); | ||
} | ||
|
||
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); | ||
mListView.setAdapter(adapter); | ||
|
||
} | ||
|
||
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); | ||
mObservableListView.setScrollViewCallbacks(this); | ||
} | ||
|
||
@Override | ||
public void onScrollChanged(int i, boolean b, boolean b1) { | ||
|
||
} | ||
|
||
@Override | ||
public void onDownMotionEvent() { | ||
|
||
} | ||
|
||
@Override | ||
public void onUpOrCancelMotionEvent(ScrollState scrollState) { | ||
if (scrollState == ScrollState.UP) { | ||
mFabToolbar.slideOutFab(); | ||
mFooterLayout.slideOutFab(); | ||
} else if (scrollState == ScrollState.DOWN) { | ||
mFabToolbar.slideInFab(); | ||
mFooterLayout.slideInFab(); | ||
} | ||
} | ||
|
||
@OnClick(R.id.fab) | ||
void onFabClick() { | ||
mFabToolbar.expandFab(); | ||
} | ||
|
||
@OnClick(R.id.fab_left) | ||
void onFabLeftClick() { | ||
callBottomSheetActivity(); | ||
// mFooterLayout.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(); | ||
@OnClick(R.id.start_fab_toolbar_demo) | ||
void startFabToolbarDemo() { | ||
Intent intet = new Intent(this, FabToolBarDemoActivity.class); | ||
startActivity(intet); | ||
} | ||
} |
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,93 @@ | ||
<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" | ||
tools:context=".MainActivity"> | ||
|
||
<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.FooterLayout | ||
android:id="@+id/fabtoolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="bottom" | ||
app:ft_container_gravity="center" | ||
app:ft_color="@color/primary"> | ||
|
||
<RelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="@dimen/toolbar_height"> | ||
|
||
<LinearLayout | ||
android:layout_centerVertical="true" | ||
android:orientation="horizontal" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
> | ||
|
||
<RelativeLayout | ||
android:id="@+id/call" | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:layout_weight="1"> | ||
|
||
<ImageView | ||
android:id="@+id/ic_call" | ||
android:layout_width="36dp" | ||
android:layout_height="36dp" | ||
android:layout_centerHorizontal="true" | ||
android:scaleType="center" | ||
android:src="@drawable/ic_call_white_36dp"/> | ||
</RelativeLayout> | ||
|
||
<RelativeLayout | ||
android:id="@+id/email" | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:layout_weight="1"> | ||
|
||
<ImageView | ||
android:id="@+id/ic_email" | ||
android:layout_width="36dp" | ||
android:layout_height="36dp" | ||
android:layout_centerHorizontal="true" | ||
android:scaleType="center" | ||
android:src="@drawable/ic_email_white_36dp"/> | ||
</RelativeLayout> | ||
|
||
<RelativeLayout | ||
android:id="@+id/forum" | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:layout_weight="1"> | ||
|
||
<ImageView | ||
android:id="@+id/ic_forum" | ||
android:layout_width="36dp" | ||
android:layout_height="36dp" | ||
android:layout_centerHorizontal="true" | ||
android:scaleType="center" | ||
android:src="@drawable/ic_forum_white_36dp"/> | ||
</RelativeLayout> | ||
</LinearLayout> | ||
</RelativeLayout> | ||
</com.bowyer.app.fabtransitionlayout.FooterLayout> | ||
</FrameLayout> |
Oops, something went wrong.