Skip to content

Commit

Permalink
升级Androidx,自动初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
hss01248 committed Dec 9, 2022
1 parent ee3f7f0 commit 2e243d5
Show file tree
Hide file tree
Showing 69 changed files with 424 additions and 239 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
misc.xml
.idea/

*.hprof
17 changes: 11 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ android {

defaultConfig {
applicationId "com.hss01248.dialogutildemo"
minSdkVersion 16
minSdkVersion 19
targetSdkVersion 32
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
Expand All @@ -21,6 +22,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}


Expand All @@ -44,11 +49,11 @@ repositories {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
compile 'com.jakewharton:butterknife:10.2.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
//compile 'com.github.rubensousa:BottomSheetBuilder:1.3'
compile project(path: ':dialog')
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import android.content.Intent;
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 android.view.View;
import android.widget.Button;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import android.app.AlertDialog;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

/**
* Created by huangshuisheng on 2017/9/30.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import android.app.AlertDialog;
import android.app.Dialog;
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 android.widget.Button;
import android.widget.TextView;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.hss01248.dialogutildemo;

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.hss01248.dialog.ActivityStackManager;

/**
* Created by huangshuisheng on 2017/11/17.
Expand All @@ -20,12 +19,12 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
ActivityStackManager.getInstance().setTopAttached(this);
//ActivityStackManager.getInstance().setTopAttached(this);
}

@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
ActivityStackManager.getInstance().removeTopAttached(this);
//ActivityStackManager.getInstance().removeActivity(this);
}
}
44 changes: 4 additions & 40 deletions app/src/main/java/com/hss01248/dialogutildemo/BaseApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import android.app.Application;
import android.os.Bundle;

import androidx.multidex.MultiDexApplication;

import com.alibaba.fastjson.JSON;
import com.hss01248.dialog.ActivityStackManager;
import com.hss01248.dialog.DialogsMaintainer;
Expand All @@ -16,14 +18,13 @@
* Created by Administrator on 2017/2/15 0015.
*/

public class BaseApp extends Application {
public class BaseApp extends MultiDexApplication {

@Override
public void onCreate() {
super.onCreate();
LeakCanary.install(this);
StyledDialog.init(getApplicationContext());
registCallback();
//StyledDialog.init(getApplicationContext());
initlog();
//TestTool.openStickModeIfIsDebug();
}
Expand All @@ -37,42 +38,5 @@ public String toJson(Object o) {
});
}

private void registCallback() {
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
ActivityStackManager.getInstance().addActivity(activity);
}

@Override
public void onActivityStarted(Activity activity) {

}

@Override
public void onActivityResumed(Activity activity) {
}

@Override
public void onActivityPaused(Activity activity) {
DialogsMaintainer.onPause(activity);

}

@Override
public void onActivityStopped(Activity activity) {

}

@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {

}

@Override
public void onActivityDestroyed(Activity activity) {
ActivityStackManager.getInstance().removeActivity(activity);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:orientation="vertical"
>

<android.support.v4.widget.NestedScrollView
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand Down Expand Up @@ -173,7 +173,7 @@


</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>



Expand Down
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/dev/remote3.gradle'
apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/master/deps/depsLastestChecker.gradle'
apply from: 'https://raw.githubusercontent.com/hss01248/flipperUtil/dev/z_config/git_branch_info.gradle'
repositories {

mavenCentral()
Expand Down
11 changes: 8 additions & 3 deletions dialog/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ android {
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

repositories {
Expand All @@ -37,9 +41,10 @@ repositories {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
api "androidx.startup:startup-runtime:1.1.0"
//compile 'com.github.hss01248:SuperAdapter:1.0.4'
//compile 'com.github.wangjiegulu:ShadowViewhelper:1.0.4'
//compile 'com.github.wangjiegulu:ShadowViewHelper:1.0.2'
Expand Down
17 changes: 13 additions & 4 deletions dialog/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hss01248.dialog">

<application android:allowBackup="true" android:label="@string/app_name"
android:supportsRtl="true">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.hss01248.dialog">

<application>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data
android:name="com.hss01248.dialog.InitForStytleDialog"
android:value="androidx.startup" />
</provider>
</application>

</manifest>
Loading

0 comments on commit 2e243d5

Please sign in to comment.