Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#本项目为更新FitAndroid7
原项目地址:
https://github.com/hongyangAndroid/FitAndroid7

One line of code completes Android 7 fileprovider adaptation~
# FitAndroid7

一行代码完成Android 7 FileProvider适配~
Expand All @@ -10,7 +15,7 @@
## 使用

```
compile 'com.zhy.base:fileprovider:1.0.0'
compile 'com.mg.RxCustomizedImagePicker:1.1.0'
```

通过FileProvider7这个类完成uri的获取即可,例如:
Expand Down
20 changes: 10 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.zhy.fitandroid7"
minSdkVersion 14
targetSdkVersion 25
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -20,11 +20,11 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.zhy.base:fileprovider:1.0.0'
testCompile 'junit:junit:4.12'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.github.shijingsh:fileprovider:1.1.0'
testImplementation 'junit:junit:4.12'
}
12 changes: 6 additions & 6 deletions app/src/main/java/com/zhy/fitandroid7/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
import android.content.pm.PackageManager;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import com.zhy.base.fileprovider.FileProvider7;

import java.io.File;
Expand Down
12 changes: 10 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.novoda:bintray-release:0.3.4'
classpath 'com.android.tools.build:gradle:3.5.2'
//classpath 'com.novoda:bintray-release:0.9.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,7 +19,11 @@ buildscript {

allprojects {
repositories {
mavenCentral()
mavenLocal()
jcenter()
google()

}
}

Expand Down
31 changes: 14 additions & 17 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Thu May 12 09:33:07 CST 2016

android.enableJetifier=true
android.useAndroidX=true
android.useDeprecatedNdk=true
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Tue Dec 03 13:46:45 GMT+08:00 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
93 changes: 76 additions & 17 deletions librararyforfileprovdider/build.gradle
Original file line number Diff line number Diff line change
@@ -1,33 +1,92 @@
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'//添加

//apply plugin: 'com.novoda.bintray-release'//添加
apply plugin: 'maven'
apply plugin: 'signing'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
minSdkVersion 7
targetSdkVersion 25
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
}

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
provided 'com.android.support:appcompat-v7:25.3.1'
api fileTree(dir: 'libs', include: ['*.jar'])
compileOnly 'androidx.appcompat:appcompat:1.1.0'
}

//添加
publish {
userOrg = 'hongyangandroid'//bintray.com用户名
groupId = 'com.zhy.base'//jcenter上的路径
artifactId = 'fileprovider'//项目名称
publishVersion = '1.0.0'//版本号
desc = 'Oh hi, this is a nice description for a project, right?'//描述,不重要
website = 'https://github.com/hyman/basetools'//网站,不重要;尽量模拟github上的地址,例如我这样的;当然你有地址最好了

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())


def ossrhUsername = properties.getProperty("ossrhUsername") //在SonaType上申请的账号
def ossrhPassword = properties.getProperty("ossrhPassword") //在SonaType上申请的密码

def PUBLISH_GROUP_ID = 'com.github.shijingsh' //这里可以不是直接申请时候的groupId只要开头是就可以

def PUBLISH_ARTIFACT_ID = "fileprovider" //引用库的artifactId

def PUBLISH_VERSION = "1.1.0" //这个是直接获取的库gradle里配置好的版本号,不用到处修改版本号,只需要维护一份就可以。

//签名
signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

// ./gradlew :librararyforfileprovdider:clean :librararyforfileprovdider:build bintrayUpload -PbintrayUser=hongyangandroid -PbintrayKey= -PdryRun=false
uploadArchives {
repositories {
mavenDeployer {

beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.groupId = PUBLISH_GROUP_ID
pom.artifactId = PUBLISH_ARTIFACT_ID
pom.version = PUBLISH_VERSION

pom.project {
name 'fileprovider'
packaging 'aar' //我这里发布的是安卓的包,所以写的aar
// optionally artifactId can be defined here
description 'One line of code completes Android 7 fileprovider adaptation~'
url 'https://github.com/shijingsh/FitAndroid7'

scm {
connection 'https://github.com/shijingsh/FitAndroid7'
developerConnection 'scm:git:git@github.com:shijingsh/FitAndroid7.git'
url 'https://github.com/shijingsh'
}

licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}

developers {
developer {
id 'liukefu'
name 'liukefu'
email 'liukefu2050@sina.com'
}
}
}
}
}
}
6 changes: 3 additions & 3 deletions librararyforfileprovdider/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

<application>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.android7.fileprovider"
android:name="com.zhy.base.fileprovider.MgFileProvider"
android:authorities="${applicationId}.android7.mg.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
android:resource="@xml/mg_file_paths" />
</provider>
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public static Uri getUriForFile(Context context, File file) {


public static Uri getUriForFile24(Context context, File file) {
Uri fileUri = android.support.v4.content.FileProvider.getUriForFile(context,
context.getPackageName() + ".android7.fileprovider",
Uri fileUri = androidx.core.content.FileProvider.getUriForFile(context,
context.getPackageName() + ".android7.mg.fileprovider",
file);
return fileUri;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.zhy.base.fileprovider;

public class MgFileProvider extends androidx.core.content.FileProvider {
}