├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── penta
│ │ └── anchorart
│ │ ├── Anchor.java
│ │ ├── MainActivity.java
│ │ ├── ObservableScrollView.java
│ │ └── TabLayoutUtil.java
│ └── res
│ ├── layout
│ ├── activity_main.xml
│ └── author.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-mdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gif
└── ezgif.com-video-to-gif.gif
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 1.6
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | 1.8
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AnchorArt
2 | TabLayout+ScrollView 实现各种电商详情页的锚点功能
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 | defaultConfig {
7 | applicationId "com.penta.anchorart"
8 | minSdkVersion 14
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:25.3.1'
28 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
29 | testCompile 'junit:junit:4.12'
30 | compile 'com.android.support:design:25.3.1'
31 | }
32 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/root1/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/penta/anchorart/Anchor.java:
--------------------------------------------------------------------------------
1 | package com.penta.anchorart;
2 |
3 | import android.content.Context;
4 | import android.support.design.widget.TabLayout;
5 | import android.view.MotionEvent;
6 | import android.view.View;
7 |
8 | import java.util.List;
9 |
10 |
11 | public class Anchor implements TabLayout.OnTabSelectedListener, ObservableScrollView.ScrollViewListener, View.OnTouchListener {
12 |
13 | /**
14 | * 内部的tab
15 | */
16 | private TabLayout mInside_tab;
17 | /**
18 | * 外部的tab
19 | */
20 | private TabLayout mOutside_tab;
21 |
22 | private ObservableScrollView mScrollView;
23 | /**
24 | * 锚点集合
25 | */
26 | private List mAimingPointList;
27 |
28 | private Context mContext;
29 | /**
30 | * ScrollView 的滑动状态
31 | */
32 | private int state = MotionEvent.ACTION_UP;
33 | /**
34 | * 覆盖的高度(顶部预留的高度 包括TabLayout 以及自定义的头部)
35 | */
36 | private float mCoverHeight;
37 | private float mTabHeight;
38 |
39 | boolean forceScroll = false;//手动滚动标识 避免点击Tab时 scrollTo 导致循环改变Tab选择的问题
40 |
41 | /**
42 | * @param inside_tab 内部Tab
43 | * @param outside_tab 外部Tab
44 | * @param scrollView scrollView
45 | * @param aimingPointList 定位的锚点集合
46 | * @param coverHeight 覆盖在scrollView上面的 布局总高度dp值
47 | */
48 | public Anchor(TabLayout inside_tab, TabLayout outside_tab, ObservableScrollView scrollView, List aimingPointList,
49 | Context context, float coverHeight, float mTabHeight) {
50 | this.mInside_tab = inside_tab;
51 | this.mOutside_tab = outside_tab;
52 | this.mScrollView = scrollView;
53 | this.mAimingPointList = aimingPointList;
54 | this.mContext = context;
55 | this.mCoverHeight = TabLayoutUtil.dip2px(mContext, coverHeight);
56 | this.mTabHeight = TabLayoutUtil.dip2px(mContext, mTabHeight);
57 |
58 | mOutside_tab.setOnTabSelectedListener(this);
59 | mInside_tab.setOnTabSelectedListener(this);
60 | mScrollView.setScrollViewListener(this);
61 | mScrollView.setOnTouchListener(this);
62 |
63 | mOutside_tab.post(new Runnable() {
64 | @Override
65 | public void run() {
66 | TabLayoutUtil.setIndicator(mContext, mOutside_tab);
67 | }
68 | });
69 | mInside_tab.post(new Runnable() {
70 | @Override
71 | public void run() {
72 | TabLayoutUtil.setIndicator(mContext, mInside_tab);
73 | }
74 | });
75 |
76 |
77 | }
78 |
79 | @Override
80 | public void onTabSelected(TabLayout.Tab tab) {
81 | int position = tab.getPosition();
82 | mOutside_tab.getTabAt(position).select();
83 | mInside_tab.getTabAt(position).select();
84 | //mOutside_tab.setVisibility(View.VISIBLE);
85 |
86 | //避免滚动的过程中点击tab
87 | if (state == MotionEvent.ACTION_UP) {
88 | forceScroll = true;
89 | mScrollView.smoothScrollTo(0, mAimingPointList.get(position).getTop() - (int) (mCoverHeight + mTabHeight));
90 |
91 | }
92 |
93 | }
94 |
95 | @Override
96 | public void onTabUnselected(TabLayout.Tab tab) {
97 | }
98 |
99 | @Override
100 | public void onTabReselected(TabLayout.Tab tab) {
101 | }
102 |
103 | @Override
104 | public void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy) {
105 | /**已经滑动的距离*/
106 | int scorlly = mScrollView.getScrollY();
107 | /**导航控制*/
108 | if (scorlly >= mInside_tab.getTop() || mInside_tab.getTop() - scorlly <= mCoverHeight) {
109 | mOutside_tab.setVisibility(View.VISIBLE);
110 | } else {
111 | mOutside_tab.setVisibility(View.GONE);
112 | }
113 | /**遍历锚点从最下面瞄点开始遍历,如果已经滑动的Y距离+tab layout高度大于锚点的top选中,选中该tab */
114 | if (!forceScroll) {
115 | for (int j = 0; j < mAimingPointList.size(); j++) {
116 | int index = mAimingPointList.size() - j - 1;
117 |
118 | int top = mAimingPointList.get(index).getTop();
119 |
120 | if (scorlly + mCoverHeight + mTabHeight >= top) {
121 | mInside_tab.getTabAt(index).select();
122 | mOutside_tab.getTabAt(index).select();
123 | return;
124 | }
125 |
126 | }
127 | } else {
128 | forceScroll = false;
129 | }
130 | }
131 |
132 | /**
133 | * 当前的触摸状态
134 | */
135 | @Override
136 | public boolean onTouch(View view, MotionEvent motionEvent) {
137 | state = motionEvent.getAction();
138 | return false;
139 | }
140 |
141 |
142 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/penta/anchorart/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.penta.anchorart;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.TabLayout;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 | import android.widget.TextView;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | public class MainActivity extends AppCompatActivity {
13 |
14 | //内部Tab
15 | private TabLayout mInside_tab;
16 | //外部Tab
17 | private TabLayout mOutside_tab;
18 |
19 | //TabLayout显示的文字
20 | private String[] pointText = new String[]{"商品描述", "图片", "评价详情"};
21 |
22 | //各个锚点
23 | private TextView tv_good_detail;
24 | private TextView tv_pic;
25 | private TextView tv_evaluate;
26 |
27 | //锚点容器
28 | private List mAimingPointList;
29 |
30 | //scrollView
31 | private ObservableScrollView mScrollView;
32 |
33 | @Override
34 | protected void onCreate(Bundle savedInstanceState) {
35 | super.onCreate(savedInstanceState);
36 | setContentView(R.layout.activity_main);
37 | initView();
38 | }
39 |
40 | private void initView() {
41 |
42 | mOutside_tab = (TabLayout) findViewById(R.id.outside_tab);
43 | mInside_tab = (TabLayout) findViewById(R.id.inside_tab);
44 | tv_good_detail = (TextView) findViewById(R.id.tv_good_detail);
45 | tv_pic = (TextView) findViewById(R.id.tv_pic);
46 | tv_evaluate = (TextView) findViewById(R.id.tv_evaluate);
47 | mScrollView = (ObservableScrollView) findViewById(R.id.sv_aiming_point);
48 |
49 | /**添加锚点到锚点列表*/
50 | mAimingPointList = new ArrayList<>();
51 | mAimingPointList.add(tv_good_detail);
52 | mAimingPointList.add(tv_pic);
53 | mAimingPointList.add(tv_evaluate);
54 |
55 | /**初始化tabLayout*/
56 | for (int i = 0; i < pointText.length; i++) {
57 | addAimingPoint(mInside_tab, pointText[i]);
58 | addAimingPoint(mOutside_tab, pointText[i]);
59 | }
60 |
61 | new Anchor(mInside_tab, mOutside_tab, mScrollView, mAimingPointList, this, 0, 50);
62 |
63 | }
64 |
65 | /**
66 | * 给TabLayout添加条目
67 | */
68 | public void addAimingPoint(TabLayout tabLayout, String text) {
69 | tabLayout.addTab(tabLayout.newTab().setText(text));
70 | }
71 |
72 |
73 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/penta/anchorart/ObservableScrollView.java:
--------------------------------------------------------------------------------
1 | package com.penta.anchorart;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ScrollView;
6 |
7 | /**
8 | * 可以监听滚动状态的ObservableScrollView
9 | */
10 | public class ObservableScrollView extends ScrollView {
11 | private ScrollViewListener scrollViewListener = null;
12 |
13 | public ObservableScrollView(Context context) {
14 | super(context);
15 | }
16 |
17 | public ObservableScrollView(Context context, AttributeSet attrs, int defStyle) {
18 | super(context, attrs, defStyle);
19 | }
20 |
21 | public ObservableScrollView(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public void setScrollViewListener(ScrollViewListener scrollViewListener) {
26 | this.scrollViewListener = scrollViewListener;
27 | }
28 |
29 | @Override
30 | protected void onScrollChanged(int x, int y, int oldx, int oldy) {
31 | super.onScrollChanged(x, y, oldx, oldy);
32 | if (scrollViewListener != null) {
33 | scrollViewListener.onScrollChanged(this, x, y, oldx, oldy);
34 | }
35 | }
36 |
37 | public interface ScrollViewListener {
38 | void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/penta/anchorart/TabLayoutUtil.java:
--------------------------------------------------------------------------------
1 | package com.penta.anchorart;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.res.Resources;
6 | import android.support.design.widget.TabLayout;
7 | import android.util.TypedValue;
8 | import android.view.View;
9 | import android.view.WindowManager;
10 | import android.widget.LinearLayout;
11 | import android.widget.TextView;
12 |
13 | import java.lang.reflect.Field;
14 |
15 | /**
16 | * Created by linyueyang on 10/26/17.
17 | */
18 |
19 | public class TabLayoutUtil {
20 | /**
21 | * 设置Tablayout下标随文字大小变化
22 | *
23 | * @param tabs
24 | */
25 | public static void setIndicator(Context context, TabLayout tabs) {
26 | try {
27 | WindowManager wm = ((Activity) context).getWindowManager();
28 | int windowWidth = wm.getDefaultDisplay().getWidth();//获取屏幕宽度
29 | int tabWidth = windowWidth / tabs.getTabCount();
30 | //拿到tabLayout的mTabStrip属性
31 | Field mTabStripField = tabs.getClass().getDeclaredField("mTabStrip");
32 | mTabStripField.setAccessible(true);
33 |
34 | LinearLayout mTabStrip = (LinearLayout) mTabStripField.get(tabs);
35 |
36 | //int dp10 =(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, Resources.getSystem().getDisplayMetrics());
37 |
38 | for (int i = 0; i < mTabStrip.getChildCount(); i++) {
39 | View tabView = mTabStrip.getChildAt(i);
40 |
41 | //拿到tabView的mTextView属性
42 | Field mTextViewField = tabView.getClass().getDeclaredField("mTextView");
43 | mTextViewField.setAccessible(true);
44 |
45 | TextView mTextView = (TextView) mTextViewField.get(tabView);
46 |
47 | tabView.setPadding(0, 0, 0, 0);
48 |
49 | //因为我想要的效果是 字多宽线就多宽,所以测量mTextView的宽度
50 | int width;
51 | width = mTextView.getWidth();
52 | if (width == 0) {
53 | mTextView.measure(0, 0);
54 | width = mTextView.getMeasuredWidth();
55 | }
56 |
57 | //设置tab左右间距为10dp 注意这里不能使用Padding 因为源码中线的宽度是根据 tabView的宽度来设置的
58 | LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) tabView.getLayoutParams();
59 | int margin = (tabWidth - width) / 2 - 1;
60 | params.width = width;
61 | params.leftMargin = margin;
62 | params.rightMargin = margin;
63 | tabView.setLayoutParams(params);
64 | tabView.invalidate();
65 | }
66 |
67 | } catch (NoSuchFieldException e) {
68 | e.printStackTrace();
69 | } catch (IllegalAccessException e) {
70 | e.printStackTrace();
71 | }
72 | }
73 |
74 | /**
75 | * 设置下标的宽度(左右的margin)
76 | *
77 | * @param tabs
78 | * @param leftDip
79 | * @param rightDip
80 | */
81 | public static void setIndicator(TabLayout tabs, int leftDip, int rightDip) {
82 | Class> tabLayout = tabs.getClass();
83 | Field tabStrip = null;
84 | try {
85 | tabStrip = tabLayout.getDeclaredField("mTabStrip");
86 | } catch (NoSuchFieldException e) {
87 | e.printStackTrace();
88 | }
89 | tabStrip.setAccessible(true);
90 | LinearLayout llTab = null;
91 | try {
92 | llTab = (LinearLayout) tabStrip.get(tabs);
93 | } catch (IllegalAccessException e) {
94 | e.printStackTrace();
95 | }
96 | int left = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, leftDip, Resources.getSystem().getDisplayMetrics());
97 | int right = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, rightDip, Resources.getSystem().getDisplayMetrics());
98 | for (int i = 0; i < llTab.getChildCount(); i++) {
99 | View child = llTab.getChildAt(i);
100 | child.setPadding(0, 0, 0, 0);
101 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1);
102 | params.leftMargin = left;
103 | params.rightMargin = right;
104 | child.setLayoutParams(params);
105 | child.invalidate();
106 | }
107 | }
108 |
109 | /**
110 | * 将dip或dp值转换为px值,保证尺寸大小不变
111 | *
112 | * @param context
113 | * @param dipValue
114 | * @return
115 | */
116 | public static int dip2px(Context context, float dipValue) {
117 | final float scale = context.getResources().getDisplayMetrics().density;
118 | return (int) (dipValue * scale + 0.5f);
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
15 |
16 |
20 |
21 |
29 |
30 |
38 |
39 |
40 |
49 |
50 |
58 |
59 |
68 |
69 |
77 |
78 |
87 |
88 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
115 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/author.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
21 |
22 |
30 |
31 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 | #000000
8 | #FFFFFF
9 | #fffafa
10 | #fffaf0
11 | #ffebcd
12 | #f8f8ff
13 | #f5f5f5
14 | #faebd7
15 | #ffdead
16 | #808080
17 | #dcdcdc
18 | #d3d3d3
19 | #a9a9a9
20 | #696969
21 | #708090
22 | #778899
23 | #2f4f4f
24 | #c0c0c0
25 |
26 | #ff0000
27 | #8b0000
28 | #dc143c
29 | #8b008b
30 | #ff00ff
31 | #ff6347
32 | #f08080
33 | #e9967a
34 | #ffdab9
35 | #dda0dd
36 | #ffc0cb
37 | #ffb6c1
38 | #ff1493
39 | #ff69b4
40 | #fff0f5
41 | #cd5c5c
42 | #bc8f8f
43 | #b22222
44 | #800000
45 | #f0fff0
46 | #ff4500
47 | #ffa500
48 | #32cd32
49 | #00ff00
50 | #ffff00
51 | #f5deb3
52 | #f0e68c
53 | #deb887
54 | #ffe4c4
55 | #ffffe0
56 | #b8860b
57 | #ff8c00
58 | #fafad2
59 | #fffacd
60 | #fff8dc
61 | #fff5ee
62 | #ffefd5
63 | #ffe4e1
64 | #ffe4b5
65 | #fffff0
66 | #ffd700
67 | #daa520
68 | #ffa07a
69 | #ff7f50
70 | #f5fffa
71 | #f5f5dc
72 | #f4a460
73 | #fdf5e6
74 | #faf0e6
75 | #fa8072
76 | #d8bfd8
77 | #d2b48c
78 | #d2691e
79 | #cd853f
80 | #bdb76b
81 | #eee8aa
82 | #a52a2a
83 | #8b4513
84 | #a0522d
85 | #808000
86 | #7fff00
87 | #adff2f
88 | #008000
89 | #006400
90 | #556b2f
91 | #6b8e23
92 | #7cfc00
93 | #228b22
94 | #7fffd4
95 | #afeeee
96 | #98fb98
97 | #48d1cc
98 | #66cdaa
99 | #00ffff
100 | #00ff7f
101 | #00fa9a
102 | #00ced1
103 | #2e8b57
104 | #90ee90
105 | #8fbc8f
106 | #40e0d0
107 | #00ffff
108 | #008b8b
109 | #e0ffff
110 | #008080
111 | #4b0082
112 | #0000ff
113 | #00008b
114 | #0000cd
115 | #191970
116 | #000080
117 | #4169e1
118 | #f0ffff
119 | #87ceeb
120 | #00bfff
121 | #87cefa
122 | #20b2aa
123 | #add8e6
124 | #b0e0e6
125 | #f0f8ff
126 | #7b68ee
127 | #6a5acd
128 | #483d8b
129 | #3cb371
130 | #4682b4
131 | #b0c4de
132 | #6495ed
133 | #1e90ff
134 | #5f9ea0
135 | #8a2be2
136 | #800080
137 | #e6e6fa
138 | #da70d6
139 | #9370db
140 | #9932cc
141 | #ee82ee
142 | #c71585
143 | #db7093
144 | #9400d3
145 | #ba55d3
146 |
147 | #6bac89
148 | #e9e4b5
149 | #df8285
150 | #fadb78
151 | #b6c87c
152 |
153 |
154 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AnchorArt
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/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:2.3.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 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gif/ezgif.com-video-to-gif.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/gif/ezgif.com-video-to-gif.gif
--------------------------------------------------------------------------------
/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 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LinLeyang/AnchorArt/3205cea5f626fe11f04ad9c1f5b4562428154642/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Oct 17 10:31:56 CST 2017
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-3.3-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 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------