Skip to content

Commit

Permalink
Migrated to AndroidX
Browse files Browse the repository at this point in the history
Added experimental Spanish Translation
Various bug fixes
  • Loading branch information
Kasim Rangwala committed Jan 29, 2019
1 parent 8659bae commit 9a2cdf7
Show file tree
Hide file tree
Showing 91 changed files with 2,639 additions and 1,506 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
6 changes: 6 additions & 0 deletions .idea/codeStyles/Project.xml

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

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

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

28 changes: 4 additions & 24 deletions .idea/misc.xml

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

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Update [`tokenKey`](https://github.com/kasim1011/OdooJsonRpcClient/blob/5edf9e5e

Do not hesitate to report [issues](https://github.com/kasim1011/OdooJsonRpcClient/issues) you may find.

Get the **sample APK** from [release](https://github.com/kasim1011/OdooJsonRpcClient/releases) saction.
Get the **sample APK** from [release](https://github.com/kasim1011/OdooJsonRpcClient/releases) section.

Next Milestone:
- **Synchronization** and **Persistence** using [Room Persistence Library](https://developer.android.com/topic/libraries/architecture/room)
Expand Down Expand Up @@ -288,7 +288,7 @@ Odoo.searchRead(model = "res.partner", fields = listOf(
val searchRead = response.body()!!
if (searchRead.isSuccessful) {
val result = searchRead.result
// use gson to convert records (jsonArray) to list of pojo
// use gson to convert records (jsonArray) to list of POJO
// ...
} else {
// Odoo specific error
Expand Down
47 changes: 25 additions & 22 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.mironov.smuggler'

// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
Expand All @@ -24,15 +23,17 @@ android {
}
}

compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId "io.gripxtech.odoojsonrpcclient"
minSdkVersion 17
targetSdkVersion 27
versionCode 3
versionName "1.02"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
targetSdkVersion 28
versionCode 4
versionName "1.03"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true

multiDexEnabled true
}
buildTypes {
release {
Expand All @@ -45,6 +46,9 @@ android {
signingConfig signingConfigs.config
}
}
androidExtensions {
experimental = true
}
dataBinding {
enabled true
}
Expand All @@ -56,30 +60,29 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.android.support:appcompat-v7:$support_library_version"
implementation "com.android.support:design:$support_library_version"
implementation "com.android.support:recyclerview-v7:$support_library_version"
implementation "com.android.support:cardview-v7:$support_library_version"
implementation "com.android.support:preference-v14:$support_library_version"
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
kapt "com.android.databinding:compiler:$gradle_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'com.google.android.material:material:1.1.0-alpha02'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.preference:preference-ktx:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.multidex:multidex:2.0.1'
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
implementation "com.github.bumptech.glide:okhttp3-integration:$glide_version"
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version"
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.16'
implementation 'com.jakewharton.timber:timber:4.7.0'
implementation 'com.intuit.sdp:sdp-android:1.0.5'
implementation 'com.intuit.ssp:ssp-android:1.0.5'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
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'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
1 change: 1 addition & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
# Application classes that will be serialized/deserialized over Gson
-keep class io.gripxtech.odoojsonrpcclient.core.entities.** { *; }
-keep interface io.gripxtech.odoojsonrpcclient.core.web.** { *; }
-keep class io.gripxtech.odoojsonrpcclient.customer.entities.** { *; }

# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package io.gripxtech.odoojsonrpcclient

import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4

import androidx.test.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand Down
114 changes: 64 additions & 50 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,76 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.gripxtech.odoojsonrpcclient">
xmlns:tools="http://schemas.android.com/tools"
package="io.gripxtech.odoojsonrpcclient">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<uses-permission
android:name="android.permission.GET_ACCOUNTS"
android:maxSdkVersion="22" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
android:name="android.permission.GET_ACCOUNTS"
android:maxSdkVersion="22"/>
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity
android:name=".MainActivity"
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
android:largeHeap="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:ignore="AllowBackup,GoogleAppIndexingWarning,UnusedAttribute">
<activity
android:name=".core.authenticator.LoginActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"/>
<activity
android:name=".core.authenticator.SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar.Immersive.Splash">
android:name=".core.authenticator.LoginActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"/>
<activity
android:name=".core.authenticator.SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar.Immersive.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".core.authenticator.ProfileActivity"
android:label="@string/action_profile"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
android:name=".core.authenticator.ProfileActivity"
android:label="@string/action_profile"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"/>
<activity
android:name=".core.authenticator.ManageAccountActivity"
android:label="@string/action_manage_account"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
android:name=".core.authenticator.ManageAccountActivity"
android:label="@string/action_manage_account"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"/>
<activity
android:name=".core.preferences.SettingsActivity"
android:label="@string/action_settings"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
android:name=".core.preferences.SettingsActivity"
android:label="@string/action_settings"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"/>

<service
android:name=".core.authenticator.AuthenticatorService"
android:enabled="true"
android:exported="true"
tools:ignore="ExportedService">
android:name=".core.authenticator.AuthenticatorService"
android:enabled="true"
android:exported="true"
tools:ignore="ExportedService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
<action android:name="android.accounts.AccountAuthenticator"/>
</intent-filter>

<meta-data
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator"/>
</service>

<provider
android:name=".core.utils.OdooFileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"/>
</provider>

</application>

</manifest>
24 changes: 20 additions & 4 deletions app/src/main/java/io/gripxtech/odoojsonrpcclient/App.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package io.gripxtech.odoojsonrpcclient

import android.app.Application
import android.content.Context
import android.content.res.Configuration
import androidx.multidex.MultiDexApplication
import io.gripxtech.odoojsonrpcclient.core.Odoo
import io.gripxtech.odoojsonrpcclient.core.utils.CookiePrefs
import io.gripxtech.odoojsonrpcclient.core.utils.LetterTileProvider
import io.gripxtech.odoojsonrpcclient.core.utils.LocaleHelper
import io.gripxtech.odoojsonrpcclient.core.utils.Retrofit2Helper
import timber.log.Timber

class App : Application() {
class App : MultiDexApplication() {

companion object {
const val KEY_ACCOUNT_TYPE = "${BuildConfig.APPLICATION_ID}.auth"
Expand All @@ -21,16 +24,29 @@ class App : Application() {
CookiePrefs(this)
}

override fun attachBaseContext(base: Context?) {
if (base != null) {
super.attachBaseContext(LocaleHelper.setLocale(base))
} else {
super.attachBaseContext(base)
}
}

override fun onConfigurationChanged(newConfig: Configuration?) {
super.onConfigurationChanged(newConfig)
LocaleHelper.setLocale(this)
}

override fun onCreate() {
super.onCreate()
Odoo.app = this
Retrofit2Helper.app = this
Odoo.app = this

if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
}

fun getLetterTile(displayName: String): ByteArray =
letterTileProvider.getLetterTile(displayName)
letterTileProvider.getLetterTile(displayName)
}
Loading

0 comments on commit 9a2cdf7

Please sign in to comment.