Skip to content

Commit

Permalink
split to module
Browse files Browse the repository at this point in the history
  • Loading branch information
Drabu committed May 6, 2019
1 parent 8cb7c4a commit 3121f2f
Show file tree
Hide file tree
Showing 47 changed files with 377 additions and 105 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 6 additions & 27 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-kapt'

android {
Expand All @@ -21,6 +20,9 @@ android {
}
}

androidExtensions {
experimental = true
}

dataBinding {
enabled = true
Expand All @@ -30,46 +32,23 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'


implementation 'com.android.support:recyclerview-v7:28.0.0'


/*REST Api Libraries*/
implementation "com.squareup.okhttp3:okhttp:$rootProject.okhttp3Version"
implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"

implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.loggingInterceptor"
implementation "com.squareup.retrofit2:converter-gson:$rootProject.gsonVersion"
implementation "com.android.support:recyclerview-v7:$rootProject.recyclerViewVersion"


/*RXAndroid and RXJava*/
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroid"
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxJava"

/*Rx Binding*/
implementation "com.jakewharton.rxbinding2:rxbinding:$rootProject.rxBindingVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.rxRoomVersion"
implementation project(':place_autocomplete')



/*life cycle components android jetpack*/
implementation "android.arch.lifecycle:extensions:$rootProject.archVersion"
kapt "android.arch.lifecycle:compiler:$rootProject.archVersion"
testImplementation "android.arch.core:core-testing:$rootProject.archVersion"

// https://mvnrepository.com/artifact/javax.annotation/jsr250-api
implementation group: 'javax.annotation', name: 'jsr250-api', version: '1.0'

}
5 changes: 4 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".ExampleLocationSearch">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

</activity>
<activity android:name="com.oneclickaway.opensource.placeautocomplete.ui.SearchPlaceActivity">
</activity>
</application>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.uipep.android.searchplaces

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.widget.Button
import com.oneclickaway.opensource.placeautocomplete.api.bean.place_details.PlaceDetails
import com.oneclickaway.opensource.placeautocomplete.components.StatusCodes
import com.oneclickaway.opensource.placeautocomplete.ui.SearchPlaceActivity

class ExampleLocationSearch : AppCompatActivity() {

lateinit var searchLocationBtn : Button

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_example_location_search)

searchLocationBtn = findViewById(R.id.searchLocationBTN)

searchLocationBtn.setOnClickListener{
startActivityForResult(Intent(this, SearchPlaceActivity::class.java), 700)
}

}


override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)

if (requestCode == 700 && resultCode == Activity.RESULT_OK){

val placeDetails = data?.getParcelableExtra<PlaceDetails>(StatusCodes.PLACE_DATA)

Log.i(javaClass.simpleName, "onActivityResult: ${placeDetails?.name} ${placeDetails?.geometry?.location} ")
}
}
}

This file was deleted.

18 changes: 18 additions & 0 deletions app/src/main/res/layout/activity_example_location_search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ExampleLocationSearch">


<Button
android:text="@string/enter_location"
android:id="@+id/searchLocationBTN"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>


</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<string name="enter_location_name">Enter location name</string>
<string name="sample_place">Sample Place</string>
<string name="sample_place_formatted_address">Sample place formatted address</string>
<string name="enter_location">Enter Location</string>
</resources>
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.30'
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()
Expand All @@ -10,6 +10,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -23,6 +24,7 @@ allprojects {
}
}


task clean(type: Delete) {
delete rootProject.buildDir
}
Expand Down
1 change: 1 addition & 0 deletions place_autocomplete/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
88 changes: 88 additions & 0 deletions place_autocomplete/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'


android {
compileSdkVersion 28

defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}


dataBinding {
enabled = true
}

androidExtensions {
experimental = true
features = ["parcelize"]
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}


compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

implementation "org.jetbrains.kotlin:kotlin-android-extensions-runtime:$kotlin_version"

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

/*REST Api Libraries*/
implementation "com.squareup.okhttp3:okhttp:$rootProject.okhttp3Version"
implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"

implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.loggingInterceptor"
implementation "com.squareup.retrofit2:converter-gson:$rootProject.gsonVersion"
implementation "com.android.support:recyclerview-v7:$rootProject.recyclerViewVersion"


/*RXAndroid and RXJava*/
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroid"
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxJava"

/*Rx Binding*/
implementation "com.jakewharton.rxbinding2:rxbinding:$rootProject.rxBindingVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.rxRoomVersion"


/*life cycle components android jetpack*/
implementation "android.arch.lifecycle:extensions:$rootProject.archVersion"
kapt "android.arch.lifecycle:compiler:$rootProject.archVersion"
testImplementation "android.arch.core:core-testing:$rootProject.archVersion"

// https://mvnrepository.com/artifact/javax.annotation/jsr250-api
implementation group: 'javax.annotation', name: 'jsr250-api', version: '1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

}
repositories {
mavenCentral()
}

21 changes: 21 additions & 0 deletions place_autocomplete/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# 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 *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.oneclickaway.opensource.placeautocomplete;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.oneclickaway.opensource.placeautocomplete.test", appContext.getPackageName());
}
}
9 changes: 9 additions & 0 deletions place_autocomplete/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.oneclickaway.opensource.placeautocomplete">

<application>
<activity android:name=".ui.SearchPlaceActivity"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.uipep.android.searchplaces.api.base
package com.oneclickaway.opensource.placeautocomplete.api.base

import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.uipep.android.searchplaces.api.base
package com.oneclickaway.opensource.placeautocomplete.api.base

import android.telecom.Call
import com.uipep.android.searchplaces.api.bean.place_details.PlacesDetailsResponse
import com.uipep.android.searchplaces.api.bean.places_response.SearchResponse
import com.oneclickaway.opensource.placeautocomplete.api.bean.place_details.PlacesDetailsResponse
import com.oneclickaway.opensource.placeautocomplete.api.bean.places_response.SearchResponse
import io.reactivex.Observable
import io.reactivex.Single
import retrofit2.http.GET
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.uipep.android.searchplaces.api.bean.place_details
package com.oneclickaway.opensource.placeautocomplete.api.bean.place_details

import javax.annotation.Generated
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import javax.annotation.Generated

@Parcelize
@Generated("com.robohorse.robopojogenerator")
data class AddressComponentsItem(

Expand All @@ -14,4 +17,4 @@ data class AddressComponentsItem(

@field:SerializedName("long_name")
val longName: String? = null
)
) : Parcelable
Loading

0 comments on commit 3121f2f

Please sign in to comment.