Skip to content

Commit 4c99ffd

Browse files
committed
Add android sample hello world.
1 parent bb07fd1 commit 4c99ffd

Some content is hidden

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

55 files changed

+2197
-23
lines changed

android-sample/.gitignore

+75-23
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,90 @@ Thumbs.db
44
# OSX files
55
.DS_Store
66

7-
# built application files
7+
8+
# Built application files
89
*.apk
10+
*.aar
911
*.ap_
12+
*.aab
1013

11-
# files for the dex VM
14+
# Files for the ART/Dalvik VM
1215
*.dex
13-
16+
1417
# Java class files
1518
*.class
16-
17-
# generated files
19+
20+
# Generated files
1821
bin/
1922
gen/
23+
out/
24+
# Uncomment the following line in case you need and you don't have the release build type files in your app
25+
# release/
26+
27+
# Gradle files
28+
.gradle/
2029
build/
21-
30+
2231
# Local configuration file (sdk path, etc)
2332
local.properties
24-
25-
# Eclipse project files
26-
.classpath
27-
.project
28-
29-
# Android Studio
30-
.idea
31-
.gradle
32-
/*/local.properties
33-
/*/out
34-
/*/*/build
35-
build
36-
/*/*/production
33+
34+
# Proguard folder generated by Eclipse
35+
proguard/
36+
37+
# Log Files
38+
*.log
39+
40+
# Android Studio Navigation editor temp files
41+
.navigation/
42+
43+
# Android Studio captures folder
44+
captures/
45+
46+
# IntelliJ
47+
.idea/
3748
*.iml
38-
*.iws
39-
*.ipr
40-
*~
41-
*.swp
49+
.idea/workspace.xml
50+
.idea/tasks.xml
51+
.idea/gradle.xml
52+
.idea/assetWizardSettings.xml
53+
.idea/dictionaries
54+
.idea/libraries
55+
# Android Studio 3 in .gitignore file.
56+
.idea/caches
57+
.idea/modules.xml
58+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
59+
.idea/navEditor.xml
60+
61+
# Keystore files
62+
# Uncomment the following lines if you do not want to check your keystore files in.
63+
#*.jks
64+
#*.keystore
65+
66+
# External native build folder generated in Android Studio 2.2 and later
67+
.externalNativeBuild
68+
.cxx/
69+
70+
# Google Services (e.g. APIs or Firebase)
71+
# google-services.json
72+
73+
# Freeline
74+
freeline.py
75+
freeline/
76+
freeline_project_description.json
77+
78+
# fastlane
79+
fastlane/report.xml
80+
fastlane/Preview.html
81+
fastlane/screenshots
82+
fastlane/test_output
83+
fastlane/readme.md
84+
85+
# Version control
86+
vcs.xml
87+
88+
# lint
89+
lint/intermediates/
90+
lint/generated/
91+
lint/outputs/
92+
lint/tmp/
93+
# lint/reports/

android-sample/app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

android-sample/app/build.gradle.kts

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
plugins {
2+
// Application Specific Plugins
3+
id(BuildPlugins.androidApplication)
4+
id(BuildPlugins.kotlinAndroid)
5+
id(BuildPlugins.kotlinAndroidExtensions)
6+
7+
// Internal Script plugins
8+
id(ScriptPlugins.variants)
9+
id(ScriptPlugins.quality)
10+
id(ScriptPlugins.compilation)
11+
}
12+
13+
android {
14+
compileSdkVersion(AndroidSdk.compile)
15+
16+
defaultConfig {
17+
minSdkVersion(AndroidSdk.min)
18+
targetSdkVersion(AndroidSdk.target)
19+
20+
applicationId = AndroidClient.appId
21+
versionCode = AndroidClient.versionCode
22+
versionName = AndroidClient.versionName
23+
testInstrumentationRunner = AndroidClient.testRunner
24+
}
25+
26+
sourceSets {
27+
map { it.java.srcDir("src/${it.name}/kotlin") }
28+
}
29+
}
30+
31+
dependencies {
32+
// Application dependencies
33+
implementation(Libraries.kotlinStdLib)
34+
implementation(Libraries.kotlinCoroutines)
35+
implementation(Libraries.kotlinCoroutinesAndroid)
36+
implementation(Libraries.ktxCore)
37+
implementation(Libraries.appCompat)
38+
implementation(Libraries.fragment)
39+
implementation(Libraries.material)
40+
implementation(Libraries.constraintLayout)
41+
42+
// Unit/Android tests dependencies
43+
testImplementation(TestLibraries.junit4)
44+
testImplementation(TestLibraries.mockk)
45+
testImplementation(TestLibraries.kluent)
46+
testImplementation(TestLibraries.robolectric)
47+
48+
// Acceptance tests dependencies
49+
androidTestImplementation(TestLibraries.testRunner)
50+
androidTestImplementation(TestLibraries.espressoCore)
51+
androidTestImplementation(TestLibraries.testExtJunit)
52+
androidTestImplementation(TestLibraries.testRules)
53+
androidTestImplementation(TestLibraries.espressoIntents)
54+
55+
// Development dependencies
56+
debugImplementation(DevLibraries.leakCanary)
57+
}

android-sample/app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Copyright (C) 2020 Fernando Cejas Open Source Project
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+
package com.fernandocejas.sample
17+
18+
import android.app.Activity
19+
import androidx.test.ext.junit.runners.AndroidJUnit4
20+
import androidx.test.filters.LargeTest
21+
import androidx.test.rule.ActivityTestRule
22+
import org.junit.Rule
23+
import org.junit.runner.RunWith
24+
25+
/**
26+
* Base class for Acceptance tests. Inherit from it to create test cases which
27+
* contain android ui. The framework used is Espresso.
28+
*/
29+
@LargeTest
30+
@RunWith(AndroidJUnit4::class)
31+
abstract class AcceptanceTest(clazz: Class<out Activity>) {
32+
33+
@get:Rule
34+
val activityRule = ActivityTestRule(clazz)
35+
}
36+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.fernandocejas.sample">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:name=".AndroidApplication"
8+
android:icon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:roundIcon="@mipmap/ic_launcher_round"
11+
android:theme="@style/Theme.Main">
12+
13+
<activity android:name="com.fernandocejas.sample.MainActivity">
14+
<intent-filter>
15+
<action android:name="android.intent.action.MAIN" />
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Copyright (C) 2020 Fernando Cejas Open Source Project
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+
package com.fernandocejas.sample
17+
18+
import android.app.Application
19+
20+
class AndroidApplication : Application()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Copyright (C) 2020 Fernando Cejas Open Source Project
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+
package com.fernandocejas.sample
17+
18+
import com.fernandocejas.sample.core.platform.BaseActivity
19+
20+
class MainActivity : BaseActivity() {
21+
override fun fragment() = MainFragment()
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Copyright (C) 2020 Fernando Cejas Open Source Project
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+
package com.fernandocejas.sample
17+
18+
import com.fernandocejas.sample.core.platform.BaseFragment
19+
20+
class MainFragment : BaseFragment(R.layout.fragment_main)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Copyright (C) 2020 Fernando Cejas Open Source Project
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+
package com.fernandocejas.sample.core.extension
17+
18+
import android.content.Context
19+
import android.net.ConnectivityManager
20+
21+
val Context.connectivityManager: ConnectivityManager get() =
22+
this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Copyright (C) 2020 Fernando Cejas Open Source Project
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+
package com.fernandocejas.sample.core.extension
17+
18+
import android.content.Context
19+
import com.fernandocejas.sample.core.platform.BaseFragment
20+
21+
val BaseFragment.appContext: Context get() = activity?.applicationContext!!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Copyright (C) 2020 Fernando Cejas Open Source Project
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+
package com.fernandocejas.sample.core.extension
17+
18+
fun String.Companion.empty() = ""

0 commit comments

Comments
 (0)