├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── fabric.properties
├── proguard-rules.pro
└── src
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── org
│ │ │ └── h7
│ │ │ └── simple
│ │ │ ├── Constants.kt
│ │ │ ├── activity
│ │ │ └── main
│ │ │ │ ├── MainActivity.kt
│ │ │ │ └── adapter
│ │ │ │ └── MenuAdapter.kt
│ │ │ ├── app
│ │ │ └── App.kt
│ │ │ ├── binding
│ │ │ └── Adapters.kt
│ │ │ ├── config
│ │ │ └── menu
│ │ │ │ └── INavViewModel.kt
│ │ │ ├── data
│ │ │ └── menu
│ │ │ │ ├── Footer.kt
│ │ │ │ ├── Header.kt
│ │ │ │ ├── MenuItem.kt
│ │ │ │ └── OnMenuClickListener.kt
│ │ │ └── widget
│ │ │ ├── CircleTransformation.kt
│ │ │ ├── EndDrawerToggle.kt
│ │ │ └── Utils.kt
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── app_bar_main.xml
│ │ ├── content_main.xml
│ │ ├── layout_menu_footer.xml
│ │ ├── layout_menu_header.xml
│ │ └── menu_item.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── zip
│ ├── AndroidManifest.xml
│ ├── java
│ └── org
│ │ └── h7
│ │ └── simple
│ │ ├── activity
│ │ └── main
│ │ │ └── MainActivityImpl.kt
│ │ └── config
│ │ └── menu
│ │ └── NavViewModel.kt
│ └── res
│ ├── drawable-nodpi
│ └── logo_placeholder.png
│ ├── drawable
│ ├── ic_menu_contact_us.xml
│ ├── ic_menu_rate_us.xml
│ ├── ic_menu_settings.xml
│ ├── ic_menu_social_media.xml
│ ├── ic_menu_support.xml
│ └── ic_menu_website.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── ids.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── keystore
└── keystore.jks
├── logo.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # IntelliJ
36 | *.iml
37 | .idea/workspace.xml
38 | .idea/tasks.xml
39 | .idea/gradle.xml
40 | .idea/assetWizardSettings.xml
41 | .idea/dictionaries
42 | .idea/libraries
43 | .idea/caches
44 |
45 | # Keystore files
46 | # Uncomment the following line if you do not want to check your keystore files in.
47 | #*.jks
48 |
49 | # External native build folder generated in Android Studio 2.2 and later
50 | .externalNativeBuild
51 |
52 | # Google Services (e.g. APIs or Firebase)
53 | google-services.json
54 |
55 | # Freeline
56 | freeline.py
57 | freeline/
58 | freeline_project_description.json
59 |
60 | # fastlane
61 | fastlane/report.xml
62 | fastlane/Preview.html
63 | fastlane/screenshots
64 | fastlane/test_output
65 | fastlane/readme.md
66 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Simple-Android-App
2 | Simple Android App w/ Source Code - Android Studio app example. Sample project with source code (free download).
3 |
4 | # simple.app
5 |
6 | Simple Android App UI: Hello World!
7 |
8 | #keystore
9 |
10 | store password: helloworld
11 |
12 | alias: simple
13 |
14 | key password: helloworld
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | apply plugin: 'kotlin-kapt'
5 | apply plugin: 'io.fabric'
6 |
7 | android {
8 | compileSdkVersion 27
9 | defaultConfig {
10 | applicationId "org.h7.simple"
11 | minSdkVersion 16
12 | targetSdkVersion 27
13 | versionCode 1
14 | versionName "1.0"
15 | multiDexEnabled true
16 | vectorDrawables.useSupportLibrary = true
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | debug {
25 | ext.enableCrashlytics = false
26 | }
27 | }
28 | compileOptions {
29 | sourceCompatibility JavaVersion.VERSION_1_8
30 | targetCompatibility JavaVersion.VERSION_1_8
31 | }
32 |
33 | dataBinding {
34 | enabled = true
35 | }
36 |
37 | flavorDimensions "app"
38 |
39 | productFlavors {
40 | zip {
41 | dimension "app"
42 | applicationIdSuffix = ".zip"
43 | }
44 | }
45 | applicationVariants.all { variant ->
46 | variant.outputs.all { output ->
47 | def appName = "simple"
48 | def flavor = variant.productFlavors[0].name
49 | def SEP = "_"
50 | def buildType = variant.variantData.variantConfiguration.buildType.name
51 | outputFileName = appName + SEP + flavor + SEP + buildType + ".apk"
52 | }
53 | }
54 |
55 | }
56 |
57 | androidExtensions {
58 | experimental = true
59 | }
60 |
61 | dependencies {
62 | implementation fileTree(dir: 'libs', include: ['*.jar'])
63 | implementation ("com.crashlytics.sdk.android:crashlytics:$crashlytics_version@aar") {
64 | transitive = true
65 | }
66 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
67 | implementation "com.android.support:appcompat-v7:$support_version"
68 | implementation "com.android.support:design:$support_version"
69 | implementation "com.android.support:design:$support_version"
70 | implementation "com.android.support:recyclerview-v7:$support_version"
71 |
72 | implementation "com.android.support:multidex:$multidex_version"
73 |
74 | implementation "com.android.support.constraint:constraint-layout:$constraint_version"
75 |
76 | implementation "io.reactivex.rxjava2:rxandroid:$rxandroid_version"
77 | implementation "io.reactivex.rxjava2:rxjava:$rxjava_version"
78 | implementation "io.reactivex.rxjava2:rxkotlin:$rxkotlin_version"
79 |
80 | implementation "android.arch.lifecycle:extensions:$viewmodel_version"
81 | implementation "android.arch.lifecycle:viewmodel:$viewmodel_version"
82 |
83 | implementation "com.squareup.picasso:picasso:$picasso_version"
84 | }
85 |
86 | kapt {
87 | generateStubs = true
88 | }
89 |
--------------------------------------------------------------------------------
/app/fabric.properties:
--------------------------------------------------------------------------------
1 | #Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public.
2 | #Thu Jun 28 16:54:21 MSK 2018
3 | apiSecret=4e2b732b64884793ffeac7ea6ad44e34ff981ad808083ea0c7d35ce07d9ec62b
4 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
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
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
12 |
13 |
14 |
15 |
23 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/java/org/h7/simple/Constants.kt:
--------------------------------------------------------------------------------
1 | package org.h7.simple
2 |
3 | /**
4 | * Created by ruslan on 12/01/2019.
5 | */
6 |
7 | class Constants {
8 | companion object {
9 | val WEB_URL = "https://app.h7.org/simple/Android"
10 | }
11 | }
--------------------------------------------------------------------------------
/app/src/main/java/org/h7/simple/activity/main/MainActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * project: Simple App, Android
3 | * app.h7.org/simple/Android
4 | * Copyright © 2018 H7 (h7.org).
5 | *
6 | * created by yatko.com
7 | */
8 |
9 | package org.h7.simple.activity.main
10 |
11 | import android.databinding.DataBindingUtil
12 | import android.os.Bundle
13 | import android.support.v4.view.GravityCompat
14 | import android.support.v7.app.AppCompatActivity
15 | import android.support.v7.widget.LinearLayoutManager
16 | import kotlinx.android.synthetic.main.activity_main.*
17 | import kotlinx.android.synthetic.main.app_bar_main.*
18 | import org.h7.simple.R
19 | import org.h7.simple.activity.main.adapter.MenuAdapter
20 | import org.h7.simple.config.menu.INavViewModel
21 | import org.h7.simple.data.menu.MenuItem
22 | import org.h7.simple.data.menu.OnMenuClickListener
23 | import org.h7.simple.databinding.ActivityMainBinding
24 | import org.h7.simple.widget.EndDrawerToggle
25 |
26 |
27 | abstract class MainActivity : AppCompatActivity() {
28 | abstract fun onMenuItemClick(item: MenuItem):Boolean
29 | abstract fun getNavViewModel():INavViewModel
30 |
31 | private lateinit var modelNavigation: INavViewModel
32 |
33 | override fun onCreate(savedInstanceState: Bundle?) {
34 | super.onCreate(savedInstanceState)
35 | val binding : ActivityMainBinding = DataBindingUtil.setContentView(this, R.layout.activity_main)
36 | modelNavigation = getNavViewModel()
37 | binding.footer = modelNavigation.getMenuFooter(this)
38 | binding.header = modelNavigation.getMenuHeader(this)
39 | initMenu()
40 | setSupportActionBar(toolbar)
41 |
42 | val toggle = EndDrawerToggle(
43 | this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close)
44 | drawerLayout.addDrawerListener(toggle)
45 | toggle.syncState()
46 | }
47 |
48 | private fun initMenu() {
49 | menuItems.adapter = MenuAdapter(modelNavigation.getMenuItems(),object:OnMenuClickListener{
50 | override fun onMenuItemClick(item: MenuItem) {
51 | if (this@MainActivity.onMenuItemClick(item))
52 | hideMenuIfOpened()
53 | }
54 |
55 | })
56 | menuItems.layoutManager = LinearLayoutManager(this)
57 | }
58 |
59 | override fun onBackPressed() {
60 | if (!hideMenuIfOpened()){
61 | super.onBackPressed()
62 | }
63 | }
64 |
65 | private fun hideMenuIfOpened():Boolean{
66 | return if (drawerLayout.isDrawerOpen(GravityCompat.END)) {
67 | drawerLayout.closeDrawer(GravityCompat.END)
68 | true
69 | } else {
70 | false
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/java/org/h7/simple/activity/main/adapter/MenuAdapter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * project: Simple App, Android
3 | * app.h7.org/simple/Android
4 | * Copyright © 2018 H7 (h7.org).
5 | *
6 | * created by yatko.com
7 | */
8 |
9 | package org.h7.simple.activity.main.adapter
10 |
11 | import android.databinding.DataBindingUtil
12 | import android.support.v7.widget.RecyclerView
13 | import android.view.LayoutInflater
14 | import android.view.View
15 | import android.view.ViewGroup
16 | import kotlinx.android.synthetic.main.menu_item.view.*
17 | import org.h7.simple.R
18 | import org.h7.simple.data.menu.MenuItem
19 | import org.h7.simple.data.menu.OnMenuClickListener
20 | import org.h7.simple.databinding.MenuItemBinding
21 |
22 |
23 | /**
24 | * Created by Alexey Rogovoy (lexapublic@gmail.com) on 29.06.2018.
25 | */
26 |
27 | class MenuAdapter(private var items : List