Skip to content

Commit

Permalink
移除expandabletextview模块
Browse files Browse the repository at this point in the history
  • Loading branch information
Z-P-J committed Feb 10, 2021
1 parent 9f454b1 commit d78b11e
Show file tree
Hide file tree
Showing 33 changed files with 344 additions and 512 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
2 changes: 0 additions & 2 deletions .idea/gradle.xml

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

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ dependencies {
// implementation project(':zmarkdown')
// implementation project(':richeditor')
// implementation project(':richeditor2')
implementation project(':expandabletextview')
// implementation project(':expandabletextview')
implementation project(':fragmentation')
implementation project(":fragmentation-dialog")

Expand Down
535 changes: 254 additions & 281 deletions app/proguardMapping.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public boolean onRedirect(int redirectCount, String redirectUrl) {
.userAgent(HttpApi.USER_AGENT)
.baseUrl("http://tt.shouji.com.cn")
.connectTimeout(10000)
.readTimeout(20000)
.readTimeout(10000)
.init();

ZDownloader.config(this, AppDownloadMission.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.ctetin.expandabletextviewlibrary.ExpandableTextView;
import com.ctetin.expandabletextviewlibrary.app.LinkType;
import com.zpj.fragmentation.dialog.impl.ImageViewerDialogFragment3;
import com.zpj.recyclerview.EasyViewHolder;
import com.zpj.recyclerview.IEasy;
Expand All @@ -43,6 +41,8 @@
import com.zpj.shouji.market.ui.widget.DownloadButton;
import com.zpj.shouji.market.ui.widget.DrawableTintTextView;
import com.zpj.shouji.market.ui.widget.count.IconCountView;
import com.zpj.shouji.market.ui.widget.expandabletextview.ExpandableTextView;
import com.zpj.shouji.market.ui.widget.expandabletextview.app.LinkType;
import com.zpj.shouji.market.ui.widget.ninegrid.NineGridView;
import com.zpj.shouji.market.ui.widget.emoji.EmojiExpandableTextView;
import com.zpj.toast.ZToast;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import android.view.LayoutInflater;
import android.view.View;

import com.ctetin.expandabletextviewlibrary.ExpandableTextView;
import com.ctetin.expandabletextviewlibrary.app.LinkType;
import com.zpj.recyclerview.EasyViewHolder;
import com.zpj.recyclerview.MultiData;
import com.zpj.recyclerview.MultiRecyclerViewWrapper;
Expand All @@ -22,6 +20,8 @@
import com.zpj.shouji.market.ui.multidata.AppGridListMultiData;
import com.zpj.shouji.market.ui.multidata.BaseHeaderMultiData;
import com.zpj.shouji.market.ui.multidata.ScreenShootMultiData;
import com.zpj.shouji.market.ui.widget.expandabletextview.ExpandableTextView;
import com.zpj.shouji.market.ui.widget.expandabletextview.app.LinkType;
import com.zpj.shouji.market.utils.EventBus;
import com.zpj.utils.ScreenUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.ctetin.expandabletextviewlibrary.ExpandableTextView;
import com.ctetin.expandabletextviewlibrary.app.LinkType;
import com.yanyusong.y_divideritemdecoration.Y_Divider;
import com.yanyusong.y_divideritemdecoration.Y_DividerBuilder;
import com.yanyusong.y_divideritemdecoration.Y_DividerItemDecoration;
Expand All @@ -22,6 +20,8 @@
import com.zpj.shouji.market.model.ClassificationItem;
import com.zpj.shouji.market.ui.fragment.ToolBarAppListFragment;
import com.zpj.shouji.market.ui.fragment.base.NextUrlFragment;
import com.zpj.shouji.market.ui.widget.expandabletextview.ExpandableTextView;
import com.zpj.shouji.market.ui.widget.expandabletextview.app.LinkType;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import android.view.View;
import android.widget.LinearLayout;

import com.ctetin.expandabletextviewlibrary.ExpandableTextView;
import com.ctetin.expandabletextviewlibrary.app.LinkType;
import com.zpj.shouji.market.R;
import com.zpj.shouji.market.manager.UserManager;
import com.zpj.shouji.market.ui.fragment.WebFragment;
import com.zpj.shouji.market.ui.widget.expandabletextview.ExpandableTextView;
import com.zpj.shouji.market.ui.widget.expandabletextview.app.LinkType;
import com.zpj.toast.ZToast;
import com.zpj.widget.checkbox.SmoothCheckBox;
import com.zpj.widget.editor.AccountInputView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import android.text.TextUtils;
import android.util.AttributeSet;

import com.ctetin.expandabletextviewlibrary.ExpandableTextView;
import com.ctetin.expandabletextviewlibrary.app.LinkType;
import com.lqr.emoji.MoonUtils;
import com.zpj.shouji.market.R;
import com.zpj.shouji.market.ui.fragment.WebFragment;
import com.zpj.shouji.market.ui.fragment.profile.ProfileFragment;
import com.zpj.shouji.market.ui.fragment.theme.TopicThemeListFragment;
import com.zpj.shouji.market.ui.widget.DotSpan;
import com.zpj.shouji.market.ui.widget.expandabletextview.ExpandableTextView;
import com.zpj.shouji.market.ui.widget.expandabletextview.app.LinkType;

public class EmojiExpandableTextView extends ExpandableTextView implements ExpandableTextView.OnLinkClickListener {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ctetin.expandabletextviewlibrary;
package com.zpj.shouji.market.ui.widget.expandabletextview;

import android.animation.ValueAnimator;
import android.content.Context;
Expand Down Expand Up @@ -31,17 +31,18 @@
import android.view.View;
import android.widget.TextView;

import com.ctetin.expandabletextviewlibrary.app.LinkType;
import com.ctetin.expandabletextviewlibrary.app.StatusType;
import com.ctetin.expandabletextviewlibrary.model.ExpandableStatusFix;
import com.ctetin.expandabletextviewlibrary.model.FormatData;
import com.ctetin.expandabletextviewlibrary.model.UUIDUtils;
import com.zpj.shouji.market.R;
import com.zpj.shouji.market.ui.widget.expandabletextview.app.LinkType;
import com.zpj.shouji.market.ui.widget.expandabletextview.app.StatusType;
import com.zpj.shouji.market.ui.widget.expandabletextview.model.ExpandableStatusFix;
import com.zpj.shouji.market.ui.widget.expandabletextview.model.FormatData;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand All @@ -52,13 +53,16 @@
* @author: cretin
* @email: mxnzp_life@163.com
* @desc: 一个支持展开 收起 网页链接 和 @用户 点击识别 的TextView
*
* from github: https://github.com/MZCretin/ExpandableTextView
* 对原库进行了一些修改
*/
public class ExpandableTextView extends AppCompatTextView {
private static final int DEF_MAX_LINE = 4;
public static String TEXT_CONTRACT = "收起";
public static String TEXT_EXPEND = "展开";
public static final String Space = " ";
public static String TEXT_TARGET = "网页链接";
public static String TEXT_TARGET = "链接";
public static final String IMAGE_TARGET = "图";
public static final String TARGET = IMAGE_TARGET + TEXT_TARGET;
public static final String DEFAULT_CONTENT = " ";
Expand Down Expand Up @@ -243,7 +247,7 @@ public void onViewDetachedFromWindow(View v) {
public void setMaxLines(int maxLines) {
super.setMaxLines(maxLines);
if (maxLines > 0) {
setOnTouchListener(new View.OnTouchListener() {
setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
Expand Down Expand Up @@ -284,11 +288,6 @@ public boolean onTouch(View v, MotionEvent event) {
}

private void init(Context context, AttributeSet attrs, int defStyleAttr) {
//适配英文版
TEXT_CONTRACT = context.getString(R.string.social_contract);
TEXT_EXPEND = context.getString(R.string.social_expend);
TEXT_TARGET = context.getString(R.string.social_text_target);

if (attrs != null) {
TypedArray a =
getContext().obtainStyledAttributes(attrs, R.styleable.ExpandableTextView,
Expand Down Expand Up @@ -323,12 +322,12 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr) {
Color.parseColor("#FF6200"));
mMentionTextColor = a.getColor(R.styleable.ExpandableTextView_ep_mention_color,
Color.parseColor("#FF6200"));
int resId = a.getResourceId(R.styleable.ExpandableTextView_ep_link_res, R.mipmap.link);
int resId = a.getResourceId(R.styleable.ExpandableTextView_ep_link_res, R.drawable.ic_link);
mLinkDrawable = getResources().getDrawable(resId);
currentLines = mLimitLines;
a.recycle();
} else {
mLinkDrawable = context.getResources().getDrawable(R.mipmap.link);
mLinkDrawable = getResources().getDrawable(R.drawable.ic_link);
}

mContext = context;
Expand Down Expand Up @@ -647,7 +646,6 @@ public void onClick(View widget) {
}
//处理链接或者@用户
List<FormatData.PositionData> positionDatas = formatData.getPositionDatas();
HH:
for (FormatData.PositionData data : positionDatas) {
if (ssb.length() >= data.getEnd()) {
if (data.getType().equals(LinkType.LINK_TYPE)) {
Expand Down Expand Up @@ -690,7 +688,7 @@ public void onClick(View widget) {
} else {
addMention(ssb, data, data.getEnd());
}
} else if (data.getType().equals(LinkType.TOPIC_TYPE)) {
} else if (data.getType().equals(LinkType.TOPIC_TYPE)) {
//如果需要展开
if (mNeedTopic && ignoreMore) {
int fitPosition = ssb.length() - getHideEndContent().length();
Expand Down Expand Up @@ -994,7 +992,7 @@ private FormatData formatData(CharSequence content) {
//解析数据
String aimSrt = result.substring(result.indexOf("[") + 1, result.indexOf("]"));
String contentSrt = result.substring(result.indexOf("(") + 1, result.indexOf(")"));
String key = UUIDUtils.getUuid(aimSrt.length());
String key = getUuid(aimSrt.length());
datasMention.add(new FormatData.PositionData(newResult.length() + 1, newResult.length() + 2 + aimSrt.length(), aimSrt, contentSrt, LinkType.SELF));
convert.put(key, aimSrt);
newResult.append(" " + key + " ");
Expand Down Expand Up @@ -1024,7 +1022,7 @@ private FormatData formatData(CharSequence content) {
newResult.append(" " + TARGET + " ");
} else {
String result = matcher.group();
String key = UUIDUtils.getUuid(result.length());
String key = getUuid(result.length());
datas.add(new FormatData.PositionData(newResult.length(), newResult.length() + 2 + key.length(), result, LinkType.LINK_TYPE));
convert.put(key, result);
newResult.append(" " + key + " ");
Expand Down Expand Up @@ -1520,4 +1518,14 @@ public void setExpandOrContractClickListener(OnExpandOrContractClickListener exp
this.expandOrContractClickListener = expandOrContractClickListener;
this.needRealExpandOrContract = needRealExpandOrContract;
}


private static String getUuid(int length) {
StringBuilder stringBuilder = new StringBuilder(UUID.randomUUID().toString());
while (stringBuilder.length() < length) {
stringBuilder.append(UUID.randomUUID().toString());
}
return stringBuilder.substring(0,length);
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ctetin.expandabletextviewlibrary.app;
package com.zpj.shouji.market.ui.widget.expandabletextview.app;

//定义类型的枚举类型
public enum LinkType {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ctetin.expandabletextviewlibrary.app;
package com.zpj.shouji.market.ui.widget.expandabletextview.app;

/**
* @date: on 2018/9/20
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.ctetin.expandabletextviewlibrary.model;
package com.zpj.shouji.market.ui.widget.expandabletextview.model;

import com.ctetin.expandabletextviewlibrary.app.StatusType;
import com.zpj.shouji.market.ui.widget.expandabletextview.app.StatusType;

/**
* @date: on 2018/9/20
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.ctetin.expandabletextviewlibrary.model;
package com.zpj.shouji.market.ui.widget.expandabletextview.model;

import com.ctetin.expandabletextviewlibrary.app.LinkType;
import com.zpj.shouji.market.ui.widget.expandabletextview.app.LinkType;

import java.util.List;

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_app_info_text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:background="?attr/backgroundColor"
android:padding="16dp">

<com.ctetin.expandabletextviewlibrary.ExpandableTextView
<com.zpj.shouji.market.ui.widget.expandabletextview.ExpandableTextView
android:id="@+id/tv_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_classification.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
android:layout_marginStart="16dp"
/>

<com.ctetin.expandabletextviewlibrary.ExpandableTextView
<com.zpj.shouji.market.ui.widget.expandabletextview.ExpandableTextView
android:id="@+id/tv_tags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@

</LinearLayout>

<com.ctetin.expandabletextviewlibrary.ExpandableTextView
<com.zpj.shouji.market.ui.widget.expandabletextview.ExpandableTextView
android:id="@+id/tv_support_users"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_theme2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@

</LinearLayout>

<com.ctetin.expandabletextviewlibrary.ExpandableTextView
<com.zpj.shouji.market.ui.widget.expandabletextview.ExpandableTextView
android:id="@+id/tv_support_users"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/layout_sign_up.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
android:layout_marginEnd="8dp"
/>

<com.ctetin.expandabletextviewlibrary.ExpandableTextView
<com.zpj.shouji.market.ui.widget.expandabletextview.ExpandableTextView
android:id="@+id/tv_agreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
39 changes: 39 additions & 0 deletions app/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,45 @@
<!-- <attr name="keepCount" format="boolean"/>-->
</declare-styleable>

<declare-styleable name="ExpandableTextView">
<!--保留的行数-->
<attr name="ep_max_line" format="integer" />
<!--是否需要展开-->
<attr name="ep_need_expand" format="boolean" />
<!--是否需要收起 这个是建立在开启展开的基础上的-->
<attr name="ep_need_contract" format="boolean" />
<!--是否需要@用户 -->
<attr name="ep_need_mention" format="boolean" />
<!--是否需要对链接进行处理 -->
<attr name="ep_need_link" format="boolean" />
<!--是否需要动画-->
<attr name="ep_need_animation" format="boolean" />
<!--是否需要永远将展开或者收回放置在最后边-->
<attr name="ep_need_always_showright" format="boolean" />
<!--是否需要将连接转换成网页链接显示 默认为true-->
<attr name="ep_need_convert_url" format="boolean" />
<!--是否需要自定义规则-->
<attr name="ep_need_self" format="boolean" />
<!--收起的文案-->
<attr name="ep_contract_text" format="string" />
<!--展开的文案-->
<attr name="ep_expand_text" format="string" />
<!--展开的文字的颜色-->
<attr name="ep_expand_color" format="color" />
<!--收起的文字的颜色-->
<attr name="ep_contract_color" format="color" />
<!--在收回和展开前面添加的内容的字体颜色-->
<attr name="ep_end_color" format="color" />
<!--链接的文字的颜色-->
<attr name="ep_link_color" format="color" />
<!--@用户的文字的颜色-->
<attr name="ep_mention_color" format="color" />
<!--自定义规则的文字的颜色-->
<attr name="ep_self_color" format="color" />
<!--链接的图标-->
<attr name="ep_link_res" format="reference" />
</declare-styleable>

<string-array name="default_wallpaper_tags">
<item>全部</item>
<item>壁纸</item>
Expand Down
1 change: 0 additions & 1 deletion expandabletextview/.gitignore

This file was deleted.

Loading

0 comments on commit d78b11e

Please sign in to comment.