Skip to content

Commit f690bc6

Browse files
author
Jorge Costa
committed
Merge branch 'release/0.4.4'
2 parents 2c20043 + c19fcea commit f690bc6

10 files changed

Lines changed: 102 additions & 93 deletions

File tree

.travis.yml

Lines changed: 52 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,58 @@
1-
language: android
2-
cache: false
1+
# Tutorial here: https://medium.com/@harmittaa/travis-ci-android-example-357f6e632fc4
32

3+
language: android
44
sudo: false
5+
jdk: oraclejdk8
6+
7+
branches:
8+
only:
9+
- master
10+
- develop
11+
- config_travis
12+
13+
before_cache:
14+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
15+
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
16+
17+
cache:
18+
directories:
19+
- $HOME/.gradle/caches/
20+
- $HOME/.gradle/wrapper/
21+
22+
env:
23+
global:
24+
- ANDROID_API=26
25+
- EMULATOR_API=22
26+
- ANDROID_BUILD_TOOLS=26.0.1
27+
- ADB_INSTALL_TIMEOUT=5 # minutes
28+
- ANDROID_ABI=armeabi-v7a
29+
- ANDROID_TAG=google_apis
30+
531
android:
6-
components:
7-
- tools
8-
- build-tools-25.0.3
9-
- platform-tools
10-
- extra-android-m2repository
11-
- extra-google-m2repository
12-
- extra-google-android-support
13-
- android-25
14-
- sys-img-armeabi-v7a-android-25
32+
components:
33+
- tools
34+
- platform-tools
35+
- build-tools-$ANDROID_BUILD_TOOLS
36+
- android-$ANDROID_API
37+
- android-$EMULATOR_API
38+
- extra-google-m2repository
39+
- extra-android-m2repository # for design library
40+
- extra-google-google_play_services
41+
- sys-img-armeabi-v7a-google_apis-$ANDROID_API
42+
- sys-img-armeabi-v7a-google_apis-$EMULATOR_API
1543

16-
jdk: oraclejdk8
17-
os:
18-
- linux
44+
licenses:
45+
- android-sdk-preview-license-.+
46+
- android-sdk-license-.+
47+
- google-gdk-license-.+
1948

20-
licenses:
21-
- 'android-sdk-preview-license-.+'
22-
- 'android-sdk-license-.+'
23-
- 'google-gdk-license-.+'
49+
before_install:
50+
- mkdir "$ANDROID_HOME/licenses" || true
51+
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
52+
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
53+
- chmod +x gradlew
54+
- ./gradlew dependencies || true # DON'T ADD unless you are getting "Install missing components using SDK manager"
55+
#Source: https://medium.com/@oldergod/constraint-layout-and-circleci-travis-d50342696d2
2456

25-
branches:
26-
only:
27-
- master
28-
- develop
29-
- config_travis
30-
31-
install:
32-
# Ensure Gradle wrapper is executable, download wrapper and show version
33-
- chmod +x ./gradlew;
34-
35-
before_script:
36-
- echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
37-
- emulator -avd test -no-skin -no-audio -no-window &
38-
- android-wait-for-emulator
39-
- adb shell input keyevent 82 &
40-
41-
script: ./gradlew build connectedCheck
57+
script:
58+
- "./gradlew clean build connectedCheck -PdisablePreDex --stacktrace"

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Activity Fragment Manager
22
[![Download](https://api.bintray.com/packages/jmspt/maven/activity-fragment-manager/images/download.svg)](https://bintray.com/jmspt/maven/activity-fragment-manager/)
33
[![Build Status](https://travis-ci.org/massivedisaster/ActivityFragmentManager.svg?branch=master)](https://travis-ci.org/massivedisaster/ActivityFragmentManager)
4-
[![API](https://img.shields.io/badge/API-10%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=10)
5-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6-
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Activity%20Fragment%20Manager-red.svg?style=flat)](https://android-arsenal.com/details/1/5916)
7-
A library to help android developer working easly with activities and fragments
4+
[![API](https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=16)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5+
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Activity%20Fragment%20Manager-red.svg?style=flat)](https://android-arsenal.com/details/1/5916)
6+
A library to help android developer working easly with activities and fragments
87

98
## Motivation
109

@@ -30,7 +29,7 @@ To use the Activity Fragment Manager, add the compile dependency with the latest
3029
Add the Activity Fragment Manager to your `build.gradle`:
3130
```gradle
3231
dependencies {
33-
compile 'com.massivedisaster:activity-fragment-manager:0.4.2'
32+
compile 'com.massivedisaster:activity-fragment-manager:0.4.3'
3433
}
3534
```
3635

@@ -41,7 +40,7 @@ In the `pom.xml` file:
4140
<dependency>
4241
<groupId>com.massivedisaster</groupId>
4342
<artifactId>activity-fragment-manager</artifactId>
44-
<version>0.4.2</version>
43+
<version>0.4.3</version>
4544
</dependency>
4645
```
4746

@@ -109,7 +108,7 @@ An example, if your ```AbstractFragmentActivity``` is started by an external int
109108
public class ActivityPrimaryTheme extends AbstractFragmentActivity {
110109

111110
...
112-
111+
113112
@Override
114113
protected Class<? extends Fragment> getDefaultFragment() {
115114
return FragmentSplash.class;
@@ -158,7 +157,7 @@ If you want to add a custom animation for all transactions inside of a ```Abstra
158157
public class ActivityPrimaryTheme extends AbstractFragmentActivity {
159158

160159
...
161-
160+
162161
@Override
163162
public int getAnimationEnter() {
164163
return R.anim.enter_from_right;
@@ -183,8 +182,8 @@ public class ActivityPrimaryTheme extends AbstractFragmentActivity {
183182
```
184183

185184
### 5. Shared Elements
186-
If you want to make your app beautiful you need to put some cool animation on it!
187-
Shared elements are introduce in API 21 and makes the transactions so great and sweet.
185+
If you want to make your app beautiful you need to put some cool animation on it!
186+
Shared elements are introduce in API 21 and makes the transactions so great and sweet.
188187
So, now it's very easy to share elements between fragments or activities.
189188
Let's take a look:
190189

@@ -208,7 +207,7 @@ or
208207
android:transitionName="sharedElement" />
209208
```
210209

211-
**Attention:** Shared elements doesn't work when you use ```add()```!
210+
**Attention:** Shared elements doesn't work when you use ```add()```!
212211
Well if you remove the first fragment it's possible, i.e. a replace :)
213212

214213
### 6. Custom Intents
@@ -219,7 +218,7 @@ Intent intent = ActivityFragmentManager.open(getContext(), ActivityPrimaryTheme.
219218
intent.setFlag(Intent.FLAG_ACTIVITY_NEW_TASK
220219
| intent.FLAG_ACTIVITY_CLEAR_TASK);
221220
getActivity().startActivity(intent);
222-
```
221+
```
223222

224223
### 7. Fragment#OnBackPressed
225224
Allows to have back pressed events in `Fragments`.
@@ -241,6 +240,7 @@ public class FragmentA extends Fragment implements OnBackPressedListener {
241240

242241
* You can pass a tag to be applied in the ```Fragment```.
243242
* You can pass ```REQUEST_CODE``` to the ```startActivityForResult```.
243+
* You can ```addToBackStack```.
244244
* You can pass data between fragments using a ```Bundle```.
245245
* You can get acess to the original ```FragmentTransaction```.
246246
* You can use ```DataBinding``` in your ```AbstractFragmentActivity```, all you need is override ```initializeDataBinding()``` and bind the view!

activity-fragment-manager/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ android {
5555

5656
dependencies {
5757
compile fileTree(include: ['*.jar'], dir: 'libs')
58-
compile 'com.android.support:appcompat-v7:26.0.1'
58+
compile 'com.android.support:appcompat-v7:26.1.0'
5959

6060
lintRules project(':lint')
6161
}
@@ -78,7 +78,7 @@ publish {
7878
userOrg = "jmspt"
7979
groupId = "com.massivedisaster"
8080
artifactId = 'activity-fragment-manager'
81-
publishVersion = "0.4.3"
81+
publishVersion = "0.4.4"
8282
desc = 'Activity Fragment Manager'
8383
website = websiteBase
8484
licences = licensesBase

activity-fragment-manager/src/main/java/com/massivedisaster/activitymanager/AddFragmentTransaction.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ class AddFragmentTransaction extends FragmentTransaction {
4747

4848
@Override
4949
public void commit() {
50+
// Apply the default activity animation if the FragmentTransaction is null.
51+
if (mTransactionAnimation == null) {
52+
mTransactionAnimation = mActivity;
53+
}
54+
55+
// Set the custom transaction animation.
56+
mFrgTransaction.setCustomAnimations(mTransactionAnimation.getAnimationEnter(), mTransactionAnimation.getAnimationExit(),
57+
mTransactionAnimation.getAnimationPopEnter(),
58+
mTransactionAnimation.getAnimationPopExit());
59+
5060
// Add the new fragment to the stack.
5161
mFrgTransaction.add(mActivity.getContainerViewId(), mFragment, mTag);
5262
// Hide the first fragment in the container.

activity-fragment-manager/src/main/java/com/massivedisaster/activitymanager/FragmentTransaction.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public abstract class FragmentTransaction implements ITransaction<FragmentTransa
4545
protected Fragment mFragment;
4646
protected android.support.v4.app.FragmentTransaction mFrgTransaction;
4747
protected String mTag;
48+
protected TransactionAnimation mTransactionAnimation;
4849

4950
/**
5051
* FragmentTransaction constructor, created to be used by an activity.
@@ -129,15 +130,7 @@ public Fragment getFragment() {
129130
* @return Return the Transaction instance.
130131
*/
131132
public FragmentTransaction setTransactionAnimation(TransactionAnimation transactionAnimation) {
132-
// Apply the default activity animation if the FragmentTransaction is null.
133-
if (transactionAnimation == null) {
134-
transactionAnimation = mActivity;
135-
}
136-
137-
// Set the custom transaction animation.
138-
mFrgTransaction.setCustomAnimations(transactionAnimation.getAnimationEnter(), transactionAnimation.getAnimationExit(),
139-
transactionAnimation.getAnimationPopEnter(),
140-
transactionAnimation.getAnimationPopExit());
133+
mTransactionAnimation = transactionAnimation;
141134

142135
return this;
143136
}

activity-fragment-manager/src/main/java/com/massivedisaster/activitymanager/ReplaceFragmentTransaction.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ class ReplaceFragmentTransaction extends FragmentTransaction {
4747

4848
@Override
4949
public void commit() {
50+
// Apply the default activity animation if the FragmentTransaction is null.
51+
if (mTransactionAnimation == null) {
52+
mTransactionAnimation = mActivity;
53+
}
54+
55+
// Set the custom transaction animation.
56+
mFrgTransaction.setCustomAnimations(mTransactionAnimation.getAnimationEnter(), mTransactionAnimation.getAnimationExit(),
57+
mTransactionAnimation.getAnimationPopEnter(),
58+
mTransactionAnimation.getAnimationPopExit());
59+
5060
// Hide the first fragment in the container.
5161
if (mActivity.getSupportFragmentManager().findFragmentById(mActivity.getContainerViewId()) != null) {
5262
mFrgTransaction.hide(mActivity.getSupportFragmentManager().findFragmentById(mActivity.getContainerViewId()));

activity-fragment-manager/src/main/java/com/massivedisaster/activitymanager/activity/AbstractFragmentActivity.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,12 @@ public void onCreate(Bundle savedInstanceState) {
8888
setContentView(rootView);
8989
initializeDataBinding(rootView);
9090

91-
if (getSupportFragmentManager().getBackStackEntryCount() == 0 && getIntent().hasExtra(ACTIVITY_MANAGER_FRAGMENT)) {
92-
performInitialTransaction(getFragment(getIntent().getStringExtra(ACTIVITY_MANAGER_FRAGMENT)), getFragmentTag());
93-
} else if (getDefaultFragment() != null) {
94-
performInitialTransaction(getFragment(getDefaultFragment().getCanonicalName()), null);
91+
if (getSupportFragmentManager().getFragments().isEmpty() && getSupportFragmentManager().getBackStackEntryCount() == 0) {
92+
if (getIntent().hasExtra(ACTIVITY_MANAGER_FRAGMENT)) {
93+
performInitialTransaction(getFragment(getIntent().getStringExtra(ACTIVITY_MANAGER_FRAGMENT)), getFragmentTag());
94+
} else if (getDefaultFragment() != null) {
95+
performInitialTransaction(getFragment(getDefaultFragment().getCanonicalName()), null);
96+
}
9597
}
9698
}
9799

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,23 @@ ext {
4343
buildscript {
4444
repositories {
4545
jcenter()
46+
google()
4647
maven {
4748
url "https://plugins.gradle.org/m2/"
4849
}
4950
}
5051
dependencies {
51-
classpath 'com.android.tools.build:gradle:2.3.2'
52-
classpath 'com.novoda:bintray-release:0.3.4'
52+
classpath 'com.android.tools.build:gradle:3.0.0-beta6'
53+
classpath 'com.novoda:bintray-release:0.5.0'
5354
classpath 'pt.simdea.verifier:verifier:3.5.8'
5455
classpath 'gradle.plugin.com.kageiit:lintrules:1.1.2'
5556
}
5657
}
5758

5859
allprojects {
5960
repositories {
60-
maven { url 'https://maven.google.com' }
6161
jcenter()
62+
google()
6263
}
6364
}
6465

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,6 @@
1-
#
2-
# ActivityFragmentManager - A library to help android developer working easily with activities and fragments.
3-
#
4-
# Copyright (c) 2017 ActivityFragmentManager
5-
#
6-
# Permission is hereby granted, free of charge, to any person obtaining
7-
# a copy of this software and associated documentation files (the
8-
# "Software"), to deal in the Software without restriction, including
9-
# without limitation the rights to use, copy, modify, merge, publish,
10-
# distribute, sublicense, and/or sell copies of the Software, and to
11-
# permit persons to whom the Software is furnished to do so, subject to
12-
# the following conditions:
13-
#
14-
# The above copyright notice and this permission notice shall be
15-
# included in all copies or substantial portions of the Software.
16-
#
17-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24-
#
25-
26-
#Wed May 31 13:33:17 UTC 2017
1+
#Tue Sep 05 11:15:31 UTC 2017
272
distributionBase=GRADLE_USER_HOME
283
distributionPath=wrapper/dists
294
zipStoreBase=GRADLE_USER_HOME
305
zipStorePath=wrapper/dists
31-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

sample/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ android {
4848

4949
dependencies {
5050
compile fileTree(include: ['*.jar'], dir: 'libs')
51-
compile 'com.android.support:appcompat-v7:26.0.1'
51+
compile 'com.android.support:appcompat-v7:26.1.0'
52+
compile 'com.android.support:design:26.1.0'
5253
compile 'android.arch.lifecycle:extensions:1.0.0-alpha9'
5354
compile 'com.massivedisaster.adal:adal-fragments:0.1.15'
5455
compile 'com.massivedisaster.adal:adal-adapters:0.1.15'

0 commit comments

Comments
 (0)