-
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 #10 from iluretar/master
CoordinatorLayout Behavior for FooterLayout
- Loading branch information
Showing
17 changed files
with
343 additions
and
20 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
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,23 +1,32 @@ | ||
<?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"/> | ||
<activity android:name=".BottomSheetDemoActivity" /> | ||
<activity android:name=".FabToolBarDemoActivity" /> | ||
<activity | ||
android:name=".CoordinatorLayoutActivity" | ||
android:label="@string/title_activity_coordinator_layout" | ||
android:parentActivityName=".MainActivity" | ||
android:theme="@style/AppTheme"> | ||
<meta-data | ||
android:name="android.support.PARENT_ACTIVITY" | ||
android:value="com.bowyer.fabtransitionlayout.demo.MainActivity" /> | ||
</activity> | ||
</application> | ||
|
||
</manifest> | ||
</manifest> |
78 changes: 78 additions & 0 deletions
78
demo/src/main/java/com/bowyer/fabtransitionlayout/demo/CoordinatorLayoutActivity.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,78 @@ | ||
package com.bowyer.fabtransitionlayout.demo; | ||
|
||
import android.os.Bundle; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.design.widget.Snackbar; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.LinearLayoutManager; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
|
||
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); | ||
|
||
ButterKnife.bind(this); | ||
setSupportActionBar(mToolbar); | ||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||
|
||
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); | ||
} | ||
|
||
RecyclerViewAdapter adapter = new RecyclerViewAdapter(list,this.getBaseContext()); | ||
mListView.setLayoutManager(new LinearLayoutManager(this.getBaseContext())); | ||
mListView.setAdapter(adapter); | ||
} | ||
|
||
@OnClick(R.id.fab) | ||
void onFabClick() { | ||
mFabToolbar.expandFab(); | ||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
getMenuInflater().inflate(R.menu.menu_coordinator, menu); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
|
||
int id = item.getItemId(); | ||
|
||
if (id == R.id.action_snackbar) { | ||
Snackbar.make(mListView,"This is a snackbar",Snackbar.LENGTH_SHORT).show(); | ||
return true; | ||
} | ||
|
||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
} |
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
46 changes: 46 additions & 0 deletions
46
demo/src/main/java/com/bowyer/fabtransitionlayout/demo/adapter/RecyclerViewAdapter.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,46 @@ | ||
package com.bowyer.fabtransitionlayout.demo.adapter; | ||
|
||
import android.content.Context; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import java.util.List; | ||
|
||
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.RecyclerHolder> { | ||
|
||
List<String> mList; | ||
|
||
public RecyclerViewAdapter(List<String> list, Context context) { | ||
this.mList = list; | ||
} | ||
|
||
@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; | ||
} | ||
|
||
@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 static class RecyclerHolder extends RecyclerView.ViewHolder { | ||
|
||
|
||
public RecyclerHolder(View itemView) { | ||
super(itemView); | ||
|
||
} | ||
} | ||
} |
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 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fitsSystemWindows="true" | ||
tools:context=".CoordinatorLayoutActivity"> | ||
|
||
<android.support.design.widget.AppBarLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:theme="@style/AppTheme.AppBarOverlay"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
android:background="?attr/colorPrimary" | ||
app:popupTheme="@style/AppTheme.PopupOverlay" | ||
/> | ||
|
||
</android.support.design.widget.AppBarLayout> | ||
|
||
<android.support.v7.widget.RecyclerView | ||
android:id="@+id/list_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:layout_behavior="@string/appbar_scrolling_view_behavior"/> | ||
|
||
<android.support.design.widget.FloatingActionButton | ||
android:id="@+id/fab" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_anchor="@id/list_view" | ||
app:layout_anchorGravity="bottom|end" | ||
android:layout_margin="@dimen/fab_margin" | ||
android:src="@drawable/ic_add_white_24dp" /> | ||
|
||
<com.bowyer.app.fabtransitionlayout.FooterLayout | ||
android:id="@+id/fabtoolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="56dp" | ||
app:layout_anchor="@id/list_view" | ||
app:layout_anchorGravity="bottom" | ||
app:ft_container_gravity="center" | ||
app:ft_color="@color/primary"> | ||
</com.bowyer.app.fabtransitionlayout.FooterLayout> | ||
|
||
</android.support.design.widget.CoordinatorLayout> |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<item android:id="@+id/action_snackbar" | ||
android:title="@string/action_snackbar" | ||
android:orderInCategory="1" | ||
app:showAsAction="always"/> | ||
</menu> |
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,9 @@ | ||
<resources> | ||
<style name="AppTheme.NoActionBar"> | ||
<item name="windowActionBar">false</item> | ||
<item name="windowNoTitle">true</item> | ||
<item name="android:windowDrawsSystemBarBackgrounds">true</item> | ||
<item name="android:statusBarColor">@android:color/transparent</item> | ||
<item name="android:windowContentTransitions">true</item> | ||
</style> | ||
</resources> |
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
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
Oops, something went wrong.