Compare commits
12 Commits
v171901010
...
v171901030
Author | SHA1 | Date | |
---|---|---|---|
a8721ad7a4 | |||
bc5e882894 | |||
e3460322b1 | |||
7e3288a076 | |||
ddc754ec25 | |||
134a0766d6 | |||
69da932ab5 | |||
592fb6328a | |||
a0aead6491 | |||
722b6cc06d | |||
6d7c4b40f6 | |||
f538ed39fc |
@ -112,7 +112,7 @@ dependencies {
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
|
||||
|
||||
//multidex
|
||||
implementation 'androidx.multidex:multidex:2.0.0'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
|
||||
// About
|
||||
implementation('com.mikepenz:aboutlibraries:6.2.0@aar') {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package apps.amine.bou.readerforselfoss
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
@ -85,10 +86,12 @@ class AddSourceActivity : AppCompatActivity() {
|
||||
|
||||
try {
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
val settings =
|
||||
getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE)
|
||||
api = SelfossApi(
|
||||
this,
|
||||
this@AddSourceActivity,
|
||||
prefs.getBoolean("isSelfSignedCert", false),
|
||||
settings.getBoolean("isSelfSignedCert", false),
|
||||
prefs.getString("api_timeout", "-1").toLong(),
|
||||
prefs.getBoolean("should_log_everything", false)
|
||||
)
|
||||
|
@ -247,14 +247,18 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
||||
val i = items.elementAtOrNull(position)
|
||||
|
||||
if (i != null) {
|
||||
val adapter = recyclerView.adapter
|
||||
val adapter = recyclerView.adapter as ItemsAdapter<*>
|
||||
|
||||
when (adapter) {
|
||||
is ItemCardAdapter -> adapter.handleItemAtIndex(position)
|
||||
is ItemListAdapter -> adapter.handleItemAtIndex(position)
|
||||
val wasItemUnread = adapter.unreadItemStatusAtIndex(position)
|
||||
|
||||
adapter.handleItemAtIndex(position)
|
||||
|
||||
if (wasItemUnread) {
|
||||
badgeNew--
|
||||
} else {
|
||||
badgeNew++
|
||||
}
|
||||
|
||||
badgeNew--
|
||||
reloadBadgeContent()
|
||||
|
||||
val tagHashes = i.tags.tags.split(",").map { it.longHash() }
|
||||
@ -515,7 +519,9 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
||||
)
|
||||
}
|
||||
} else {
|
||||
val filteredTags = maybeTags.filterNot { hiddenTags.contains(it.tag) }
|
||||
val filteredTags = maybeTags
|
||||
.filterNot { hiddenTags.contains(it.tag) }
|
||||
.sortedBy { it.unread == 0 }
|
||||
tagsBadge = filteredTags.map {
|
||||
val gd = GradientDrawable()
|
||||
val color = try {
|
||||
@ -1348,12 +1354,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
||||
).show()
|
||||
tabNewBadge.removeBadge()
|
||||
|
||||
|
||||
tagsBadge = itemsByTag.map {
|
||||
(it.key to ((tagsBadge[it.key] ?: it.value) - it.value))
|
||||
}.toMap()
|
||||
|
||||
reloadTagsBadges()
|
||||
handleDrawerItems()
|
||||
|
||||
getElementsAccordingToTab()
|
||||
} else {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package apps.amine.bou.readerforselfoss
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Build
|
||||
@ -27,6 +28,7 @@ import apps.amine.bou.readerforselfoss.persistence.migrations.MIGRATION_2_3
|
||||
import apps.amine.bou.readerforselfoss.themes.AppColors
|
||||
import apps.amine.bou.readerforselfoss.themes.Toppings
|
||||
import apps.amine.bou.readerforselfoss.transformers.DepthPageTransformer
|
||||
import apps.amine.bou.readerforselfoss.utils.Config
|
||||
import apps.amine.bou.readerforselfoss.utils.maybeHandleSilentException
|
||||
import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible
|
||||
import apps.amine.bou.readerforselfoss.utils.persistence.toEntity
|
||||
@ -94,6 +96,9 @@ class ReaderActivity : AppCompatActivity() {
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
|
||||
val settings =
|
||||
getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE)
|
||||
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
editor = prefs.edit()
|
||||
|
||||
@ -105,7 +110,7 @@ class ReaderActivity : AppCompatActivity() {
|
||||
api = SelfossApi(
|
||||
this,
|
||||
this@ReaderActivity,
|
||||
prefs.getBoolean("isSelfSignedCert", false),
|
||||
settings.getBoolean("isSelfSignedCert", false),
|
||||
prefs.getString("api_timeout", "-1").toLong(),
|
||||
prefs.getBoolean("should_log_everything", false)
|
||||
)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package apps.amine.bou.readerforselfoss
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
import android.os.Build
|
||||
@ -13,6 +14,7 @@ import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||
import apps.amine.bou.readerforselfoss.api.selfoss.Source
|
||||
import apps.amine.bou.readerforselfoss.themes.AppColors
|
||||
import apps.amine.bou.readerforselfoss.themes.Toppings
|
||||
import apps.amine.bou.readerforselfoss.utils.Config
|
||||
import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible
|
||||
import com.ftinc.scoop.Scoop
|
||||
import kotlinx.android.synthetic.main.activity_sources.*
|
||||
@ -54,12 +56,14 @@ class SourcesActivity : AppCompatActivity() {
|
||||
super.onResume()
|
||||
val mLayoutManager = LinearLayoutManager(this)
|
||||
|
||||
val settings =
|
||||
getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE)
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
|
||||
val api = SelfossApi(
|
||||
this,
|
||||
this@SourcesActivity,
|
||||
prefs.getBoolean("isSelfSignedCert", false),
|
||||
settings.getBoolean("isSelfSignedCert", false),
|
||||
prefs.getString("api_timeout", "-1").toLong(),
|
||||
prefs.getBoolean("should_log_everything", false)
|
||||
)
|
||||
|
@ -132,15 +132,17 @@ abstract class ItemsAdapter<VH : RecyclerView.ViewHolder?> : RecyclerView.Adapte
|
||||
}
|
||||
|
||||
fun handleItemAtIndex(position: Int) {
|
||||
val i = items[position]
|
||||
|
||||
if (i.unread) {
|
||||
if (unreadItemStatusAtIndex(position)) {
|
||||
readItemAtIndex(position)
|
||||
} else {
|
||||
unreadItemAtIndex(position)
|
||||
}
|
||||
}
|
||||
|
||||
fun unreadItemStatusAtIndex(position: Int): Boolean {
|
||||
return items[position].unread
|
||||
}
|
||||
|
||||
private fun readItemAtIndex(position: Int) {
|
||||
val i = items[position]
|
||||
items.remove(i)
|
||||
|
@ -12,7 +12,10 @@ import com.burgstaller.okhttp.digest.CachingAuthenticator
|
||||
import com.burgstaller.okhttp.digest.Credentials
|
||||
import com.burgstaller.okhttp.digest.DigestAuthenticator
|
||||
import com.google.gson.GsonBuilder
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import retrofit2.Call
|
||||
import retrofit2.Retrofit
|
||||
@ -62,6 +65,17 @@ class SelfossApi(
|
||||
.maybeWithSelfSigned(isWithSelfSignedCert)
|
||||
.authenticator(CachingAuthenticatorDecorator(this, authCache))
|
||||
.addInterceptor(AuthenticationCacheInterceptor(authCache))
|
||||
.addInterceptor(object: Interceptor {
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val request: Request = chain.request()
|
||||
val response: Response = chain.proceed(request)
|
||||
|
||||
if (response.code() == 408) {
|
||||
return response
|
||||
}
|
||||
return response
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
init {
|
||||
|
@ -127,7 +127,13 @@ class ArticleFragment : Fragment() {
|
||||
font = prefs.getString("reader_font", "")
|
||||
if (font.isNotEmpty()) {
|
||||
resId = context!!.resources.getIdentifier(font, "font", context!!.packageName)
|
||||
typeface = ResourcesCompat.getFont(context!!, resId)!!
|
||||
typeface = try {
|
||||
ResourcesCompat.getFont(context!!, resId)!!
|
||||
} catch (e: java.lang.Exception) {
|
||||
// ACRA.getErrorReporter().maybeHandleSilentException(Throwable("Font loading issue: ${e.message}"), context!!)
|
||||
// Just to be sure
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
refreshAlignment()
|
||||
|
@ -4,15 +4,15 @@
|
||||
<string name="app_name">"Selfoss 阅读器"</string>
|
||||
<string name="title_activity_login">"登录"</string>
|
||||
<string name="prompt_password">"密码"</string>
|
||||
<string name="prompt_http_password">"HTTP 密码"</string>
|
||||
<string name="prompt_http_password">"HTTP 密碼"</string>
|
||||
<string name="action_sign_in">"转至"</string>
|
||||
<string name="error_invalid_password">"密码不够长"</string>
|
||||
<string name="error_field_required">"必填字段"</string>
|
||||
<string name="error_field_required">"欄位必填"</string>
|
||||
<string name="prompt_url">"网址"</string>
|
||||
<string name="withLoginSwitch">"需要登录?"</string>
|
||||
<string name="withLoginSwitch">"需要登入?"</string>
|
||||
<string name="withHttpLoginSwitch">"请先登录网站"</string>
|
||||
<string name="login_url_problem">"哎呀。您可能需要在网址的末尾添加一个 \"/\"。"</string>
|
||||
<string name="prompt_login">"用户名"</string>
|
||||
<string name="prompt_login">"使用者名稱"</string>
|
||||
<string name="prompt_http_login">"HTTP 用户名"</string>
|
||||
<string name="label_share">"分享"</string>
|
||||
<string name="readAll">"全部阅读"</string>
|
||||
@ -36,7 +36,7 @@
|
||||
<string name="tab_favs">"收藏夹"</string>
|
||||
<string name="action_about">"关于我们"</string>
|
||||
<string name="marked_as_read">"已读"</string>
|
||||
<string name="marked_as_unread">"Item unread"</string>
|
||||
<string name="marked_as_unread">"未讀項目"</string>
|
||||
<string name="undo_string">"撤销"</string>
|
||||
<string name="addStringNoUrl">"登录以添加数据源。"</string>
|
||||
<string name="cant_get_sources">"无法获取数据列表。"</string>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
buildscript {
|
||||
ext {
|
||||
kotlin_version = '1.2.51'
|
||||
kotlin_version = '1.3.0'
|
||||
android_version = '1.0.0'
|
||||
lifecycle_version = '2.0.0'
|
||||
room_version = '2.1.0-alpha01'
|
||||
@ -16,7 +16,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath 'com.android.tools.build:gradle:3.3.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
||||
#Tue Sep 25 20:41:54 CEST 2018
|
||||
#Mon Jan 14 20:50:06 CET 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
|
||||
|
Reference in New Issue
Block a user