Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #2

Merged
merged 23 commits into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
de48650
修复因类加载加载机制不同,导致 Parcel 数据恢复失败而引起的崩溃
amibition521 Sep 2, 2018
bc3368d
Merge branch 'amibition521-master', fix #1079 #1122 #1014 #1004: `Bad…
YoKeyword Jun 6, 2019
80c66cc
Fix #1112, SwipeBackFragment does not completely pop
YoKeyword Jun 6, 2019
8a82c03
Optimize DebugStackBubble
YoKeyword Jun 7, 2019
c0118bb
add a checkup
Sep 21, 2018
5eeccef
Optimize `isParentInvisble()`
YoKeyword Jun 7, 2019
9e2dbdf
Compatible with #1031 (>=27.1.0)
YoKeyword Jun 7, 2019
751d5ac
_mActivity: FragmentActivity -> SupportActivity
YoKeyword Jun 7, 2019
21760a3
Add a DialogFragment Demo
YoKeyword Jun 7, 2019
c9a782a
Add setSwipeAlpha()
YoKeyword Jun 7, 2019
1ff69d4
Update to 1.3.7
YoKeyword Jun 7, 2019
31c97e1
Allow multiple (`Fragmentation`) install()
YoKeyword Jun 7, 2019
0f3c03d
Update to 1.3.7
YoKeyword Jun 8, 2019
3d000b1
build: fix build break
liaolintao Aug 12, 2019
6ecb447
fix(fragmentation_core): mInvisibleWhenLeave state is wrong when rela…
liaolintao Aug 13, 2019
28deec7
Revert "_mActivity: FragmentActivity -> SupportActivity"
liaolintao Aug 13, 2019
8af190f
fix(fragmentation_core): make sure onLazyInitView called when fragmen…
liaolintao Aug 14, 2019
d5e79a3
fix(fragmentation_core): make sure childFragment.onSupportVisible cal…
liaolintao Sep 25, 2019
11d5abb
Merge pull request #1172 from liaolintao/master
YoKeyword Nov 15, 2019
540d9ba
Revert "_mActivity: SupportActivity -> FragmentActivity"
YoKeyword Nov 15, 2019
a9bd3d8
Update to 1.3.8
YoKeyword Nov 15, 2019
2d6ad8f
DEPRECATED
YoKeyword Nov 15, 2019
76e2823
DEPRECATED
YoKeyword Nov 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[![Download](https://api.bintray.com/packages/yokeyword/maven/Fragmentation/images/download.svg) ](https://bintray.com/yokeyword/maven/Fragmentation/_latestVersion)
[![Hex.pm](https://img.shields.io/hexpm/l/plug.svg)](https://www.apache.org/licenses/LICENSE-2.0)

# PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED

### [中文版 README.md](https://github.com/YoKeyword/Fragmentation/blob/master/README_CN.md)

# Fragmentation
Expand Down Expand Up @@ -46,15 +48,15 @@ The first demo shows the basic usage of the library. The second one shows the wa
**1、build.gradle**
````gradle
// appcompat-v7 is required
compile 'me.yokeyword:fragmentation:1.3.6'
compile 'me.yokeyword:fragmentation:1.3.8'

// If you don't want to extends SupportActivity/Fragment and would like to customize your own support, just rely on fragmentation-core
// compile 'me.yokeyword:fragmentation-core:1.3.6'
// compile 'me.yokeyword:fragmentation-core:1.3.8'

// To get SwipeBack feature, rely on both fragmentation & fragmentation-swipeback
compile 'me.yokeyword:fragmentation:1.3.6'
compile 'me.yokeyword:fragmentation:1.3.8'
// Swipeback is based on fragmentation. Refer to SwipeBackActivity/Fragment for your Customized SupportActivity/Fragment
compile 'me.yokeyword:fragmentation-swipeback:1.3.6'
compile 'me.yokeyword:fragmentation-swipeback:1.3.8'

// To simplify the communication between Fragments.
compile 'me.yokeyword:eventbus-activity-scope:1.1.0'
Expand Down
10 changes: 6 additions & 4 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[![Download](https://api.bintray.com/packages/yokeyword/maven/Fragmentation/images/download.svg) ](https://bintray.com/yokeyword/maven/Fragmentation/_latestVersion)
[![Hex.pm](https://img.shields.io/hexpm/l/plug.svg)](https://www.apache.org/licenses/LICENSE-2.0)

# 注意:该项目不再维护

# Fragmentation
A powerful library that manage Fragment for Android!

Expand Down Expand Up @@ -52,15 +54,15 @@ A powerful library that manage Fragment for Android!
**1. 项目下app的build.gradle中依赖:**
````gradle
// appcompat-v7包是必须的
compile 'me.yokeyword:fragmentation:1.3.6'
compile 'me.yokeyword:fragmentation:1.3.8'

// 如果不想继承SupportActivity/Fragment,自己定制Support,可仅依赖:
// compile 'me.yokeyword:fragmentation-core:1.3.6'
// compile 'me.yokeyword:fragmentation-core:1.3.8'

// 如果想使用SwipeBack 滑动边缘退出Fragment/Activity功能,完整的添加规则如下:
compile 'me.yokeyword:fragmentation:1.3.6'
compile 'me.yokeyword:fragmentation:1.3.8'
// swipeback基于fragmentation, 如果是自定制SupportActivity/Fragment,则参照SwipeBackActivity/Fragment实现即可
compile 'me.yokeyword:fragmentation-swipeback:1.3.6'
compile 'me.yokeyword:fragmentation-swipeback:1.3.8'

// Activity作用域的EventBus,更安全,可有效避免after onSavenInstanceState()异常
compile 'me.yokeyword:eventbus-activity-scope:1.1.0'
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ buildscript {

allprojects {
repositories {
jcenter()
google()
jcenter()
}
}

Expand Down
20 changes: 10 additions & 10 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ android {
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:$rootProject.v4Version"
compile "com.android.support:design:$rootProject.v4Version"
compile "com.android.support:cardview-v7:$rootProject.v4Version"
compile "com.android.support:recyclerview-v7:$rootProject.v4Version"
compile project(':fragmentation')
compile project(':fragmentation_swipeback')
api fileTree(include: ['*.jar'], dir: 'libs')
testApi 'junit:junit:4.12'
api "com.android.support:appcompat-v7:$rootProject.v4Version"
api "com.android.support:design:$rootProject.v4Version"
api "com.android.support:cardview-v7:$rootProject.v4Version"
api "com.android.support:recyclerview-v7:$rootProject.v4Version"
api project(':fragmentation')
api project(':fragmentation_swipeback')
// EventBus
compile project(':eventbus_activity_scope')
compile 'org.greenrobot:eventbus:3.0.0'
api project(':eventbus_activity_scope')
api 'org.greenrobot:eventbus:3.0.0'
// apt 'org.greenrobot:eventbus-annotation-processor:3.0.1'
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package me.yokeyword.sample.demo_wechat.ui.fragment.second;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import me.yokeyword.fragmentation.ISupportActivity;
import me.yokeyword.sample.R;

/**
* 使用DialogFragment时,需要重写show(),入Fragmentation的事务队列
*
* Dialog是基于Window (Activity也是Window),普通Fragment的视图一般基于View,这样会导致Dialog永远会浮在最顶层
*
* 可以考虑自定义半透明View的Fragment,从视觉上模拟Dialog
*
* Created by YoKey on 19/6/7.
*/

public class DemoDialogFragment extends DialogFragment {

public static DemoDialogFragment newInstance() {
return new DemoDialogFragment();
}

protected FragmentActivity _mActivity;

@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
_mActivity = (FragmentActivity) activity;
}

/**
* Enqueue the Fragmentation Queue.
*
* 如果是SupportFragment打开,可以不用复写该方法, 放到post()中show亦可
*/
@Override
public void show(final FragmentManager manager, final String tag) {
if (_mActivity instanceof ISupportActivity) {
((ISupportActivity) _mActivity).getSupportDelegate().post(new Runnable() {
@Override
public void run() {
DemoDialogFragment.super.show(manager, tag);
}
});
return;
}

super.show(manager, tag);
}

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.wechat_fragment_dialog, container, false);
view.findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
return view;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ public void onClick(View v) {
}
});

// 启动一个DialogFragment
view.findViewById(R.id.btn_dialog).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DemoDialogFragment dialogFragment = DemoDialogFragment.newInstance();
dialogFragment.show(getFragmentManager(), getClass().getSimpleName());
}
});

return attachToSwipeBack(view);
}

Expand Down
20 changes: 20 additions & 0 deletions demo/src/main/res/layout/wechat_fragment_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">

<EditText
android:layout_width="300dp"
android:layout_height="wrap_content"/>

<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Dismiss"/>

</LinearLayout>
139 changes: 85 additions & 54 deletions demo/src/main/res/layout/wechat_fragment_new_feature.xml
Original file line number Diff line number Diff line change
@@ -1,61 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/toolbar"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="48dp"
android:text="@string/new_tip_start"
android:textColor="@android:color/black"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="16dp"
android:text="extraTransaction()\n.setCustomAnimations(enter,exit...)\n.start()"/>

<Button
android:id="@+id/btn_start"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="start()"
android:textAllCaps="false"/>
android:orientation="vertical">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="32dp"
android:text="@string/new_tip_start_dont_hide"
android:textColor="@android:color/black"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="16dp"
android:text="extraTransaction()\n.setCustomAnimations(enter,exit...)\n.startDontHideSelf()"/>
<include layout="@layout/toolbar"/>

<Button
android:id="@+id/btn_start_dont_hide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="startDontHideSelf()"
android:textAllCaps="false"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="48dp"
android:text="@string/new_tip_start"
android:textColor="@android:color/black"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="16dp"
android:text="extraTransaction()\n.setCustomAnimations(enter,exit...)\n.start()"/>

<Button
android:id="@+id/btn_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="start()"
android:textAllCaps="false"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="32dp"
android:text="@string/new_tip_start_dont_hide"
android:textColor="@android:color/black"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="16dp"
android:text="extraTransaction()\n.setCustomAnimations(enter,exit...)\n.startDontHideSelf()"/>

<Button
android:id="@+id/btn_start_dont_hide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="startDontHideSelf()"
android:textAllCaps="false"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="32dp"
android:text="Show a DialogFragment"
android:textColor="@android:color/black"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="16dp"
android:text="dialogFragment.show(fragmentManager, tag)"/>

<Button
android:id="@+id/btn_dialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="dialogFragment.show(..)"
android:textAllCaps="false"/>

</LinearLayout>
</LinearLayout>
</ScrollView>
2 changes: 1 addition & 1 deletion eventbus_activity_scope/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ android {
}

dependencies {
provided 'org.greenrobot:eventbus:3.0.0'
compileOnly 'org.greenrobot:eventbus:3.0.0'
}
4 changes: 2 additions & 2 deletions fragmentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ android {
}

dependencies {
provided "com.android.support:appcompat-v7:$rootProject.v4Version"
compile project(':fragmentation_core')
compileOnly "com.android.support:appcompat-v7:$rootProject.v4Version"
api project(':fragmentation_core')
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.animation.Animation;

Expand All @@ -19,7 +18,7 @@
*/
public class SupportFragment extends Fragment implements ISupportFragment {
final SupportFragmentDelegate mDelegate = new SupportFragmentDelegate(this);
protected FragmentActivity _mActivity;
protected SupportActivity _mActivity;

@Override
public SupportFragmentDelegate getSupportDelegate() {
Expand All @@ -39,7 +38,7 @@ public ExtraTransaction extraTransaction() {
public void onAttach(Activity activity) {
super.onAttach(activity);
mDelegate.onAttach(activity);
_mActivity = mDelegate.getActivity();
_mActivity = (SupportActivity) mDelegate.getActivity();
}

@Override
Expand Down
Loading