Compare commits

...

2 Commits

Author SHA1 Message Date
Jonas Kalderstam 1735899c9c Override both versions of onAttach
fixes #101
2016-08-03 19:16:32 +02:00
Jonas Kalderstam ce565e6e8a Update versions of support library and tools 2016-08-03 19:15:02 +02:00
3 changed files with 29 additions and 9 deletions

View File

@ -14,12 +14,12 @@ def gitCommitCount =
Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 9
targetSdkVersion 23
targetSdkVersion 24
versionCode gitCommitCount
versionName gitTag
}
@ -27,9 +27,9 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
testCompile 'junit:junit:4.12'
}

View File

@ -6,9 +6,11 @@
package com.nononsenseapps.filepicker;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@ -350,9 +352,27 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
return checkable;
}
@SuppressWarnings("deprecation")
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
onAttachToContext(activity);
}
}
@TargetApi(23)
@Override
public void onAttach(Context context) {
super.onAttach(context);
onAttachToContext(context);
}
/**
* Called when attached to activity/context
* @param context we attached to
*/
protected void onAttachToContext(Context context) {
try {
mListener = (OnFilePickedListener) context;
} catch (ClassCastException e) {

View File

@ -11,8 +11,8 @@ def gitCommitCount =
Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileSdkVersion 24
buildToolsVersion "23.0.3"
packagingOptions {
exclude 'META-INF/LICENSE.txt'
@ -25,7 +25,7 @@ android {
defaultConfig {
minSdkVersion 18
targetSdkVersion 23
targetSdkVersion 24
versionCode gitCommitCount
versionName gitTag
archivesBaseName = "nononsensefilepicker-sample-${gitTag}".toString()