textview添加图片、平板通讯录页面返回bug修复

This commit is contained in:
adam 2022-06-23 18:00:07 +08:00
parent b23bd04f58
commit 3afce50abc
7 changed files with 35 additions and 12 deletions

View File

@ -159,15 +159,15 @@ public abstract class BaseActivity extends AppCompatActivity {
//判断是否是平板
public boolean isPad() {
// WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
// Display display = wm.getDefaultDisplay();
// DisplayMetrics dm = new DisplayMetrics();
// display.getRealMetrics(dm);
// double x = Math.pow(dm.widthPixels / dm.xdpi, 2);
// double y = Math.pow(dm.heightPixels / dm.ydpi, 2);
// double screenInches = Math.sqrt(x + y);//屏幕尺寸
// return screenInches >= 7.0;
return true;
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
DisplayMetrics dm = new DisplayMetrics();
display.getRealMetrics(dm);
double x = Math.pow(dm.widthPixels / dm.xdpi, 2);
double y = Math.pow(dm.heightPixels / dm.ydpi, 2);
double screenInches = Math.sqrt(x + y);//屏幕尺寸
return screenInches >= 7.0;
// return true;
}
protected boolean isNavBarHasShown(Context ctx) {

View File

@ -3,7 +3,10 @@ package com.tenlionsoft.baselib.core.widget.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.style.ImageSpan;
import android.util.AttributeSet;
import com.tenlionsoft.baselib.R;
@ -17,6 +20,7 @@ import androidx.annotation.Nullable;
* 描述:
*/
public class TypeFaceTextView extends androidx.appcompat.widget.AppCompatTextView {
private boolean mIsShowLine;//是否显示标题
public TypeFaceTextView(Context context) {
this(context, null);
@ -32,6 +36,7 @@ public class TypeFaceTextView extends androidx.appcompat.widget.AppCompatTextVie
super(context, attrs, defStyleAttr);
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TypeFaceTextView, defStyleAttr, 0);
int type = a.getInteger(R.styleable.TypeFaceTextView_text_type_cus, 0);
mIsShowLine = a.getBoolean(R.styleable.TypeFaceTextView_text_show_line, false);
if (type == 2) {
TextPaint paint = getPaint();
paint.setFakeBoldText(true);
@ -44,4 +49,16 @@ public class TypeFaceTextView extends androidx.appcompat.widget.AppCompatTextVie
setTypeface(typeface);
}
@Override
public void setText(CharSequence text, BufferType type) {
if (mIsShowLine) {
String content = " " + text;
SpannableString as = new SpannableString(content);
ImageSpan is = new ImageSpan(getContext(), R.drawable.ic_oa_flow_title_icon);
as.setSpan(is, 0, 1, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
super.setText(as, type);
} else {
super.setText(text, type);
}
}
}

View File

@ -21,6 +21,7 @@
<attr name="iconRight" format="reference" />
<attr name="duration_max" format="integer" />
<attr name="text_type_cus" format="integer" />
<attr name="text_show_line" format="boolean" />
<declare-styleable name="JCameraView">
<attr name="iconSize" />
<attr name="iconMargin" />
@ -32,6 +33,7 @@
<!--属性集合-->
<declare-styleable name="TypeFaceTextView">
<attr name="text_type_cus" />
<attr name="text_show_line" />
</declare-styleable>
<declare-styleable name="DiffuseView">
<attr name="diffuse_color" />

View File

@ -13,6 +13,7 @@ import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.text.Editable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.view.View;
import android.webkit.JavascriptInterface;
@ -215,6 +216,7 @@ public class OaFlowCenterActivity extends BaseActivity {
getOaFlowLog();
}
}
}

View File

@ -124,6 +124,7 @@ public class AddressListFragment extends BaseFragment {
setStateView(STATE_SUCCESS);
mSrlView.setEnableRefresh(false);
mSrlView.setEnableLoadMore(false);
mIvBack.setOnClickListener(v -> mMainActivity.backFragment(1, this));
boolean isSync = UserLgUtils.getIsSync();
if (isSync) {
initViews();
@ -137,7 +138,6 @@ public class AddressListFragment extends BaseFragment {
* 初始化页面
*/
private void initViews() {
mIvBack.setOnClickListener(v -> mMainActivity.backFragment(1, this));
mCsvState.setState(CustomStateView.STATE_LOAD);
mDatas = new ArrayList<>();
DeptDatabaseBean bean1 = new DeptDatabaseBean();

View File

@ -20,6 +20,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:background="@drawable/shp_rectangle_white_5"
android:minHeight="250dp">

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView
@ -11,8 +11,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
app:text_type_cus="2"
android:textColor="@color/black"
android:textSize="@dimen/text_14"
app:text_show_line="false"
app:text_type_cus="2"
tools:text="签批测试流程" />
</LinearLayout>