Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
armcha committed Nov 14, 2017
1 parent e188ab3 commit 815beae
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 23 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Expand Up @@ -71,9 +71,9 @@ dependencies {
implementation "com.android.support.constraint:constraint-layout:1.0.2"

//Database
implementation "android.arch.persistence.room:runtime:1.0.0-rc1"
implementation "android.arch.persistence.room:rxjava2:1.0.0-rc1"
kapt "android.arch.persistence.room:compiler:1.0.0-rc1"
implementation "android.arch.persistence.room:runtime:1.0.0"
implementation "android.arch.persistence.room:rxjava2:1.0.0"
kapt "android.arch.persistence.room:compiler:1.0.0"

//RX
implementation "io.reactivex.rxjava2:rxjava:${rxJavaVersion}"
Expand Down Expand Up @@ -103,7 +103,7 @@ dependencies {
kapt "com.github.bumptech.glide:compiler:${glideVersion}"

//Leak canary
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'

//Testing
testImplementation 'junit:junit:4.12'
Expand Down
Expand Up @@ -46,7 +46,6 @@ class ApiModule {
okHttpBuilder.addInterceptor(logging)
}
return okHttpBuilder.apply {
protocols(listOf(Protocol.HTTP_1_1))
readTimeout(15.toLong(), TimeUnit.SECONDS)
connectTimeout(15.toLong(), TimeUnit.SECONDS)
}
Expand Down
Expand Up @@ -40,11 +40,6 @@ class HomePresenter @Inject constructor(private val userInteractor: UserInteract
}
}

@OnLifecycleEvent(value = Lifecycle.Event.ON_DESTROY)
fun onDestroy() {
userInteractor.clearCache()
}

override fun onPresenterCreate() {
super.onPresenterCreate()
fetch(userInteractor.getAuthenticatedUser()) {
Expand All @@ -54,6 +49,11 @@ class HomePresenter @Inject constructor(private val userInteractor: UserInteract
view?.openShotFragment()
}

override fun onPresenterDestroy() {
super.onPresenterDestroy()
userInteractor.clearCache()
}

override fun handleFragmentChanges(currentTag: String, fragment: Fragment) {
val tag = if (fragment is BaseFragment<*, *>) {
fragment.getTitle()
Expand Down
Expand Up @@ -6,7 +6,6 @@ import io.armcha.ribble.domain.fetcher.result_listener.RequestType
import io.armcha.ribble.domain.interactor.CommentInteractor
import io.armcha.ribble.domain.interactor.ShotLikeInteractor
import io.armcha.ribble.presentation.base_mvp.api.ApiPresenter
import io.armcha.ribble.presentation.utils.extensions.log
import javax.inject.Inject

/**
Expand Down
Expand Up @@ -14,8 +14,6 @@ import io.armcha.ribble.presentation.utils.S
import io.armcha.ribble.presentation.utils.extensions.takeColor
import io.armcha.ribble.presentation.utils.glide.load
import io.armcha.ribble.presentation.widget.navigation_view.NavigationId
import kotlinx.android.extensions.CacheImplementation
import kotlinx.android.extensions.ContainerOptions
import kotlinx.android.synthetic.main.fragment_user_likes.*
import kotlinx.android.synthetic.main.liked_shot_item.view.*
import kotlinx.android.synthetic.main.progress_bar.*
Expand Down
Expand Up @@ -8,6 +8,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.target.DrawableImageViewTarget

/**
* Created by Chatikyan on 28.08.2017.
Expand All @@ -34,7 +35,7 @@ private fun load(view: ImageView,
if (transformationType != TransformationType.NOTHING) {
glideRequest.transform(transformationType.getTransformation())
}
glideRequest.into(view)
glideRequest.into(DrawableImageViewTarget(view))
}

fun ImageView.clear() {
Expand Down
Expand Up @@ -37,9 +37,4 @@ class RibbleGlideModule : AppGlideModule() {
)
}

override fun registerComponents(context: Context?, glide: Glide, registry: Registry) {
val client = OkHttpClient.Builder().build()
val factory = OkHttpUrlLoader.Factory(client)
glide.registry.replace(GlideUrl::class.java, InputStream::class.java, factory)
}
}
10 changes: 6 additions & 4 deletions app/src/main/res/layout/shot_item.xml
Expand Up @@ -9,10 +9,12 @@
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardCornerRadius="18dp"
app:cardElevation="5dp"
app:cardUseCompatPadding="true">
app:cardElevation="10dp"
app:cardUseCompatPadding="false">

<ImageView
android:id="@+id/image"
Expand All @@ -29,7 +31,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="2dp"
android:layout_marginTop="-5dp"
android:layout_marginTop="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:ellipsize="end"
Expand Down

0 comments on commit 815beae

Please sign in to comment.