diff --git a/temp/droidkit-actors-0.2.48/.gitignore b/temp/droidkit-actors-0.2.48/.gitignore deleted file mode 100644 index 724c2cf..0000000 --- a/temp/droidkit-actors-0.2.48/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -actors/build -actors-sample/build -.idea -.gradle -*.iml - -local.properties diff --git a/temp/droidkit-actors-0.2.48/LICENSE b/temp/droidkit-actors-0.2.48/LICENSE deleted file mode 100644 index 326fe25..0000000 --- a/temp/droidkit-actors-0.2.48/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/temp/droidkit-actors-0.2.48/README.md b/temp/droidkit-actors-0.2.48/README.md deleted file mode 100644 index a8e5421..0000000 --- a/temp/droidkit-actors-0.2.48/README.md +++ /dev/null @@ -1,81 +0,0 @@ -DroidKit Actors -=============== -Lightweight java implementation of actor model for small applications. Designed for Android applications. -Read more about actors on [Wikipedia](http://en.wikipedia.org/wiki/Actor_model) - -QuickStart -=============== -### Add dependency to your gradle project -``` -compile 'com.droidkit:actors:0.1.+' -``` - -### Create log Actor -``` -import android.util.Log; -import com.droidkit.actors.Actor; - -public class LogActor extends Actor { - - @Override - public void preStart() { - Log.d("LOGACTOR#" + hashCode(), "preStart"); - } - - @Override - public void onReceive(Object message) { - Log.d("LOGACTOR#" + hashCode(), message + ""); - } - - @Override - public void postStop() { - Log.d("LOGACTOR#" + hashCode(), "postStop"); - } -} -``` - -### Use main actor system -Actor system is entry point to actor model, it contains all configurations, dispatchers and actors. -Dispatcher is a queue + worker threads for this queue. - -By default ActorSystem has static main ActorSystem and in most cases you can use it in two ways: -``` -void a() { - ActorSystem.system() -} -``` -or -``` -import static com.droidkit.actors.ActorSystem.system; - -void a() { - system() -} -``` -### or create your Actor system -``` -ActorSystem system = new ActorSystem(); -// Add additional dispatcher with threads number == cores count -system.addDispatcher("images"); -// Add additional dispather with 3 threads with minimal priority -system.addDispatcher("images", new MailboxesDispatcher(system, 2, Thread.MIN_PRIORITY)); -``` -### Complete sample -``` -system().addDispatcher("images", new MailboxesDispatcher(system(), 2, Thread.MIN_PRIORITY)); - -ActorRef log1 = system().actorOf(LogActor.class, "log"); -ActorRef log2 = system().actorOf(LogActor.class, "log"); -ActorRef log3 = system().actorOf(Props.create(LogActor.class).changeDispatcher("images"), "log2"); -ActorRef log4 = system().actorOf(Props.create(LogActor.class).changeDispatcher("images"), "log3"); - -ActorRef[] refs = new ActorRef[]{log1, log2, log3, log4}; -for (int i = 0; i < 100; i++) { - refs[i % refs.length].send("test" + i); -} -``` -Log output will be with messages without ordering across all messages, but ordered for every actor. - -License -=============== -License use [MIT License](LICENSE) diff --git a/temp/droidkit-actors-0.2.48/actors-android/build.gradle b/temp/droidkit-actors-0.2.48/actors-android/build.gradle deleted file mode 100644 index bf408e3..0000000 --- a/temp/droidkit-actors-0.2.48/actors-android/build.gradle +++ /dev/null @@ -1,130 +0,0 @@ -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.+' -} \ No newline at end of file diff --git a/temp/droidkit-actors-0.2.48/actors-android/proguard-rules.txt b/temp/droidkit-actors-0.2.48/actors-android/proguard-rules.txt deleted file mode 100644 index 7efd9b8..0000000 --- a/temp/droidkit-actors-0.2.48/actors-android/proguard-rules.txt +++ /dev/null @@ -1,17 +0,0 @@ -# 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 *; -#} \ No newline at end of file diff --git a/temp/droidkit-actors-0.2.48/actors-android/src/main/AndroidManifest.xml b/temp/droidkit-actors-0.2.48/actors-android/src/main/AndroidManifest.xml deleted file mode 100644 index fbf285e..0000000 --- a/temp/droidkit-actors-0.2.48/actors-android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/temp/droidkit-actors-0.2.48/actors-android/src/main/java/com/droidkit/actors/android/UiActor.java b/temp/droidkit-actors-0.2.48/actors-android/src/main/java/com/droidkit/actors/android/UiActor.java deleted file mode 100644 index 9de0061..0000000 --- a/temp/droidkit-actors-0.2.48/actors-android/src/main/java/com/droidkit/actors/android/UiActor.java +++ /dev/null @@ -1,85 +0,0 @@ -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 createProps(final UiActor uiActor) { - return Props.create(BackedUiActor.class, new ActorCreator() { - @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); - } - } - } -} diff --git a/temp/droidkit-actors-0.2.48/actors-android/src/main/java/com/droidkit/actors/android/UiActorDispatcher.java b/temp/droidkit-actors-0.2.48/actors-android/src/main/java/com/droidkit/actors/android/UiActorDispatcher.java deleted file mode 100644 index be98fee..0000000 --- a/temp/droidkit-actors-0.2.48/actors-android/src/main/java/com/droidkit/actors/android/UiActorDispatcher.java +++ /dev/null @@ -1,24 +0,0 @@ -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(new MailboxesQueue(), new Dispatch() { - @Override - public void dispatchMessage(Envelope message) { - processEnvelope(message); - } - })); - } -} diff --git a/temp/droidkit-actors-0.2.48/actors-android/src/main/java/com/droidkit/actors/android/UiDispatcher.java b/temp/droidkit-actors-0.2.48/actors-android/src/main/java/com/droidkit/actors/android/UiDispatcher.java deleted file mode 100644 index a598ea4..0000000 --- a/temp/droidkit-actors-0.2.48/actors-android/src/main/java/com/droidkit/actors/android/UiDispatcher.java +++ /dev/null @@ -1,54 +0,0 @@ -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> extends AbstractDispatcher { - private Handler handler = new Handler(Looper.getMainLooper()) { - @Override - public void dispatchMessage(Message msg) { - doIteration(); - } - }; - - protected UiDispatcher(Q queue, Dispatch 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); - } - } -} \ No newline at end of file diff --git a/temp/droidkit-actors-0.2.48/actors-sample/build.gradle b/temp/droidkit-actors-0.2.48/actors-sample/build.gradle deleted file mode 100644 index c26084b..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/build.gradle +++ /dev/null @@ -1,60 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.9.+' - } -} -apply plugin: 'android' - -repositories { - mavenCentral() - maven { url "https://oss.sonatype.org/content/groups/public/" } -} - -android { - compileSdkVersion 19 - buildToolsVersion "20.0.0" - - defaultConfig { - minSdkVersion 9 - targetSdkVersion 19 - versionCode apkVersionCode - versionName apkVersionName - } - - signingConfigs { - release { - - } - } - - buildTypes { - release { - signingConfig signingConfigs.release - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } - - if (project.hasProperty('androidStore') && - project.hasProperty('androidStorePass') && - project.hasProperty('androidAliasPass')&& - project.hasProperty('androidAlias')) { - android.signingConfigs.release.storeFile = file(androidStore) - android.signingConfigs.release.storePassword = androidStorePass - android.signingConfigs.release.keyAlias = androidAlias - android.signingConfigs.release.keyPassword = androidAliasPass - } else { - buildTypes.release.signingConfig = null - } -} - -dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:19.+' - // compile project(":actors-android") - compile project(":actors") - compile project(":actors-android") -} diff --git a/temp/droidkit-actors-0.2.48/actors-sample/proguard-rules.txt b/temp/droidkit-actors-0.2.48/actors-sample/proguard-rules.txt deleted file mode 100644 index 7efd9b8..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/proguard-rules.txt +++ /dev/null @@ -1,17 +0,0 @@ -# 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 *; -#} \ No newline at end of file diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/AndroidManifest.xml b/temp/droidkit-actors-0.2.48/actors-sample/src/main/AndroidManifest.xml deleted file mode 100644 index 2aaabd4..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/src/main/AndroidManifest.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/CounterActor.java b/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/CounterActor.java deleted file mode 100644 index f580259..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/CounterActor.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.droidkit.actors.sample; - -import com.droidkit.actors.Actor; - -/** - * Created by ex3ndr on 27.08.14. - */ -public class CounterActor extends Actor { - int last = -1; - - @Override - public void onReceive(Object message) { - if (message instanceof Integer) { - int val = (Integer) message; - if (last != val - 1) { - Log.d("Error! Wrong order expected #" + (last + 1) + " got #" + val); - } - last++; - } - } -} diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/DownloadFile.java b/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/DownloadFile.java deleted file mode 100644 index 8c4e7ea..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/DownloadFile.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.droidkit.actors.sample; - -import com.droidkit.actors.ReflectedActor; -import com.droidkit.actors.tasks.AskCallback; -import com.droidkit.actors.tasks.AskFuture; - -/** - * Created by ex3ndr on 18.08.14. - */ -public class DownloadFile extends ReflectedActor { - - public void onReceive(String[] url) { - ask(HttpDownloader.download(url[0])); - ask(HttpDownloader.download(url[1])); - AskFuture future = ask(HttpDownloader.download(url[2])); - - try { - Thread.sleep(10); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - future.cancel(); - -// combine("downloaded", byte[].class, -// ask(HttpDownloader.download(url[0])), -// ask(HttpDownloader.download(url[1]))); - } - - public void onDownloadedReceive(byte[][] data) { - Log.d("DownloadFile:onDownloadedReceive:" + data); - Log.d("downloaded " + data[0].length + " bytes and " + data[1].length + " bytes"); - } - - public void onDownloadedReceive(Throwable throwable) { - Log.d("DownloadFile:onDownloadedReceiveError:" + throwable); - } - - public void onReceive(String url) { - Log.d("DownloadFile:onReceiveUrl:" + url); - ask(HttpDownloader.download(url), new AskCallback() { - @Override - public void onResult(Object result) { - self().send(result); - } - - @Override - public void onError(Throwable throwable) { - - } - }); - } - - public void onReceive(byte[] data) { - Log.d("DownloadFile:receiveData:" + data); - Log.d("downloaded " + data.length + " bytes"); - } -} \ No newline at end of file diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/HashUtil.java b/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/HashUtil.java deleted file mode 100644 index ce5d4e8..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/HashUtil.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.droidkit.actors.sample; - -import java.io.UnsupportedEncodingException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** - * Created by ex3ndr on 17.08.14. - */ -public class HashUtil { - public static String md5(String s) { - try { - byte[] bytesOfMessage = s.getBytes("UTF-8"); - MessageDigest md = MessageDigest.getInstance("MD5"); - byte[] thedigest = md.digest(bytesOfMessage); - return hex(thedigest); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - throw new RuntimeException(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - throw new RuntimeException(); - } - } - - public static String hex(byte[] data) { - StringBuilder res = new StringBuilder(); - for (int i = 0; i < data.length; i++) { - res.append(Integer.toHexString(data[i] & 0xFF).toLowerCase()); - } - return res.toString(); - } - -} diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/HttpDownloader.java b/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/HttpDownloader.java deleted file mode 100644 index 7b4ef14..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/HttpDownloader.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.droidkit.actors.sample; - -import com.droidkit.actors.*; -import com.droidkit.actors.dispatch.RunnableDispatcher; -import com.droidkit.actors.tasks.TaskActor; - -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; - -/** - * Created by ex3ndr on 18.08.14. - */ -public class HttpDownloader extends TaskActor { - - private static final RunnableDispatcher dispatcher = new RunnableDispatcher(2); - - public static String path(String url) { - return "/http_" + HashUtil.md5(url); - } - - public static Props prop(final String url) { - return Props.create(HttpDownloader.class, new ActorCreator() { - @Override - public HttpDownloader create() { - return new HttpDownloader(url); - } - }); - } - - public static ActorSelection download(String url) { - return new ActorSelection(prop(url), path(url)); - } - - private String url; - private Runnable runnable; - - public HttpDownloader(final String url) { - this.url = url; - runnable = new Runnable() { - @Override - public void run() { - try { - Log.d("HttpDownloader:startDownload:" + url); - URL urlSpec = new URL(url); - HttpURLConnection urlConnection = (HttpURLConnection) urlSpec.openConnection(); - urlConnection.setConnectTimeout(15000); - urlConnection.setReadTimeout(15000); - InputStream in = urlConnection.getInputStream(); - byte[] data = IOUtils.readAll(in); - complete(data); - Log.d("HttpDownloader:complete:" + url); - } catch (IOException e) { - error(e); - Log.d("HttpDownloader:error:" + url); - } - } - }; - setTimeOut(500); - } - - @Override - public void startTask() { - Log.d("HttpDownloader:startTask:" + url); - dispatcher.postAction(runnable); - } - - @Override - public void onTaskObsolete() { - Log.d("HttpDownloader:onTaskObsolete:" + url); - } -} diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/IOUtils.java b/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/IOUtils.java deleted file mode 100644 index de2a5e9..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/IOUtils.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.droidkit.actors.sample; - -import java.io.BufferedInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - -/** - * Created by ex3ndr on 20.08.14. - */ -public class IOUtils { - public static byte[] readAll(InputStream in) throws IOException { - BufferedInputStream bufferedInputStream = new BufferedInputStream(in); - ByteArrayOutputStream os = new ByteArrayOutputStream(4096); - byte[] buffer = new byte[4 * 1024]; - int len; - int readed = 0; - try { - while ((len = bufferedInputStream.read(buffer)) >= 0) { - Thread.yield(); - os.write(buffer, 0, len); - readed += len; - } - } catch (java.io.IOException e) { - - } - return os.toByteArray(); - } -} diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/Log.java b/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/Log.java deleted file mode 100644 index c9d08bd..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/Log.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.droidkit.actors.sample; - -import com.droidkit.actors.ActorRef; -import com.droidkit.actors.ActorSystem; - -/** - * Created by ex3ndr on 18.08.14. - */ -public class Log { - private static final ActorRef log = ActorSystem.system().actorOf(LogActor.class, "log"); - - public static void d(String s) { - log.send(s); - } -} diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/LogActor.java b/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/LogActor.java deleted file mode 100644 index c737cd7..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/LogActor.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.droidkit.actors.sample; - -import android.util.Log; -import com.droidkit.actors.Actor; - -/** - * Created by ex3ndr on 14.08.14. - */ -public class LogActor extends Actor { - - @Override - public void preStart() { - Log.d("LOGACTOR#" + hashCode(), "preStart"); - } - - @Override - public void onReceive(Object message) { - Log.d("LOGACTOR#" + hashCode(), message + ""); - } - - @Override - public void postStop() { - Log.d("LOGACTOR#" + hashCode(), "postStop"); - } -} diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/MainActivity.java b/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/MainActivity.java deleted file mode 100644 index b0d0c05..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/src/main/java/com/droidkit/actors/sample/MainActivity.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.droidkit.actors.sample; - -import android.support.v7.app.ActionBarActivity; -import android.os.Bundle; -import android.view.View; -import android.widget.TextView; -import com.droidkit.actors.ActorRef; -import com.droidkit.actors.android.UiActor; -import com.droidkit.actors.android.UiActorDispatcher; - -import static com.droidkit.actors.ActorSystem.system; - -public class MainActivity extends ActionBarActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - system().addDispatcher("ui", new UiActorDispatcher(system())); - -// ActorRef log = system().actorOf(LogActor.class, "log"); - -// ActorRef downloader = system().actorOf(DownloadFile.class, "dow"); -// downloader.send("http://flirtyfleurs.com/wp-content/uploads/2012/10/pwg-sample-11_photo.jpg"); -// downloader.send("http://flirtyfleurs.com/wp-content/uploads/2012/10/pwg-sample-11_photo.jpg", 600); -// downloader.send("http://flirtyfleurs.com/wp-content/uploads/2012/10/pwg-sample-11_photo.jpg", 3000); - -// ActorRef dow2 = system().actorOf(DownloadFile.class, "dow2"); -// dow2.send(new String[]{ -// "http://flirtyfleurs.com/wp-content/uploads/2012/10/pwg-sample-11_photo.jpg", -// "http://isc.stuorg.iastate.edu/wp-content/uploads/sample.jpg", -// "http://imgsv.imaging.nikon.com/lineup/lens/zoom/normalzoom/af-s_dx_18-300mmf_35-56g_ed_vr/img/sample/sample4_l.jpg"}); - - final TextView view = (TextView) findViewById(R.id.demo); - final UiActor actor = new UiActor() { - @Override - public void onReceive(Object message) { - view.setText(message.toString()); - } - }; - - findViewById(R.id.demoButton).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - for (int i = 0; i < 10; i++) { - actor.getActorRef().send("message_" + i, i * 500); - } - } - }); - - new Thread() { - @Override - public void run() { - ActorRef ref = system().actorOf(CounterActor.class, "counter1"); - Log.d("Start"); - for (int i = 0; i < 1000000; i++) { - ref.send((Integer) i); - if (i % 1000 == 0) { - Log.d("Progress " + i); - try { - Thread.sleep(300); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - Log.d("End"); - } - }.start(); - - } -} \ No newline at end of file diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-hdpi/ic_launcher.png b/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-hdpi/ic_launcher.png deleted file mode 100644 index 96a442e..0000000 Binary files a/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-mdpi/ic_launcher.png b/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-mdpi/ic_launcher.png deleted file mode 100644 index 359047d..0000000 Binary files a/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-xhdpi/ic_launcher.png b/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 71c6d76..0000000 Binary files a/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-xxhdpi/ic_launcher.png b/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-xxhdpi/ic_launcher.png deleted file mode 100644 index 4df1894..0000000 Binary files a/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/layout/activity_main.xml b/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/layout/activity_main.xml deleted file mode 100644 index 9097779..0000000 --- a/temp/droidkit-actors-0.2.48/actors-sample/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - -