Skip to content

Commit c20ef9a

Browse files
committed
Initial commit
0 parents  commit c20ef9a

File tree

213 files changed

+8485
-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.

213 files changed

+8485
-0
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
2+
*.iml
3+
4+
## Directory-based project format:
5+
.idea/
6+
7+
.gradle
8+
/local.properties
9+
.DS_Store
10+
/build
11+
/captures
12+
13+
# release key
14+
app/myreleasekey.jks

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: android
2+
jdk:
3+
- oraclejdk8
4+
android:
5+
components:
6+
- tools
7+
- build-tools-23.0.2
8+
- android-23
9+
- extra-android-m2repository
10+
11+
script: ./gradlew testDebug
12+
13+
before_cache:
14+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
15+
cache:
16+
directories:
17+
- $HOME/.gradle/caches/
18+
- $HOME/.gradle/wrapper/

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Akira Sosa
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Android micropost app
2+
3+
This repository is an example Android application, which is based on Rails tutorial app.
4+
5+
[![Build Status][travis-image]][travis-url]
6+
7+
Key components.
8+
9+
* Dagger 2
10+
* Retrolambda
11+
* RxJava / RxAndroid
12+
* Retrofit 2
13+
* Data Binding
14+
* Robolectric 3
15+
16+
## Getting Started
17+
18+
Prepare backend app.
19+
20+
```
21+
git clone https://github.com/springboot-angular2-tutorial/boot-app.git
22+
cd boot-app
23+
mvn spring-boot:run
24+
```
25+
26+
Configure API URL.
27+
28+
```
29+
vi app/src/debug/java/com/hana053/micropost/Constants.java
30+
```
31+
32+
Then, just run from Android Studio.
33+
34+
Testing.
35+
36+
```
37+
./gradlew testDebug
38+
```
39+
40+
Release build.
41+
42+
```
43+
cp yourkey app/myreleasekey.jks
44+
export KSTOREPWD=yourpass
45+
export KEYPWD=yourpass
46+
./gradlew assembleRelease
47+
```
48+
49+
## Tutorial
50+
51+
Under construction...
52+
53+
## License
54+
55+
[MIT](/LICENSE)
56+
57+
[travis-url]: https://travis-ci.org/springboot-angular2-tutorial/android-app
58+
[travis-image]: https://travis-ci.org/springboot-angular2-tutorial/android-app.svg

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: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
apply plugin: 'com.android.application'
2+
apply plugin: 'me.tatarka.retrolambda'
3+
apply plugin: 'com.neenbedankt.android-apt'
4+
5+
android {
6+
compileSdkVersion 23
7+
buildToolsVersion '23.0.2'
8+
9+
defaultConfig {
10+
applicationId "com.hana053.micropost"
11+
minSdkVersion 17
12+
targetSdkVersion 23
13+
versionCode 1
14+
versionName "1.0.0"
15+
}
16+
signingConfigs {
17+
release {
18+
storeFile file("myreleasekey.jks")
19+
keyAlias "MyReleaseKey"
20+
storePassword System.getenv("KSTOREPWD")
21+
keyPassword System.getenv("KEYPWD")
22+
}
23+
}
24+
buildTypes {
25+
debug {
26+
applicationIdSuffix ".debug"
27+
}
28+
release {
29+
minifyEnabled false
30+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31+
signingConfig signingConfigs.release
32+
}
33+
}
34+
compileOptions {
35+
sourceCompatibility JavaVersion.VERSION_1_8
36+
targetCompatibility JavaVersion.VERSION_1_8
37+
}
38+
lintOptions {
39+
disable 'InvalidPackage'
40+
}
41+
dataBinding {
42+
enabled = true
43+
}
44+
}
45+
46+
dependencies {
47+
provided 'javax.annotation:jsr250-api:1.0'
48+
provided "org.projectlombok:lombok:$lombok_version"
49+
50+
apt "org.projectlombok:lombok:$lombok_version"
51+
apt "com.google.dagger:dagger-compiler:$dagger_version"
52+
apt "org.parceler:parceler:$parceler_version"
53+
54+
compile "com.android.support:appcompat-v7:$android_support_version"
55+
compile "com.android.support:design:$android_support_version"
56+
compile 'io.reactivex:rxandroid:1.1.0'
57+
compile 'io.reactivex:rxjava:1.1.0'
58+
compile "com.google.dagger:dagger:$dagger_version"
59+
compile 'com.jakewharton.timber:timber:4.1.0'
60+
compile 'com.jakewharton:butterknife:7.0.1'
61+
compile "com.squareup.retrofit2:retrofit:$retrofit_version"
62+
compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
63+
compile "com.squareup.retrofit2:converter-moshi:$retrofit_version"
64+
compile 'com.squareup.okhttp3:okhttp:3.1.2'
65+
compile 'com.squareup.picasso:picasso:2.5.2'
66+
compile "org.parceler:parceler-api:$parceler_version"
67+
compile 'org.greenrobot:eventbus:3.0.0'
68+
compile 'com.github.curioustechizen.android-ago:library:1.3.0'
69+
70+
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
71+
72+
testCompile 'junit:junit:4.12', {
73+
transitive = false
74+
}
75+
testCompile 'org.hamcrest:hamcrest-all:1.3'
76+
testCompile 'org.mockito:mockito-core:1.10.19'
77+
testCompile "org.robolectric:robolectric:$robolectric_version"
78+
testCompile "org.robolectric:shadows-support-v4:$robolectric_version"
79+
}
80+
81+
buildscript {
82+
ext {
83+
android_support_version = '23.1.1'
84+
retrofit_version = '2.0.0-beta4'
85+
dagger_version = '2.0.2'
86+
parceler_version = '1.0.4'
87+
lombok_version = '1.16.6'
88+
robolectric_version = '3.0'
89+
}
90+
repositories {
91+
mavenCentral()
92+
}
93+
}
94+
repositories {
95+
mavenCentral()
96+
}

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 /usr/local/opt/android-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 com.hana053.micropost;
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+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.hana053.micropost;
2+
3+
import android.os.StrictMode;
4+
5+
import com.hana053.micropost.presentation.core.di.AppComponent;
6+
import com.hana053.micropost.presentation.core.base.BaseApplication;
7+
import com.hana053.micropost.presentation.core.di.DaggerAppComponent;
8+
import com.hana053.micropost.system.SystemServicesModule;
9+
import com.squareup.leakcanary.LeakCanary;
10+
11+
import timber.log.Timber;
12+
13+
public class Application extends BaseApplication {
14+
15+
@Override
16+
public void onCreate() {
17+
super.onCreate();
18+
LeakCanary.install(this);
19+
20+
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().penaltyDeathOnNetwork().build());
21+
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().detectActivityLeaks().penaltyLog().build());
22+
23+
Timber.plant(new Timber.DebugTree());
24+
}
25+
26+
@Override
27+
protected AppComponent createComponent() {
28+
return DaggerAppComponent.builder()
29+
.systemServicesModule(new SystemServicesModule(this))
30+
.build();
31+
}
32+
33+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.hana053.micropost;
2+
3+
public final class Constants {
4+
public static final String API_URL = "http://192.168.58.1:8080/api/";
5+
}

app/src/main/AndroidManifest.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.hana053.micropost">
4+
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
7+
<application
8+
android:name="com.hana053.micropost.Application"
9+
android:allowBackup="true"
10+
android:icon="@mipmap/ic_launcher"
11+
android:label="@string/app_name"
12+
android:supportsRtl="true"
13+
android:theme="@style/AppTheme">
14+
<activity android:name=".presentation.main.MainActivity">
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
<category android:name="android.intent.category.LAUNCHER" />
18+
</intent-filter>
19+
</activity>
20+
<activity
21+
android:name=".presentation.micropostnew.MicropostNewActivity"
22+
android:windowSoftInputMode="adjustResize" />
23+
<activity
24+
android:name=".presentation.top.TopActivity"
25+
android:theme="@style/AppTheme.Top" />
26+
<activity
27+
android:name=".presentation.login.LoginActivity"
28+
android:theme="@style/AppTheme.Flat" />
29+
<activity
30+
android:name=".presentation.signup.SignupActivity"
31+
android:theme="@style/AppTheme.Flat" />
32+
<activity android:name=".presentation.usershow.UserShowActivity" />
33+
<activity
34+
android:name=".presentation.relateduserlist.followinglist.FollowingListActivity"
35+
android:label="@string/Followings" />
36+
<activity
37+
android:name=".presentation.relateduserlist.followerlist.FollowerListActivity"
38+
android:label="@string/Followers" />
39+
</application>
40+
41+
</manifest>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.hana053.micropost.domain;
2+
3+
4+
import org.parceler.Parcel;
5+
import org.parceler.ParcelConstructor;
6+
7+
import java.io.Serializable;
8+
9+
import lombok.Builder;
10+
import lombok.Value;
11+
12+
@Builder
13+
@Value
14+
@Parcel
15+
public final class Micropost implements Serializable {
16+
17+
static final long serialVersionUID = 1L;
18+
19+
public final long id;
20+
public final String content;
21+
public final long createdAt;
22+
public final User user;
23+
24+
@ParcelConstructor
25+
public Micropost(long id, String content, long createdAt, User user) {
26+
this.id = id;
27+
this.content = content;
28+
this.createdAt = createdAt;
29+
this.user = user;
30+
}
31+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.hana053.micropost.domain;
2+
3+
import org.parceler.Parcel;
4+
import org.parceler.ParcelConstructor;
5+
6+
import java.io.Serializable;
7+
8+
import lombok.EqualsAndHashCode;
9+
import lombok.Value;
10+
11+
@EqualsAndHashCode(callSuper = false)
12+
@Parcel
13+
@Value
14+
public final class RelatedUser extends User implements Serializable {
15+
16+
static final long serialVersionUID = 1L;
17+
18+
public final long relationshipId;
19+
20+
@ParcelConstructor
21+
public RelatedUser(long id, String name, String email, UserStats userStats, long relationshipId) {
22+
super(id, name, email, userStats);
23+
this.relationshipId = relationshipId;
24+
}
25+
}

0 commit comments

Comments
 (0)