mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2025-07-04 22:16:26 +00:00
First commit: Just a collection of library sources from Github. Compiles, but doesn't work.
This commit is contained in:
130
temp/droidkit-actors-0.2.48/actors-android/build.gradle
Normal file
130
temp/droidkit-actors-0.2.48/actors-android/build.gradle
Normal file
@ -0,0 +1,130 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.9.+'
|
||||
}
|
||||
}
|
||||
apply plugin: 'android-library'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'signing'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url "https://oss.sonatype.org/content/groups/public/" }
|
||||
}
|
||||
|
||||
sourceCompatibility = 1.6
|
||||
group = 'com.droidkit'
|
||||
version = fullVersion
|
||||
|
||||
android {
|
||||
compileSdkVersion 19
|
||||
buildToolsVersion "20.0.0"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 19
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
runProguard false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
// Android JavaDocs
|
||||
android.libraryVariants.all { variant ->
|
||||
task("${variant.name}Javadoc", type: Javadoc) {
|
||||
destinationDir = new File("$project.buildDir/javadoc/$variant.name")
|
||||
|
||||
source = variant.javaCompile.source
|
||||
exclude '**/BuildConfig.java'
|
||||
exclude '**/R.java'
|
||||
|
||||
ext.androidJar = "${android.plugin.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
|
||||
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
|
||||
}
|
||||
|
||||
task("${variant.name}JavadocJar", type: Jar, dependsOn: "${variant.name}Javadoc") {
|
||||
classifier 'javadoc'
|
||||
destinationDir = new File("$project.buildDir/libs/")
|
||||
from "$project.buildDir/javadoc/$variant.name"
|
||||
}
|
||||
|
||||
task("${variant.name}SourcesJar", type: Jar) {
|
||||
classifier 'sources'
|
||||
|
||||
destinationDir = new File("$project.buildDir/libs/")
|
||||
|
||||
from variant.javaCompile.source
|
||||
exclude '**/BuildConfig.java'
|
||||
exclude '**/R.java'
|
||||
}
|
||||
}
|
||||
|
||||
project.afterEvaluate {
|
||||
artifacts {
|
||||
archives releaseJavadocJar
|
||||
archives releaseSourcesJar
|
||||
}
|
||||
|
||||
if (project.hasProperty("ossrhUsername") && project.hasProperty("ossrhPassword")) {
|
||||
|
||||
signing {
|
||||
sign configurations.archives
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
pom.project {
|
||||
name 'DroidKit Actors: Android'
|
||||
packaging 'aar'
|
||||
description 'DroidKit Actors: Android is extension for DroidKit Actors for creating UIActors'
|
||||
url 'https://github.com/secretapphd/droidkit-actors'
|
||||
|
||||
scm {
|
||||
url 'scm:git@github.com:secretapphd/droidkit-actors.git'
|
||||
connection 'scm:git@github.com:secretapphd/droidkit-actors.git'
|
||||
developerConnection 'scm:git@github.com:secretapphd/droidkit-actors.git'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'The MIT License (MIT)'
|
||||
url 'http://opensource.org/licenses/MIT'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'ex3ndr'
|
||||
name 'Stepan Korshakov'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:appcompat-v7:20.+'
|
||||
compile 'com.droidkit:actors:0.2.+'
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /Users/ex3ndr/Documents/android-sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
@ -0,0 +1,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.droidkit.actors.android">
|
||||
|
||||
<application></application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,85 @@
|
||||
package com.droidkit.actors.android;
|
||||
|
||||
import com.droidkit.actors.*;
|
||||
import com.droidkit.actors.messages.PoisonPill;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Actor-like object that works in UI Thread and backed by real Actor that dispatched on UI thread too.
|
||||
*/
|
||||
public class UiActor {
|
||||
private String path;
|
||||
private ActorSystem actorSystem;
|
||||
private ActorRef actorRef;
|
||||
private boolean isKilled;
|
||||
|
||||
public UiActor() {
|
||||
this(ActorSystem.system());
|
||||
}
|
||||
|
||||
public UiActor(ActorSystem actorSystem) {
|
||||
this.actorSystem = actorSystem;
|
||||
this.actorRef = actorSystem.actorOf(BackedUiActor.createProps(this), "ui_" + UUID.randomUUID());
|
||||
this.isKilled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of actor
|
||||
*
|
||||
* @return Path
|
||||
*/
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Backed ActorRef
|
||||
*
|
||||
* @return ActorRef
|
||||
*/
|
||||
public ActorRef getActorRef() {
|
||||
return actorRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* On incoming message
|
||||
*
|
||||
* @param message message
|
||||
*/
|
||||
public void onReceive(Object message) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop receiving messages by this actor
|
||||
*/
|
||||
public void kill() {
|
||||
isKilled = true;
|
||||
actorRef.send(PoisonPill.INSTANCE);
|
||||
}
|
||||
|
||||
private static class BackedUiActor extends Actor {
|
||||
public static Props<BackedUiActor> createProps(final UiActor uiActor) {
|
||||
return Props.create(BackedUiActor.class, new ActorCreator<BackedUiActor>() {
|
||||
@Override
|
||||
public BackedUiActor create() {
|
||||
return new BackedUiActor(uiActor);
|
||||
}
|
||||
}).changeDispatcher("ui");
|
||||
}
|
||||
|
||||
private UiActor uiActor;
|
||||
|
||||
private BackedUiActor(UiActor uiActor) {
|
||||
this.uiActor = uiActor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Object message) {
|
||||
if (!uiActor.isKilled) {
|
||||
uiActor.onReceive(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.droidkit.actors.android;
|
||||
|
||||
import com.droidkit.actors.ActorSystem;
|
||||
import com.droidkit.actors.dispatch.Dispatch;
|
||||
import com.droidkit.actors.mailbox.AbsActorDispatcher;
|
||||
import com.droidkit.actors.mailbox.Envelope;
|
||||
import com.droidkit.actors.mailbox.MailboxesQueue;
|
||||
|
||||
/**
|
||||
* Actor Dispatcher for dispatching messages on UI Thread
|
||||
*/
|
||||
public class UiActorDispatcher extends AbsActorDispatcher {
|
||||
|
||||
public UiActorDispatcher(ActorSystem actorSystem) {
|
||||
super(actorSystem);
|
||||
|
||||
initDispatcher(new UiDispatcher<Envelope, MailboxesQueue>(new MailboxesQueue(), new Dispatch<Envelope>() {
|
||||
@Override
|
||||
public void dispatchMessage(Envelope message) {
|
||||
processEnvelope(message);
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.droidkit.actors.android;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import com.droidkit.actors.ActorTime;
|
||||
import com.droidkit.actors.dispatch.AbstractDispatchQueue;
|
||||
import com.droidkit.actors.dispatch.AbstractDispatcher;
|
||||
import com.droidkit.actors.dispatch.Dispatch;
|
||||
|
||||
/**
|
||||
* Thread Dispatcher that dispatches messages on UI Thread
|
||||
*/
|
||||
public class UiDispatcher<T, Q extends AbstractDispatchQueue<T>> extends AbstractDispatcher<T, Q> {
|
||||
private Handler handler = new Handler(Looper.getMainLooper()) {
|
||||
@Override
|
||||
public void dispatchMessage(Message msg) {
|
||||
doIteration();
|
||||
}
|
||||
};
|
||||
|
||||
protected UiDispatcher(Q queue, Dispatch<T> dispatch) {
|
||||
super(queue, dispatch);
|
||||
}
|
||||
|
||||
protected void invalidate() {
|
||||
handler.removeMessages(0);
|
||||
handler.sendEmptyMessage(0);
|
||||
}
|
||||
|
||||
protected void invalidateDelay(long delay) {
|
||||
handler.removeMessages(0);
|
||||
if (delay > 15000) {
|
||||
delay = 15000;
|
||||
}
|
||||
handler.sendEmptyMessageDelayed(0, delay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void notifyDispatcher() {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
protected void doIteration() {
|
||||
long time = ActorTime.currentTime();
|
||||
T action = getQueue().dispatch(time);
|
||||
if (action == null) {
|
||||
long delay = getQueue().waitDelay(time);
|
||||
invalidateDelay(delay);
|
||||
} else {
|
||||
dispatchMessage(action);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user