Skip to content

Commit

Permalink
Merge pull request #1 from bowyer-app/develop
Browse files Browse the repository at this point in the history
fix animation
  • Loading branch information
bowyer-app committed Sep 23, 2015
2 parents d23d09e + 4525aa5 commit 8849615
Show file tree
Hide file tree
Showing 45 changed files with 1,676 additions and 377 deletions.
3 changes: 3 additions & 0 deletions LICENSE.txt
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
Binary file added art/bottomsheet.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/toolbar.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'

classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
27 changes: 18 additions & 9 deletions demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
apply plugin: 'com.android.application'

repositories {
mavenCentral()

maven {
url "https://jitpack.io"
}
}

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion COMPILE_SDK_VERSION as int
buildToolsVersion BUILD_TOOLS_VERSION

defaultConfig {
applicationId "com.bowyer.fabtransitionlayout.demo"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
minSdkVersion MIN_SDK_VERSION
targetSdkVersion TARGET_SDK_VERSION as int
versionCode VERSION_CODE as int
versionName VERSION_NAME
}
buildTypes {
release {
Expand All @@ -21,9 +29,10 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.0'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.1'
compile project(':fabtransitionlayout')
}
20 changes: 11 additions & 9 deletions demo/src/main/AndroidManifest.xml
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>
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();
}

}
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();
}
}
Loading

0 comments on commit 8849615

Please sign in to comment.