Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #290 from razeware/development
Browse files Browse the repository at this point in the history
v1.0.7: Domestic 🦆
  • Loading branch information
orionthewake authored Sep 30, 2020
2 parents df13337 + 5f4ac3f commit 1d6c121
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 93 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ dependencies {

// RecyclerView
implementation "androidx.recyclerview:recyclerview:${versions.recyclerView}"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:${versions.swiperefreshlayout}"

// ConstraintLayout
implementation "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}"
Expand Down
30 changes: 30 additions & 0 deletions app/src/main/java/com/razeware/emitron/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import android.view.View
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.view.doOnLayout
import androidx.core.view.updatePadding
import androidx.navigation.NavDestination
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
Expand Down Expand Up @@ -75,6 +77,34 @@ class MainActivity : DaggerAppCompatActivity() {
initObservers()
CastContext.getSharedInstance(this)
initPendingDownloadsWorker()

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
setupWindowInsets()
}
}

/**
* Because new devices often use display cutouts (A.K.A. Notches), to save up screen real estate
* for front cameras, it's important to add extra padding to the top part of the screen, to avoid
* notch overlapping with the UI.
*
* To do this, we read the Notch size, and reduce the number by the default status bar height,
* because this is the margin size that's added to all the screens by default. This provides us
* with a stable UI, that doesn't overlap any content with the notch.
* */
@TargetApi(Build.VERSION_CODES.P)
private fun setupWindowInsets() {
binding.container.doOnLayout {
val inset = binding.container.rootWindowInsets

val cutoutSize = inset?.stableInsetTop

if (cutoutSize != null) {
val defaultTopMargin = resources.getDimensionPixelSize(R.dimen.guideline_top_status_bar)

binding.container.updatePadding(top = cutoutSize - defaultTopMargin)
}
}
}

private fun createNotificationChannels() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ class NetModule {
authInterceptor: AuthInterceptorImpl
): OkHttpClient =
OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.connectTimeout(30, TimeUnit.SECONDS)
.callTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.addNetworkInterceptor(authInterceptor)
.addInterceptor(loggingInterceptor)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ package com.razeware.emitron.ui.library

import android.annotation.SuppressLint
import android.os.Bundle
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo.*
import androidx.appcompat.widget.PopupMenu
import androidx.core.view.isVisible
import androidx.core.view.setPadding
import androidx.fragment.app.activityViewModels
Expand Down Expand Up @@ -151,6 +149,10 @@ class LibraryFragment : DaggerFragment() {
binding.textInputLayoutSearch.setEndIconOnClickListener {
handleQueryCleared()
}

binding.libraryPullToRefresh.setOnRefreshListener {
loadCollections()
}
}

private fun showRecentSearchControls() {
Expand Down Expand Up @@ -224,6 +226,10 @@ class LibraryFragment : DaggerFragment() {
toggleControls(true, uiState == UiStateManager.UiState.INIT_EMPTY)
hideRecentSearchControls()
progressDelegate.hideProgressView()
binding.libraryPullToRefresh.isRefreshing = false
}
UiStateManager.UiState.INIT_FAILED -> {
loadCollections() // retry
}
else -> {
// Handled by the adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ class SettingsFragment : DaggerFragment() {
titleVersionName.text = getString(
R.string.label_version, BuildConfig.VERSION_NAME
)
titleLoggedInUser.text = getString(
R.string.settings_logged_in_user, viewModel.getLoggedInUser()
)
titleLoggedInUser.text = getString(
R.string.settings_logged_in_user, viewModel.getLoggedInUser()
)
switchCrashReporting.setOnCheckedChangeListener { _, checked ->
viewModel.updateCrashReportingAllowed(checked)
}
Expand Down
23 changes: 15 additions & 8 deletions app/src/main/res/layout/fragment_library.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,24 +163,31 @@
app:icon="@drawable/ic_material_icon_sort"
app:iconPadding="@dimen/button_padding_internal_dense"
app:iconTint="@color/colorIcon2"
app:layout_constraintBottom_toTopOf="@+id/recycler_view_library"
app:layout_constraintBottom_toTopOf="@+id/library_pull_to_refresh"
app:layout_constraintEnd_toEndOf="@id/guideline_right"
app:layout_constraintStart_toEndOf="@+id/text_library_count"
app:layout_constraintTop_toBottomOf="@+id/scroll_view_library_filter" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_library"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/library_pull_to_refresh"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="@dimen/activity_vertical_margin"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/guideline_right"
app:layout_constraintStart_toStartOf="@id/guideline_left"
app:layout_constraintTop_toBottomOf="@+id/text_library_count"
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_content" />
app:layout_constraintTop_toBottomOf="@+id/text_library_count">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_library"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/activity_vertical_margin"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_content" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

<FrameLayout
android:id="@+id/layout_progress_container"
Expand Down
101 changes: 47 additions & 54 deletions app/src/main/res/layout/fragment_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
android:orientation="vertical"
app:paddingBottomSystemWindowInsets="@{true}">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/guideline_top_status_bar_1"
android:layout_height="?android:actionBarSize"
app:layout_constraintBottom_toTopOf="@+id/title_version_name"
app:layout_constraintTop_toTopOf="@+id/guideline_top"
app:layout_constraintVertical_bias="0"
app:layout_constraintVertical_chainStyle="packed" />

<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
Expand All @@ -22,14 +32,6 @@
android:layout_height="wrap_content"
android:clipToPadding="true">


<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="@dimen/guideline_top_status_bar_1" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_left"
android:layout_width="wrap_content"
Expand All @@ -51,15 +53,6 @@
android:orientation="horizontal"
app:layout_constraintGuide_end="@dimen/guideline_bottom_gesture" />

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:actionBarSize"
app:layout_constraintBottom_toTopOf="@+id/title_version_name"
app:layout_constraintTop_toTopOf="@+id/guideline_top"
app:layout_constraintVertical_bias="0"
app:layout_constraintVertical_chainStyle="packed" />

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/title_video_quality"
style="@style/TextAppearance.Body.1"
Expand All @@ -70,7 +63,7 @@
app:layout_constraintBottom_toTopOf="@+id/divider_0"
app:layout_constraintEnd_toStartOf="@id/settings_selected_video_quality"
app:layout_constraintStart_toStartOf="@id/guideline_left"
app:layout_constraintTop_toBottomOf="@id/toolbar" />
app:layout_constraintTop_toTopOf="parent" />

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/settings_selected_video_quality"
Expand Down Expand Up @@ -480,41 +473,41 @@

</ScrollView>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/title_logged_in_user"
style="@style/TextAppearance.Body.1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginTop="@dimen/text_spacing_vertical_default"
android:layout_marginBottom="@dimen/text_spacing_vertical_default"
app:layout_constraintEnd_toStartOf="@id/guideline_right"
app:layout_constraintStart_toStartOf="@id/guideline_left"
app:layout_constraintTop_toBottomOf="@+id/divider_10"
android:layout_gravity="center"
tools:text="Logged in as lukusfreebird" />

<com.google.android.material.button.MaterialButton
android:id="@+id/button_logout"
style="@style/Button.Colored.3.Icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginStart="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_vertical_margin"
android:text="@string/button_sign_out"
app:icon="@drawable/ic_material_button_icon_arrow_right_red_contained"
app:iconGravity="end"
app:iconTint="@color/white"
app:iconTintMode="multiply"
tools:visibility="visible" />

</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/title_logged_in_user"
style="@style/TextAppearance.Body.1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/text_spacing_vertical_default"
android:layout_marginBottom="@dimen/text_spacing_vertical_default"
android:gravity="center_vertical"
app:layout_constraintEnd_toStartOf="@id/guideline_right"
app:layout_constraintStart_toStartOf="@id/guideline_left"
app:layout_constraintTop_toBottomOf="@+id/divider_10"
tools:text="Logged in as lukusfreebird" />

<com.google.android.material.button.MaterialButton
android:id="@+id/button_logout"
style="@style/Button.Colored.3.Icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_vertical_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:text="@string/button_sign_out"
app:icon="@drawable/ic_material_button_icon_arrow_right_red_contained"
app:iconGravity="end"
app:iconTint="@color/white"
app:iconTintMode="multiply"
tools:visibility="visible" />

</LinearLayout>
</LinearLayout>
</layout>
1 change: 1 addition & 0 deletions app/src/main/res/values-v28/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<item name="colorPrimarySurface">@color/colorBackground</item>
<item name="materialCardViewStyle">@style/Card</item>
<item name="materialAlertDialogTheme">@style/AlertDialog</item>
<item name="android:windowLayoutInDisplayCutoutMode">default</item>
</style>

<style name="AppTheme.Toolbar_Overlay" parent="AppTheme">
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-v29/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<item name="colorPrimarySurface">@color/colorBackground</item>
<item name="materialCardViewStyle">@style/Card</item>
<item name="materialAlertDialogTheme">@style/AlertDialog</item>
<item name="android:windowLayoutInDisplayCutoutMode">default</item>
</style>

<style name="AppTheme.Popup" parent="Widget.AppCompat.PopupMenu">
Expand Down
48 changes: 25 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,55 @@
buildscript {
ext.versions = [
// build
'versionCode' : 21,
'versionName' : "1.0.6",
'versionCode' : 22,
'versionName' : "1.0.7",
'minSdk' : 21,
'targetSdk' : 29,
'compileSdk' : 29,
'gradle' : '3.6.1',
'kotlin' : '1.3.70',
'targetSdk' : 30,
'compileSdk' : 30,
'gradle' : '4.0.1',
'kotlin' : '1.4.0',

// core
'coreKtx' : "1.1.0",
'fragmentKtx' : "1.1.0",
'preferenceKtx' : "1.1.0",
'architectureComponents' : "2.1.0",
'architectureComponentsPaging': "2.1.0",
'workManager' : '2.2.0',
'coreKtx' : "1.3.1",
'fragmentKtx' : "1.2.5",
'preferenceKtx' : "1.1.1",
'architectureComponents' : "2.2.0",
'architectureComponentsPaging': "2.1.2",
'workManager' : '2.4.0',
'annotations' : "1.1.0",
'appCompat' : "1.1.0",
'appCompat' : "1.2.0",
'multidex' : "2.0.1",
'browser' : "1.0.0", // Chrome custom tabs
'browser' : "1.2.0", // Chrome custom tabs

'dagger' : '2.25.2',
'coroutines' : "1.3.3",
'dagger' : '2.27',
'coroutines' : "1.3.9",

// cast
'mediarouter' : "1.1.0",
'castFramework' : '17.1.0', // Google cast

// ui
'constraintLayout' : "1.1.3",
'constraintLayout' : "2.0.1",
'exoplayer' : "2.10.4",
'navigation' : "2.1.0",
'materialDesign' : '1.1.0-beta02',
'navigation' : "2.3.0",
'materialDesign' : '1.2.1',
'vectorDrawable' : '1.1.0',
'recyclerView' : "1.0.0",
'viewpagerdots' : "1.0.0",
'viewpager' : "1.0.0",
'swiperefreshlayout' : "1.1.0",


// db
'room' : '2.2.1',
'room' : '2.2.5',

// time
'threetenabp' : "1.2.1",
'threetenabp' : "1.2.4",

//network
'retrofit' : '2.6.2',
'retrofit' : '2.9.0',
'moshi' : '1.9.2',
'okHttp' : '4.2.2',
'okHttp' : '4.8.1',
'glide' : '4.10.0',

//quality
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Mar 01 01:15:44 IST 2020
#Mon Sep 14 16:50:38 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
1 change: 1 addition & 0 deletions model/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion versions.compileSdk

Expand Down
Loading

0 comments on commit 1d6c121

Please sign in to comment.