diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml index 4c5388cc..d8f708f1 100644 --- a/.idea/codeStyleSettings.xml +++ b/.idea/codeStyleSettings.xml @@ -34,6 +34,34 @@ + + diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 6fdf9873..701563c5 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -10,7 +10,7 @@ diff --git a/.idea/misc.xml b/.idea/misc.xml index e9309050..1a3eaffb 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,6 +3,30 @@ + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml index 53b39783..af608f8f 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 00000000..7f68460d --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/Material.iml b/Material.iml index 35524d89..95f4d916 100644 --- a/Material.iml +++ b/Material.iml @@ -1,5 +1,5 @@ - + @@ -8,7 +8,7 @@ - + diff --git a/app/app.iml b/app/app.iml index dbeeadc2..50b71d60 100644 --- a/app/app.iml +++ b/app/app.iml @@ -1,5 +1,5 @@ - + @@ -12,10 +12,12 @@ - + @@ -34,13 +36,13 @@ - + - + @@ -63,42 +65,35 @@ - + - - - - - - + + + - - - - + - - + - + + + + - - - - + - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 58edbcb1..6e7f9c1c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 21 - buildToolsVersion "21.1.1" + compileSdkVersion 23 + buildToolsVersion "21.1.2" defaultConfig { applicationId "com.rey.material.demo" minSdkVersion 9 - targetSdkVersion 21 + targetSdkVersion 23 versionCode 5 versionName "0.0.5" } @@ -30,11 +30,15 @@ android { } } +ext{ + libSupportVersion = '23.1.1' +} + dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.2.0' - compile 'com.android.support:cardview-v7:22.2.0' + compile "com.android.support:appcompat-v7:${libSupportVersion}" + compile "com.android.support:cardview-v7:${libSupportVersion}" compile 'com.squareup.picasso:picasso:2.5.0' compile 'com.squareup.leakcanary:leakcanary-android:1.3.1' - compile project(':lib') + compile project(':material') } diff --git a/app/src/main/java/com/rey/material/app/ContactEditText.java b/app/src/main/java/com/rey/material/app/ContactEditText.java index 77e6953a..ef7bd764 100644 --- a/app/src/main/java/com/rey/material/app/ContactEditText.java +++ b/app/src/main/java/com/rey/material/app/ContactEditText.java @@ -24,7 +24,6 @@ import android.text.TextUtils; import android.text.TextWatcher; import android.util.AttributeSet; -import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; @@ -48,7 +47,6 @@ import com.squareup.picasso.Target; import java.util.ArrayList; -import java.util.Calendar; import java.util.HashMap; /** @@ -60,7 +58,7 @@ public class ContactEditText extends EditText{ private HashMap mRecipientMap; - private int mDefaultAvatarId = R.drawable.ic_user; + private int mDefaultAvatarId; private int mSpanHeight; private int mSpanMaxWidth; private int mSpanPaddingLeft; @@ -93,7 +91,7 @@ public ContactEditText(Context context, AttributeSet attrs, int defStyleAttr) { } public ContactEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr); + super(context, attrs, defStyleAttr, defStyleRes); } @Override @@ -101,6 +99,7 @@ protected void init(Context context, AttributeSet attrs, int defStyleAttr, int d mRecipientMap = new HashMap<>(); mAutoCompleteMode = AUTOCOMPLETE_MODE_MULTI; + mDefaultAvatarId = R.drawable.ic_user; mSpanHeight = ThemeUtil.dpToPx(context, 32); mSpanMaxWidth = ThemeUtil.dpToPx(context, 150); mSpanPaddingLeft = ThemeUtil.dpToPx(context, 8); diff --git a/app/src/main/java/com/rey/material/app/ContactView.java b/app/src/main/java/com/rey/material/app/ContactView.java index 68d39d70..10cb0a5e 100644 --- a/app/src/main/java/com/rey/material/app/ContactView.java +++ b/app/src/main/java/com/rey/material/app/ContactView.java @@ -159,7 +159,7 @@ public void setOnClickListener(OnClickListener l) { @Override public boolean onTouchEvent(@NonNull MotionEvent event) { boolean result = super.onTouchEvent(event); - return mRippleManager.onTouchEvent(event) || result; + return mRippleManager.onTouchEvent(this, event) || result; } public void setAvatarBitmap(Bitmap bm){ diff --git a/app/src/main/java/com/rey/material/demo/MainActivity.java b/app/src/main/java/com/rey/material/demo/MainActivity.java index 576569c0..718c7def 100644 --- a/app/src/main/java/com/rey/material/demo/MainActivity.java +++ b/app/src/main/java/com/rey/material/demo/MainActivity.java @@ -8,10 +8,8 @@ import android.support.v4.view.GravityCompat; import android.support.v4.view.ViewPager; import android.support.v4.widget.DrawerLayout; -import android.support.v7.app.ActionBarActivity; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; -import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -29,7 +27,7 @@ import com.rey.material.util.ThemeUtil; import com.rey.material.util.ViewUtil; import com.rey.material.widget.SnackBar; -import com.rey.material.widget.TabPageIndicator; +import com.rey.material.widget.TabIndicatorView; import java.lang.reflect.Field; import java.util.ArrayList; @@ -40,7 +38,7 @@ public class MainActivity extends AppCompatActivity implements ToolbarManager.On private FrameLayout fl_drawer; private ListView lv_drawer; private CustomViewPager vp; - private TabPageIndicator tpi; + private TabIndicatorView tiv; private DrawerAdapter mDrawerAdapter; private PagerAdapter mPagerAdapter; @@ -62,14 +60,14 @@ protected void onCreate(Bundle savedInstanceState) { lv_drawer = (ListView)findViewById(R.id.main_lv_drawer); mToolbar = (Toolbar)findViewById(R.id.main_toolbar); vp = (CustomViewPager)findViewById(R.id.main_vp); - tpi = (TabPageIndicator)findViewById(R.id.main_tpi); + tiv = (TabIndicatorView)findViewById(R.id.main_tiv); mSnackBar = (SnackBar)findViewById(R.id.main_sn); mToolbarManager = new ToolbarManager(getDelegate(), mToolbar, R.id.tb_group_main, R.style.ToolbarRippleStyle, R.anim.abc_fade_in, R.anim.abc_fade_out); mToolbarManager.setNavigationManager(new ToolbarManager.ThemableNavigationManager(R.array.navigation_drawer, getSupportFragmentManager(), mToolbar, dl_navigator) { @Override public void onNavigationClick() { - if(mToolbarManager.getCurrentGroup() != R.id.tb_group_main) + if (mToolbarManager.getCurrentGroup() != R.id.tb_group_main) mToolbarManager.setCurrentGroup(R.id.tb_group_main); else dl_navigator.openDrawer(GravityCompat.START); @@ -93,8 +91,8 @@ protected boolean shouldSyncDrawerSlidingProgress() { mPagerAdapter = new PagerAdapter(getSupportFragmentManager(), mItems); vp.setAdapter(mPagerAdapter); - tpi.setViewPager(vp); - tpi.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { + tiv.setTabIndicatorFactory(new TabIndicatorView.ViewPagerIndicatorFactory(vp)); + vp.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { diff --git a/app/src/main/java/com/rey/material/demo/SnackbarFragment.java b/app/src/main/java/com/rey/material/demo/SnackbarFragment.java index 9269679e..31664825 100644 --- a/app/src/main/java/com/rey/material/demo/SnackbarFragment.java +++ b/app/src/main/java/com/rey/material/demo/SnackbarFragment.java @@ -40,23 +40,23 @@ public void onClick(View v) { else{ switch (v.getId()) { case R.id.snackbar_bt_mobile_single: - mSnackBar.applyStyle(R.style.SnackBarSingleLine) - .show(); + mSnackBar.applyStyle(R.style.SnackBarSingleLine); + mSnackBar.show(); break; case R.id.snackbar_bt_mobile_multi: - mSnackBar.applyStyle(R.style.SnackBarMultiLine) - .show(); + mSnackBar.applyStyle(R.style.SnackBarMultiLine); + mSnackBar.show(); break; case R.id.snackbar_bt_tablet_single: - mSnackBar.applyStyle(R.style.Material_Widget_SnackBar_Tablet) - .text("This is single-line snackbar.") + mSnackBar.applyStyle(R.style.Material_Widget_SnackBar_Tablet); + mSnackBar.text("This is single-line snackbar.") .actionText("CLOSE") .duration(0) .show(); break; case R.id.snackbar_bt_tablet_multi: - mSnackBar.applyStyle(R.style.Material_Widget_SnackBar_Tablet_MultiLine) - .text("This is multi-line snackbar.\nIt will auto-close after 5s.") + mSnackBar.applyStyle(R.style.Material_Widget_SnackBar_Tablet_MultiLine); + mSnackBar.text("This is multi-line snackbar.\nIt will auto-close after 5s.") .actionText(null) .duration(5000) .show(); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 5404b290..04e4c705 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -22,8 +22,8 @@ android:minHeight="?attr/actionBarSize" app:theme="@style/AppBar"/> - @@ -28,6 +29,7 @@ android:layout_height="wrap_content" android:minWidth="128dp" android:padding="8dp" + android:gravity="left" app:spn_label="Spinner without arrow" app:v_styleId="@array/spinner_no_arrow"/> diff --git a/app/src/main/res/layout/fragment_textfield.xml b/app/src/main/res/layout/fragment_textfield.xml index d2912b2e..32fd4ef0 100644 --- a/app/src/main/res/layout/fragment_textfield.xml +++ b/app/src/main/res/layout/fragment_textfield.xml @@ -21,6 +21,7 @@ android:imeOptions="actionNext|flagNoEnterAction|flagNoExtractUi" android:dropDownSelector="@drawable/abc_list_selector_background_transition_holo_light" app:et_inputId="@+id/textfield_et_contact_input" + app:et_autoCompleteMode="multi" app:et_supportMode="none" app:cet_spanFontFamily="asset:FreeSans.ttf" android:completionThreshold="2" diff --git a/app/src/main/res/layout/row_spn.xml b/app/src/main/res/layout/row_spn.xml index 302a6e2e..0794402c 100644 --- a/app/src/main/res/layout/row_spn.xml +++ b/app/src/main/res/layout/row_spn.xml @@ -2,7 +2,7 @@ 4dp - multi 32dp 150dp 8dp diff --git a/app/src/main/res/values/styles_light.xml b/app/src/main/res/values/styles_light.xml index 8ee677c7..62581d89 100644 --- a/app/src/main/res/values/styles_light.xml +++ b/app/src/main/res/values/styles_light.xml @@ -243,7 +243,6 @@ diff --git a/lib/src/main/res/xml/nav_states.xml b/material/src/main/res/xml/nav_states.xml similarity index 100% rename from lib/src/main/res/xml/nav_states.xml rename to material/src/main/res/xml/nav_states.xml diff --git a/material/src/test/java/com/rey/material/ExampleUnitTest.java b/material/src/test/java/com/rey/material/ExampleUnitTest.java new file mode 100644 index 00000000..64a6ebe9 --- /dev/null +++ b/material/src/test/java/com/rey/material/ExampleUnitTest.java @@ -0,0 +1,15 @@ +package com.rey.material; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * To work on unit tests, switch the Test Artifact in the Build Variants view. + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 3cbe2493..cca828c9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app', ':lib' +include ':app', ':material'