Skip to content

Commit

Permalink
Merge pull request feelfreelinux#130 from otwarty-wykop-mobilny/fix_l…
Browse files Browse the repository at this point in the history
…ink_detais_preview
  • Loading branch information
mateuszkwiecinski authored Dec 3, 2021
2 parents d3da35e + f08b856 commit 0a8b15a
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 56 deletions.
3 changes: 0 additions & 3 deletions app/src/main/kotlin/io/github/wykopmobilny/Const.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class LinkDetailsAdapter @Inject constructor(
if (holder.itemViewType == LinkHeaderViewHolder.TYPE_HEADER) {
link?.let {
(holder as LinkHeaderViewHolder).bindView(
link = it, showMinifiedImages = showMinifiedImages,
link = it,
showMinifiedImages = false, // always use original version on details
)
}
} else if (holder is BlockedViewHolder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import com.google.android.youtube.player.YouTubePlayer
import com.google.android.youtube.player.YouTubePlayer.ErrorReason
import com.google.android.youtube.player.YouTubePlayerView
import io.github.aakira.napier.Napier
import io.github.wykopmobilny.GOOGLE_KEY
import io.github.wykopmobilny.BuildConfig
import io.github.wykopmobilny.utils.youtubeTimestampToMsOrNull
import java.net.URLDecoder

Expand Down Expand Up @@ -102,7 +102,6 @@ class YTPlayer :
YouTubePlayer.OnFullscreenListener,
YouTubePlayer.PlayerStateChangeListener {

private var googleApiKey: String? = null
private var videoId: String? = null
private var timestampMs: Int? = null

Expand All @@ -121,7 +120,7 @@ class YTPlayer :
initialize()

playerView = YouTubePlayerView(this)
playerView.initialize(googleApiKey, this)
playerView.initialize(BuildConfig.GOOGLE_KEY, this)

addContentView(playerView, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))

Expand All @@ -131,16 +130,6 @@ class YTPlayer :
}

private fun initialize() {
try {
googleApiKey = GOOGLE_KEY
} catch (notFound: PackageManager.NameNotFoundException) {
Napier.i("Failed to initialize YTplayer", notFound)
}

if (googleApiKey == null) {
throw NullPointerException("Google API key must not be null. Set your api key as meta data in AndroidManifest.xml file.")
}

videoId = intent.getStringExtra(EXTRA_VIDEO_ID)
if (videoId == null) {
throw NullPointerException("Video ID must not be null")
Expand Down Expand Up @@ -221,7 +210,7 @@ class YTPlayer :
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == RECOVERY_DIALOG_REQUEST) {
// Retry initialization if user performed a recovery action
playerView.initialize(googleApiKey, this)
playerView.initialize(BuildConfig.GOOGLE_KEY, this)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,22 +170,21 @@ class LinkDetailsActivity :
R.id.refresh -> onRefresh()
R.id.sortbyBest -> {
presenter.sortBy = "best"
appStorage.preferencesQueries.insertOrReplace(PreferenceEntity(key = "settings.links.comments_sort", value = "best"))
appStorage.preferencesQueries.insertOrReplace(PreferenceEntity(key = "settings.links.comments_sort", value_ = "best"))
setSubtitle()
presenter.loadComments()
binding.swiperefresh.isRefreshing = true
}
R.id.sortbyNewest -> {
presenter.sortBy = "new"
appStorage.preferencesQueries.insertOrReplace(PreferenceEntity(key = "settings.links.comments_sort", value = "new"))
appStorage.preferencesQueries.insertOrReplace(PreferenceEntity(key = "settings.links.comments_sort", value_ = "new"))
setSubtitle()
presenter.loadComments()
binding.swiperefresh.isRefreshing = true
}

R.id.sortbyOldest -> {
presenter.sortBy = "old"
appStorage.preferencesQueries.insertOrReplace(PreferenceEntity(key = "settings.links.comments_sort", value = "old"))
appStorage.preferencesQueries.insertOrReplace(PreferenceEntity(key = "settings.links.comments_sort", value_ = "old"))
setSubtitle()
presenter.loadComments()
binding.swiperefresh.isRefreshing = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ class UpcomingFragment : BaseLinksFragment(), UpcomingView {
R.id.sortByComments -> {
presenter.sortBy = UpcomingPresenter.SORTBY_COMMENTS
appStorage.preferencesQueries.insertOrReplace(
PreferenceEntity(
key = "settings.links.upcoming_sort",
value = UpcomingPresenter.SORTBY_COMMENTS,
),
preferenceEntity = PreferenceEntity(key = "settings.links.upcoming_sort", UpcomingPresenter.SORTBY_COMMENTS),
)
setSubtitle()
binding.swipeRefresh.isRefreshing = true
Expand All @@ -65,10 +62,7 @@ class UpcomingFragment : BaseLinksFragment(), UpcomingView {
R.id.sortByVotes -> {
presenter.sortBy = UpcomingPresenter.SORTBY_VOTES
appStorage.preferencesQueries.insertOrReplace(
PreferenceEntity(
key = "settings.links.upcoming_sort",
value = UpcomingPresenter.SORTBY_VOTES,
),
preferenceEntity = PreferenceEntity(key = "settings.links.upcoming_sort", UpcomingPresenter.SORTBY_VOTES),
)
setSubtitle()
binding.swipeRefresh.isRefreshing = true
Expand All @@ -77,10 +71,7 @@ class UpcomingFragment : BaseLinksFragment(), UpcomingView {
R.id.sortByDate -> {
presenter.sortBy = UpcomingPresenter.SORTBY_DATE
appStorage.preferencesQueries.insertOrReplace(
PreferenceEntity(
key = "settings.links.upcoming_sort",
value = UpcomingPresenter.SORTBY_DATE,
),
preferenceEntity = PreferenceEntity(key = "settings.links.upcoming_sort", UpcomingPresenter.SORTBY_DATE),
)
setSubtitle()
binding.swipeRefresh.isRefreshing = true
Expand All @@ -89,10 +80,7 @@ class UpcomingFragment : BaseLinksFragment(), UpcomingView {
R.id.sortByActive -> {
presenter.sortBy = UpcomingPresenter.SORTBY_ACTIVE
appStorage.preferencesQueries.insertOrReplace(
PreferenceEntity(
key = "settings.links.upcoming_sort",
value = UpcomingPresenter.SORTBY_ACTIVE,
),
preferenceEntity = PreferenceEntity(key = "settings.links.upcoming_sort", UpcomingPresenter.SORTBY_ACTIVE),
)
setSubtitle()
binding.swipeRefresh.isRefreshing = true
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id("com.starter.versioning")
id("com.gradleup.auto.manifest")
id("com.osacky.doctor") version("0.7.3")
id("com.starter.easylauncher") version("4.1.1") apply(false)
id("com.starter.easylauncher") version("4.2.0") apply(false)
id "com.github.ben-manes.versions" version "0.39.0"
}

Expand Down
12 changes: 6 additions & 6 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("java-gradle-plugin")
id("org.jetbrains.kotlin.jvm") version "1.5.31"
Expand All @@ -15,17 +13,19 @@ dependencies {
implementation("com.project.starter:android:0.38.0")
implementation("com.gradleup:auto-manifest-plugin:1.0.4")
implementation("com.google.gms:google-services:4.3.10")
implementation("com.google.firebase:firebase-crashlytics-gradle:2.8.0")
implementation("com.google.firebase:firebase-crashlytics-gradle:2.8.1")
implementation("com.slack.keeper:keeper:0.11.1")
implementation("com.google.firebase:perf-plugin:1.4.0")
implementation("com.squareup.sqldelight:gradle-plugin:1.5.2")
implementation("com.squareup.sqldelight:gradle-plugin:1.5.3")
implementation("com.android.tools:common:30.0.3")
implementation("com.karumi:shot:5.11.2")
implementation("pl.droidsonroids.gradle:plugin:1.0.9")
}

tasks.withType(KotlinCompile).configureEach {
kotlinOptions.jvmTarget = JavaVersion.current()
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

gradlePlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class FragmentScenarioIHateGoogle<F : Fragment>(
internal val FACTORY: ViewModelProvider.Factory =
object : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
val viewModel = FragmentFactoryHolderViewModel()
return viewModel as T
}
Expand Down
2 changes: 0 additions & 2 deletions data/cache/sqldelight/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("com.starter.library.android")
id("org.jetbrains.kotlin.kapt")
Expand Down
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[versions]
google-lifecycle = "2.3.1"
google-appcompat = "1.4.0-beta01"
google-lifecycle = "2.4.0"
google-appcompat = "1.4.0"
google-swiperefreshlayout = "1.1.0"
google-recyclerView = "1.2.1"
google-constraintlayout = "2.1.1"
google-constraintlayout = "2.1.2"
google-androidtest = "1.4.0"
google-androidtestext = "1.1.3"
google-androidArchCore = "2.1.0"
google-material = "1.4.0"
google-work = "2.7.0"
google-work = "2.7.1"
google-preference = "1.1.1"
google-paging = "3.0.1"
google-paging = "3.1.0"
google-browser = "1.3.0"
google-viewpager2 = "1.0.0"
google-androidxcore = "1.6.0"
google-androidxcore = "1.7.0"
google-activity = "1.4.0"
google-fragment = "1.3.6"
google-fragment = "1.4.0"
google-datastore = "1.0.0"
google-cardview = "1.0.0"
google-exifinterface = "1.3.3"
Expand All @@ -31,7 +31,7 @@ mavencentral-datetime = "0.3.1"
mavencentral-store = "4.0.2-KT15"
mavencentral-retrofit = "2.9.0"
mavencentral-moshi = "1.12.0"
mavencentral-sqldelight = "1.5.2"
mavencentral-sqldelight = "1.5.3"
mavencentral-jspoon = "1.3.2"
mavencentral-jsoup = "1.14.3"
mavencentral-slidr = "3.0.0"
Expand Down

0 comments on commit 0a8b15a

Please sign in to comment.