Skip to content

Commit

Permalink
update 3.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ifan-ge committed Mar 25, 2022
1 parent 4216677 commit 071ebc7
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 16 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](https://github.com/gyf-dev/Screenshots/blob/master/ImmersionBar/readme_head.png)
# ImmersionBar -- android 4.4以上沉浸式实现
[![version](https://img.shields.io/badge/version-3.2.1-brightgreen.svg)](https://bintray.com/geyifeng/maven/immersionbar) [![author](https://img.shields.io/badge/author-gyf--dev-orange.svg)](https://github.com/gyf-dev) [![简书](https://img.shields.io/badge/%E7%AE%80%E4%B9%A6-HeLe%E5%B0%8F%E5%AD%90%E6%8B%BD-blue.svg)](https://www.jianshu.com/p/2a884e211a62) [![QQ群](https://img.shields.io/badge/QQ%E7%BE%A4-314360549-red.svg)]()
[![version](https://img.shields.io/badge/version-3.2.2-brightgreen.svg)](https://bintray.com/geyifeng/maven/immersionbar) [![author](https://img.shields.io/badge/author-gyf--dev-orange.svg)](https://github.com/gyf-dev) [![简书](https://img.shields.io/badge/%E7%AE%80%E4%B9%A6-HeLe%E5%B0%8F%E5%AD%90%E6%8B%BD-blue.svg)](https://www.jianshu.com/p/2a884e211a62) [![QQ群](https://img.shields.io/badge/QQ%E7%BE%A4-314360549-red.svg)]()

## 直接看效果图,建议下载demo体验,最下面有各个版本的效果图
<img width="300" src="https://github.com/gyf-dev/Screenshots/blob/master/ImmersionBar/Screenshot_6.0.gif"/>
Expand All @@ -9,11 +9,11 @@
> 3.1.1以上版本(mavenCentral)
```groovy
// 基础依赖包,必须要依赖
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.1'
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2'
// kotlin扩展(可选)
implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.1'
implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.2'
// fragment快速实现(可选)已废弃
implementation 'com.geyifeng.immersionbar:immersionbar-components:3.2.1'
implementation 'com.geyifeng.immersionbar:immersionbar-components:3.2.2'
```
> 3.0.0版本(jcenter)
```groovy
Expand All @@ -29,13 +29,13 @@
#### [点我查看版本说明](https://github.com/gyf-dev/ImmersionBar/wiki)

## 下载demo
#### [点我下载immersionBar-3.2.1.apk](https://github.com/gyf-dev/ImmersionBar/blob/master/apk/immersionbar-3.2.1.apk)
#### [点我下载immersionBar-3.2.2.apk](https://github.com/gyf-dev/ImmersionBar/blob/master/apk/immersionbar-3.2.2.apk)

## 关于全面屏与刘海
#### 关于全面屏
在manifest加入如下配置,四选其一,或者都写

① 升级targetSdkVersion为25以上版本,现在基本都是25以上了,所以以下三个必须要配置了
① 升级targetSdkVersion为25以上版本,现在基本都是25以上了,所以以下三个没有必要配置了

② 在manifest的Application节点中加入
```xml
Expand Down
Binary file not shown.
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ import java.util.function.Consumer
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.6.10'
ext.immersionbar_version = '3.2.1'
ext.kotlin_version = '1.4.32'
ext.immersionbar_version = '3.2.2'
repositories {
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/public' }
mavenCentral()
google()
jcenter()
}
dependencies {

classpath 'com.android.tools.build:gradle:7.1.1'
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -21,6 +23,8 @@ buildscript {

allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/public' }
mavenCentral()
google()
jcenter()
Expand Down Expand Up @@ -50,7 +54,7 @@ subprojects.forEach(new Consumer<Project>() {
project.getPlugins().withId(s) {
project.afterEvaluate {
def file = new File(project.getProjectDir().parent, "gradle/publish-mavencentral.gradle")
if(file.exists()){
if (file.exists()) {
project.apply from: file
}
}
Expand Down
39 changes: 39 additions & 0 deletions immersionbar/src/main/java/com/gyf/immersionbar/ImmersionBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,45 @@ public static ImmersionBar with(@NonNull Activity activity, @NonNull Dialog dial
return getRetriever().get(activity, dialog, isOnly);
}

/**
* 销毁Fragment
*
* @param fragment the Fragment
*/
public static void destroy(@NonNull Fragment fragment) {
getRetriever().destroy(fragment, false);
}

/**
* 销毁Fragment
*
* @param fragment the Fragment
* @param isOnly the is only fragment实例对象是否唯一,默认是false,不唯一,isOnly影响tag以何种形式生成
*/
public static void destroy(@NonNull Fragment fragment, boolean isOnly) {
getRetriever().destroy(fragment, isOnly);
}

/**
* 销毁Fragment
*
* @param fragment the android.app.Fragment
*/
public static void destroy(@NonNull android.app.Fragment fragment) {
getRetriever().destroy(fragment, false);
}


/**
* 销毁Fragment
*
* @param fragment the android.app.Fragment
* @param isOnly the is only fragment实例对象是否唯一,默认是false,不唯一,isOnly影响tag以何种形式生成
*/
public static void destroy(@NonNull android.app.Fragment fragment, boolean isOnly) {
getRetriever().destroy(fragment, isOnly);
}

/**
* 在Dialog里销毁,不包括DialogFragment
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import android.app.Dialog;
import android.content.res.Configuration;
import android.os.Build;
import android.view.Surface;

import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import android.view.Surface;

/**
* @author geyifeng
Expand Down Expand Up @@ -65,6 +66,7 @@ void onResume() {

void onDestroy() {
mBarProperties = null;
mOnBarListener = null;
if (mImmersionBar != null) {
mImmersionBar.onDestroy();
mImmersionBar = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.app.Fragment;
import android.content.res.Configuration;
import android.os.Bundle;

import androidx.annotation.Nullable;

/**
Expand Down Expand Up @@ -46,8 +47,8 @@ public void onResume() {
}

@Override
public void onDestroy() {
super.onDestroy();
public void onDestroyView() {
super.onDestroyView();
if (mDelegate != null) {
mDelegate.onDestroy();
mDelegate = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -147,6 +146,29 @@ public ImmersionBar get(Activity activity, Dialog dialog, boolean isOnly) {
}
}

public void destroy(Fragment fragment, boolean isOnly) {
if (fragment == null) return;
String tag = mTag;
tag += fragment.getClass().getName();
if (!isOnly) {
tag += System.identityHashCode(fragment) + mNotOnly;
}
getSupportFragment(fragment.getChildFragmentManager(), tag, true);
}

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public void destroy(android.app.Fragment fragment, boolean isOnly) {
if (fragment == null) {
return;
}
String tag = mTag;
tag += fragment.getClass().getName();
if (!isOnly) {
tag += System.identityHashCode(fragment) + mNotOnly;
}
getFragment(fragment.getChildFragmentManager(), tag, true);
}

/**
* Destroy
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.app.Dialog;
import android.content.res.Configuration;
import android.os.Bundle;

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

Expand Down Expand Up @@ -46,8 +47,8 @@ public void onResume() {
}

@Override
public void onDestroy() {
super.onDestroy();
public void onDestroyView() {
super.onDestroyView();
if (mDelegate != null) {
mDelegate.onDestroy();
mDelegate = null;
Expand Down

0 comments on commit 071ebc7

Please sign in to comment.