Skip to content

Commit 9cf3f27

Browse files
authored
- first commit (#2)
1 parent 0bc443c commit 9cf3f27

File tree

73 files changed

+3345
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3345
-0
lines changed

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 23
5+
buildToolsVersion "23.0.3"
6+
7+
defaultConfig {
8+
applicationId "it.sysdata.eventdispatcher"
9+
minSdkVersion 9
10+
targetSdkVersion 23
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
lintOptions {
21+
abortOnError false
22+
}
23+
}
24+
25+
dependencies {
26+
27+
def adapterVersionName = project.ext.libVersionName
28+
29+
compile fileTree(dir: 'libs', include: ['*.jar'])
30+
testCompile 'junit:junit:4.12'
31+
compile 'com.android.support:appcompat-v7:23.3.0'
32+
compile 'com.android.support:design:23.3.0'
33+
34+
// WITH THESE ONES YOU CAN TEST REMOTE LIBS
35+
// REMEMBER TO USE THESE AFTER TEST CAUSE JENKINS TROUBLES
36+
compile "com.baseandroid:baseandroid-busadapter:$adapterVersionName"
37+
compile "com.baseandroid:baseandroid-eventdispatcher:$adapterVersionName"
38+
// compile "com.baseandroid:baseandroid-rxeventdispatcher:$adapterVersionName'
39+
40+
// WITH THESE ONES YOU CAN USE LOCAL PROJECTS
41+
// REMEMBER: COMMENT THESE ONES BEFOR PUSH ON DEVELOP CAUSE JENKINS TROUBLES
42+
//compile project(path: ':baseandroid-busadapter')
43+
//compile project(path: ':baseandroid-eventdispatcher')
44+
//compile project(path: ':baseandroid-rxeventdispatcher')
45+
46+
}

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in C:\Users\Stefano\Sviluppo\ADT_bundle_windows\sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package it.sysdata.eventdispatcher;
2+
3+
import android.app.Application;
4+
import android.test.ApplicationTestCase;
5+
6+
/**
7+
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8+
*/
9+
public class ApplicationTest extends ApplicationTestCase<Application> {
10+
public ApplicationTest() {
11+
super(Application.class);
12+
}
13+
}

app/src/main/AndroidManifest.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="it.sysdata.eventdispatcher" >
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:supportsRtl="true"
10+
android:theme="@style/AppTheme" >
11+
<activity
12+
android:name=".MainActivity"
13+
android:label="@string/app_name"
14+
android:theme="@style/AppTheme.NoActionBar" >
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
18+
<category android:name="android.intent.category.LAUNCHER" />
19+
</intent-filter>
20+
</activity>
21+
</application>
22+
23+
</manifest>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (C) 2016 Sysdata Digital, S.r.l.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package it.sysdata.eventdispatcher;
18+
19+
import android.os.Bundle;
20+
import android.support.design.widget.FloatingActionButton;
21+
import android.support.v7.app.AppCompatActivity;
22+
import android.support.v7.widget.Toolbar;
23+
import android.view.Menu;
24+
import android.view.MenuItem;
25+
import android.view.View;
26+
import com.baseandroid.events.EventDispatcher;
27+
28+
public class MainActivity extends AppCompatActivity {
29+
30+
@Override
31+
protected void onCreate(Bundle savedInstanceState) {
32+
super.onCreate(savedInstanceState);
33+
setContentView(R.layout.activity_main);
34+
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
35+
setSupportActionBar(toolbar);
36+
EventDispatcher.register(this);
37+
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
38+
fab.setOnClickListener(new View.OnClickListener() {
39+
@Override
40+
public void onClick(View view) {
41+
EventDispatcher.post(new UIEvent());
42+
}
43+
});
44+
}
45+
46+
@Override
47+
public boolean onCreateOptionsMenu(Menu menu) {
48+
// Inflate the menu; this adds items to the action bar if it is present.
49+
getMenuInflater().inflate(R.menu.menu_main, menu);
50+
return true;
51+
}
52+
53+
@Override
54+
public boolean onOptionsItemSelected(MenuItem item) {
55+
// Handle action bar item clicks here. The action bar will
56+
// automatically handle clicks on the Home/Up button, so long
57+
// as you specify a parent activity in AndroidManifest.xml.
58+
int id = item.getItemId();
59+
60+
//noinspection SimplifiableIfStatement
61+
if (id == R.id.action_settings) {
62+
return true;
63+
}
64+
65+
return super.onOptionsItemSelected(item);
66+
}
67+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (C) 2016 Sysdata Digital, S.r.l.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package it.sysdata.eventdispatcher;
18+
19+
import android.os.Bundle;
20+
import android.support.v4.app.Fragment;
21+
import android.view.LayoutInflater;
22+
import android.view.View;
23+
import android.view.ViewGroup;
24+
import android.widget.Toast;
25+
26+
import com.baseandroid.events.EventDispatcher;
27+
import com.squareup.otto.Subscribe;
28+
29+
/**
30+
* A placeholder fragment containing a simple view.
31+
*/
32+
public class MainActivityFragment extends Fragment {
33+
34+
public MainActivityFragment() {
35+
}
36+
37+
@Override
38+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
39+
Bundle savedInstanceState) {
40+
EventDispatcher.register(this);
41+
return inflater.inflate(R.layout.fragment_main, container, false);
42+
}
43+
44+
@Subscribe
45+
public void onConsumePippo(final UIEvent UIEvent) {
46+
Toast.makeText(getActivity(), "received UIEvent", Toast.LENGTH_SHORT).show();
47+
}
48+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (C) 2016 Sysdata Digital, S.r.l.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package it.sysdata.eventdispatcher;
18+
19+
import com.baseandroid.events.Event;
20+
21+
/**
22+
* @author Stefano
23+
* created on 24/11/2015.
24+
*/
25+
@Event(type = Event.Type.UI)
26+
public class UIEvent {
27+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright (C) 2016 Sysdata Digital, S.r.l.
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<android.support.design.widget.CoordinatorLayout
19+
xmlns:android="http://schemas.android.com/apk/res/android"
20+
xmlns:app="http://schemas.android.com/apk/res-auto"
21+
xmlns:tools="http://schemas.android.com/tools"
22+
android:layout_width="match_parent"
23+
android:layout_height="match_parent"
24+
android:fitsSystemWindows="true"
25+
tools:context=".MainActivity">
26+
27+
<android.support.design.widget.AppBarLayout
28+
android:layout_height="wrap_content"
29+
android:layout_width="match_parent"
30+
android:theme="@style/AppTheme.AppBarOverlay">
31+
32+
<android.support.v7.widget.Toolbar
33+
android:id="@+id/toolbar"
34+
android:layout_width="match_parent"
35+
android:layout_height="?attr/actionBarSize"
36+
android:background="?attr/colorPrimary"
37+
app:popupTheme="@style/AppTheme.PopupOverlay"/>
38+
39+
</android.support.design.widget.AppBarLayout>
40+
41+
<include layout="@layout/content_main"/>
42+
43+
<android.support.design.widget.FloatingActionButton
44+
android:id="@+id/fab"
45+
android:layout_width="wrap_content"
46+
android:layout_height="wrap_content"
47+
android:layout_gravity="bottom|end"
48+
android:layout_margin="@dimen/fab_margin"
49+
android:src="@android:drawable/ic_dialog_email"/>
50+
51+
</android.support.design.widget.CoordinatorLayout>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!--
2+
~ Copyright (C) 2016 Sysdata Digital, S.r.l.
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
18+
xmlns:tools="http://schemas.android.com/tools"
19+
xmlns:app="http://schemas.android.com/apk/res-auto"
20+
android:id="@+id/fragment"
21+
android:name="it.sysdata.eventdispatcher.MainActivityFragment"
22+
android:layout_width="match_parent"
23+
android:layout_height="match_parent"
24+
app:layout_behavior="@string/appbar_scrolling_view_behavior"
25+
tools:layout="@layout/fragment_main"/>

0 commit comments

Comments
 (0)