Skip to content

Commit

Permalink
update RxTitle.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamsiree committed Feb 20, 2020
1 parent 01b2e33 commit c152b54
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 61 deletions.
10 changes: 5 additions & 5 deletions RxUI/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 16
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
Expand All @@ -23,17 +23,17 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion = '29.0.2'
buildToolsVersion = '29.0.3'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
compileOnly 'androidx.appcompat:appcompat:1.0.0'
compileOnly 'androidx.appcompat:appcompat:1.1.0'
compileOnly 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
compileOnly 'androidx.recyclerview:recyclerview:1.0.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
compileOnly 'androidx.recyclerview:recyclerview:1.1.0'
//cardView包
compileOnly 'androidx.cardview:cardview:1.0.0'
compileOnly project(':RxKit')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import com.tamsiree.rxui.view.dialog.RxDialogTool;


import static android.content.Context.LOCATION_SERVICE;


/**
* @author tamsiree
*/
Expand Down Expand Up @@ -46,7 +49,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void initGPS() {
mLocationManager = (LocationManager) this.getSystemService(LOCATION_SERVICE);
mLocationManager = (LocationManager) mContext.getSystemService(LOCATION_SERVICE);
}

//----------------------------------------------------------------------------------------------检测GPS是否已打开 start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ protected void onSaveInstanceState(Bundle paramBundle) {
public void onConfigurationChanged(Configuration newConfig) {
try {
super.onConfigurationChanged(newConfig);
if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
if (mContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
Log.v("Himi", "onConfigurationChanged_ORIENTATION_LANDSCAPE");
} else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
} else if (mContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
Log.v("Himi", "onConfigurationChanged_ORIENTATION_PORTRAIT");
}
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.tamsiree.rxui.view.likeview.tools.ei.RxEase;
import com.tamsiree.rxui.view.likeview.tools.ei.RxEasingInterpolator;


/**
* @author tamsiree
* @date 2016/7/5 下午5:09
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class RxTextAutoZoom extends AppCompatEditText {
private boolean initiallized = false;
private TextPaint paint;

private interface SizeTester {
public interface SizeTester {
/**
* AutoFitEditText
*
Expand Down
61 changes: 52 additions & 9 deletions RxUI/src/main/java/com/tamsiree/rxui/view/RxTitle.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
Expand All @@ -13,6 +14,9 @@
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.tamsiree.rxtool.RxDataTool;
import com.tamsiree.rxtool.RxImageTool;
import com.tamsiree.rxtool.RxKeyboardTool;
Expand All @@ -26,14 +30,17 @@
public class RxTitle extends FrameLayout {
//*******************************************控件start******************************************
//根布局
private RelativeLayout mRootLayout;
private LinearLayout mRootLayout;

//Title的TextView控件
private RxTextAutoZoom mTvTitle;

//左边布局
private LinearLayout mLlLeft;

//左边ImageView控件的背景
private LinearLayout mllIconLeftBg;

//左边ImageView控件
private ImageView mIvLeft;

Expand All @@ -43,6 +50,9 @@ public class RxTitle extends FrameLayout {
//右边布局
private LinearLayout mLlRight;

//左边ImageView控件的背景
private LinearLayout mllIconRightBg;

//右边ImageView控件
private ImageView mIvRight;

Expand All @@ -63,18 +73,14 @@ public class RxTitle extends FrameLayout {
//Title是否显示
private boolean mTitleVisibility;

//------------------------------------------左侧布局---------------------------------------------

//左边 ICON 引用的资源ID
private int mLeftIcon;

//右边 ICON 引用的资源ID
private int mRightIcon;

//左边 ICON 是否显示
private boolean mLeftIconVisibility;

//右边 ICON 是否显示
private boolean mRightIconVisibility;

//左边文字
private String mLeftText;

Expand All @@ -87,9 +93,17 @@ public class RxTitle extends FrameLayout {
//左边文字是否显示
private boolean mLeftTextVisibility;

//--------------------------------------------右侧布局-------------------------------------------

//右边 ICON 引用的资源ID
private int mRightIcon;

//右边文字
private String mRightText;

//右边 ICON 是否显示
private boolean mRightIconVisibility;

//右边字体颜色
private int mRightTextColor;

Expand All @@ -98,10 +112,12 @@ public class RxTitle extends FrameLayout {

//右边文字是否显示
private boolean mRightTextVisibility;

//===========================================属性end=============================================

public RxTitle(Context context) {
super(context);
initView(context, null);
}

public RxTitle(Context context, AttributeSet attrs) {
Expand All @@ -110,12 +126,29 @@ public RxTitle(Context context, AttributeSet attrs) {
initView(context, attrs);
}

public RxTitle(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context, attrs);
}

public RxTitle(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
initView(context, attrs);
}

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
}

private void initView(final Context context, AttributeSet attrs) {
LayoutInflater.from(context).inflate(R.layout.include_rx_title, this);

mRootLayout = findViewById(R.id.root_layout);
mTvTitle = findViewById(R.id.tv_rx_title);
mLlLeft = findViewById(R.id.ll_left);
mllIconLeftBg = findViewById(R.id.ll_icon_left_bg);
mllIconRightBg = findViewById(R.id.ll_icon_right_bg);
mIvLeft = findViewById(R.id.iv_left);
mIvRight = findViewById(R.id.iv_right);
mLlRight = findViewById(R.id.ll_right);
Expand All @@ -138,7 +171,7 @@ private void initView(final Context context, AttributeSet attrs) {
mTitleVisibility = a.getBoolean(R.styleable.RxTitle_titleVisibility, true);

//左边图标
mLeftIcon = a.getResourceId(R.styleable.RxTitle_leftIcon, R.drawable.previous_icon);
mLeftIcon = a.getResourceId(R.styleable.RxTitle_leftIcon, R.drawable.ic_back);
//右边图标
mRightIcon = a.getResourceId(R.styleable.RxTitle_rightIcon, R.drawable.set);
//左边图标是否显示
Expand All @@ -160,6 +193,7 @@ private void initView(final Context context, AttributeSet attrs) {
mRightTextSize = a.getDimensionPixelSize(R.styleable.RxTitle_rightTextSize, RxImageTool.dip2px(8));
mRightTextVisibility = a.getBoolean(R.styleable.RxTitle_rightTextVisibility, false);


} finally {
//回收这个对象
a.recycle();
Expand Down Expand Up @@ -234,7 +268,7 @@ private void initAutoFitEditText() {

//**********************************************************************************************以下为get方法

public RelativeLayout getRootLayout() {
public LinearLayout getRootLayout() {
return mRootLayout;
}

Expand Down Expand Up @@ -270,6 +304,14 @@ public boolean isTitleVisibility() {
return mTitleVisibility;
}

public LinearLayout getMllIconLeftBg() {
return mllIconLeftBg;
}

public LinearLayout getMllIconRightBg() {
return mllIconRightBg;
}

public void setTitleVisibility(boolean titleVisibility) {
mTitleVisibility = titleVisibility;
if (mTitleVisibility) {
Expand Down Expand Up @@ -479,4 +521,5 @@ public void setRightIconOnClickListener(OnClickListener onClickListener) {
}
//==============================================================================================以上为set方法


}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tamsiree.rxui.view.dialog;


import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
Expand Down
Binary file added RxUI/src/main/res/drawable-xhdpi/ic_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c152b54

Please sign in to comment.