diff --git a/app/.gitignore b/app/.gitignore new file mode 100755 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100755 index 0000000..eff4b58 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,46 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.3" + + defaultConfig { + applicationId "it.sysdata.eventdispatcher" + minSdkVersion 9 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + lintOptions { + abortOnError false + } +} + +dependencies { + + def adapterVersionName = project.ext.libVersionName + + compile fileTree(dir: 'libs', include: ['*.jar']) + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:23.3.0' + compile 'com.android.support:design:23.3.0' + + // WITH THESE ONES YOU CAN TEST REMOTE LIBS + // REMEMBER TO USE THESE AFTER TEST CAUSE JENKINS TROUBLES + compile "com.baseandroid:baseandroid-busadapter:$adapterVersionName" + compile "com.baseandroid:baseandroid-eventdispatcher:$adapterVersionName" + // compile "com.baseandroid:baseandroid-rxeventdispatcher:$adapterVersionName' + + // WITH THESE ONES YOU CAN USE LOCAL PROJECTS + // REMEMBER: COMMENT THESE ONES BEFOR PUSH ON DEVELOP CAUSE JENKINS TROUBLES + //compile project(path: ':baseandroid-busadapter') + //compile project(path: ':baseandroid-eventdispatcher') + //compile project(path: ':baseandroid-rxeventdispatcher') + +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100755 index 0000000..ca4c607 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\Stefano\Sviluppo\ADT_bundle_windows\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# 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 *; +#} diff --git a/app/src/androidTest/java/it/sysdata/eventdispatcher/ApplicationTest.java b/app/src/androidTest/java/it/sysdata/eventdispatcher/ApplicationTest.java new file mode 100755 index 0000000..85a6646 --- /dev/null +++ b/app/src/androidTest/java/it/sysdata/eventdispatcher/ApplicationTest.java @@ -0,0 +1,13 @@ +package it.sysdata.eventdispatcher; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100755 index 0000000..64ccc47 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/java/it/sysdata/eventdispatcher/MainActivity.java b/app/src/main/java/it/sysdata/eventdispatcher/MainActivity.java new file mode 100755 index 0000000..f60cb9a --- /dev/null +++ b/app/src/main/java/it/sysdata/eventdispatcher/MainActivity.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2016 Sysdata Digital, S.r.l. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package it.sysdata.eventdispatcher; + +import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import com.baseandroid.events.EventDispatcher; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + EventDispatcher.register(this); + FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); + fab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + EventDispatcher.post(new UIEvent()); + } + }); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/it/sysdata/eventdispatcher/MainActivityFragment.java b/app/src/main/java/it/sysdata/eventdispatcher/MainActivityFragment.java new file mode 100755 index 0000000..548251c --- /dev/null +++ b/app/src/main/java/it/sysdata/eventdispatcher/MainActivityFragment.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2016 Sysdata Digital, S.r.l. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package it.sysdata.eventdispatcher; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Toast; + +import com.baseandroid.events.EventDispatcher; +import com.squareup.otto.Subscribe; + +/** + * A placeholder fragment containing a simple view. + */ +public class MainActivityFragment extends Fragment { + + public MainActivityFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + EventDispatcher.register(this); + return inflater.inflate(R.layout.fragment_main, container, false); + } + + @Subscribe + public void onConsumePippo(final UIEvent UIEvent) { + Toast.makeText(getActivity(), "received UIEvent", Toast.LENGTH_SHORT).show(); + } +} diff --git a/app/src/main/java/it/sysdata/eventdispatcher/UIEvent.java b/app/src/main/java/it/sysdata/eventdispatcher/UIEvent.java new file mode 100755 index 0000000..cbf03af --- /dev/null +++ b/app/src/main/java/it/sysdata/eventdispatcher/UIEvent.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2016 Sysdata Digital, S.r.l. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package it.sysdata.eventdispatcher; + +import com.baseandroid.events.Event; + +/** + * @author Stefano + * created on 24/11/2015. + */ +@Event(type = Event.Type.UI) +public class UIEvent { +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100755 index 0000000..800bcfc --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml new file mode 100755 index 0000000..21b1aad --- /dev/null +++ b/app/src/main/res/layout/content_main.xml @@ -0,0 +1,25 @@ + + + diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml new file mode 100755 index 0000000..4407c04 --- /dev/null +++ b/app/src/main/res/layout/fragment_main.xml @@ -0,0 +1,33 @@ + + + + + + + diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml new file mode 100755 index 0000000..17b7c37 --- /dev/null +++ b/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100755 index 0000000..cde69bc Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100755 index 0000000..c133a0c Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100755 index 0000000..bfa42f0 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100755 index 0000000..324e72c Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100755 index 0000000..aee44e1 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml new file mode 100755 index 0000000..a490268 --- /dev/null +++ b/app/src/main/res/values-v21/styles.xml @@ -0,0 +1,24 @@ + + +> + + diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml new file mode 100755 index 0000000..c1c1b7b --- /dev/null +++ b/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,22 @@ + + + + + 64dp + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100755 index 0000000..a706a0b --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,22 @@ + + + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100755 index 0000000..44e2008 --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,22 @@ + + + + + 16dp + 16dp + 16dp + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100755 index 0000000..b06e8d1 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,20 @@ + + + + EventDispatcher + Settings + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100755 index 0000000..d67389b --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,33 @@ + + + + + + + +