Skip to content

Commit e53ac71

Browse files
authored
Merge pull request #98 from odaridavid/pr96-cleanup
Codebase optimizations
2 parents 9366a48 + ff2fdff commit e53ac71

File tree

137 files changed

+908
-157
lines changed

Some content is hidden

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

137 files changed

+908
-157
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ keystore.properties
6868

6969
If you encounter any error check [this site](https://docs.travis-ci.com/user/encrypting-files/) out.
7070

71+
To setup the Travis CLI tools see [this](https://github.com/travis-ci/travis.rb#installation)
72+
7173
## Architecture
7274

7375
The Application is split into a three layer architecture:

app/build.gradle

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
*
3+
* Copyright 2020 David Odari
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10+
* or implied. See the License for the specific language governing permissions and limitations under
11+
* the License.
12+
*
13+
**/
114
apply plugin: 'com.android.application'
215

316
apply plugin: 'kotlin-android'
@@ -8,10 +21,10 @@ apply plugin: 'kotlin-kapt'
821

922
apply plugin: 'jacoco-android'
1023

11-
apply plugin: 'io.fabric'
12-
1324
apply plugin: 'com.mikepenz.aboutlibraries.plugin'
1425

26+
apply plugin: 'com.google.firebase.crashlytics'
27+
1528
jacoco {
1629
toolVersion = "0.8.4"
1730
}
@@ -53,24 +66,18 @@ android {
5366
buildTypes {
5467

5568
release {
56-
minifyEnabled false
69+
minifyEnabled true
70+
shrinkResources true
5771
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
58-
manifestPlaceholders = [
59-
crashlyticsEnabled: true,
60-
appIcon : "@mipmap/ic_launcher",
61-
appIconRound : "@mipmap/ic_launcher_round"
62-
]
72+
manifestPlaceholders = [crashlyticsEnabled: true]
6373
signingConfig signingConfigs.release
6474
}
6575

6676
debug {
77+
minifyEnabled false
6778
applicationIdSuffix ".debug"
6879
versionNameSuffix "-debug"
69-
manifestPlaceholders = [
70-
crashlyticsEnabled: false,
71-
appIcon : "@mipmap/ic_debug_launcher",
72-
appIconRound : "@mipmap/ic_debug_launcher_round"
73-
]
80+
manifestPlaceholders = [crashlyticsEnabled: false]
7481
testCoverageEnabled true
7582
}
7683
}
@@ -121,7 +128,7 @@ dependencies {
121128

122129
//Firebase
123130
implementation appDependencies.firebaseAnalytics
124-
implementation appDependencies.crashlytics
131+
implementation appDependencies.firebaseCrashlytics
125132

126133
//Stetho
127134
implementation appDependencies.stetho

app/proguard-rules.pro

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@
1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
2121
#-renamesourcefileattribute SourceFile
22+
23+
#Exclude R from ProGuard to enable the libraries auto detection[AboutLibraries]
24+
-keep class **.R$* {
25+
<fields>;
26+
}
27+
28+
-printusage build/outputs/mapping/release/usage.txt
29+
30+
-keep class com.k0d4black.theforce.** { *; }

app/src/main/AndroidManifest.xml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<!--
4+
~ Copyright 2020 David Odari
5+
~
6+
~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
7+
~ in compliance with the License. You may obtain a copy of the License at
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
~ Unless required by applicable law or agreed to in writing, software distributed under the License
10+
~ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
~ or implied. See the License for the specific language governing permissions and limitations under
12+
~ the License.
13+
-->
14+
215
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
316
package="com.k0d4black.theforce">
417

518
<application
619
android:name=".TheForceApplication"
720
android:allowBackup="true"
8-
android:icon="${appIcon}"
21+
android:icon="@mipmap/ic_launcher"
922
android:label="@string/app_name"
1023
android:networkSecurityConfig="@xml/network_security_config"
11-
android:roundIcon="${appIconRound}"
12-
android:supportsRtl="true"
24+
android:roundIcon="@mipmap/ic_launcher_round"
1325
android:theme="@style/AppTheme">
1426
<activity android:name=".base.BaseActivity" />
1527
<activity
-22.8 KB
Binary file not shown.

app/src/main/kotlin/com/k0d4black/theforce/TheForceApplication.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
*
3+
* Copyright 2020 David Odari
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10+
* or implied. See the License for the specific language governing permissions and limitations under
11+
* the License.
12+
*
13+
**/
114
package com.k0d4black.theforce
215

316
import android.app.Application

app/src/main/kotlin/com/k0d4black/theforce/activities/AboutActivity.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
*
3+
* Copyright 2020 David Odari
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10+
* or implied. See the License for the specific language governing permissions and limitations under
11+
* the License.
12+
*
13+
**/
114
package com.k0d4black.theforce.activities
215

316
import android.os.Bundle

app/src/main/kotlin/com/k0d4black/theforce/activities/CharacterDetailActivity.kt

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
*
3+
* Copyright 2020 David Odari
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10+
* or implied. See the License for the specific language governing permissions and limitations under
11+
* the License.
12+
*
13+
**/
114
package com.k0d4black.theforce.activities
215

316
import android.os.Bundle
@@ -16,7 +29,7 @@ import com.k0d4black.theforce.models.states.CharacterDetailsViewState
1629
import com.k0d4black.theforce.viewmodel.CharacterDetailViewModel
1730
import org.koin.androidx.viewmodel.ext.android.viewModel
1831

19-
//TODO Disable Saving favs for remote till everything is done
32+
//TODO Disable Saving favs for remote till everything is done and is not error
2033
internal class CharacterDetailActivity : BaseActivity() {
2134

2235
private val characterDetailViewModel by viewModel<CharacterDetailViewModel>()
@@ -88,9 +101,9 @@ internal class CharacterDetailActivity : BaseActivity() {
88101
menuInflater.inflate(R.menu.details_menu, menu)
89102
val menuItem = menu?.getItem(0)
90103
if (isFavorite)
91-
menuItem?.setIcon(R.drawable.ic_fav_on)
104+
menuItem?.setIcon(R.drawable.ic_favs_24dp)
92105
else
93-
menuItem?.setIcon(R.drawable.ic_fav_off)
106+
menuItem?.setIcon(R.drawable.ic_no_favs_24dp)
94107
return super.onCreateOptionsMenu(menu)
95108
}
96109

app/src/main/kotlin/com/k0d4black/theforce/activities/DashboardActivity.kt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
*
3+
* Copyright 2020 David Odari
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10+
* or implied. See the License for the specific language governing permissions and limitations under
11+
* the License.
12+
*
13+
**/
114
package com.k0d4black.theforce.activities
215

316
import android.os.Bundle
@@ -138,8 +151,8 @@ internal class DashboardActivity : BaseActivity() {
138151
})
139152
}
140153

141-
private fun handleSearchLoading(stateDashboard: DashboardSearchViewState) {
142-
if (stateDashboard.isLoading) {
154+
private fun handleSearchLoading(state: DashboardSearchViewState) {
155+
if (state.isLoading) {
143156
binding.searchResultsRecyclerView.hide()
144157
binding.searchResultsProgressBar.show()
145158
} else {
@@ -148,8 +161,8 @@ internal class DashboardActivity : BaseActivity() {
148161
}
149162
}
150163

151-
private fun handleFavoritesLoading(stateDashboard: DashboardFavoritesViewState) {
152-
if (stateDashboard.isLoading) {
164+
private fun handleFavoritesLoading(state: DashboardFavoritesViewState) {
165+
if (state.isLoading) {
153166
binding.favoritesProgressBar.show()
154167
} else {
155168
binding.favoritesProgressBar.hide()
@@ -187,8 +200,8 @@ internal class DashboardActivity : BaseActivity() {
187200
)
188201
}
189202

190-
private fun handleSearchError(stateDashboard: DashboardSearchViewState) {
191-
stateDashboard.error?.run {
203+
private fun handleSearchError(state: DashboardSearchViewState) {
204+
state.error?.run {
192205
showSnackbar(
193206
binding.searchResultsRecyclerView,
194207
getString(this.message),
@@ -197,8 +210,8 @@ internal class DashboardActivity : BaseActivity() {
197210
}
198211
}
199212

200-
private fun handleFavoritesError(stateDashboard: DashboardFavoritesViewState) {
201-
stateDashboard.error?.run {
213+
private fun handleFavoritesError(state: DashboardFavoritesViewState) {
214+
state.error?.run {
202215
showSnackbar(
203216
binding.favoritesRecyclerView,
204217
getString(this.message),

app/src/main/kotlin/com/k0d4black/theforce/activities/SettingsActivity.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
*
3+
* Copyright 2020 David Odari
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10+
* or implied. See the License for the specific language governing permissions and limitations under
11+
* the License.
12+
*
13+
**/
114
package com.k0d4black.theforce.activities
215

316
import android.os.Bundle

app/src/main/kotlin/com/k0d4black/theforce/adapters/FavoritesAdapter.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
package com.k0d4black.theforce.adapters;
2-
3-
import android.view.LayoutInflater
4-
import android.view.ViewGroup
5-
import androidx.recyclerview.widget.DiffUtil
6-
import androidx.recyclerview.widget.ListAdapter
7-
import androidx.recyclerview.widget.RecyclerView
8-
import com.k0d4black.theforce.databinding.ItemFavoriteBinding
9-
import com.k0d4black.theforce.models.FavoritePresentation
10-
import kotlinx.android.synthetic.main.item_favorite.view.*
11-
121
/**
132
*
143
* Copyright 2020 David Odari
@@ -22,6 +11,17 @@ import kotlinx.android.synthetic.main.item_favorite.view.*
2211
* the License.
2312
*
2413
**/
14+
package com.k0d4black.theforce.adapters;
15+
16+
import android.view.LayoutInflater
17+
import android.view.ViewGroup
18+
import androidx.recyclerview.widget.DiffUtil
19+
import androidx.recyclerview.widget.ListAdapter
20+
import androidx.recyclerview.widget.RecyclerView
21+
import com.k0d4black.theforce.databinding.ItemFavoriteBinding
22+
import com.k0d4black.theforce.models.FavoritePresentation
23+
import kotlinx.android.synthetic.main.item_favorite.view.*
24+
2525
internal class FavoritesAdapter(
2626
val onClick: (FavoritePresentation) -> (Unit)
2727
) : ListAdapter<FavoritePresentation, FavoritesAdapter.FavoriteViewHolder>(DiffUtil) {

app/src/main/kotlin/com/k0d4black/theforce/adapters/FilmsAdapter.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
*
3+
* Copyright 2020 David Odari
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10+
* or implied. See the License for the specific language governing permissions and limitations under
11+
* the License.
12+
*
13+
**/
114
package com.k0d4black.theforce.adapters
215

316
import android.view.LayoutInflater

app/src/main/kotlin/com/k0d4black/theforce/adapters/SearchResultAdapter.kt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
*
3+
* Copyright 2020 David Odari
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10+
* or implied. See the License for the specific language governing permissions and limitations under
11+
* the License.
12+
*
13+
**/
114
package com.k0d4black.theforce.adapters;
215

316
import android.view.LayoutInflater
@@ -7,7 +20,6 @@ import androidx.recyclerview.widget.ListAdapter
720
import androidx.recyclerview.widget.RecyclerView
821
import com.k0d4black.theforce.databinding.ItemSearchBinding
922
import com.k0d4black.theforce.models.CharacterPresentation
10-
import kotlinx.android.synthetic.main.item_search.view.*
1123

1224

1325
internal class SearchResultAdapter(
@@ -31,7 +43,7 @@ internal class SearchResultAdapter(
3143
binding.searchedCharacter = characterPresentation
3244
binding.executePendingBindings()
3345

34-
binding.root.more_info_arrow_image_button.setOnClickListener {
46+
binding.moreInfoArrowImageButton.setOnClickListener {
3547
onClick(characterPresentation)
3648
}
3749
}

app/src/main/kotlin/com/k0d4black/theforce/adapters/SpeciesAdapter.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
*
3+
* Copyright 2020 David Odari
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10+
* or implied. See the License for the specific language governing permissions and limitations under
11+
* the License.
12+
*
13+
**/
114
package com.k0d4black.theforce.adapters
215

316
import android.view.LayoutInflater

app/src/main/kotlin/com/k0d4black/theforce/base/BaseActivity.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
*
3+
* Copyright 2020 David Odari
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10+
* or implied. See the License for the specific language governing permissions and limitations under
11+
* the License.
12+
*
13+
**/
114
package com.k0d4black.theforce.base
215

316
import android.os.Build

0 commit comments

Comments
 (0)