Skip to content

Commit

Permalink
update data
Browse files Browse the repository at this point in the history
update data
  • Loading branch information
秋逸 committed Oct 26, 2016
1 parent 83c2308 commit 43ac307
Show file tree
Hide file tree
Showing 62 changed files with 20,287 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 21 additions & 67 deletions VonTools/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

android {
compileSdkVersion 24
Expand Down Expand Up @@ -32,70 +30,26 @@ dependencies {
testCompile 'junit:junit:4.12'
}

def siteUrl = 'https://github.com/vondear/VonTools'
def gitUrl = 'https://github.com/vondear/VonTools.git'
group = "com.vondear.vontools" // Maven Group ID for the artifact,一般填你唯一的包名
install{
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
// Add your description here
name 'Android Tools' //项目的描述 你可以多写一点
url siteUrl
// Set your license
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'von' //填写的一些基本信息
name 'vondear'
email '[email protected]'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
ext {
bintrayRepo = 'maven'
bintrayName = 'vontools'

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
/*task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}*/
artifacts {
//archives javadocJar
archives sourcesJar
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = "maven"
name = "VonTool" //发布到JCenter上的项目名字
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}
publishedGroupId = 'com.vondear.vontools'
libraryName = 'VonTools'
artifact = 'vontools'

libraryDescription = 'A Tools on Android'

siteUrl = 'https://github.com/vondear/VonTools'
gitUrl = 'https://github.com/vondear/VonTools.git'

libraryVersion = '1.0.0'

developerId = 'vondear'
developerName = 'vondear'
developerEmail = '[email protected]'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.vondear.vontool;

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 static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.vondear.vontool.test", appContext.getPackageName());
}
}
2 changes: 1 addition & 1 deletion VonTools/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.vondear.vontools">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.vondear.vontool">

<application android:allowBackup="true" android:label="@string/app_name"
android:supportsRtl="true">
Expand Down
102 changes: 102 additions & 0 deletions VonTools/src/main/java/com/vondear/vontool/utils/VonActivityUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package com.vondear.vontool.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;


/**
* Created by vondear on 2016/1/24.
*/
public class VonActivityUtils {

/**
* 判断是否存在指定Activity
*
* @param context 上下文
* @param packageName 包名
* @param className activity全路径类名
* @return {@code true}: 是<br>{@code false}: 否
*/
public static boolean isExistActivity(Context context, String packageName, String className) {
Intent intent = new Intent();
intent.setClassName(packageName, className);
return !(context.getPackageManager().resolveActivity(intent, 0) == null ||
intent.resolveActivity(context.getPackageManager()) == null ||
context.getPackageManager().queryIntentActivities(intent, 0).size() == 0);
}

/**
* 打开指定的Activity
*
* @param context 上下文
* @param packageName 包名
* @param className 全类名
*/
public static void launchActivity(Context context, String packageName, String className) {
launchActivity(context, packageName, className, null);
}

/**
* 打开指定的Activity
*
* @param context 上下文
* @param packageName 包名
* @param className 全类名
* @param bundle bundle
*/
public static void launchActivity(Context context, String packageName, String className, Bundle bundle) {
context.startActivity(VonIntentUtils.getComponentNameIntent(packageName, className, bundle));
}


/**
* Activity 跳转
*
* @param context
* @param goal
*/
public static void skipActivityAndFinish(Context context, Class<?> goal, Bundle bundle) {
Intent intent = new Intent(context, goal);
intent.putExtras(bundle);
context.startActivity(intent);
((Activity) context).finish();
}

/**
* Activity 跳转
*
* @param context
* @param goal
*/
public static void skipActivityAndFinish(Context context, Class<?> goal) {
Intent intent = new Intent(context, goal);
context.startActivity(intent);
((Activity) context).finish();
}


/**
* Activity 跳转
*
* @param context
* @param goal
*/
public static void skipActivity(Context context, Class<?> goal) {
Intent intent = new Intent(context, goal);
context.startActivity(intent);
}

/**
* Activity 跳转
*
* @param context
* @param goal
*/
public static void skipActivity(Context context, Class<?> goal, Bundle bundle) {
Intent intent = new Intent(context, goal);
intent.putExtras(bundle);
context.startActivity(intent);
}
}
Loading

0 comments on commit 43ac307

Please sign in to comment.