Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/dictionaries/Administrator.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Material.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.github.rey5137" external.system.module.version="0.8.0-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
Expand Down
2 changes: 1 addition & 1 deletion app/app.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="Material" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.github.rey5137" external.system.module.version="0.8.0-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/java/com/rey/material/demo/ButtonFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,23 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

@Override
public void onClick(View v) {
Toast.makeText(getActivity(), "Button Clicked!\nEvent's fired when in anim end.", Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(), "Button Clicked!\nEvent's fired when in anim end.", Toast.LENGTH_SHORT).show();
if(v instanceof FloatingActionButton){
FloatingActionButton bt = (FloatingActionButton)v;
bt.setLineMorphingState((bt.getLineMorphingState() + 1) % 2, true);
}
}
};

View.OnClickListener listener_delay = new View.OnClickListener() {

@Override
public void onClick(View v) {
Toast.makeText(getActivity(), "Button Clicked!\nEvent's fired when out anim end.", Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(), "Button Clicked!\nEvent's fired when out anim end.", Toast.LENGTH_SHORT).show();
if(v instanceof FloatingActionButton){
FloatingActionButton bt = (FloatingActionButton)v;
bt.setLineMorphingState((bt.getLineMorphingState() + 1) % 2, true);
}
}
};

Expand Down
33 changes: 33 additions & 0 deletions app/src/main/java/com/rey/material/demo/CustomViewPager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.rey.material.demo;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;

import com.rey.material.widget.Slider;
import com.rey.material.widget.Switch;

/**
* Created by Rey on 3/18/2015.
*/
public class CustomViewPager extends ViewPager{

public CustomViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}

public CustomViewPager(Context context) {
super(context);
}

protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
return super.canScroll(v, checkV, dx, x, y) || (checkV && customCanScroll(v));
}

protected boolean customCanScroll(View v) {
if (v instanceof Slider || v instanceof Switch)
return true;
return false;
}
}
64 changes: 64 additions & 0 deletions app/src/main/java/com/rey/material/demo/FabFragment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.rey.material.demo;

import android.annotation.TargetApi;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.rey.material.widget.FloatingActionButton;

public class FabFragment extends Fragment{


public static FabFragment newInstance(){
FabFragment fragment = new FabFragment();

return fragment;
}

private Drawable[] mDrawables = new Drawable[2];
private int index = 0;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_fab, container, false);

final FloatingActionButton fab_line = (FloatingActionButton)v.findViewById(R.id.fab_line);
fab_line.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fab_line.setLineMorphingState((fab_line.getLineMorphingState() + 1) % 2, true);
}
});

final FloatingActionButton fab_image = (FloatingActionButton)v.findViewById(R.id.fab_image);
mDrawables[0] = v.getResources().getDrawable(R.drawable.ic_autorenew_white_24dp);
mDrawables[1] = v.getResources().getDrawable(R.drawable.ic_done_white_24dp);
fab_image.setIcon(mDrawables[index], false);
fab_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
index = (index + 1) % 2;
fab_image.setIcon(mDrawables[index], true);
}
});

return v;
}

@Override
public void onPause() {
super.onPause();
}

@Override
public void onResume() {
super.onResume();
}

}
26 changes: 18 additions & 8 deletions app/src/main/java/com/rey/material/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class MainActivity extends ActionBarActivity implements AdapterView.OnIte
private DrawerLayout dl_navigator;
private FrameLayout fl_drawer;
private ListView lv_drawer;
private ViewPager vp;
private CustomViewPager vp;
private TabPageIndicator tpi;

private DrawerAdapter mDrawerAdapter;
Expand All @@ -47,7 +47,7 @@ public class MainActivity extends ActionBarActivity implements AdapterView.OnIte
private ToolbarManager mToolbarManager;
private SnackBar mSnackBar;

private Tab[] mItems = new Tab[]{Tab.PROGRESS, Tab.BUTTONS, Tab.SWITCHES, Tab.TEXTFIELDS, Tab.SNACKBARS, Tab.DIALOGS};
private Tab[] mItems = new Tab[]{Tab.PROGRESS, Tab.BUTTONS, Tab.FAB, Tab.SWITCHES, Tab.SLIDERS, Tab.TEXTFIELDS, Tab.SNACKBARS, Tab.DIALOGS};

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -59,7 +59,7 @@ protected void onCreate(Bundle savedInstanceState) {
fl_drawer = (FrameLayout)findViewById(R.id.main_fl_drawer);
lv_drawer = (ListView)findViewById(R.id.main_lv_drawer);
mToolbar = (Toolbar)findViewById(R.id.main_toolbar);
vp = (ViewPager)findViewById(R.id.main_vp);
vp = (CustomViewPager)findViewById(R.id.main_vp);
tpi = (TabPageIndicator)findViewById(R.id.main_tpi);
mSnackBar = (SnackBar)findViewById(R.id.main_sn);

Expand Down Expand Up @@ -109,7 +109,7 @@ public void onPageScrollStateChanged(int state) {}

});

vp.setCurrentItem(0);
vp.setCurrentItem(2);
}

@Override
Expand Down Expand Up @@ -153,14 +153,14 @@ public SnackBar getSnackBar(){
return mSnackBar;
}



public enum Tab {
PROGRESS ("Progresses"),
BUTTONS ("Buttons"),
FAB ("FABs"),
SWITCHES ("Switches"),
TEXTFIELDS ("Textfields"),
SNACKBARS ("Snackbars"),
SLIDERS ("Sliders"),
TEXTFIELDS ("TextFields"),
SNACKBARS ("SnackBars"),
DIALOGS ("Dialogs");
private final String name;

Expand Down Expand Up @@ -260,8 +260,12 @@ public PagerAdapter(FragmentManager fm, Tab[] tabs) {
setFragment(Tab.PROGRESS, fragment);
else if(fragment instanceof ButtonFragment)
setFragment(Tab.BUTTONS, fragment);
else if(fragment instanceof FabFragment)
setFragment(Tab.FAB, fragment);
else if(fragment instanceof SwitchesFragment)
setFragment(Tab.SWITCHES, fragment);
else if(fragment instanceof SliderFragment)
setFragment(Tab.SLIDERS, fragment);
else if(fragment instanceof TextfieldFragment)
setFragment(Tab.TEXTFIELDS, fragment);
else if(fragment instanceof SnackbarFragment)
Expand Down Expand Up @@ -292,9 +296,15 @@ public Fragment getItem(int position) {
case BUTTONS:
mFragments[position] = ButtonFragment.newInstance();
break;
case FAB:
mFragments[position] = FabFragment.newInstance();
break;
case SWITCHES:
mFragments[position] = SwitchesFragment.newInstance();
break;
case SLIDERS:
mFragments[position] = SliderFragment.newInstance();
break;
case TEXTFIELDS:
mFragments[position] = TextfieldFragment.newInstance();
break;
Expand Down
41 changes: 41 additions & 0 deletions app/src/main/java/com/rey/material/demo/SliderFragment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.rey.material.demo;

import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;

import com.rey.material.widget.RadioButton;

public class SliderFragment extends Fragment{


public static SliderFragment newInstance(){
SliderFragment fragment = new SliderFragment();

return fragment;
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_slider, container, false);

return v;
}

@Override
public void onPause() {
super.onPause();
}

@Override
public void onResume() {
super.onResume();
}

}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
android:clipToPadding="false"
android:background="?attr/colorPrimary"/>

<android.support.v4.view.ViewPager
<com.rey.material.demo.CustomViewPager
android:id="@+id/main_vp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center">
android:gravity="center"
android:padding="8dp">

<TextView
android:layout_width="match_parent"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center">
android:gravity="center"
android:padding="8dp">

<TextView
android:layout_width="match_parent"
Expand Down
53 changes: 53 additions & 0 deletions app/src/main/res/layout/fragment_fab.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbarStyle="outsideOverlay">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:padding="8dp">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/title_text"
android:padding="8dp"
android:textColor="#FF000000"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Title"
android:text="Image"/>

<com.rey.material.widget.FloatingActionButton
style="@style/Material.Widget.FloatingActionButton.Light"
android:id="@+id/fab_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fab_iconSrc="@drawable/ic_done_white_24dp"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/title_text"
android:padding="8dp"
android:textColor="#FF000000"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Title"
android:text="Line Morphing"/>

<com.rey.material.widget.FloatingActionButton
style="@style/Material.Widget.FloatingActionButton.Light"
android:id="@+id/fab_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fab_iconLineMorphing="@style/FloatingActionButtonIcon"/>


</LinearLayout>


</ScrollView>

3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_progress.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:padding="8dp">

<TextView
android:layout_width="match_parent"
Expand Down
Loading