forked from WilliamRen/NextAndroid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
265 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
buildscript { | ||
repositories { | ||
jcenter() | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' | ||
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1" | ||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' | ||
} | ||
} | ||
|
||
plugins { | ||
id "com.jfrog.bintray" version "1.6" | ||
} | ||
|
||
repositories { | ||
jcenter() | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
|
@@ -31,10 +39,130 @@ repositories { | |
dependencies { | ||
|
||
testCompile 'junit:junit:4.12' | ||
testCompile 'org.mockito:mockito-core:1.10.19' | ||
testCompile 'org.robolectric:robolectric:3.0' | ||
|
||
compile 'com.android.support:support-annotations:23.0.1' | ||
} | ||
|
||
apply from: 'https://raw.githubusercontent.com/yoojia/Gradles/master/android.gradle' | ||
|
||
ext{ | ||
projVersion = '2.2' | ||
projArtifactId = 'next-android' | ||
projName = 'NextAndroid' | ||
projDesc = 'NextAndroid: Tools, Widgets, Utils' | ||
projURL = "https://github.com/yoojia/NextAndroid" | ||
projVCS = "https://github.com/yoojia/NextAndroid.git" | ||
} | ||
|
||
group 'com.github.yoojia' | ||
version projVersion | ||
project.archivesBaseName = projArtifactId | ||
|
||
tasks.withType(JavaCompile) { | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
apply plugin: 'com.github.dcendents.android-maven' | ||
|
||
task androidSourcesJar(type: Jar) { | ||
from android.sourceSets.main.java.srcDirs | ||
classifier = 'sources' | ||
} | ||
|
||
task javadoc(type: Javadoc) { | ||
source = android.sourceSets.main.java.srcDirs | ||
classpath += configurations.compile | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
} | ||
|
||
task androidJavadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
javadoc { | ||
options{ | ||
encoding "UTF-8" | ||
charSet 'UTF-8' | ||
author true | ||
version true | ||
links "http://docs.oracle.com/javase/7/docs/api" | ||
title projName | ||
} | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
archives androidJavadocJar | ||
} | ||
|
||
install { | ||
repositories.mavenInstaller { | ||
pom.project { | ||
name projName | ||
description projDesc | ||
url projURL | ||
inceptionYear '2016' | ||
|
||
packaging 'aar' | ||
groupId 'com.github.yoojia' | ||
artifactId projArtifactId | ||
version projVersion | ||
|
||
licenses { | ||
license { | ||
name 'The Apache Software License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
scm { | ||
connection projVCS | ||
url projURL | ||
|
||
} | ||
developers { | ||
developer { | ||
id 'yoojia' | ||
name 'Yoojia Chen' | ||
email '[email protected]' | ||
url 'https://yoojia.github.io' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
bintray { | ||
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') | ||
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') | ||
configurations = ['archives'] | ||
|
||
dryRun = false | ||
publish = true | ||
|
||
pkg { | ||
repo = 'maven' | ||
name = projName | ||
userOrg = 'yoojia' | ||
licenses = ['Apache-2.0'] | ||
vcsUrl = projVCS | ||
version { | ||
name = projVersion | ||
desc = projDesc | ||
vcsTag = projVersion | ||
attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin'] | ||
|
||
gpg { | ||
sign = true | ||
} | ||
|
||
mavenCentralSync { | ||
sync = project.hasProperty('SONATYPE_USER') && project.hasProperty('SONATYPE_KEY') | ||
user = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : "" | ||
password = project.hasProperty('SONATYPE_PASS') ? project.property('SONATYPE_PASS') : "" | ||
close = '1' | ||
} | ||
} | ||
} | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<manifest package="com.github.yoojia.next.ext"/> | ||
<manifest package="com.github.yoojia.next"/> |
75 changes: 75 additions & 0 deletions
75
supports/src/main/java/com/github/yoojia/next/system/NextDoubleClick.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.github.yoojia.next.system; | ||
|
||
import android.app.Activity; | ||
import android.os.Handler; | ||
import android.os.Looper; | ||
import android.support.annotation.StringRes; | ||
import android.view.KeyEvent; | ||
import android.widget.Toast; | ||
|
||
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
/** | ||
* @author YOOJIA.CHEN ([email protected]) | ||
* @since 2.1 | ||
*/ | ||
public class NextDoubleClick { | ||
|
||
private final AtomicBoolean mWaitingSecond = new AtomicBoolean(false); | ||
private final Activity mContext; | ||
private final String mMessage; | ||
private final Handler mHandler = new Handler(Looper.getMainLooper()); | ||
private final Runnable mResetWaiting = new Runnable() { | ||
@Override | ||
public void run() { | ||
mWaitingSecond.set(false); | ||
} | ||
}; | ||
|
||
private long mDoubleClickEscape = 2500; | ||
private OnDoubleClickListener mOnDoubleClickListener; | ||
|
||
public NextDoubleClick(Activity context, String message) { | ||
mContext = context; | ||
mMessage = message; | ||
} | ||
|
||
public NextDoubleClick(Activity context, @StringRes int confirmExitMsgResId) { | ||
this(context, context.getResources().getString(confirmExitMsgResId)); | ||
} | ||
|
||
/** | ||
* 接入Activity的onKeyDown方法 | ||
* @param keyCode keyCode | ||
* @param event event | ||
*/ | ||
public boolean onKeyDown(int keyCode, KeyEvent event){ | ||
if(keyCode == KeyEvent.KEYCODE_BACK ) { | ||
if ( ! mWaitingSecond.get()) { | ||
mWaitingSecond.set(true); | ||
Toast.makeText(mContext, mMessage, Toast.LENGTH_SHORT).show(); | ||
mHandler.postDelayed(mResetWaiting, mDoubleClickEscape); | ||
return true; | ||
}else{ | ||
if (mOnDoubleClickListener != null) { | ||
mOnDoubleClickListener.onDoubleClick(); | ||
} | ||
return false; | ||
} | ||
}else{ | ||
return false; // Not back click | ||
} | ||
} | ||
|
||
public void setDoubleClickEscape(long doubleClickEscape) { | ||
mDoubleClickEscape = doubleClickEscape; | ||
} | ||
|
||
public void setOnDoubleClickListener(OnDoubleClickListener onDoubleClickListener) { | ||
mOnDoubleClickListener = onDoubleClickListener; | ||
} | ||
|
||
public interface OnDoubleClickListener { | ||
void onDoubleClick(); | ||
} | ||
} |
53 changes: 0 additions & 53 deletions
53
supports/src/main/java/com/github/yoojia/next/system/NextExit.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
import android.widget.EditText; | ||
import android.widget.ImageView; | ||
|
||
import com.github.yoojia.next.ext.R; | ||
import com.github.yoojia.next.R; | ||
|
||
/** | ||
* @author 陈小锅 ([email protected]) | ||
|
Oops, something went wrong.