Skip to content

Commit ab8f49a

Browse files
committed
before changing livedatas
1 parent c3362f3 commit ab8f49a

35 files changed

+894
-300
lines changed

SmartFileBrowser/build.gradle

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
plugins {
22
id 'com.android.library'
3+
id 'maven-publish'
4+
id 'signing'
35
}
46

57
android {
@@ -28,16 +30,21 @@ android {
2830
targetCompatibility JavaVersion.VERSION_1_8
2931
}
3032
}
31-
33+
group = 'ir.smartdevelopers'
34+
version = '1.0.0'
35+
task sourcesJar(type: Jar) {
36+
archiveClassifier.set("sources")
37+
from android.sourceSets.main.java.srcDirs
38+
}
39+
task javadocJar2(type: Jar) {
40+
archiveClassifier.set( 'javadoc')
41+
from android.sourceSets.main.java.srcDirs
42+
}
3243
dependencies {
3344

3445
implementation 'androidx.appcompat:appcompat:1.2.0'
3546
implementation 'com.google.android.material:material:1.2.1'
3647
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
37-
testImplementation 'junit:junit:4.+'
38-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
39-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
40-
implementation 'com.squareup.picasso:picasso:2.71828'
4148
implementation 'com.github.bumptech.glide:glide:4.11.0'
4249
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
4350
// implementation 'it.sephiroth.android.library.bottomnavigation:bottom-navigation:3.0.0'
@@ -50,4 +57,57 @@ dependencies {
5057
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
5158
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
5259
implementation "androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version"
60+
}
61+
afterEvaluate{
62+
publishing {
63+
publications {
64+
release(MavenPublication) {
65+
from components.release
66+
groupId = 'ir.smartdevelopers'
67+
artifactId = 'smart-file-picker'
68+
pom {
69+
name = 'smart-file-picker'
70+
description = 'pick file easilly'
71+
url = 'https://github.com/smartdevelopers-ir/SmartFilePicker'
72+
73+
licenses {
74+
license {
75+
name = 'The Apache License, Version 2.0'
76+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
77+
}
78+
}
79+
developers {
80+
developer {
81+
id = 'smartdevelopers'
82+
name = 'mostafa babaei'
83+
email = 'info@smartdevelopers.ir'
84+
}
85+
}
86+
scm {
87+
connection = 'scm:git:git://github.com/smartdevelopers-ir/SmartFilePicker.git'
88+
developerConnection = 'scm:git:ssh://github.com/smartdevelopers-ir/SmartFilePicker.git'
89+
url = 'http://github.com/smartdevelopers-ir/SmartFilePicker'
90+
}
91+
92+
}
93+
}
94+
}
95+
repositories {
96+
maven {
97+
// change URLs to point to your repos, e.g. http://my.org/repo
98+
def releasesRepoUrl = "$buildDir/repos/releases"
99+
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
100+
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
101+
}
102+
}
103+
}
104+
105+
}
106+
signing {
107+
sign configurations.archives
108+
}
109+
110+
artifacts {
111+
archives sourcesJar
112+
archives javadocJar2
53113
}

SmartFileBrowser/src/androidTest/java/ir/smartdevelopers/smartfilebrowser/ExampleInstrumentedTest.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
package ir.smartdevelopers.smartfilebrowser;
22

33
import android.content.Context;
4+
import android.util.Log;
45

56
import androidx.test.platform.app.InstrumentationRegistry;
67
import androidx.test.ext.junit.runners.AndroidJUnit4;
78

89
import org.junit.Test;
910
import org.junit.runner.RunWith;
1011

12+
import java.io.File;
13+
import java.io.FileFilter;
14+
15+
import ir.smartdevelopers.smartfilebrowser.customClasses.FileUtil;
16+
import ir.smartdevelopers.smartfilebrowser.customClasses.SFBFileFilter;
17+
1118
import static org.junit.Assert.*;
1219

1320
/**
@@ -22,5 +29,41 @@ public void useAppContext() {
2229
// Context of the app under test.
2330
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
2431
assertEquals("ir.smartdevelopers.smartfilebrowser.test", appContext.getPackageName());
32+
String extension= FileUtil.getFileExtensionFromPath("/sdcard/Download");
33+
System.out.println("ext="+extension);
34+
}
35+
@Test
36+
public void fileFilterTest(){
37+
SFBFileFilter sfbFileFilter=new SFBFileFilter.Builder()
38+
.isFile(true).isFolder(true).includeExtension("pdf").build();
39+
Log.v("TTT","accespt=" + getFileFilterFromSfbFileFilter(sfbFileFilter)
40+
.accept(new File("/sdcard/Download")));
41+
Log.v("TTT","accespt=" + getFileFilterFromSfbFileFilter(sfbFileFilter)
42+
.accept(new File("/sdcard/Download/mm.pdf")));
43+
}
44+
private FileFilter getFileFilterFromSfbFileFilter(SFBFileFilter sfbFileFilter){
45+
return new FileFilter() {
46+
@Override
47+
public boolean accept(File pathname) {
48+
if (pathname==null){
49+
return false;
50+
}
51+
if (pathname.isDirectory()){
52+
return sfbFileFilter.isFolder();
53+
}else {
54+
if (pathname.isFile()){
55+
if (sfbFileFilter.getExtensionList().isEmpty()){
56+
return sfbFileFilter.isFile();
57+
}else {
58+
if (sfbFileFilter.isFile()){
59+
return sfbFileFilter.getExtensionList()
60+
.contains(FileUtil.getFileExtensionFromPath(pathname.getPath()));
61+
}
62+
}
63+
}
64+
}
65+
return false;
66+
}
67+
};
2568
}
2669
}

0 commit comments

Comments
 (0)