Skip to content

Commit

Permalink
升级androidx
Browse files Browse the repository at this point in the history
修复无法在android studio渲染的问题
  • Loading branch information
LeonDevLifeLog committed Jan 8, 2020
1 parent 9aded5b commit 64694ae
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 81 deletions.
12 changes: 5 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
compileSdkVersion 28

defaultConfig {
applicationId "org.wuhenzhizao"
minSdkVersion 15
targetSdkVersion 25
targetSdkVersion 28
versionCode 2
versionName "1.1"

Expand All @@ -27,10 +26,9 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.jude:swipebackhelper:2.1.5'
implementation 'com.ogaclejapan.smarttablayout:library:1.6.1'
implementation 'com.ogaclejapan.smarttablayout:library:2.0.0'
implementation project(':library')
// compile 'com.wuhenzhizao:titlebar:1.1.4'
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13'
}
13 changes: 0 additions & 13 deletions app/src/androidTest/java/org/wuhenzhizao/ApplicationTest.java

This file was deleted.

4 changes: 2 additions & 2 deletions app/src/main/java/org/wuhenzhizao/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.Toast;

import androidx.viewpager.widget.ViewPager;

import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.wuhenzhizao.titlebar.utils.KeyboardConflictCompat;
import com.wuhenzhizao.titlebar.utils.ScreenUtils;
import com.wuhenzhizao.titlebar.widget.CommonTitleBar;

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/org/wuhenzhizao/QuickPreviewActivity.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.wuhenzhizao;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import androidx.annotation.Nullable;

import com.wuhenzhizao.titlebar.utils.KeyboardConflictCompat;
import com.wuhenzhizao.titlebar.widget.CommonTitleBar;

Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/org/wuhenzhizao/SwipeBackActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.jude.swipbackhelper.SwipeBackHelper;


/**
* Created by liufei on 2017/12/18.
*/
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/org/wuhenzhizao/TabFragment.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package org.wuhenzhizao;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

/**
* Created by liufei on 2017/12/1.
*/
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/org/wuhenzhizao/TabFragmentAdapter.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.wuhenzhizao;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

/**
* Created by liufei on 2017/12/1.
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_quick_preview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:background="#eeeeee"
android:overScrollMode="never">

<LinearLayout xmlns:titlebar="http://schemas.android.com/apk/res-auto"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
Expand Down Expand Up @@ -121,6 +121,7 @@
titlebar:fillStatusBar="false"
titlebar:leftType="imageButton"
titlebar:rightText="确定"
titlebar:centerSearchHint="搜索"
titlebar:rightType="textView" />

<com.wuhenzhizao.titlebar.widget.CommonTitleBar
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/content_center_custom_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
titlebar:rightCustomView="@layout/layout_custom_right"
titlebar:rightType="customView" />

<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.novoda:bintray-release:0.8.1'
classpath 'com.novoda:bintray-release:0.9.2'
}
}

Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
android.enableJetifier=true
android.useAndroidX=true
31 changes: 15 additions & 16 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
//apply plugin: 'com.novoda.bintray-release'

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
compileSdkVersion 28

defaultConfig {
minSdkVersion 15
targetSdkVersion 26
targetSdkVersion 28
versionCode 6
versionName "1.1.4"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

}

Expand All @@ -29,18 +28,18 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
implementation 'androidx.appcompat:appcompat:1.1.0'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13'
}

publish {
userOrg = 'wuhenzhizao'
groupId = 'com.wuhenzhizao'
artifactId = 'titlebar'
publishVersion = '1.1.4'
desc = '通用,功能全面的自定义标题栏,支持沉浸式标题栏,颜色渐变,miui9'
website = 'https://github.com/wuhenzhizao/android-titlebar'
}
//publish {
// userOrg = 'wuhenzhizao'
// groupId = 'com.wuhenzhizao'
// artifactId = 'titlebar'
// publishVersion = '1.1.4'
// desc = '通用,功能全面的自定义标题栏,支持沉浸式标题栏,颜色渐变,miui9'
// website = 'https://github.com/wuhenzhizao/android-titlebar'
//}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import androidx.annotation.ColorInt;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.UUID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ public class CommonTitleBar extends RelativeLayout implements View.OnClickListen

private static final int TYPE_CENTER_SEARCH_RIGHT_VOICE = 0;
private static final int TYPE_CENTER_SEARCH_RIGHT_DELETE = 1;
private String centerSearchHint;

public CommonTitleBar(Context context, AttributeSet attrs) {
super(context, attrs);
Expand Down Expand Up @@ -242,6 +243,7 @@ private void loadAttributes(Context context, AttributeSet attrs) {
centerSearchEditable = array.getBoolean(R.styleable.CommonTitleBar_centerSearchEditable, true);
centerSearchBgResource = array.getResourceId(R.styleable.CommonTitleBar_centerSearchBg, R.drawable.comm_titlebar_search_gray_shape);
centerSearchRightType = array.getInt(R.styleable.CommonTitleBar_centerSearchRightType, TYPE_CENTER_SEARCH_RIGHT_VOICE);
centerSearchHint = array.getString(R.styleable.CommonTitleBar_centerSearchHint);
} else if (centerType == TYPE_CENTER_CUSTOM_VIEW) {
centerCustomViewRes = array.getResourceId(R.styleable.CommonTitleBar_centerCustomView, 0);
}
Expand All @@ -261,7 +263,10 @@ private void initGlobalViews(Context context) {
ViewGroup.LayoutParams globalParams = new ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT);
setLayoutParams(globalParams);

boolean transparentStatusBar = StatusBarUtils.supportTransparentStatusBar();
boolean transparentStatusBar = false;
if (!isInEditMode()) {
transparentStatusBar = StatusBarUtils.supportTransparentStatusBar();
}

// 构建标题栏填充视图
if (fillStatusBar && transparentStatusBar && !isInEditMode()) {
Expand Down Expand Up @@ -455,7 +460,11 @@ private void initMainCenterViews(Context context) {
tvCenter.setGravity(Gravity.CENTER);
tvCenter.setSingleLine(true);
// 设置跑马灯效果
tvCenter.setMaxWidth((int) (ScreenUtils.getScreenPixelSize(context)[0] * 3 / 5.0));
int maxWidth = 100;
if (!isInEditMode()) {
maxWidth = (int) (ScreenUtils.getScreenPixelSize(context)[0] * 3 / 5.0);
}
tvCenter.setMaxWidth(maxWidth);
if (centerTextMarquee){
tvCenter.setEllipsize(TextUtils.TruncateAt.MARQUEE);
tvCenter.setMarqueeRepeatLimit(-1);
Expand Down Expand Up @@ -557,7 +566,7 @@ private void initMainCenterViews(Context context) {
etSearchHint = new EditText(context);
etSearchHint.setBackgroundColor(Color.TRANSPARENT);
etSearchHint.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
etSearchHint.setHint(getResources().getString(R.string.titlebar_search_hint));
etSearchHint.setHint(centerSearchHint);
etSearchHint.setTextColor(Color.parseColor("#666666"));
etSearchHint.setHintTextColor(Color.parseColor("#999999"));
etSearchHint.setTextSize(TypedValue.COMPLEX_UNIT_PX, ScreenUtils.dp2PxInt(context, 14));
Expand Down Expand Up @@ -621,7 +630,9 @@ public void onClick(View v) {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
setUpImmersionTitleBar();
if (!isInEditMode()) {
setUpImmersionTitleBar();
}
}

private void setUpImmersionTitleBar() {
Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<enum name="voice" value="0" />
<enum name="delete" value="1" />
</attr>
<attr name="centerSearchHint" format="string" />
<!-- TextView 文字, 对应centerType_TextView -->
<attr name="centerText" format="string" />
<!-- TextView 颜色, 对应centerType_TextView -->
Expand Down

0 comments on commit 64694ae

Please sign in to comment.