-
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.
Merge pull request #1 from bowyer-app/develop
fix animation
- Loading branch information
Showing
45 changed files
with
1,676 additions
and
377 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Copyright (c) 2015 Bowyer | ||
Released under the MIT license | ||
http://opensource.org/licenses/mit-license.php |
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
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,23 @@ | ||
<?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"/> | ||
<activity android:name=".FabToolBarDemoActivity"/> | ||
</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.Bind; | ||
import butterknife.ButterKnife; | ||
import butterknife.OnClick; | ||
|
||
/** | ||
* 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_menu) | ||
ListView mMenuList; | ||
|
||
@Bind(R.id.fab) | ||
FloatingActionButton mFab; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_bottom_sheet); | ||
ButterKnife.bind(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(); | ||
} | ||
|
||
} |
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.Bind; | ||
import butterknife.OnClick; | ||
|
||
/** | ||
* Created by Bowyer on 15/08/07. | ||
*/ | ||
public class FabToolBarDemoActivity extends ActionBarActivity implements ObservableScrollViewCallbacks { | ||
|
||
@Bind(R.id.list_view) | ||
ObservableListView mObservableListView; | ||
|
||
@Bind(R.id.fabtoolbar) | ||
FooterLayout mFabToolbar; | ||
|
||
@Bind(R.id.fab) | ||
FloatingActionButton mFab; | ||
|
||
@Bind(R.id.ic_call) | ||
ImageView mIcCall; | ||
|
||
@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); | ||
} | ||
|
||
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(); | ||
} | ||
} |
Oops, something went wrong.