Skip to content

Commit

Permalink
support android x
Browse files Browse the repository at this point in the history
  • Loading branch information
LightSun committed Feb 28, 2020
1 parent 0748e60 commit 39e667f
Show file tree
Hide file tree
Showing 28 changed files with 116 additions and 111 deletions.
Binary file modified Android-components/.idea/caches/build_file_checksums.ser
Binary file not shown.
10 changes: 7 additions & 3 deletions Android-components/.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 Android-components/.idea/misc.xml

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

24 changes: 9 additions & 15 deletions Android-components/android-app-components/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
apply plugin: 'com.android.library'
//apply plugin: 'com.novoda.bintray-release'
apply plugin: 'com.github.dcendents.android-maven'
apply from: '../androidx_compat.gradle'

group='com.github.LightSun'

android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
minSdkVersion 14
targetSdkVersion 26
targetSdkVersion 28
versionCode 110
versionName "1.1.0"

Expand All @@ -27,18 +28,11 @@ android {

dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation "com.android.support:recyclerview-v7:26.1.0"
implementation 'com.heaven7.java.base:Java-base:1.1.0'

//compile 'com.heaven7.java.base:Java-base:1.0.9'
//compile 'com.heaven7.core.util:util-v1:1.1.2'
//compile 'com.heaven7.android.util2:android-util2:1.0.5'

testImplementation 'junit:junit:4.12'

// implementation 'com.android.support:appcompat-v7:26.1.0'
// implementation "com.android.support:recyclerview-v7:26.1.0"
implementation 'com.heaven7.java.base:Java-base:1.2.0'

}

/*ext {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.heaven7.android.component;

import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.LifecycleObserver;
import android.arch.lifecycle.LifecycleOwner;
import android.arch.lifecycle.OnLifecycleEvent;
import android.support.annotation.CallSuper;
import androidx.annotation.CallSuper;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.OnLifecycleEvent;

import com.heaven7.java.base.util.SmartReference;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.heaven7.android.component;

import android.arch.lifecycle.LifecycleOwner;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.LifecycleOwner;

import com.heaven7.android.component.guide.AppGuideComponent;
import com.heaven7.android.component.image.AppImageComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.heaven7.android.component;

import android.arch.lifecycle.LifecycleObserver;
import android.arch.lifecycle.LifecycleOwner;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleOwner;

import com.heaven7.android.component.guide.AppGuideComponent;
import com.heaven7.android.component.image.AppImageComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.View;

import androidx.fragment.app.Fragment;

import com.heaven7.java.base.util.SmartReference;

/**
Expand All @@ -31,7 +32,7 @@ protected boolean shouldWeakReference(T t) {
return t instanceof AppComponentContext
|| t instanceof Context
|| t instanceof Fragment
|| t instanceof android.support.v4.app.Fragment
|| t instanceof android.app.Fragment
|| t instanceof View
|| t instanceof Dialog;
}
Expand All @@ -51,15 +52,15 @@ protected boolean shouldDestroyReference(T t) {
return true;
}
}
if (t instanceof android.support.v4.app.Fragment) {
final android.support.v4.app.Fragment frag = (android.support.v4.app.Fragment) t;
if (t instanceof Fragment) {
final Fragment frag = (Fragment) t;
if (frag.isDetached() || frag.isRemoving()) {
Log.w(TAG, "shouldDestroyReference>>> fragment is detached or removing. fragment = "
+ name);
return true;
}
}
if (t instanceof Fragment) {
if (t instanceof android.app.Fragment) {
final Fragment frag = (Fragment) t;
if (frag.isDetached() || frag.isRemoving()) {
Log.w(TAG, "shouldDestroyReference>>> fragment is detached or removing. fragment = "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.graphics.Bitmap;
import android.support.annotation.IdRes;

import com.heaven7.android.component.AppComponentContext;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.heaven7.android.component.lifecycle;

import android.arch.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwner;

/**
* the lifecycle context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.heaven7.android.component.loading;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import androidx.recyclerview.widget.RecyclerView;

import com.heaven7.android.component.AppComponentContext;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.heaven7.android.component.toast;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;

import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StyleRes;

/**
* the mini window delegate.
* @author heaven7
Expand Down
16 changes: 16 additions & 0 deletions Android-components/androidx_compat.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

def useAndroidX = true

dependencies {
def androidX_ver = "1.0.0"
def androidSupport_ver = '28.0.0'
if(useAndroidX){
implementation "androidx.appcompat:appcompat:$androidX_ver"
implementation "androidx.recyclerview:recyclerview:$androidX_ver"
//implementation "androidx.exifinterface:exifinterface:$androidX_ver"
}else {
implementation "com.android.support:recyclerview-v7:$androidSupport_ver"
implementation "com.android.support:appcompat-v7:$androidSupport_ver"
//implementation "com.android.support:exifinterface:$androidSupport_ver"
}
}
51 changes: 15 additions & 36 deletions Android-components/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
apply plugin: 'com.android.application'
//apply plugin: 'com.neenbedankt.android-apt'
apply from: '../androidx_compat.gradle'

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
applicationId "com.heaven7.android.components.demo"
minSdkVersion 14
targetSdkVersion 26
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -37,47 +38,25 @@ android {
}
}

//fix compat of com.android.support.
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.heaven7.android.component') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.1.0'
}
}
/*if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.1.0'
}
}*/
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// compile 'com.android.support:multidex:1.0.2'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation "com.android.support:recyclerview-v7:26.1.0"
//compile "com.android.support:design:${SUPPORT_VERSION}"
// compile "com.android.support:cardview-v7:${SUPPORT_VERSION}"

testImplementation 'junit:junit:4.12'
implementation 'com.github.LightSun:SuperAdapter:2.0.9-x'
implementation 'com.heaven7.java.base:Java-base:1.2.0'

implementation 'com.heaven7.core.adapter:adapter:1.8.8'
implementation 'com.heaven7.java.base:Java-base:1.1.0'
implementation 'com.heaven7.core.util:util-v1:1.1.2'
implementation('com.heaven7.android.util2:android-util2:1.2.0', {
implementation('com.github.LightSun:util-v1:1.1.7-beta-x') {
exclude group: 'com.android.support'
exclude group: 'com.heaven7.android.component'
}
/* implementation('com.heaven7.android.util2:android-util2:1.2.0', {
exclude group: 'com.heaven7.android.component', module: 'android-app-components'
})
implementation 'com.heaven7.android.pullrefresh2:android-pullrefreshview2:1.0'
})*/
implementation 'com.github.LightSun:android-PullRefreshView:1.1.1-x'

implementation 'com.jakewharton:butterknife:8.4.0'
annotationProcessor "com.jakewharton:butterknife-compiler:8.4.0"
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.bumptech.glide:glide:4.10.0'
//compile 'com.squareup.picasso:picasso:2.5.2'

implementation project(':android-app-components')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import androidx.appcompat.app.AppCompatActivity;

import com.heaven7.android.component.AppComponentFactory;
import com.heaven7.android.component.AppComponentOwner;
import com.heaven7.android.component.guide.AppGuideComponent;
import com.heaven7.android.component.image.AppImageComponent;
import com.heaven7.android.component.loading.AppLoadingComponent;
import com.heaven7.android.component.toast.AppToastComponent;
import com.heaven7.android.components.demo.imageimpl.GlideAppImageComponent;
import com.heaven7.android.components.demo.toastimpl.AppToastComponentImpl;
import com.heaven7.android.util2.BackKeyListener;
import com.heaven7.android.util2.GuideHelper;
//import com.heaven7.android.components.demo.imageimpl.GlideAppImageComponent;

import butterknife.ButterKnife;

Expand All @@ -30,27 +28,30 @@ public void onCreate(Bundle savedInstanceState) {
mAppComponentOwner = new AppComponentOwner(this, new AppComponentFactory() {
@Override
public AppImageComponent onCreateAppImageComponent(Activity activity) {
return new GlideAppImageComponent();
// return new GlideAppImageComponent();
return null;
}
@Override
public AppLoadingComponent onCreateAppLoadingComponent(Activity activity) {
return BaseActivity.this.onCreateAppLoadingComponent();
}
@Override
public AppGuideComponent onCreateAppGuideComponent(Activity activity) {
final GuideHelper helper = new GuideHelper(activity, getLayoutId());
// final GuideHelper helper = new GuideHelper(activity, getLayoutId());
//register back key listener of guide.
helper.setOnKeyListener(new BackKeyListener() {
/* helper.setOnKeyListener(new BackKeyListener() {
@Override
protected void onBackPressed() {
getAppGuideComponent().dismiss();
}
});
return helper;
return helper;*/
return null;
}
@Override
public AppToastComponent onCreateAppToastComponent(Activity activity) {
return AppToastComponentImpl.create(activity);
//return AppToastComponentImpl.create(activity);
return null;
}
});

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

import android.app.Application;

import com.heaven7.android.components.demo.imageimpl.GlideAppImageComponent;
//import com.heaven7.android.components.demo.imageimpl.GlideAppImageComponent;

/**
* Created by heaven7 on 2017/8/22 0022.
Expand All @@ -13,12 +13,12 @@ public class SampleApplication extends Application{
@Override
public void onLowMemory() {
super.onLowMemory();
new GlideAppImageComponent().getBitmapPool(this).clearMemory();
// new GlideAppImageComponent().getBitmapPool(this).clearMemory();
}

@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
new GlideAppImageComponent().getBitmapPool(this).trimMemory(level);
// new GlideAppImageComponent().getBitmapPool(this).trimMemory(level);
}
}
Loading

0 comments on commit 39e667f

Please sign in to comment.