fragments, String[] titles) {
+ super(fm);
+ this.fragments = fragments;
+ this.titles = titles;
+ }
+
+ @Override
+ public int getCount() {
+ return fragments.size();
+ }
+
+ @Override
+ public CharSequence getPageTitle(int position) {
+ return titles[position];
+ }
+
+ @Override
+ public Fragment getItem(int position) {
+ return fragments.get(position);
+ }
+
+ @Override
+ public void destroyItem(ViewGroup container, int position, Object object) {
+ // 覆写destroyItem并且空实现,这样每个Fragment中的视图就不会被销毁
+ // super.destroyItem(container, position, object);
+ }
+
+ @Override
+ public int getItemPosition(Object object) {
+ return PagerAdapter.POSITION_NONE;
+ }
+ }
+
+ @Override
+ protected Parcelable onSaveInstanceState() {
+ Bundle bundle = new Bundle();
+ bundle.putParcelable("instanceState", super.onSaveInstanceState());
+ bundle.putInt("mCurrentTab", mCurrentTab);
+ return bundle;
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Parcelable state) {
+ if (state instanceof Bundle) {
+ Bundle bundle = (Bundle) state;
+ mCurrentTab = bundle.getInt("mCurrentTab");
+ state = bundle.getParcelable("instanceState");
+ if (mCurrentTab != 0 && mTabsContainer.getChildCount() > 0) {
+ updateTabSelection(mCurrentTab);
+ scrollToCurrentTab();
+ }
+ }
+ super.onRestoreInstanceState(state);
+ }
+
+ protected int dp2px(float dp) {
+ final float scale = mContext.getResources().getDisplayMetrics().density;
+ return (int) (dp * scale + 0.5f);
+ }
+
+ protected int sp2px(float sp) {
+ final float scale = this.mContext.getResources().getDisplayMetrics().scaledDensity;
+ return (int) (sp * scale + 0.5f);
+ }
+}
diff --git a/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/listener/CustomTabEntity.java b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/listener/CustomTabEntity.java
new file mode 100644
index 0000000..ee39fe7
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/listener/CustomTabEntity.java
@@ -0,0 +1,13 @@
+package com.flyco.tablayout.listener;
+
+import androidx.annotation.DrawableRes;
+
+public interface CustomTabEntity {
+ String getTabTitle();
+
+ @DrawableRes
+ int getTabSelectedIcon();
+
+ @DrawableRes
+ int getTabUnselectedIcon();
+}
\ No newline at end of file
diff --git a/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/listener/OnTabSelectListener.java b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/listener/OnTabSelectListener.java
new file mode 100644
index 0000000..edf6cdb
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/listener/OnTabSelectListener.java
@@ -0,0 +1,6 @@
+package com.flyco.tablayout.listener;
+
+public interface OnTabSelectListener {
+ void onTabSelect(int position);
+ void onTabReselect(int position);
+}
\ No newline at end of file
diff --git a/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/ExtendTransformer.java b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/ExtendTransformer.java
new file mode 100644
index 0000000..ce40c95
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/ExtendTransformer.java
@@ -0,0 +1,52 @@
+package com.flyco.tablayout.transformer;
+
+import androidx.annotation.NonNull;
+import androidx.viewpager.widget.ViewPager;
+import android.view.View;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by li.zhipeng on 2019/1/3.
+ *
+ * tab切换的
+ */
+public class ExtendTransformer implements ViewPager.PageTransformer {
+
+ private ArrayList transformers = new ArrayList<>();
+
+
+ public ExtendTransformer() {
+ }
+
+ public void addViewPagerTransformer(IViewPagerTransformer transformer) {
+ if (!transformers.contains(transformer)) {
+ transformers.add(transformer);
+ }
+ }
+
+ public void removeViewPagerTransformer(IViewPagerTransformer transformer) {
+ transformers.remove(transformer);
+ }
+
+ public List getTransformers() {
+ return transformers;
+ }
+
+ public void setTransformers(List transformers) {
+ this.transformers.addAll(transformers);
+ }
+
+ @Override
+ public void transformPage(@NonNull View view, final float position) {
+ // 回调设置的页面切换效果设置
+ if (transformers != null && transformers.size() > 0) {
+ for (IViewPagerTransformer transformer : transformers) {
+ transformer.transformPage(view, position);
+ }
+ }
+ }
+
+
+}
diff --git a/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/ITabScaleTransformer.java b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/ITabScaleTransformer.java
new file mode 100644
index 0000000..5a989a9
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/ITabScaleTransformer.java
@@ -0,0 +1,6 @@
+package com.flyco.tablayout.transformer;
+
+public interface ITabScaleTransformer {
+ void setNormalWidth(int position, int width, boolean isSelect);
+ void onPageScrolled(int position, float positionOffset, int positionOffsetPixels);
+}
diff --git a/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/IViewPagerTransformer.java b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/IViewPagerTransformer.java
new file mode 100644
index 0000000..93235a5
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/IViewPagerTransformer.java
@@ -0,0 +1,12 @@
+package com.flyco.tablayout.transformer;
+
+import androidx.viewpager.widget.ViewPager;
+
+/**
+ * Created by li.zhipeng on 2019/1/3.
+ *
+ * ViewPager的扩展Transformer,配合SlidingScaleTabLayout使用
+ * 因为字体的切换效果设置了默认的Transformer,所以扩展此接口
+ */
+public interface IViewPagerTransformer extends ViewPager.PageTransformer {
+}
diff --git a/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/TabScaleTransformer.java b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/TabScaleTransformer.java
new file mode 100644
index 0000000..5757d64
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/transformer/TabScaleTransformer.java
@@ -0,0 +1,110 @@
+package com.flyco.tablayout.transformer;
+
+import android.util.Log;
+import android.util.TypedValue;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.flyco.tablayout.SlidingScaleTabLayout;
+
+/**
+ * Created by li.zhipeng on 2019/1/3.
+ *
+ * tab切换的
+ */
+public class TabScaleTransformer implements ITabScaleTransformer {
+
+ private SlidingScaleTabLayout slidingScaleTabLayout;
+
+ private float textSelectSize;
+
+ private float textUnSelectSize;
+
+// private float maxScale;
+
+ private boolean openDmg;
+
+ public TabScaleTransformer(SlidingScaleTabLayout slidingScaleTabLayout,
+ float textSelectSize, float textUnSelectSize, boolean openDmg) {
+ this.slidingScaleTabLayout = slidingScaleTabLayout;
+ this.textSelectSize = textSelectSize;
+ this.textUnSelectSize = textUnSelectSize;
+// this.maxScale = (textSelectSize / textUnSelectSize) - 1;
+ this.openDmg = openDmg;
+ }
+
+ @Override
+ public void setNormalWidth(int position, int width, boolean isSelect) {
+ }
+
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+ Log.i("TabScaleTransformer", "position:" + position);
+ // 字体大小相同,不需要切换
+ if (textSelectSize == textUnSelectSize) return;
+ if (openDmg) {
+ for (int i = 0; i < slidingScaleTabLayout.getTabCount(); i++) {
+ if (i != position && i != position + 1) {
+ changTabDmgWidth(i, 0);
+ }
+ }
+ changeDmgSize(position, positionOffset);
+ } else {
+ for (int i = 0; i < slidingScaleTabLayout.getTabCount(); i++) {
+ if (i != position && i != position + 1) {
+ updateTextSize(i, 1);
+ }
+ }
+ changeTextSize(position, positionOffset);
+ }
+ }
+
+ private void changeTextSize(final int position, final float positionOffset) {
+ updateTextSize(position, positionOffset);
+ if (position + 1 < slidingScaleTabLayout.getTabCount()) {
+ updateTextSize(position + 1, 1 - positionOffset);
+ }
+ }
+
+ private void updateTextSize(final int position, final float positionOffset) {
+ final TextView currentTab = slidingScaleTabLayout.getTitle(position);
+ // 必须要在View调用post更新样式,否则可能无效
+ currentTab.post(new Runnable() {
+ @Override
+ public void run() {
+ int textSize = (int) (textSelectSize - Math.abs((textSelectSize - textUnSelectSize) * positionOffset));
+ if (currentTab.getTextSize() != textSize) {
+ currentTab.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
+ currentTab.requestLayout();
+ }
+ }
+ });
+ }
+
+ private void changeDmgSize(final int position, final float positionOffset) {
+ slidingScaleTabLayout.post(new Runnable() {
+ @Override
+ public void run() {
+// Log.i("lzp", "position:" + position + " positionOffset:" + positionOffset);
+ float scale = 1 - positionOffset;
+ changTabDmgWidth(position, scale);
+ if (position + 1 < slidingScaleTabLayout.getTabCount()) {
+ changTabDmgWidth(position + 1, positionOffset);
+ }
+ }
+ });
+ }
+
+ private void changTabDmgWidth(int position, float scale) {
+ final ImageView currentTabDmg = slidingScaleTabLayout.getDmgView(position);
+ if (currentTabDmg == null) return;
+ if (currentTabDmg.getDrawable() == null) return;
+ ViewGroup.LayoutParams params = currentTabDmg.getLayoutParams();
+ int width = (int) (currentTabDmg.getMinimumWidth() + (currentTabDmg.getMaxWidth() - currentTabDmg.getMinimumWidth()) * scale);
+ if (params.width != width) {
+ params.width = width;
+ currentTabDmg.setLayoutParams(params);
+ }
+// Log.i("lzp", "position:" + position + " scale:" + scale + " width:" + params.width);
+ }
+}
\ No newline at end of file
diff --git a/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/utils/FragmentChangeManager.java b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/utils/FragmentChangeManager.java
new file mode 100644
index 0000000..f47b315
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/utils/FragmentChangeManager.java
@@ -0,0 +1,55 @@
+package com.flyco.tablayout.utils;
+
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentTransaction;
+
+import java.util.ArrayList;
+
+public class FragmentChangeManager {
+ private FragmentManager mFragmentManager;
+ private int mContainerViewId;
+ /** Fragment切换数组 */
+ private ArrayList mFragments;
+ /** 当前选中的Tab */
+ private int mCurrentTab;
+
+ public FragmentChangeManager(FragmentManager fm, int containerViewId, ArrayList fragments) {
+ this.mFragmentManager = fm;
+ this.mContainerViewId = containerViewId;
+ this.mFragments = fragments;
+ initFragments();
+ }
+
+ /** 初始化fragments */
+ private void initFragments() {
+ for (Fragment fragment : mFragments) {
+ mFragmentManager.beginTransaction().add(mContainerViewId, fragment).hide(fragment).commit();
+ }
+
+ setFragments(0);
+ }
+
+ /** 界面切换控制 */
+ public void setFragments(int index) {
+ for (int i = 0; i < mFragments.size(); i++) {
+ FragmentTransaction ft = mFragmentManager.beginTransaction();
+ Fragment fragment = mFragments.get(i);
+ if (i == index) {
+ ft.show(fragment);
+ } else {
+ ft.hide(fragment);
+ }
+ ft.commit();
+ }
+ mCurrentTab = index;
+ }
+
+ public int getCurrentTab() {
+ return mCurrentTab;
+ }
+
+ public Fragment getCurrentFragment() {
+ return mFragments.get(mCurrentTab);
+ }
+}
\ No newline at end of file
diff --git a/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/utils/UnreadMsgUtils.java b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/utils/UnreadMsgUtils.java
new file mode 100644
index 0000000..0446bfa
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/utils/UnreadMsgUtils.java
@@ -0,0 +1,58 @@
+package com.flyco.tablayout.utils;
+
+
+import android.util.DisplayMetrics;
+import android.view.View;
+import android.widget.RelativeLayout;
+
+import com.flyco.tablayout.widget.MsgView;
+
+/**
+ * 未读消息提示View,显示小红点或者带有数字的红点:
+ * 数字一位,圆
+ * 数字两位,圆角矩形,圆角是高度的一半
+ * 数字超过两位,显示99+
+ */
+public class UnreadMsgUtils {
+ public static void show(MsgView msgView, int num) {
+ if (msgView == null) {
+ return;
+ }
+ RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) msgView.getLayoutParams();
+ DisplayMetrics dm = msgView.getResources().getDisplayMetrics();
+ msgView.setVisibility(View.VISIBLE);
+ if (num <= 0) {//圆点,设置默认宽高
+ msgView.setStrokeWidth(0);
+ msgView.setText("");
+
+ lp.width = (int) (5 * dm.density);
+ lp.height = (int) (5 * dm.density);
+ msgView.setLayoutParams(lp);
+ } else {
+ lp.height = (int) (18 * dm.density);
+ if (num < 10) {//圆
+ lp.width = (int) (18 * dm.density);
+ msgView.setText(num + "");
+ } else if (num < 100) {//圆角矩形,圆角是高度的一半,设置默认padding
+ lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
+ msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0);
+ msgView.setText(num + "");
+ } else {//数字超过两位,显示99+
+ lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
+ msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0);
+ msgView.setText("99+");
+ }
+ msgView.setLayoutParams(lp);
+ }
+ }
+
+ public static void setSize(MsgView rtv, int size) {
+ if (rtv == null) {
+ return;
+ }
+ RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) rtv.getLayoutParams();
+ lp.width = size;
+ lp.height = size;
+ rtv.setLayoutParams(lp);
+ }
+}
diff --git a/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/utils/ViewUtils.java b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/utils/ViewUtils.java
new file mode 100644
index 0000000..2f54c6b
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/utils/ViewUtils.java
@@ -0,0 +1,39 @@
+package com.flyco.tablayout.utils;
+
+import android.graphics.Bitmap;
+import androidx.annotation.IdRes;
+import android.view.View;
+
+public class ViewUtils {
+
+ public static Bitmap generateViewCacheBitmap(View view) {
+ view.destroyDrawingCache();
+ int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
+ int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
+ view.measure(widthMeasureSpec, heightMeasureSpec);
+ int width = view.getMeasuredWidth();
+ int height = view.getMeasuredHeight();
+ view.layout(0, 0, width, height);
+ view.setDrawingCacheEnabled(true);
+ view.buildDrawingCache();
+ return Bitmap.createBitmap(view.getDrawingCache());
+ }
+
+ public static View findBrotherView(View view, @IdRes int id, int level) {
+ int count = 0;
+ View temp = view;
+ while (count < level) {
+ View target = temp.findViewById(id);
+ if (target != null) {
+ return target;
+ }
+ count += 1;
+ if (temp.getParent() instanceof View) {
+ temp = (View) temp.getParent();
+ } else {
+ break;
+ }
+ }
+ return null;
+ }
+}
diff --git a/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/widget/MsgView.java b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/widget/MsgView.java
new file mode 100644
index 0000000..59dd2b6
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/java/com/flyco/tablayout/widget/MsgView.java
@@ -0,0 +1,157 @@
+package com.flyco.tablayout.widget;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Color;
+import android.graphics.drawable.GradientDrawable;
+import android.graphics.drawable.StateListDrawable;
+import android.os.Build;
+import android.util.AttributeSet;
+import android.widget.TextView;
+
+import com.flyco.tablayout.R;
+
+/** 用于需要圆角矩形框背景的TextView的情况,减少直接使用TextView时引入的shape资源文件 */
+public class MsgView extends TextView {
+ private Context context;
+ private GradientDrawable gd_background = new GradientDrawable();
+ private int backgroundColor;
+ private int cornerRadius;
+ private int strokeWidth;
+ private int strokeColor;
+ private boolean isRadiusHalfHeight;
+ private boolean isWidthHeightEqual;
+
+ public MsgView(Context context) {
+ this(context, null);
+ }
+
+ public MsgView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public MsgView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ this.context = context;
+ obtainAttributes(context, attrs);
+ }
+
+ private void obtainAttributes(Context context, AttributeSet attrs) {
+ TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.MsgView);
+ backgroundColor = ta.getColor(R.styleable.MsgView_mv_backgroundColor, Color.TRANSPARENT);
+ cornerRadius = ta.getDimensionPixelSize(R.styleable.MsgView_mv_cornerRadius, 0);
+ strokeWidth = ta.getDimensionPixelSize(R.styleable.MsgView_mv_strokeWidth, 0);
+ strokeColor = ta.getColor(R.styleable.MsgView_mv_strokeColor, Color.TRANSPARENT);
+ isRadiusHalfHeight = ta.getBoolean(R.styleable.MsgView_mv_isRadiusHalfHeight, false);
+ isWidthHeightEqual = ta.getBoolean(R.styleable.MsgView_mv_isWidthHeightEqual, false);
+
+ ta.recycle();
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ if (isWidthHeightEqual() && getWidth() > 0 && getHeight() > 0) {
+ int max = Math.max(getWidth(), getHeight());
+ int measureSpec = MeasureSpec.makeMeasureSpec(max, MeasureSpec.EXACTLY);
+ super.onMeasure(measureSpec, measureSpec);
+ return;
+ }
+
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ super.onLayout(changed, left, top, right, bottom);
+ if (isRadiusHalfHeight()) {
+ setCornerRadius(getHeight() / 2);
+ } else {
+ setBgSelector();
+ }
+ }
+
+
+ public void setBackgroundColor(int backgroundColor) {
+ this.backgroundColor = backgroundColor;
+ setBgSelector();
+ }
+
+ public void setCornerRadius(int cornerRadius) {
+ this.cornerRadius = dp2px(cornerRadius);
+ setBgSelector();
+ }
+
+ public void setStrokeWidth(int strokeWidth) {
+ this.strokeWidth = dp2px(strokeWidth);
+ setBgSelector();
+ }
+
+ public void setStrokeColor(int strokeColor) {
+ this.strokeColor = strokeColor;
+ setBgSelector();
+ }
+
+ public void setIsRadiusHalfHeight(boolean isRadiusHalfHeight) {
+ this.isRadiusHalfHeight = isRadiusHalfHeight;
+ setBgSelector();
+ }
+
+ public void setIsWidthHeightEqual(boolean isWidthHeightEqual) {
+ this.isWidthHeightEqual = isWidthHeightEqual;
+ setBgSelector();
+ }
+
+ public int getBackgroundColor() {
+ return backgroundColor;
+ }
+
+ public int getCornerRadius() {
+ return cornerRadius;
+ }
+
+ public int getStrokeWidth() {
+ return strokeWidth;
+ }
+
+ public int getStrokeColor() {
+ return strokeColor;
+ }
+
+ public boolean isRadiusHalfHeight() {
+ return isRadiusHalfHeight;
+ }
+
+ public boolean isWidthHeightEqual() {
+ return isWidthHeightEqual;
+ }
+
+ protected int dp2px(float dp) {
+ final float scale = context.getResources().getDisplayMetrics().density;
+ return (int) (dp * scale + 0.5f);
+ }
+
+ protected int sp2px(float sp) {
+ final float scale = this.context.getResources().getDisplayMetrics().scaledDensity;
+ return (int) (sp * scale + 0.5f);
+ }
+
+ private void setDrawable(GradientDrawable gd, int color, int strokeColor) {
+ gd.setColor(color);
+ gd.setCornerRadius(cornerRadius);
+ gd.setStroke(strokeWidth, strokeColor);
+ }
+
+ public void setBgSelector() {
+ StateListDrawable bg = new StateListDrawable();
+
+ setDrawable(gd_background, backgroundColor, strokeColor);
+ bg.addState(new int[]{-android.R.attr.state_pressed}, gd_background);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {//16
+ setBackground(bg);
+ } else {
+ //noinspection deprecation
+ setBackgroundDrawable(bg);
+ }
+ }
+}
diff --git a/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_scale_tab.xml b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_scale_tab.xml
new file mode 100644
index 0000000..1533d51
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_scale_tab.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab.xml b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab.xml
new file mode 100644
index 0000000..9a46415
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_bottom.xml b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_bottom.xml
new file mode 100644
index 0000000..229e640
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_bottom.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_left.xml b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_left.xml
new file mode 100644
index 0000000..dd9c729
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_left.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_right.xml b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_right.xml
new file mode 100644
index 0000000..0d65d85
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_right.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_segment.xml b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_segment.xml
new file mode 100644
index 0000000..6d36a01
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_segment.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_top.xml b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_top.xml
new file mode 100644
index 0000000..68478b6
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/res/layout/layout_tab_top.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FlycoTabLayoutZ_Lib/src/main/res/values/attrs.xml b/FlycoTabLayoutZ_Lib/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..324c0ca
--- /dev/null
+++ b/FlycoTabLayoutZ_Lib/src/main/res/values/attrs.xml
@@ -0,0 +1,319 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 440fdc7..3c83bbe 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -15,8 +15,8 @@ android {
applicationId "com.uiuios.aios"
minSdkVersion 24
targetSdkVersion 29
- versionCode 48
- versionName "5.7"
+ versionCode 49
+ versionName "5.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -189,6 +189,8 @@ dependencies {
// implementation 'io.github.lucksiege:pictureselector:v2.5.8'
//验证码输入
// implementation 'com.jacktuotuo.customview:verificationcodeview:1.0.5'
+// implementation project(path: ':FlycoTabLayoutZ_Lib')
+ implementation 'com.github.wuao:FlycoTabLayout2:Tag1.1.3'
implementation 'com.contrarywind:Android-PickerView:4.1.9'
implementation 'com.github.ForgetAll:LoadingDialog:v1.1.2'
//动态权限框架
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e19195f..380fc68 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -204,6 +204,7 @@
{
private static final String TAG = PhoneActivity.class.getSimpleName();
+ private String[] title = new String[]{"通话", "记录", "联系人"};
private FragmentManager mFragmentManager;
private CustomPagerAdapter mCustomPagerAdapter;
private List mFragments;
- private ContactFragment mContactFragment;
private DialerFragment mDialerFragment;
private RecordFragment mRecordFragment;
+ private ContactFragment mContactFragment;
@Override
protected int getLayoutId() {
@@ -44,20 +45,25 @@ public class PhoneActivity extends BaseMvvmActivity();
- if (mContactFragment == null) {
- mContactFragment = new ContactFragment();
- }
- mFragments.add(mContactFragment);
+
if (mDialerFragment == null) {
mDialerFragment = new DialerFragment();
}
mFragments.add(mDialerFragment);
+
if (mRecordFragment == null) {
mRecordFragment = new RecordFragment();
}
mFragments.add(mRecordFragment);
+
+ if (mContactFragment == null) {
+ mContactFragment = new ContactFragment();
+ }
+ mFragments.add(mContactFragment);
+
mCustomPagerAdapter = new CustomPagerAdapter(mFragmentManager, mFragments, getLifecycle());
mViewDataBinding.viewPager.setAdapter(mCustomPagerAdapter);
+ mViewDataBinding.slidingTabLayout.setViewPager(mViewDataBinding.viewPager, title);
}
@Override
@@ -78,6 +84,7 @@ public class PhoneActivity extends BaseMvvmActivity {
+ private static final String TAG = CallRecordAdapter.class.getSimpleName();
+
private Context mContext;
private List mRecordsInfoList;
@@ -82,10 +85,15 @@ public class CallRecordAdapter extends RecyclerView.Adapter>() {
@Override
public void onChanged(List contacts) {
@@ -95,6 +91,13 @@ public class ContactFragment extends BaseMvvmFragment {
+public class DialerFragment extends BaseMvvmFragment {
private static final String TAG = DialerFragment.class.getSimpleName();
private Context mContext;
@@ -39,7 +41,7 @@ public class DialerFragment extends BaseMvvmFragment {
+public class DialerViewModel extends BaseViewModel {
@Override
- public FragmentDialerBinding getVDBinding() {
+ public FragmentDialerNewBinding getVDBinding() {
return binding;
}
@@ -16,5 +16,4 @@ public class DialerViewModel extends BaseViewModelR1W1XpgiQ$|AmG9hk`W>#6Ow_1rGS8lK7ka9
zLP3367nC9h3PyuQMM1RCiiNrWLL+&K3q}jFC{3*R-XG65-^~1$@0@e*{oV6@Gkb#q
zeGT-?^#A}c@b_Z`YsMh$ql4AFiwxDZn!yb5jzB`-9f+7Ega8i?91DT|JXRbO46!(=
zNw*<40GNa0hDIO}%m5l2<`Gz03_-#ZXxISYwoW2ou@fK!jD_O3d^+y+<*PW5%c0}K
zDNGVm;048V{nCU`NLpYhJ1v3j%E7H$3%W^Y8UY@Jus{hfkuRc2=(tb1G|gPQO~iqp
zAV>lo_jghe%plMU7D6C};N-w2k;x#HN+7SHP^skApd*RwNF-@)ssniqjY6e4I)k4t
zoFE62)RMLF`0;g>gi(tE;P4!_m<}gK!X~@)4HAfiJ?(
zDli}sTgVk4T$m4P6I7RY4&e<+Xl
z1ua5?q5tIjKZQl1sRD=?42j@mAzRb99e8ah0nJMYu@G1o3d4!Brx+9uBd{nQ7JyzM
zRB%N&m(PL4qLrWUOeW2rFG5&+HssHs<1`8cE|)_id#`aKlc+vUYaA(LvbT??i=(3}
zgW}}uMW%SWI8$f2449qFgZRiSm-B_|O!_KUYXzP_6PW=CxhW9GM+o!4PbJg1U(bc{
zRlUz#&R27xdViHm)FeaHHuk?7J-elGk9PXSwwlEk<3oIn+l3li|2Y%h2>=+WKf@zb
z^6$V8*fMr|{Z^Y?)ZcT>-mJiM+KYvgUEZ^Jm9P1$M{f9xqf2{TYlHa|^yv+9k<
zqj?skVcj}@_wsxS%NQj+KZIH9W9R5mR%ZUh+AWph3ODU*!oIN_TOHWc*x2{%?xFNJ
z)sgAOO75lcs)5cvnRvLfqU2uhS-k
z=QnED!!GE|MS8v(lpT;4$#b@ssIqpH-f1k)B-oZE644RF2av2U81T8v~xk1eR9?2%Vy?0akly7@hN
zxp+fk>q&~jXCetMos&lxir8w`zkR~fSYfVasdwi2*4UjgzltI(&+?AS
z8RhO(Ha#Y0C#eD1;=#=)l&0h6F*5y-B{tJrZDj}2F@mPM4u7n$x@o5xX#w6Zm{@Cc
z#6{IvfmZGs4m7Gu8Ma7lQwMa>3{Q7+AFAfo-}%KX-`eTGSx*$TBV*IHmS)}Z4CD8E
z9&h+HDtstGbT{@6f>LwG!wwB5I|F;mW}@d;M`K^8XGr5G>u=Am*EK&<2E`+K@CsC7C;8XsW?_px8%Z6y(yoBj_YM0G8a;Su*>*kbhihZY
z%ks{-n?67*$Ge{E!OSA-vaz~d2eD=OZ>!2Gjlt-&pUApaxd~Q5R>73iAD1ff{6|eK
z#eLb|w`1G)sM1QGB=s5u6?-nx;Q;)+nN`^9=!MsJ<{HOD&aI32Z40W$XH+kYhXtbx
zFFE9d*Oza>%#l0isJ7OaKA{`B^**z*)>sZrCChHnVuat
zJu$_bZvm?6oiA^+d0}2ZH!2T*HgG%&&JsS3YLlQMM1F_V8!J@^O{2VmRQ4eL=2)TKJctz@huD!IlcM^c13tat3G
z)O~t4YFX}1`rJjO`lAx5q3MF8a#W@TVubZ_>i~RnU);iaDdT;edKvjhK|86ytD-`u
zX5+zX{hZ%nOuIOx*mu#X+9Xzr0SLPs51IMJa_H#Y1#yuUjnU1~+(MfuHiT&(sR};n
zk-=_JOEZnbLI7d%KbsNDL|2cDOoP!&50i~w)`y~RM;)D9JCVa(w5i61vufZcdWsd0jV#
zQbD9Hnff5i0$YGPW37$dKj*tGOY}Ux%%$o=m-wncJjS}*etx5=!oj_Vp#Bb*CuRuS
z0#JeAxAPed1yAhkR99Po_Mr_&7M6A`LCG6SM$Qw)Z|O~kz3(q@vdI_w2&+=yRp*6<
zg%{ns#ryLX^%p2p8l+kKWYY)YCo?bfXg~Nu`-@^(Z9g^tUE#8&Hrc&4vi-6NRmJ^<
z${*i$D}VOul~9?MqFg0uaLh|y9W${vAbG8mj#XO+Mv)#j=@Io?(9`b68E^Z-;xp_6
zVjtO`J1KwfURU#8xGS9S>?0bzx{Hr5I^i8V@yWzEyGV
z{QAVh_VySUaIbM(h>v-DL+6#}$32G1e=Jwr>78KB&D9yap;Hw~@V#-Oe9~pV>_AKM
s_6(2VGZk&D>AZJ;kUHm;DYDS|K*IfWsawb3S?&Ldzjq+xtY=KlUov&lUjP6A
literal 0
HcmV?d00001
diff --git a/app/src/main/res/drawable/add_contact_confirm_background.xml b/app/src/main/res/drawable/add_contact_confirm_background.xml
new file mode 100644
index 0000000..c9e83b8
--- /dev/null
+++ b/app/src/main/res/drawable/add_contact_confirm_background.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/add_wechat_contact_background.xml b/app/src/main/res/drawable/add_wechat_contact_background.xml
new file mode 100644
index 0000000..ecbf7e6
--- /dev/null
+++ b/app/src/main/res/drawable/add_wechat_contact_background.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bt_dialer_background.xml b/app/src/main/res/drawable/bt_dialer_background.xml
new file mode 100644
index 0000000..105ac18
--- /dev/null
+++ b/app/src/main/res/drawable/bt_dialer_background.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bt_dialer_other_background.xml b/app/src/main/res/drawable/bt_dialer_other_background.xml
new file mode 100644
index 0000000..7c1ae6e
--- /dev/null
+++ b/app/src/main/res/drawable/bt_dialer_other_background.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/contact_adapter_bg.xml b/app/src/main/res/drawable/contact_adapter_bg.xml
new file mode 100644
index 0000000..a4469ed
--- /dev/null
+++ b/app/src/main/res/drawable/contact_adapter_bg.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/contact_add_contact_bg.xml b/app/src/main/res/drawable/contact_add_contact_bg.xml
new file mode 100644
index 0000000..0ea83e7
--- /dev/null
+++ b/app/src/main/res/drawable/contact_add_contact_bg.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dialer_call_bg.xml b/app/src/main/res/drawable/dialer_call_bg.xml
index 39dce6e..2059a8e 100644
--- a/app/src/main/res/drawable/dialer_call_bg.xml
+++ b/app/src/main/res/drawable/dialer_call_bg.xml
@@ -1,9 +1,14 @@
-
+
-
+
+
+
diff --git a/app/src/main/res/drawable/seekbar_progress_default.xml b/app/src/main/res/drawable/seekbar_progress_default.xml
index 30e5bfb..47fed2c 100644
--- a/app/src/main/res/drawable/seekbar_progress_default.xml
+++ b/app/src/main/res/drawable/seekbar_progress_default.xml
@@ -36,7 +36,7 @@
-
+
diff --git a/app/src/main/res/layout-land/activity_phone.xml b/app/src/main/res/layout-land/activity_phone.xml
index dd2caac..44e9815 100644
--- a/app/src/main/res/layout-land/activity_phone.xml
+++ b/app/src/main/res/layout-land/activity_phone.xml
@@ -16,6 +16,22 @@
android:layout_height="match_parent"
android:background="@drawable/bg_aero">
+
+
+ android:layout_height="match_parent">
+
+
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/sliding_tab_layout"
+ tools:layout_editor_absoluteX="27dp" />
diff --git a/app/src/main/res/layout-port/fragment_home.xml b/app/src/main/res/layout-port/fragment_home.xml
index 1ac1ecb..53a08b4 100644
--- a/app/src/main/res/layout-port/fragment_home.xml
+++ b/app/src/main/res/layout-port/fragment_home.xml
@@ -52,7 +52,6 @@
app:layout_constraintTop_toTopOf="parent"
tools:text="00:00" />
-
@@ -32,15 +31,17 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="新建联系人"
- android:textColor="@color/default_text_color"
- android:textSize="@dimen/sp_18"
+ android:textColor="@color/white"
+ android:textSize="@dimen/sp_22"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toEndOf="@+id/iv_cancel"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_add_wechat_contact.xml b/app/src/main/res/layout/activity_add_wechat_contact.xml
index d7ae28e..d730cbe 100644
--- a/app/src/main/res/layout/activity_add_wechat_contact.xml
+++ b/app/src/main/res/layout/activity_add_wechat_contact.xml
@@ -14,7 +14,7 @@
+ android:background="#404146">
@@ -42,231 +42,301 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:text="新建微信联系人"
- android:textColor="@color/default_text_color"
+ android:textColor="@color/white"
android:textSize="@dimen/sp_22"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/fragment_contact.xml b/app/src/main/res/layout/fragment_contact.xml
index 04e4cd1..ea57725 100644
--- a/app/src/main/res/layout/fragment_contact.xml
+++ b/app/src/main/res/layout/fragment_contact.xml
@@ -6,6 +6,9 @@
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+ android:layout_height="@dimen/dp_72"
+ android:layout_weight="2"
+ android:background="@drawable/contact_add_contact_bg"
+ android:onClick="@{click::add}"
+ app:layout_constraintBottom_toBottomOf="parent">
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_dialer_new.xml b/app/src/main/res/layout/fragment_dialer_new.xml
new file mode 100644
index 0000000..cfa946c
--- /dev/null
+++ b/app/src/main/res/layout/fragment_dialer_new.xml
@@ -0,0 +1,525 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_record.xml b/app/src/main/res/layout/fragment_record.xml
index 40ec807..6e97deb 100644
--- a/app/src/main/res/layout/fragment_record.xml
+++ b/app/src/main/res/layout/fragment_record.xml
@@ -27,10 +27,10 @@
@@ -40,7 +40,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
- android:textSize="@dimen/sp_18"
+ android:textSize="@dimen/sp_22"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="name" />
@@ -56,32 +56,33 @@
app:layout_constraintTop_toBottomOf="@+id/tv_name"
tools:text="12345665432" />
+
+
-
-
+ app:layout_constraintTop_toTopOf="parent" />
+
+ />
+ android:layout_marginStart="@dimen/dp_16"
+ app:layout_constraintBottom_toBottomOf="@+id/iv_head"
+ app:layout_constraintEnd_toStartOf="@+id/iv_sim"
+ app:layout_constraintStart_toEndOf="@+id/iv_head"
+ app:layout_constraintTop_toTopOf="@+id/iv_head">