This commit is contained in:
Ashwini Kumar
2019-07-31 11:19:26 +05:30
parent 2cb97f98c1
commit 60493a9cd9
6 changed files with 31 additions and 134 deletions

View File

@ -105,4 +105,11 @@
-dontwarn org.codehaus.mojo.animal_sniffer.*
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-dontwarn okhttp3.internal.platform.ConscryptPlatform
# Strip Timber Log statments in release
-assumenosideeffects class timber.log.Timber* {
public static *** v(...);
public static *** d(...);
public static *** i(...);
}

View File

@ -7,7 +7,7 @@ import androidx.test.espresso.IdlingResource
import com.android.tvmaze.R
/**
* An idling resource which checks if the loader is being shown on screen
* An idling resource which checks which tells Espresso to wait until Progress Bar dismisses
*/
class LoadingIdlingResource constructor(private val activity: Activity) : IdlingResource {
private var resourceCallback: IdlingResource.ResourceCallback? = null

View File

@ -1,6 +1,7 @@
package com.android.tvmaze.network
import android.content.Context
import com.android.tvmaze.BuildConfig
import dagger.Module
import dagger.Provides
import okhttp3.Cache
@ -25,7 +26,11 @@ object NetworkModule {
@Provides
@Singleton
fun provideLoggingInterceptor(): HttpLoggingInterceptor {
return HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BODY }
return HttpLoggingInterceptor().apply {
if (BuildConfig.DEBUG) {
level = HttpLoggingInterceptor.Level.BODY
}
}
}
@JvmStatic

View File

@ -1,51 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="com.android.tvmaze.network.home.Show" />
<import type="com.android.tvmaze.network.home.Show"/>
<import type="android.view.View" />
<import type="android.view.View"/>
<import type="androidx.core.text.HtmlCompat" />
<import type="androidx.core.text.HtmlCompat"/>
<variable
name="rating"
type="String" />
type="String"/>
<variable
name="show"
type="com.android.tvmaze.network.home.Show" />
type="com.android.tvmaze.network.home.Show"/>
</data>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:layout_margin="2dp"
app:cardCornerRadius="2dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="160dp"
android:orientation="horizontal"
android:padding="8dp">
android:orientation="horizontal">
<ImageView
android:id="@+id/show_image"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_marginRight="8dp"
android:scaleType="fitXY" />
android:scaleType="fitXY"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dp"
android:orientation="vertical">
<TextView
@ -54,18 +50,18 @@
android:text="@{show.name}"
android:textSize="16sp"
android:textStyle="bold"
tools:text="Hell's Kitchen" />
tools:text="Hell's Kitchen"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:ellipsize="end"
android:maxLines="4"
android:maxLines="5"
android:text="@{HtmlCompat.fromHtml(show.summary, HtmlCompat.FROM_HTML_MODE_LEGACY)}"
android:visibility="@{show.summary == null ? View.GONE: View.VISIBLE, default = gone}"
tools:text="In Hell's Kitchen, aspiring chefs are put through an intense culinary academy to prove they possess the right combination of ingredients to win a life-changing grand prize."
tools:visibility="visible" />
tools:visibility="visible"/>
<TextView
android:layout_width="wrap_content"
@ -75,7 +71,7 @@
android:textSize="12sp"
android:visibility="@{show.rating == null ? View.GONE: View.VISIBLE, default=gone}"
tools:text="Rating: 8.9"
tools:visibility="visible" />
tools:visibility="visible"/>
<TextView
android:layout_width="wrap_content"
@ -85,7 +81,7 @@
android:textSize="12sp"
android:visibility="@{show.premiered == null ? View.GONE:View.VISIBLE, default=gone}"
tools:text="Premiered On: 2005-05-30"
tools:visibility="visible" />
tools:visibility="visible"/>
</LinearLayout>
</LinearLayout>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/show_image"
android:layout_width="match_parent"
android:layout_height="260dp"
android:scaleType="fitXY" />
</layout>

View File

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="episode"
type="com.android.tvmaze.network.home.Episode"/>
<variable
name="show"
type="com.android.tvmaze.network.home.Show"/>
</data>
<androidx.cardview.widget.CardView
android:layout_width="300dp"
android:layout_height="wrap_content"
android:foreground="?android:attr/selectableItemBackground"
card_view:cardBackgroundColor="@color/grey"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true"
card_view:contentPadding="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="64dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{episode.airtime}"
android:textColor="@color/blue"
android:textSize="12sp"
android:textStyle="bold"
tools:text="20:00"/>
<TextView
android:id="@+id/network_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@{show.airChannel.name}"
android:textColor="@color/white"
android:textSize="12sp"
tools:text="CBS"/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="@color/light_grey"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/show_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@{show.name}"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
tools:text="Game of Thrones"/>
<TextView
android:id="@+id/episode_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@{episode.name}"
android:textColor="@color/white"
android:textSize="12sp"
tools:text="Ice and Fire"/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</layout>