39 | * To use the component, simply add it to your view hierarchy. Then in your
40 | * {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call
41 | * {@link #setViewPager(android.support.v4.view.ViewPager)} providing it the ViewPager this layout is being used for.
42 | *
43 | * The colors can be customized in two ways. The first and simplest is to provide an array of colors
44 | * via {@link #setSelectedIndicatorColors(int...)}. The
45 | * alternative is via the {@link com.tekinarslan.material.sample.SlidingTabLayout.TabColorizer} interface which provides you complete control over
46 | * which color is used for any individual position.
47 | *
48 | * The views used as tabs can be customized by calling {@link #setCustomTabView(int, int)},
49 | * providing the layout ID of your custom layout.
50 | */
51 | public class SlidingTabLayout extends HorizontalScrollView {
52 | /**
53 | * Allows complete control over the colors drawn in the tab layout. Set with
54 | * {@link #setCustomTabColorizer(com.tekinarslan.material.sample.SlidingTabLayout.TabColorizer)}.
55 | */
56 | public interface TabColorizer {
57 |
58 | /**
59 | * @return return the color of the indicator used when {@code position} is selected.
60 | */
61 | int getIndicatorColor(int position);
62 |
63 | }
64 |
65 | private static final int TITLE_OFFSET_DIPS = 24;
66 | private static final int TAB_VIEW_PADDING_DIPS = 16;
67 | private static final int TAB_VIEW_TEXT_SIZE_SP = 12;
68 |
69 | private int mTitleOffset;
70 |
71 | private int mTabViewLayoutId;
72 | private int mTabViewTextViewId;
73 | private boolean mDistributeEvenly;
74 |
75 | private ViewPager mViewPager;
76 | private SparseArray mContentDescriptions = new SparseArray<>();
77 | private ViewPager.OnPageChangeListener mViewPagerPageChangeListener;
78 |
79 | private final SlidingTabStrip mTabStrip;
80 |
81 | public SlidingTabLayout(Context context) {
82 | this(context, null);
83 | }
84 |
85 | public SlidingTabLayout(Context context, AttributeSet attrs) {
86 | this(context, attrs, 0);
87 | }
88 |
89 | public SlidingTabLayout(Context context, AttributeSet attrs, int defStyle) {
90 | super(context, attrs, defStyle);
91 |
92 | // Disable the Scroll Bar
93 | setHorizontalScrollBarEnabled(false);
94 | // Make sure that the Tab Strips fills this View
95 | setFillViewport(true);
96 |
97 | mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density);
98 |
99 | mTabStrip = new SlidingTabStrip(context);
100 | addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
101 | }
102 |
103 | /**
104 | * Set the custom {@link com.tekinarslan.material.sample.SlidingTabLayout.TabColorizer} to be used.
105 | *
106 | * If you only require simple custmisation then you can use
107 | * {@link #setSelectedIndicatorColors(int...)} to achieve
108 | * similar effects.
109 | */
110 | public void setCustomTabColorizer(TabColorizer tabColorizer) {
111 | mTabStrip.setCustomTabColorizer(tabColorizer);
112 | }
113 |
114 | public void setDistributeEvenly(boolean distributeEvenly) {
115 | mDistributeEvenly = distributeEvenly;
116 | }
117 |
118 | /**
119 | * Sets the colors to be used for indicating the selected tab. These colors are treated as a
120 | * circular array. Providing one color will mean that all tabs are indicated with the same color.
121 | */
122 | public void setSelectedIndicatorColors(int... colors) {
123 | mTabStrip.setSelectedIndicatorColors(colors);
124 | }
125 |
126 | /**
127 | * Set the {@link android.support.v4.view.ViewPager.OnPageChangeListener}. When using {@link com.tekinarslan.material.sample.SlidingTabLayout} you are
128 | * required to set any {@link android.support.v4.view.ViewPager.OnPageChangeListener} through this method. This is so
129 | * that the layout can update it's scroll position correctly.
130 | *
131 | * @see android.support.v4.view.ViewPager#setOnPageChangeListener(android.support.v4.view.ViewPager.OnPageChangeListener)
132 | */
133 | public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
134 | mViewPagerPageChangeListener = listener;
135 | }
136 |
137 | /**
138 | * Set the custom layout to be inflated for the tab views.
139 | *
140 | * @param layoutResId Layout id to be inflated
141 | * @param textViewId id of the {@link android.widget.TextView} in the inflated view
142 | */
143 | public void setCustomTabView(int layoutResId, int textViewId) {
144 | mTabViewLayoutId = layoutResId;
145 | mTabViewTextViewId = textViewId;
146 | }
147 |
148 | /**
149 | * Sets the associated view pager. Note that the assumption here is that the pager content
150 | * (number of tabs and tab titles) does not change after this call has been made.
151 | */
152 | public void setViewPager(ViewPager viewPager) {
153 | mTabStrip.removeAllViews();
154 |
155 | mViewPager = viewPager;
156 | if (viewPager != null) {
157 | viewPager.setOnPageChangeListener(new InternalViewPagerListener());
158 | populateTabStrip();
159 | }
160 | }
161 |
162 | /**
163 | * Create a default view to be used for tabs. This is called if a custom tab view is not set via
164 | * {@link #setCustomTabView(int, int)}.
165 | */
166 | protected TextView createDefaultTabView(Context context) {
167 | TextView textView = new TextView(context);
168 | textView.setGravity(Gravity.CENTER);
169 | textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
170 | textView.setTypeface(Typeface.DEFAULT_BOLD);
171 | textView.setLayoutParams(new LinearLayout.LayoutParams(
172 | ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
173 |
174 | TypedValue outValue = new TypedValue();
175 | getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
176 | outValue, true);
177 | textView.setBackgroundResource(outValue.resourceId);
178 | textView.setAllCaps(true);
179 |
180 | int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
181 | textView.setPadding(padding, padding, padding, padding);
182 |
183 | return textView;
184 | }
185 |
186 | private void populateTabStrip() {
187 | final PagerAdapter adapter = mViewPager.getAdapter();
188 | final OnClickListener tabClickListener = new TabClickListener();
189 |
190 | for (int i = 0; i < adapter.getCount(); i++) {
191 | View tabView = null;
192 | TextView tabTitleView = null;
193 |
194 | if (mTabViewLayoutId != 0) {
195 | // If there is a custom tab view layout id set, try and inflate it
196 | tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip,
197 | false);
198 | tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
199 | }
200 |
201 | if (tabView == null) {
202 | tabView = createDefaultTabView(getContext());
203 | }
204 |
205 | if (tabTitleView == null && TextView.class.isInstance(tabView)) {
206 | tabTitleView = (TextView) tabView;
207 | }
208 |
209 | if (mDistributeEvenly) {
210 | LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams();
211 | lp.width = 0;
212 | lp.weight = 1;
213 | }
214 |
215 | tabTitleView.setText(adapter.getPageTitle(i));
216 | tabTitleView.setTextColor(Color.WHITE);
217 | tabView.setOnClickListener(tabClickListener);
218 | String desc = mContentDescriptions.get(i, null);
219 | if (desc != null) {
220 | tabView.setContentDescription(desc);
221 | }
222 |
223 | mTabStrip.addView(tabView);
224 | if (i == mViewPager.getCurrentItem()) {
225 | tabView.setSelected(true);
226 | }
227 | }
228 | }
229 |
230 | public void setContentDescription(int i, String desc) {
231 | mContentDescriptions.put(i, desc);
232 | }
233 |
234 | @Override
235 | protected void onAttachedToWindow() {
236 | super.onAttachedToWindow();
237 |
238 | if (mViewPager != null) {
239 | scrollToTab(mViewPager.getCurrentItem(), 0);
240 | }
241 | }
242 |
243 | private void scrollToTab(int tabIndex, int positionOffset) {
244 | final int tabStripChildCount = mTabStrip.getChildCount();
245 | if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
246 | return;
247 | }
248 |
249 | View selectedChild = mTabStrip.getChildAt(tabIndex);
250 | if (selectedChild != null) {
251 | int targetScrollX = selectedChild.getLeft() + positionOffset;
252 |
253 | if (tabIndex > 0 || positionOffset > 0) {
254 | // If we're not at the first child and are mid-scroll, make sure we obey the offset
255 | targetScrollX -= mTitleOffset;
256 | }
257 |
258 | scrollTo(targetScrollX, 0);
259 | }
260 | }
261 |
262 | private class InternalViewPagerListener implements ViewPager.OnPageChangeListener {
263 | private int mScrollState;
264 |
265 | @Override
266 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
267 | int tabStripChildCount = mTabStrip.getChildCount();
268 | if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) {
269 | return;
270 | }
271 |
272 | mTabStrip.onViewPagerPageChanged(position, positionOffset);
273 |
274 | View selectedTitle = mTabStrip.getChildAt(position);
275 | int extraOffset = (selectedTitle != null)
276 | ? (int) (positionOffset * selectedTitle.getWidth())
277 | : 0;
278 | scrollToTab(position, extraOffset);
279 |
280 | if (mViewPagerPageChangeListener != null) {
281 | mViewPagerPageChangeListener.onPageScrolled(position, positionOffset,
282 | positionOffsetPixels);
283 | }
284 | }
285 |
286 | @Override
287 | public void onPageScrollStateChanged(int state) {
288 | mScrollState = state;
289 |
290 | if (mViewPagerPageChangeListener != null) {
291 | mViewPagerPageChangeListener.onPageScrollStateChanged(state);
292 | }
293 | }
294 |
295 | @Override
296 | public void onPageSelected(int position) {
297 | if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
298 | mTabStrip.onViewPagerPageChanged(position, 0f);
299 | scrollToTab(position, 0);
300 | }
301 | for (int i = 0; i < mTabStrip.getChildCount(); i++) {
302 | mTabStrip.getChildAt(i).setSelected(position == i);
303 | }
304 | if (mViewPagerPageChangeListener != null) {
305 | mViewPagerPageChangeListener.onPageSelected(position);
306 | }
307 | }
308 |
309 | }
310 |
311 | private class TabClickListener implements OnClickListener {
312 | @Override
313 | public void onClick(View v) {
314 | for (int i = 0; i < mTabStrip.getChildCount(); i++) {
315 | if (v == mTabStrip.getChildAt(i)) {
316 | mViewPager.setCurrentItem(i);
317 | return;
318 | }
319 | }
320 | }
321 | }
322 |
323 | }
324 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tekinarslan/material/sample/SlidingTabStrip.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Google Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.tekinarslan.material.sample;
18 |
19 | import android.R;
20 | import android.content.Context;
21 | import android.graphics.Canvas;
22 | import android.graphics.Color;
23 | import android.graphics.Paint;
24 | import android.util.AttributeSet;
25 | import android.util.TypedValue;
26 | import android.view.View;
27 | import android.widget.LinearLayout;
28 |
29 |
30 | class SlidingTabStrip extends LinearLayout {
31 |
32 | private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 0;
33 | private static final byte DEFAULT_BOTTOM_BORDER_COLOR_ALPHA = 0x26;
34 | private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 3;
35 | private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5;
36 |
37 | private final int mBottomBorderThickness;
38 | private final Paint mBottomBorderPaint;
39 |
40 | private final int mSelectedIndicatorThickness;
41 | private final Paint mSelectedIndicatorPaint;
42 |
43 | private final int mDefaultBottomBorderColor;
44 |
45 | private int mSelectedPosition;
46 | private float mSelectionOffset;
47 |
48 | private SlidingTabLayout.TabColorizer mCustomTabColorizer;
49 | private final SimpleTabColorizer mDefaultTabColorizer;
50 |
51 | SlidingTabStrip(Context context) {
52 | this(context, null);
53 | }
54 |
55 | SlidingTabStrip(Context context, AttributeSet attrs) {
56 | super(context, attrs);
57 | setWillNotDraw(false);
58 |
59 | final float density = getResources().getDisplayMetrics().density;
60 |
61 | TypedValue outValue = new TypedValue();
62 | context.getTheme().resolveAttribute(R.attr.colorForeground, outValue, true);
63 | final int themeForegroundColor = outValue.data;
64 |
65 | mDefaultBottomBorderColor = setColorAlpha(themeForegroundColor,
66 | DEFAULT_BOTTOM_BORDER_COLOR_ALPHA);
67 |
68 | mDefaultTabColorizer = new SimpleTabColorizer();
69 | mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR);
70 |
71 | mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density);
72 | mBottomBorderPaint = new Paint();
73 | mBottomBorderPaint.setColor(mDefaultBottomBorderColor);
74 |
75 | mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density);
76 | mSelectedIndicatorPaint = new Paint();
77 | }
78 |
79 | void setCustomTabColorizer(SlidingTabLayout.TabColorizer customTabColorizer) {
80 | mCustomTabColorizer = customTabColorizer;
81 | invalidate();
82 | }
83 |
84 | void setSelectedIndicatorColors(int... colors) {
85 | // Make sure that the custom colorizer is removed
86 | mCustomTabColorizer = null;
87 | mDefaultTabColorizer.setIndicatorColors(colors);
88 | invalidate();
89 | }
90 |
91 | void onViewPagerPageChanged(int position, float positionOffset) {
92 | mSelectedPosition = position;
93 | mSelectionOffset = positionOffset;
94 | invalidate();
95 | }
96 |
97 | @Override
98 | protected void onDraw(Canvas canvas) {
99 | final int height = getHeight();
100 | final int childCount = getChildCount();
101 | final SlidingTabLayout.TabColorizer tabColorizer = mCustomTabColorizer != null
102 | ? mCustomTabColorizer
103 | : mDefaultTabColorizer;
104 |
105 | // Thick colored underline below the current selection
106 | if (childCount > 0) {
107 | View selectedTitle = getChildAt(mSelectedPosition);
108 | int left = selectedTitle.getLeft();
109 | int right = selectedTitle.getRight();
110 | int color = tabColorizer.getIndicatorColor(mSelectedPosition);
111 |
112 | if (mSelectionOffset > 0f && mSelectedPosition < (getChildCount() - 1)) {
113 | int nextColor = tabColorizer.getIndicatorColor(mSelectedPosition + 1);
114 | if (color != nextColor) {
115 | color = blendColors(nextColor, color, mSelectionOffset);
116 | }
117 |
118 | // Draw the selection partway between the tabs
119 | View nextTitle = getChildAt(mSelectedPosition + 1);
120 | left = (int) (mSelectionOffset * nextTitle.getLeft() +
121 | (1.0f - mSelectionOffset) * left);
122 | right = (int) (mSelectionOffset * nextTitle.getRight() +
123 | (1.0f - mSelectionOffset) * right);
124 | }
125 |
126 | mSelectedIndicatorPaint.setColor(color);
127 |
128 | canvas.drawRect(left, height - mSelectedIndicatorThickness, right,
129 | height, mSelectedIndicatorPaint);
130 | }
131 |
132 | // Thin underline along the entire bottom edge
133 | canvas.drawRect(0, height - mBottomBorderThickness, getWidth(), height, mBottomBorderPaint);
134 | }
135 |
136 | /**
137 | * Set the alpha value of the {@code color} to be the given {@code alpha} value.
138 | */
139 | private static int setColorAlpha(int color, byte alpha) {
140 | return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color));
141 | }
142 |
143 | /**
144 | * Blend {@code color1} and {@code color2} using the given ratio.
145 | *
146 | * @param ratio of which to blend. 1.0 will return {@code color1}, 0.5 will give an even blend,
147 | * 0.0 will return {@code color2}.
148 | */
149 | private static int blendColors(int color1, int color2, float ratio) {
150 | final float inverseRation = 1f - ratio;
151 | float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation);
152 | float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation);
153 | float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation);
154 | return Color.rgb((int) r, (int) g, (int) b);
155 | }
156 |
157 | private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer {
158 | private int[] mIndicatorColors;
159 |
160 | @Override
161 | public final int getIndicatorColor(int position) {
162 | return mIndicatorColors[position % mIndicatorColors.length];
163 | }
164 |
165 | void setIndicatorColors(int... colors) {
166 | mIndicatorColors = colors;
167 | }
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tekinarslan/material/sample/ToolBarMaterial.java:
--------------------------------------------------------------------------------
1 | package com.tekinarslan.material.sample;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.graphics.Bitmap;
6 | import android.graphics.Bitmap.Config;
7 | import android.graphics.Canvas;
8 | import android.graphics.Color;
9 | import android.graphics.Paint;
10 | import android.graphics.Rect;
11 | import android.graphics.drawable.GradientDrawable;
12 | import android.graphics.drawable.LayerDrawable;
13 | import android.util.AttributeSet;
14 | import android.util.TypedValue;
15 | import android.view.MotionEvent;
16 | import android.widget.RelativeLayout;
17 | import android.widget.TextView;
18 |
19 |
20 |
21 | public class ToolbarMaterial extends AppCompactActivity
22 | {
23 |
24 | public void onCreate(Bundle bundle)
25 | {
26 | super.onCreate(bundle);
27 | setContentView(R.layout.ToolbarMaterial);
28 |
29 | mTopToolbar = (Toolbar) findViewById(R.id.my_toolbar);
30 | setSupportActionBar(mTopToolbar);
31 | }
32 |
33 |
34 |
35 |
36 |
37 | public boolean onCreateOptionsMenu(Menu menu) {
38 |
39 | getMenuInflater().inflate(R.menu.menu_main, menu);
40 | return true;
41 | }
42 |
43 |
44 | public void Item1(View view)
45 | {
46 | Button button1 =findViewById(R.id.button1);
47 | button1.setOnClickListener(new OnClickListener()
48 | {
49 | public void onClick(View view)
50 | {
51 |
52 | Toast.makeText(this,"Hey you Have done this!!",Toast.LENGTH_LONG).show();
53 | }
54 | });
55 | }
56 |
57 |
58 |
59 | public void Item1(View view)
60 | {
61 | Button button2=findViewById(R.id.button2);
62 | button2.setOnClickListener(new OnClickListener()
63 | {
64 | public void onClick(View view)
65 | {
66 |
67 | Toast.makeText(this,"Hey you Have done this!!",Toast.LENGTH_LONG).show();
68 |
69 | Intent intent=new Intent(this,YourNewActivity.class);
70 | startActivity(intent);
71 | finish();
72 | }
73 | });
74 | }
75 |
76 |
77 |
78 |
79 |
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tekinarslan/material/sample/ViewPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.tekinarslan.material.sample;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentPagerAdapter;
6 |
7 | public class ViewPagerAdapter extends FragmentPagerAdapter {
8 |
9 | final int PAGE_COUNT =8;
10 | private String[] titles;
11 |
12 | public ViewPagerAdapter(FragmentManager fm, String[] titles2) {
13 | super(fm);
14 | titles=titles2;
15 | }
16 |
17 | @Override
18 | public Fragment getItem(int position) {
19 | switch (position) {
20 | // Open FragmentTab1.java
21 | case 0:
22 | return SampleFragment.newInstance(position);
23 | case 1:
24 | return SampleFragment.newInstance(position);
25 | case 2:
26 | return SampleFragment.newInstance(position);
27 | case 3:
28 | return SampleFragment.newInstance(position);
29 | case 4:
30 | return SampleFragment.newInstance(position);
31 | case 5:
32 | return SampleFragment.newInstance(position);
33 | case 6:
34 | return SampleFragment.newInstance(position);
35 | case 7:
36 | return SampleFragment.newInstance(position);
37 |
38 | }
39 | return null;
40 | }
41 |
42 | public CharSequence getPageTitle(int position) {
43 | return titles[position];
44 | }
45 |
46 | @Override
47 | public int getCount() {
48 | return PAGE_COUNT;
49 | }
50 |
51 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/background_card.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/app/src/main/res/drawable-hdpi/background_card.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_ab_drawer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/app/src/main/res/drawable-hdpi/ic_ab_drawer.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/app/src/main/res/drawable-hdpi/plus.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/shadow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/app/src/main/res/drawable-hdpi/shadow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_ab_drawer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/app/src/main/res/drawable-xhdpi/ic_ab_drawer.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/app/src/main/res/drawable-xhdpi/plus.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/shadow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/app/src/main/res/drawable-xhdpi/shadow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_ab_drawer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/app/src/main/res/drawable-xxhdpi/ic_ab_drawer.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/fab.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/ToolBarMaterial.java:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
14 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_sample.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
18 |
19 |
26 |
27 |
33 |
34 |
35 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/page.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
20 |
21 |
22 |
30 |
31 |
40 |
41 |
50 |
51 |
63 |
64 |
65 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/color.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #bf360c
4 | #ffbf5232
5 |
6 | @color/material_deep_teal_500
7 | #ff149691
8 |
9 | #304f9f
10 | @color/material_blue_grey_800
11 | @color/primary_material_light
12 |
13 | @color/material_deep_teal_500
14 | @color/material_deep_teal_500
15 |
16 | #333333
17 | #80000000
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 260dp
3 |
4 | 56dp
5 | 8dp
6 |
7 | 4dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Material Toolbar
5 | drawer_open
6 | drawer_close
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.1.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tekinarslan/AndroidMaterialDesignToolbar/893cc28b24c61c11253ab5b02e77fe41d1f7b49e/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue May 19 21:36:13 EEST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------