Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
aartikov committed Mar 2, 2019
2 parents 58b364d + 768f101 commit ba0278d
Show file tree
Hide file tree
Showing 120 changed files with 1,476 additions and 1,188 deletions.
70 changes: 38 additions & 32 deletions README.md

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions advancedscreenswitchersample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
apply plugin: 'com.android.application'

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

defaultConfig {
applicationId "me.aartikov.advancedscreenswitchersample"
minSdkVersion 15
targetSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

}
buildTypes {
Expand All @@ -28,16 +28,16 @@ android {

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'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
exclude group: 'androidx.annotation', module: 'annotation'
})
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'

implementation project (':alligator')
annotationProcessor project(':alligator-compiler')

implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package me.aartikov.advancedscreenswitchersample;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;

/**
* Instrumentation test, which will execute on an Android device.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package me.aartikov.advancedscreenswitchersample;

import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import me.aartikov.alligator.animations.AnimationData;
import me.aartikov.alligator.Screen;
import me.aartikov.alligator.animations.TransitionAnimation;
import me.aartikov.alligator.animations.providers.TransitionAnimationProvider;
import me.aartikov.alligator.TransitionType;
import me.aartikov.alligator.animations.AnimationData;
import me.aartikov.alligator.animations.SimpleTransitionAnimation;
import me.aartikov.alligator.animations.TransitionAnimation;
import me.aartikov.alligator.animations.providers.TransitionAnimationProvider;

/**
* Date: 28.02.2017
Expand All @@ -17,7 +18,9 @@
*/
public class SampleTransitionAnimationProvider implements TransitionAnimationProvider {
@Override
public TransitionAnimation getAnimation(TransitionType transitionType, Class<? extends Screen> screenClassFrom, Class<? extends Screen> screenClassTo, boolean isActivity, @Nullable AnimationData animationData) {
@NonNull
public TransitionAnimation getAnimation(@NonNull TransitionType transitionType, @NonNull Class<? extends Screen> screenClassFrom, @NonNull Class<? extends Screen> screenClassTo,
boolean isActivity, @Nullable AnimationData animationData) {
if (isActivity) {
return TransitionAnimation.DEFAULT;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package me.aartikov.advancedscreenswitchersample.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -11,6 +9,8 @@
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;

import com.google.android.material.bottomnavigation.BottomNavigationView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import butterknife.BindView;
import butterknife.ButterKnife;
import me.aartikov.advancedscreenswitchersample.R;
Expand Down Expand Up @@ -78,7 +79,7 @@ protected void onResumeFragments() {

@Override
protected void onPause() {
mNavigationContextBinder.unbind();
mNavigationContextBinder.unbind(this);
super.onPause();
}

Expand Down Expand Up @@ -110,7 +111,7 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
}

@Override
public void onScreenSwitched(@Nullable Screen screenFrom, Screen screenTo) {
public void onScreenSwitched(@Nullable Screen screenFrom, @NonNull Screen screenTo) {
int tabId = getTabId(screenTo);
mBottomBar.getMenu().findItem(tabId).setChecked(true);
bindNavigationContext(); // rebind NavigationContext because we need to set another container id and another child fragment manager.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package me.aartikov.advancedscreenswitchersample.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:layout_height="0dp"
android:layout_weight="1" />

<android.support.design.widget.BottomNavigationView
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import me.aartikov.alligator.ScreenResult;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
@Retention(RetentionPolicy.CLASS)
public @interface RegisterScreen {
Class<? extends Screen> value();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.MirroredTypeException;

import me.aartikov.alligator.annotations.RegisterScreen;
import me.aartikov.alligator.ScreenResult;
import me.aartikov.alligator.annotations.RegisterScreen;

public class RegistrationAnnotatedClassCreator {
private ProcessingUtils utils;
Expand Down Expand Up @@ -52,7 +52,7 @@ private ScreenType obtainScreenType(TypeElement classElement) throws ProcessingE
return screenType;
}
}
throw new ProcessingException(classElement, "Only Activity, support Fragment and support DialogFragment can be annotated with @RegisterScreen.");
throw new ProcessingException(classElement, "Only Activity, AndroidX Fragment and AndroidX DialogFragment can be annotated with @RegisterScreen.");
}

private String obtainScreenClassName(TypeElement classElement) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

public enum ScreenType {
ACTIVITY("android.app.Activity"),
DIALOG_FRAGMENT("android.support.v4.app.DialogFragment"),
FRAGMENT("android.support.v4.app.Fragment");
DIALOG_FRAGMENT("androidx.fragment.app.DialogFragment"),
FRAGMENT("androidx.fragment.app.Fragment");

private final String className;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
me.aartikov.alligatorcompiler.AlligatorCompiler,aggregating
6 changes: 3 additions & 3 deletions alligator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ apply plugin: 'com.github.dcendents.android-maven'
group = 'com.github.aartikov'

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

defaultConfig {
minSdkVersion 14
Expand All @@ -20,7 +20,7 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
}

task sourcesJar(type: Jar) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import androidx.annotation.Nullable;

/**
* Date: 12.03.2017
Expand All @@ -16,9 +17,10 @@
*/
public class ActivityResult {
private int mResultCode;
@Nullable
private Intent mIntent;

public ActivityResult(int resultCode, Intent intent) {
public ActivityResult(int resultCode, @Nullable Intent intent) {
mResultCode = resultCode;
mIntent = intent;
}
Expand All @@ -27,10 +29,12 @@ public int getResultCode() {
return mResultCode;
}

@Nullable
public Intent getIntent() {
return mIntent;
}

@Nullable
public Uri getDataUri() {
return mIntent != null ? mIntent.getData() : null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package me.aartikov.alligator;

import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import me.aartikov.alligator.helpers.ScreenResultHelper;
import me.aartikov.alligator.listeners.ScreenResultListener;
Expand All @@ -23,11 +25,11 @@ public class ActivityResultHandler {
private ScreenResultListener mScreenResultListener;
private ScreenResultPair mPendingScreenResultPair;

ActivityResultHandler(NavigationFactory navigationFactory) {
ActivityResultHandler(@NonNull NavigationFactory navigationFactory) {
mNavigationFactory = navigationFactory;
}

void setScreenResultListener(ScreenResultListener screenResultListener) {
void setScreenResultListener(@NonNull ScreenResultListener screenResultListener) {
mScreenResultListener = screenResultListener;
handlePendingScreenResult();
}
Expand All @@ -43,7 +45,7 @@ void resetScreenResultListener() {
* @param resultCode resultCode passed to {@code onActivityResult}
* @param data intent passed to {@code onActivityResult}
*/
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
Class<? extends Screen> screenClass = mNavigationFactory.getScreenClass(requestCode);
if (screenClass != null) {
ScreenImplementation screenImplementation = mNavigationFactory.getScreenImplementation(screenClass);
Expand All @@ -62,7 +64,7 @@ public void onActivityResult(final int requestCode, final int resultCode, final
*
* @param intent intent passed to {@code onNewIntent}
*/
public void onNewIntent(Intent intent) {
public void onNewIntent(@NonNull Intent intent) {
int requestCode = intent.getIntExtra(ScreenResultHelper.KEY_REQUEST_CODE, -1);
if (requestCode != -1) {
int resultCode = intent.getIntExtra(ScreenResultHelper.KEY_RESULT_CODE, 0);
Expand All @@ -81,7 +83,7 @@ private class ScreenResultPair {
Class<? extends Screen> mScreenClass;
ScreenResult mScreenResult;

ScreenResultPair(Class<? extends Screen> screenClass, ScreenResult screenResult) {
ScreenResultPair(@NonNull Class<? extends Screen> screenClass, @Nullable ScreenResult screenResult) {
mScreenClass = screenClass;
mScreenResult = screenResult;
}
Expand Down
Loading

0 comments on commit ba0278d

Please sign in to comment.