Compare commits
2 Commits
v172103081
...
imagecache
Author | SHA1 | Date | |
---|---|---|---|
9e0fdf30ec | |||
0d84a2d7e9 |
@ -36,12 +36,6 @@
|
|||||||
|
|
||||||
- Closing #178. Expending images on tap.
|
- Closing #178. Expending images on tap.
|
||||||
|
|
||||||
- Closing #323. Old issue with textview not having the right color.
|
|
||||||
|
|
||||||
- Closing #324. Svg images loading crashes the app.
|
|
||||||
|
|
||||||
- Closing #322. App crashed because of svg images.
|
|
||||||
|
|
||||||
**1.6.x**
|
**1.6.x**
|
||||||
|
|
||||||
- Handling hidden tags.
|
- Handling hidden tags.
|
||||||
@ -62,8 +56,6 @@
|
|||||||
|
|
||||||
- Fixes #215, #208.
|
- Fixes #215, #208.
|
||||||
|
|
||||||
- Fixes #328.
|
|
||||||
|
|
||||||
**1.5.7.x**
|
**1.5.7.x**
|
||||||
|
|
||||||
- Added confirmation to the mark as read and update menues.
|
- Added confirmation to the mark as read and update menues.
|
||||||
|
@ -30,6 +30,8 @@ apply plugin: 'kotlin-android'
|
|||||||
|
|
||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
|
|
||||||
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
@ -37,9 +39,6 @@ android {
|
|||||||
}
|
}
|
||||||
compileSdkVersion 30
|
compileSdkVersion 30
|
||||||
buildToolsVersion '30.0.3'
|
buildToolsVersion '30.0.3'
|
||||||
buildFeatures {
|
|
||||||
viewBinding true
|
|
||||||
}
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "apps.amine.bou.readerforselfoss"
|
applicationId "apps.amine.bou.readerforselfoss"
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
|
@ -23,11 +23,11 @@ import apps.amine.bou.readerforselfoss.themes.Toppings
|
|||||||
import apps.amine.bou.readerforselfoss.utils.Config
|
import apps.amine.bou.readerforselfoss.utils.Config
|
||||||
import apps.amine.bou.readerforselfoss.utils.isBaseUrlValid
|
import apps.amine.bou.readerforselfoss.utils.isBaseUrlValid
|
||||||
import com.ftinc.scoop.Scoop
|
import com.ftinc.scoop.Scoop
|
||||||
|
import kotlinx.android.synthetic.main.activity_add_source.*
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ActivityAddSourceBinding
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -37,53 +37,50 @@ class AddSourceActivity : AppCompatActivity() {
|
|||||||
private lateinit var api: SelfossApi
|
private lateinit var api: SelfossApi
|
||||||
|
|
||||||
private lateinit var appColors: AppColors
|
private lateinit var appColors: AppColors
|
||||||
private lateinit var binding: ActivityAddSourceBinding
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
appColors = AppColors(this@AddSourceActivity)
|
appColors = AppColors(this@AddSourceActivity)
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityAddSourceBinding.inflate(layoutInflater)
|
|
||||||
val view = binding.root
|
|
||||||
|
|
||||||
setContentView(view)
|
setContentView(R.layout.activity_add_source)
|
||||||
|
|
||||||
val scoop = Scoop.getInstance()
|
val scoop = Scoop.getInstance()
|
||||||
scoop.bind(this, Toppings.PRIMARY.value, binding.toolbar)
|
scoop.bind(this, Toppings.PRIMARY.value, toolbar)
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
val drawable = binding.nameInput.background
|
val drawable = nameInput.background
|
||||||
drawable.setColorFilter(appColors.colorAccent, PorterDuff.Mode.SRC_ATOP)
|
drawable.setColorFilter(appColors.colorAccent, PorterDuff.Mode.SRC_ATOP)
|
||||||
|
|
||||||
|
|
||||||
// TODO: clean
|
// TODO: clean
|
||||||
if(Build.VERSION.SDK_INT > 16) {
|
if(Build.VERSION.SDK_INT > 16) {
|
||||||
binding.nameInput.background = drawable
|
nameInput.background = drawable
|
||||||
} else{
|
} else{
|
||||||
binding.nameInput.setBackgroundDrawable(drawable)
|
nameInput.setBackgroundDrawable(drawable)
|
||||||
}
|
}
|
||||||
|
|
||||||
val drawable1 = binding.sourceUri.background
|
val drawable1 = sourceUri.background
|
||||||
drawable1.setColorFilter(appColors.colorAccent, PorterDuff.Mode.SRC_ATOP)
|
drawable1.setColorFilter(appColors.colorAccent, PorterDuff.Mode.SRC_ATOP)
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT > 16) {
|
if(Build.VERSION.SDK_INT > 16) {
|
||||||
binding.sourceUri.background = drawable1
|
sourceUri.background = drawable1
|
||||||
} else{
|
} else{
|
||||||
binding.sourceUri.setBackgroundDrawable(drawable1)
|
sourceUri.setBackgroundDrawable(drawable1)
|
||||||
}
|
}
|
||||||
|
|
||||||
val drawable2 = binding.tags.background
|
val drawable2 = tags.background
|
||||||
drawable2.setColorFilter(appColors.colorAccent, PorterDuff.Mode.SRC_ATOP)
|
drawable2.setColorFilter(appColors.colorAccent, PorterDuff.Mode.SRC_ATOP)
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT > 16) {
|
if(Build.VERSION.SDK_INT > 16) {
|
||||||
binding.tags.background = drawable2
|
tags.background = drawable2
|
||||||
} else{
|
} else{
|
||||||
binding.tags.setBackgroundDrawable(drawable2)
|
tags.setBackgroundDrawable(drawable2)
|
||||||
}
|
}
|
||||||
|
|
||||||
setSupportActionBar(binding.toolbar)
|
setSupportActionBar(toolbar)
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||||
|
|
||||||
@ -101,12 +98,12 @@ class AddSourceActivity : AppCompatActivity() {
|
|||||||
mustLoginToAddSource()
|
mustLoginToAddSource()
|
||||||
}
|
}
|
||||||
|
|
||||||
maybeGetDetailsFromIntentSharing(intent, binding.sourceUri, binding.nameInput)
|
maybeGetDetailsFromIntentSharing(intent, sourceUri, nameInput)
|
||||||
|
|
||||||
binding.saveBtn.setTextColor(appColors.colorAccent)
|
saveBtn.setTextColor(appColors.colorAccent)
|
||||||
|
|
||||||
binding.saveBtn.setOnClickListener {
|
saveBtn.setOnClickListener {
|
||||||
handleSaveSource(binding.tags, binding.nameInput.text.toString(), binding.sourceUri.text.toString(), api)
|
handleSaveSource(tags, nameInput.text.toString(), sourceUri.text.toString(), api!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +114,7 @@ class AddSourceActivity : AppCompatActivity() {
|
|||||||
if (config.baseUrl.isEmpty() || !config.baseUrl.isBaseUrlValid(this@AddSourceActivity)) {
|
if (config.baseUrl.isEmpty() || !config.baseUrl.isBaseUrlValid(this@AddSourceActivity)) {
|
||||||
mustLoginToAddSource()
|
mustLoginToAddSource()
|
||||||
} else {
|
} else {
|
||||||
handleSpoutsSpinner(binding.spoutsSpinner, api, binding.progress, binding.formContainer)
|
handleSpoutsSpinner(spoutsSpinner, api, progress, formContainer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ import apps.amine.bou.readerforselfoss.adapters.ItemListAdapter
|
|||||||
import apps.amine.bou.readerforselfoss.adapters.ItemsAdapter
|
import apps.amine.bou.readerforselfoss.adapters.ItemsAdapter
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.*
|
import apps.amine.bou.readerforselfoss.api.selfoss.*
|
||||||
import apps.amine.bou.readerforselfoss.background.LoadingWorker
|
import apps.amine.bou.readerforselfoss.background.LoadingWorker
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ActivityHomeBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.persistence.database.AppDatabase
|
import apps.amine.bou.readerforselfoss.persistence.database.AppDatabase
|
||||||
import apps.amine.bou.readerforselfoss.persistence.entities.ActionEntity
|
import apps.amine.bou.readerforselfoss.persistence.entities.ActionEntity
|
||||||
import apps.amine.bou.readerforselfoss.persistence.migrations.MIGRATION_1_2
|
import apps.amine.bou.readerforselfoss.persistence.migrations.MIGRATION_1_2
|
||||||
@ -65,10 +64,10 @@ import com.mikepenz.materialdrawer.holder.StringHolder
|
|||||||
import com.mikepenz.materialdrawer.model.DividerDrawerItem
|
import com.mikepenz.materialdrawer.model.DividerDrawerItem
|
||||||
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem
|
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem
|
||||||
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem
|
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem
|
||||||
|
import kotlinx.android.synthetic.main.activity_home.*
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlin.concurrent.thread
|
import kotlin.concurrent.thread
|
||||||
|
|
||||||
@ -102,9 +101,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
private var infiniteScroll: Boolean = false
|
private var infiniteScroll: Boolean = false
|
||||||
private var lastFetchDone: Boolean = false
|
private var lastFetchDone: Boolean = false
|
||||||
private var itemsCaching: Boolean = false
|
private var itemsCaching: Boolean = false
|
||||||
private var updateSources: Boolean = true
|
|
||||||
private var hiddenTags: List<String> = emptyList()
|
private var hiddenTags: List<String> = emptyList()
|
||||||
private var apiVersionMajor: Int = 0
|
|
||||||
|
|
||||||
private var periodicRefresh = false
|
private var periodicRefresh = false
|
||||||
private var refreshMinutes: Long = 360L
|
private var refreshMinutes: Long = 360L
|
||||||
@ -123,7 +120,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
private var firstVisible: Int = 0
|
private var firstVisible: Int = 0
|
||||||
private lateinit var recyclerViewScrollListener: RecyclerView.OnScrollListener
|
private lateinit var recyclerViewScrollListener: RecyclerView.OnScrollListener
|
||||||
private lateinit var settings: SharedPreferences
|
private lateinit var settings: SharedPreferences
|
||||||
private lateinit var binding: ActivityHomeBinding
|
|
||||||
|
|
||||||
private var recyclerAdapter: RecyclerView.Adapter<*>? = null
|
private var recyclerAdapter: RecyclerView.Adapter<*>? = null
|
||||||
|
|
||||||
@ -152,8 +148,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
config = Config(this@HomeActivity)
|
config = Config(this@HomeActivity)
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityHomeBinding.inflate(layoutInflater)
|
|
||||||
val view = binding.root
|
|
||||||
|
|
||||||
fromTabShortcut = intent.getIntExtra("shortcutTab", -1) != -1
|
fromTabShortcut = intent.getIntExtra("shortcutTab", -1) != -1
|
||||||
offlineShortcut = intent.getBooleanExtra("startOffline", false)
|
offlineShortcut = intent.getBooleanExtra("startOffline", false)
|
||||||
@ -162,11 +156,11 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
elementsShown = intent.getIntExtra("shortcutTab", UNREAD_SHOWN)
|
elementsShown = intent.getIntExtra("shortcutTab", UNREAD_SHOWN)
|
||||||
}
|
}
|
||||||
|
|
||||||
setContentView(view)
|
setContentView(R.layout.activity_home)
|
||||||
|
|
||||||
handleThemeBinding()
|
handleThemeBinding()
|
||||||
|
|
||||||
setSupportActionBar(binding.toolBar)
|
setSupportActionBar(toolBar)
|
||||||
|
|
||||||
db = Room.databaseBuilder(
|
db = Room.databaseBuilder(
|
||||||
applicationContext,
|
applicationContext,
|
||||||
@ -192,21 +186,15 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
handleDrawer()
|
handleDrawer()
|
||||||
|
|
||||||
handleSwipeRefreshLayout()
|
handleSwipeRefreshLayout()
|
||||||
|
|
||||||
handleSharedPrefs()
|
|
||||||
|
|
||||||
getApiMajorVersion()
|
|
||||||
|
|
||||||
getElementsAccordingToTab()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleSwipeRefreshLayout() {
|
private fun handleSwipeRefreshLayout() {
|
||||||
binding.swipeRefreshLayout.setColorSchemeResources(
|
swipeRefreshLayout.setColorSchemeResources(
|
||||||
R.color.refresh_progress_1,
|
R.color.refresh_progress_1,
|
||||||
R.color.refresh_progress_2,
|
R.color.refresh_progress_2,
|
||||||
R.color.refresh_progress_3
|
R.color.refresh_progress_3
|
||||||
)
|
)
|
||||||
binding.swipeRefreshLayout.setOnRefreshListener {
|
swipeRefreshLayout.setOnRefreshListener {
|
||||||
offlineShortcut = false
|
offlineShortcut = false
|
||||||
allItems = ArrayList()
|
allItems = ArrayList()
|
||||||
lastFetchDone = false
|
lastFetchDone = false
|
||||||
@ -243,7 +231,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
val i = items.elementAtOrNull(position)
|
val i = items.elementAtOrNull(position)
|
||||||
|
|
||||||
if (i != null) {
|
if (i != null) {
|
||||||
val adapter = binding.recyclerView.adapter as ItemsAdapter<*>
|
val adapter = recyclerView.adapter as ItemsAdapter<*>
|
||||||
|
|
||||||
val wasItemUnread = adapter.unreadItemStatusAtIndex(position)
|
val wasItemUnread = adapter.unreadItemStatusAtIndex(position)
|
||||||
|
|
||||||
@ -281,7 +269,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemTouchHelper(simpleItemTouchCallback).attachToRecyclerView(binding.recyclerView)
|
ItemTouchHelper(simpleItemTouchCallback).attachToRecyclerView(recyclerView)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleBottomBar() {
|
private fun handleBottomBar() {
|
||||||
@ -318,42 +306,21 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
).setActiveColorResource(R.color.pink)
|
).setActiveColorResource(R.color.pink)
|
||||||
.setBadgeItem(tabStarredBadge)
|
.setBadgeItem(tabStarredBadge)
|
||||||
|
|
||||||
binding.bottomBar
|
bottomBar
|
||||||
.addItem(tabNew)
|
.addItem(tabNew)
|
||||||
.addItem(tabArchive)
|
.addItem(tabArchive)
|
||||||
.addItem(tabStarred)
|
.addItem(tabStarred)
|
||||||
.setFirstSelectedPosition(0)
|
.setFirstSelectedPosition(0)
|
||||||
.initialise()
|
.initialise()
|
||||||
binding.bottomBar.setMode(BottomNavigationBar.MODE_SHIFTING)
|
|
||||||
binding.bottomBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC)
|
bottomBar.setMode(BottomNavigationBar.MODE_SHIFTING)
|
||||||
|
bottomBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC)
|
||||||
|
|
||||||
if (fromTabShortcut) {
|
if (fromTabShortcut) {
|
||||||
binding.bottomBar.selectTab(elementsShown - 1)
|
bottomBar.selectTab(elementsShown - 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getApiMajorVersion() {
|
|
||||||
api.apiVersion.enqueue(object : Callback<ApiVersion> {
|
|
||||||
override fun onFailure(call: Call<ApiVersion>, t: Throwable) {
|
|
||||||
if (apiVersionMajor >= 4) {
|
|
||||||
Config.dateTimeFormatter = "yyyy-MM-dd'T'HH:mm:ssXXX"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResponse(call: Call<ApiVersion>, response: Response<ApiVersion>) {
|
|
||||||
if(response.body() != null) {
|
|
||||||
val version = response.body() as ApiVersion
|
|
||||||
apiVersionMajor = version.getApiMajorVersion()
|
|
||||||
sharedPref.edit().putInt("apiVersionMajor", apiVersionMajor).commit()
|
|
||||||
|
|
||||||
if (apiVersionMajor >= 4) {
|
|
||||||
Config.dateTimeFormatter = "yyyy-MM-dd'T'HH:mm:ssXXX"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
@ -364,6 +331,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
|
|
||||||
editor = settings.edit()
|
editor = settings.edit()
|
||||||
|
|
||||||
|
handleSharedPrefs()
|
||||||
|
|
||||||
handleDrawerItems()
|
handleDrawerItems()
|
||||||
|
|
||||||
handleThemeUpdate()
|
handleThemeUpdate()
|
||||||
@ -371,20 +340,22 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
reloadLayoutManager()
|
reloadLayoutManager()
|
||||||
|
|
||||||
if (!infiniteScroll) {
|
if (!infiniteScroll) {
|
||||||
binding.recyclerView.setHasFixedSize(true)
|
recyclerView.setHasFixedSize(true)
|
||||||
} else {
|
} else {
|
||||||
handleInfiniteScroll()
|
handleInfiniteScroll()
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBottomBarActions()
|
handleBottomBarActions()
|
||||||
|
|
||||||
|
getElementsAccordingToTab()
|
||||||
|
|
||||||
handleRecurringTask()
|
handleRecurringTask()
|
||||||
|
|
||||||
handleOfflineActions()
|
handleOfflineActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getAndStoreAllItems() {
|
private fun getAndStoreAllItems() {
|
||||||
api.allNewItems().enqueue(object : Callback<List<Item>> {
|
api.allItems().enqueue(object : Callback<List<Item>> {
|
||||||
override fun onFailure(call: Call<List<Item>>, t: Throwable) {
|
override fun onFailure(call: Call<List<Item>>, t: Throwable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,48 +363,18 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
call: Call<List<Item>>,
|
call: Call<List<Item>>,
|
||||||
response: Response<List<Item>>
|
response: Response<List<Item>>
|
||||||
) {
|
) {
|
||||||
enqueueArticles(response, true)
|
thread {
|
||||||
}
|
if (response.body() != null) {
|
||||||
})
|
val apiItems = (response.body() as ArrayList<Item>).filter {
|
||||||
|
maybeTagFilter != null || filter(it.tags.tags)
|
||||||
api.allReadItems().enqueue(object : Callback<List<Item>> {
|
} as ArrayList<Item>
|
||||||
override fun onFailure(call: Call<List<Item>>, t: Throwable) {
|
db.itemsDao().deleteAllItems()
|
||||||
}
|
db.itemsDao()
|
||||||
|
.insertAllItems(*(apiItems.map { it.toEntity() }).toTypedArray())
|
||||||
override fun onResponse(
|
}
|
||||||
call: Call<List<Item>>,
|
|
||||||
response: Response<List<Item>>
|
|
||||||
) {
|
|
||||||
enqueueArticles(response, false)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
api.allStarredItems().enqueue(object : Callback<List<Item>> {
|
|
||||||
override fun onFailure(call: Call<List<Item>>, t: Throwable) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResponse(
|
|
||||||
call: Call<List<Item>>,
|
|
||||||
response: Response<List<Item>>
|
|
||||||
) {
|
|
||||||
enqueueArticles(response, false)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun enqueueArticles(response: Response<List<Item>>, clearDatabase: Boolean) {
|
|
||||||
thread {
|
|
||||||
if (response.body() != null) {
|
|
||||||
val apiItems = (response.body() as ArrayList<Item>).filter {
|
|
||||||
maybeTagFilter != null || filter(it.tags.tags)
|
|
||||||
} as ArrayList<Item>
|
|
||||||
if (clearDatabase) {
|
|
||||||
db.itemsDao().deleteAllItems()
|
|
||||||
}
|
}
|
||||||
db.itemsDao()
|
|
||||||
.insertAllItems(*(apiItems.map { it.toEntity() }).toTypedArray())
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
@ -453,7 +394,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
displayAccountHeader = sharedPref.getBoolean("account_header_displaying", false)
|
displayAccountHeader = sharedPref.getBoolean("account_header_displaying", false)
|
||||||
infiniteScroll = sharedPref.getBoolean("infinite_loading", false)
|
infiniteScroll = sharedPref.getBoolean("infinite_loading", false)
|
||||||
itemsCaching = sharedPref.getBoolean("items_caching", false)
|
itemsCaching = sharedPref.getBoolean("items_caching", false)
|
||||||
updateSources = sharedPref.getBoolean("update_sources", true)
|
|
||||||
hiddenTags = if (sharedPref.getString("hidden_tags", "")!!.isNotEmpty()) {
|
hiddenTags = if (sharedPref.getString("hidden_tags", "")!!.isNotEmpty()) {
|
||||||
sharedPref.getString("hidden_tags", "")!!.replace("\\s".toRegex(), "").split(",")
|
sharedPref.getString("hidden_tags", "")!!.replace("\\s".toRegex(), "").split(",")
|
||||||
} else {
|
} else {
|
||||||
@ -466,13 +406,11 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
if (refreshMinutes <= 15) {
|
if (refreshMinutes <= 15) {
|
||||||
refreshMinutes = 15
|
refreshMinutes = 15
|
||||||
}
|
}
|
||||||
|
|
||||||
apiVersionMajor = sharedPref.getInt("apiVersionMajor", 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleThemeBinding() {
|
private fun handleThemeBinding() {
|
||||||
val scoop = Scoop.getInstance()
|
val scoop = Scoop.getInstance()
|
||||||
scoop.bind(this, Toppings.PRIMARY.value, binding.toolBar)
|
scoop.bind(this, Toppings.PRIMARY.value, toolBar)
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
||||||
}
|
}
|
||||||
@ -495,18 +433,18 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
|
|
||||||
drawer = drawer {
|
drawer = drawer {
|
||||||
rootViewRes = R.id.drawer_layout
|
rootViewRes = R.id.drawer_layout
|
||||||
toolbar = binding.toolBar
|
toolbar = toolBar
|
||||||
actionBarDrawerToggleEnabled = true
|
actionBarDrawerToggleEnabled = true
|
||||||
actionBarDrawerToggleAnimated = true
|
actionBarDrawerToggleAnimated = true
|
||||||
showOnFirstLaunch = true
|
showOnFirstLaunch = true
|
||||||
onSlide { _, p1 ->
|
onSlide { _, p1 ->
|
||||||
binding.bottomBar.alpha = (1 - p1)
|
bottomBar.alpha = (1 - p1)
|
||||||
}
|
}
|
||||||
onClosed {
|
onClosed {
|
||||||
binding.bottomBar.show()
|
bottomBar.show()
|
||||||
}
|
}
|
||||||
onOpened {
|
onOpened {
|
||||||
binding.bottomBar.hide()
|
bottomBar.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displayAccountHeader) {
|
if (displayAccountHeader) {
|
||||||
@ -758,7 +696,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
if (maybeDrawerData.tags != null) {
|
if (maybeDrawerData.tags != null) {
|
||||||
thread {
|
thread {
|
||||||
val tagEntities = maybeDrawerData.tags.map { it.toEntity() }
|
val tagEntities = maybeDrawerData.tags.map { it.toEntity() }
|
||||||
db.drawerDataDao().deleteAllTags()
|
|
||||||
db.drawerDataDao().insertAllTags(*tagEntities.toTypedArray())
|
db.drawerDataDao().insertAllTags(*tagEntities.toTypedArray())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -766,7 +703,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
thread {
|
thread {
|
||||||
val sourceEntities =
|
val sourceEntities =
|
||||||
maybeDrawerData.sources.map { it.toEntity() }
|
maybeDrawerData.sources.map { it.toEntity() }
|
||||||
db.drawerDataDao().deleteAllSources()
|
|
||||||
db.drawerDataDao().insertAllSources(*sourceEntities.toTypedArray())
|
db.drawerDataDao().insertAllSources(*sourceEntities.toTypedArray())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -794,7 +730,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
var sources: List<Source>?
|
var sources: List<Source>?
|
||||||
|
|
||||||
fun sourcesApiCall() {
|
fun sourcesApiCall() {
|
||||||
if (this@HomeActivity.isNetworkAccessible(null, offlineShortcut) && updateSources) {
|
if (this@HomeActivity.isNetworkAccessible(null, offlineShortcut)) {
|
||||||
api.sources.enqueue(object : Callback<List<Source>> {
|
api.sources.enqueue(object : Callback<List<Source>> {
|
||||||
override fun onResponse(
|
override fun onResponse(
|
||||||
call: Call<List<Source>>?,
|
call: Call<List<Source>>?,
|
||||||
@ -817,7 +753,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this@HomeActivity.isNetworkAccessible(null, offlineShortcut) && updateSources) {
|
if (this@HomeActivity.isNetworkAccessible(null, offlineShortcut)) {
|
||||||
api.tags.enqueue(object : Callback<List<Tag>> {
|
api.tags.enqueue(object : Callback<List<Tag>> {
|
||||||
override fun onResponse(
|
override fun onResponse(
|
||||||
call: Call<List<Tag>>,
|
call: Call<List<Tag>>,
|
||||||
@ -851,7 +787,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun reloadLayoutManager() {
|
private fun reloadLayoutManager() {
|
||||||
val currentManager = binding.recyclerView.layoutManager
|
val currentManager = recyclerView.layoutManager
|
||||||
val layoutManager: RecyclerView.LayoutManager
|
val layoutManager: RecyclerView.LayoutManager
|
||||||
|
|
||||||
// This will only update the layout manager if settings changed
|
// This will only update the layout manager if settings changed
|
||||||
@ -862,7 +798,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
this,
|
this,
|
||||||
calculateNoOfColumns()
|
calculateNoOfColumns()
|
||||||
)
|
)
|
||||||
binding.recyclerView.layoutManager = layoutManager
|
recyclerView.layoutManager = layoutManager
|
||||||
}
|
}
|
||||||
is GridLayoutManager ->
|
is GridLayoutManager ->
|
||||||
if (shouldBeCardView) {
|
if (shouldBeCardView) {
|
||||||
@ -872,7 +808,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
)
|
)
|
||||||
layoutManager.gapStrategy =
|
layoutManager.gapStrategy =
|
||||||
StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
|
StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
|
||||||
binding.recyclerView.layoutManager = layoutManager
|
recyclerView.layoutManager = layoutManager
|
||||||
}
|
}
|
||||||
else ->
|
else ->
|
||||||
if (currentManager == null) {
|
if (currentManager == null) {
|
||||||
@ -881,7 +817,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
this,
|
this,
|
||||||
calculateNoOfColumns()
|
calculateNoOfColumns()
|
||||||
)
|
)
|
||||||
binding.recyclerView.layoutManager = layoutManager
|
recyclerView.layoutManager = layoutManager
|
||||||
} else {
|
} else {
|
||||||
layoutManager = StaggeredGridLayoutManager(
|
layoutManager = StaggeredGridLayoutManager(
|
||||||
calculateNoOfColumns(),
|
calculateNoOfColumns(),
|
||||||
@ -889,7 +825,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
)
|
)
|
||||||
layoutManager.gapStrategy =
|
layoutManager.gapStrategy =
|
||||||
StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
|
StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
|
||||||
binding.recyclerView.layoutManager = layoutManager
|
recyclerView.layoutManager = layoutManager
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
@ -897,11 +833,11 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun handleBottomBarActions() {
|
private fun handleBottomBarActions() {
|
||||||
binding.bottomBar.setTabSelectedListener(object : BottomNavigationBar.OnTabSelectedListener {
|
bottomBar.setTabSelectedListener(object : BottomNavigationBar.OnTabSelectedListener {
|
||||||
override fun onTabUnselected(position: Int) = Unit
|
override fun onTabUnselected(position: Int) = Unit
|
||||||
|
|
||||||
override fun onTabReselected(position: Int) {
|
override fun onTabReselected(position: Int) {
|
||||||
val layoutManager = binding.recyclerView.adapter
|
val layoutManager = recyclerView.adapter
|
||||||
|
|
||||||
when (layoutManager) {
|
when (layoutManager) {
|
||||||
is StaggeredGridLayoutManager ->
|
is StaggeredGridLayoutManager ->
|
||||||
@ -926,14 +862,12 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
|
|
||||||
if (itemsCaching) {
|
if (itemsCaching) {
|
||||||
|
|
||||||
if (!binding.swipeRefreshLayout.isRefreshing) {
|
if (!swipeRefreshLayout.isRefreshing) {
|
||||||
binding.swipeRefreshLayout.post { binding.swipeRefreshLayout.isRefreshing = true }
|
swipeRefreshLayout.post { swipeRefreshLayout.isRefreshing = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
thread {
|
thread {
|
||||||
val dbItems = db.itemsDao().items().map { it.toView() }.sortedByDescending {
|
val dbItems = db.itemsDao().items().map { it.toView() }
|
||||||
SimpleDateFormat(Config.dateTimeFormatter).parse(it.datetime)
|
|
||||||
}
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (dbItems.isNotEmpty()) {
|
if (dbItems.isNotEmpty()) {
|
||||||
items = when (position) {
|
items = when (position) {
|
||||||
@ -979,7 +913,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
recyclerViewScrollListener = object : RecyclerView.OnScrollListener() {
|
recyclerViewScrollListener = object : RecyclerView.OnScrollListener() {
|
||||||
override fun onScrolled(localRecycler: RecyclerView, dx: Int, dy: Int) {
|
override fun onScrolled(localRecycler: RecyclerView, dx: Int, dy: Int) {
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
val manager = binding.recyclerView.layoutManager
|
val manager = recyclerView.layoutManager
|
||||||
val lastVisibleItem: Int = when (manager) {
|
val lastVisibleItem: Int = when (manager) {
|
||||||
is StaggeredGridLayoutManager -> manager.findLastCompletelyVisibleItemPositions(
|
is StaggeredGridLayoutManager -> manager.findLastCompletelyVisibleItemPositions(
|
||||||
null
|
null
|
||||||
@ -995,17 +929,17 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.recyclerView.clearOnScrollListeners()
|
recyclerView.clearOnScrollListeners()
|
||||||
binding.recyclerView.addOnScrollListener(recyclerViewScrollListener)
|
recyclerView.addOnScrollListener(recyclerViewScrollListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mayBeEmpty() =
|
private fun mayBeEmpty() =
|
||||||
if (items.isEmpty()) {
|
if (items.isEmpty()) {
|
||||||
binding.emptyText.visibility = View.VISIBLE
|
emptyText.visibility = View.VISIBLE
|
||||||
binding.recyclerView.visibility = View.GONE
|
recyclerView.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
binding.emptyText.visibility = View.GONE
|
emptyText.visibility = View.GONE
|
||||||
binding.recyclerView.visibility = View.VISIBLE
|
recyclerView.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getElementsAccordingToTab(
|
private fun getElementsAccordingToTab(
|
||||||
@ -1030,14 +964,12 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
|
|
||||||
if (itemsCaching) {
|
if (itemsCaching) {
|
||||||
|
|
||||||
if (!binding.swipeRefreshLayout.isRefreshing) {
|
if (!swipeRefreshLayout.isRefreshing) {
|
||||||
binding.swipeRefreshLayout.post { binding.swipeRefreshLayout.isRefreshing = true }
|
swipeRefreshLayout.post { swipeRefreshLayout.isRefreshing = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
thread {
|
thread {
|
||||||
val dbItems = db.itemsDao().items().map { it.toView() }.sortedByDescending {
|
val dbItems = db.itemsDao().items().map { it.toView() }
|
||||||
SimpleDateFormat(Config.dateTimeFormatter).parse(it.datetime)
|
|
||||||
}
|
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (dbItems.isNotEmpty()) {
|
if (dbItems.isNotEmpty()) {
|
||||||
items = when (elementsShown) {
|
items = when (elementsShown) {
|
||||||
@ -1101,11 +1033,11 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
handleListResult(appendResults)
|
handleListResult(appendResults)
|
||||||
|
|
||||||
if (!appendResults) mayBeEmpty()
|
if (!appendResults) mayBeEmpty()
|
||||||
binding.swipeRefreshLayout.isRefreshing = false
|
swipeRefreshLayout.isRefreshing = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!binding.swipeRefreshLayout.isRefreshing) {
|
if (!swipeRefreshLayout.isRefreshing) {
|
||||||
binding.swipeRefreshLayout.post { binding.swipeRefreshLayout.isRefreshing = true }
|
swipeRefreshLayout.post { swipeRefreshLayout.isRefreshing = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this@HomeActivity.isNetworkAccessible(this@HomeActivity.findViewById(R.id.coordLayout), offlineShortcut)) {
|
if (this@HomeActivity.isNetworkAccessible(this@HomeActivity.findViewById(R.id.coordLayout), offlineShortcut)) {
|
||||||
@ -1119,7 +1051,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(call: Call<List<Item>>, t: Throwable) {
|
override fun onFailure(call: Call<List<Item>>, t: Throwable) {
|
||||||
binding.swipeRefreshLayout.isRefreshing = false
|
swipeRefreshLayout.isRefreshing = false
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
this@HomeActivity,
|
this@HomeActivity,
|
||||||
toastMessage,
|
toastMessage,
|
||||||
@ -1128,7 +1060,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
binding.swipeRefreshLayout.post { binding.swipeRefreshLayout.isRefreshing = false }
|
swipeRefreshLayout.post { swipeRefreshLayout.isRefreshing = false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1173,7 +1105,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
|
|
||||||
private fun handleListResult(appendResults: Boolean = false) {
|
private fun handleListResult(appendResults: Boolean = false) {
|
||||||
if (appendResults) {
|
if (appendResults) {
|
||||||
val oldManager = binding.recyclerView.layoutManager
|
val oldManager = recyclerView.layoutManager
|
||||||
firstVisible = when (oldManager) {
|
firstVisible = when (oldManager) {
|
||||||
is StaggeredGridLayoutManager ->
|
is StaggeredGridLayoutManager ->
|
||||||
oldManager.findFirstCompletelyVisibleItemPositions(null).last()
|
oldManager.findFirstCompletelyVisibleItemPositions(null).last()
|
||||||
@ -1218,14 +1150,14 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
updateItems(it)
|
updateItems(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.recyclerView.addItemDecoration(
|
recyclerView.addItemDecoration(
|
||||||
DividerItemDecoration(
|
DividerItemDecoration(
|
||||||
this@HomeActivity,
|
this@HomeActivity,
|
||||||
DividerItemDecoration.VERTICAL
|
DividerItemDecoration.VERTICAL
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
binding.recyclerView.adapter = recyclerAdapter
|
recyclerView.adapter = recyclerAdapter
|
||||||
} else {
|
} else {
|
||||||
if (!appendResults) {
|
if (!appendResults) {
|
||||||
(recyclerAdapter as ItemsAdapter<*>).updateAllItems(items)
|
(recyclerAdapter as ItemsAdapter<*>).updateAllItems(items)
|
||||||
@ -1376,7 +1308,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
R.id.readAll -> {
|
R.id.readAll -> {
|
||||||
if (elementsShown == UNREAD_SHOWN) {
|
if (elementsShown == UNREAD_SHOWN) {
|
||||||
needsConfirmation(R.string.readAll, R.string.markall_dialog_message) {
|
needsConfirmation(R.string.readAll, R.string.markall_dialog_message) {
|
||||||
binding.swipeRefreshLayout.isRefreshing = false
|
swipeRefreshLayout.isRefreshing = false
|
||||||
val ids = allItems.map { it.id }
|
val ids = allItems.map { it.id }
|
||||||
val itemsByTag: Map<Long, Int> =
|
val itemsByTag: Map<Long, Int> =
|
||||||
allItems.flattenTags()
|
allItems.flattenTags()
|
||||||
@ -1411,7 +1343,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.swipeRefreshLayout.isRefreshing = false
|
swipeRefreshLayout.isRefreshing = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(call: Call<SuccessResponse>, t: Throwable) {
|
override fun onFailure(call: Call<SuccessResponse>, t: Throwable) {
|
||||||
@ -1420,7 +1352,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
R.string.all_posts_not_read,
|
R.string.all_posts_not_read,
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
binding.swipeRefreshLayout.isRefreshing = false
|
swipeRefreshLayout.isRefreshing = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
items = ArrayList()
|
items = ArrayList()
|
||||||
|
@ -5,31 +5,27 @@ import android.view.MenuItem
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter
|
import androidx.fragment.app.FragmentStatePagerAdapter
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ActivityImageBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.fragments.ImageFragment
|
import apps.amine.bou.readerforselfoss.fragments.ImageFragment
|
||||||
|
import kotlinx.android.synthetic.main.activity_reader.*
|
||||||
|
|
||||||
class ImageActivity : AppCompatActivity() {
|
class ImageActivity : AppCompatActivity() {
|
||||||
private lateinit var allImages : ArrayList<String>
|
private lateinit var allImages : ArrayList<String>
|
||||||
private var position : Int = 0
|
private var position : Int = 0
|
||||||
|
|
||||||
private lateinit var binding: ActivityImageBinding
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityImageBinding.inflate(layoutInflater)
|
|
||||||
val view = binding.root
|
|
||||||
|
|
||||||
setContentView(view)
|
setContentView(R.layout.activity_image)
|
||||||
|
|
||||||
setSupportActionBar(binding.toolBar)
|
setSupportActionBar(toolBar)
|
||||||
supportActionBar?.setDisplayShowTitleEnabled(false)
|
supportActionBar?.setDisplayShowTitleEnabled(false)
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
|
||||||
allImages = intent.getStringArrayListExtra("allImages") as ArrayList<String>
|
allImages = intent.getStringArrayListExtra("allImages") as ArrayList<String>
|
||||||
position = intent.getIntExtra("position", 0)
|
position = intent.getIntExtra("position", 0)
|
||||||
|
|
||||||
binding.pager.adapter = ScreenSlidePagerAdapter(supportFragmentManager)
|
pager.adapter = ScreenSlidePagerAdapter(supportFragmentManager)
|
||||||
binding.pager.currentItem = position
|
pager.currentItem = position
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
|
@ -17,13 +17,13 @@ import android.widget.TextView
|
|||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ActivityLoginBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.themes.AppColors
|
import apps.amine.bou.readerforselfoss.themes.AppColors
|
||||||
import apps.amine.bou.readerforselfoss.utils.Config
|
import apps.amine.bou.readerforselfoss.utils.Config
|
||||||
import apps.amine.bou.readerforselfoss.utils.isBaseUrlValid
|
import apps.amine.bou.readerforselfoss.utils.isBaseUrlValid
|
||||||
import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible
|
import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible
|
||||||
import com.mikepenz.aboutlibraries.Libs
|
import com.mikepenz.aboutlibraries.Libs
|
||||||
import com.mikepenz.aboutlibraries.LibsBuilder
|
import com.mikepenz.aboutlibraries.LibsBuilder
|
||||||
|
import kotlinx.android.synthetic.main.activity_login.*
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
@ -39,18 +39,15 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
private lateinit var editor: SharedPreferences.Editor
|
private lateinit var editor: SharedPreferences.Editor
|
||||||
private lateinit var userIdentifier: String
|
private lateinit var userIdentifier: String
|
||||||
private lateinit var appColors: AppColors
|
private lateinit var appColors: AppColors
|
||||||
private lateinit var binding: ActivityLoginBinding
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
appColors = AppColors(this@LoginActivity)
|
appColors = AppColors(this@LoginActivity)
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityLoginBinding.inflate(layoutInflater)
|
|
||||||
val view = binding.root
|
|
||||||
|
|
||||||
setContentView(view)
|
setContentView(R.layout.activity_login)
|
||||||
|
|
||||||
setSupportActionBar(binding.toolbar)
|
setSupportActionBar(toolbar)
|
||||||
|
|
||||||
handleBaseUrlFail()
|
handleBaseUrlFail()
|
||||||
|
|
||||||
@ -68,14 +65,14 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun handleActions() {
|
private fun handleActions() {
|
||||||
|
|
||||||
binding.withSelfhostedCert.setOnCheckedChangeListener { _, b ->
|
withSelfhostedCert.setOnCheckedChangeListener { _, b ->
|
||||||
isWithSelfSignedCert = !isWithSelfSignedCert
|
isWithSelfSignedCert = !isWithSelfSignedCert
|
||||||
val visi: Int = if (b) View.VISIBLE else View.GONE
|
val visi: Int = if (b) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
binding.warningText.visibility = visi
|
warningText.visibility = visi
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.passwordView.setOnEditorActionListener(
|
passwordView.setOnEditorActionListener(
|
||||||
TextView.OnEditorActionListener { _, id, _ ->
|
TextView.OnEditorActionListener { _, id, _ ->
|
||||||
if (id == R.id.loginView || id == EditorInfo.IME_NULL) {
|
if (id == R.id.loginView || id == EditorInfo.IME_NULL) {
|
||||||
attemptLogin()
|
attemptLogin()
|
||||||
@ -85,22 +82,22 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.signInButton.setOnClickListener { attemptLogin() }
|
signInButton.setOnClickListener { attemptLogin() }
|
||||||
|
|
||||||
binding.withLogin.setOnCheckedChangeListener { _, b ->
|
withLogin.setOnCheckedChangeListener { _, b ->
|
||||||
isWithLogin = !isWithLogin
|
isWithLogin = !isWithLogin
|
||||||
val visi: Int = if (b) View.VISIBLE else View.GONE
|
val visi: Int = if (b) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
binding.loginLayout.visibility = visi
|
loginLayout.visibility = visi
|
||||||
binding.passwordLayout.visibility = visi
|
passwordLayout.visibility = visi
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.withHttpLogin.setOnCheckedChangeListener { _, b ->
|
withHttpLogin.setOnCheckedChangeListener { _, b ->
|
||||||
isWithHTTPLogin = !isWithHTTPLogin
|
isWithHTTPLogin = !isWithHTTPLogin
|
||||||
val visi: Int = if (b) View.VISIBLE else View.GONE
|
val visi: Int = if (b) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
binding.httpLoginInput.visibility = visi
|
httpLoginInput.visibility = visi
|
||||||
binding.httpPasswordInput.visibility = visi
|
httpPasswordInput.visibility = visi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,25 +124,25 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
private fun attemptLogin() {
|
private fun attemptLogin() {
|
||||||
|
|
||||||
// Reset errors.
|
// Reset errors.
|
||||||
binding.urlView.error = null
|
urlView.error = null
|
||||||
binding.loginView.error = null
|
loginView.error = null
|
||||||
binding.httpLoginView.error = null
|
httpLoginView.error = null
|
||||||
binding.passwordView.error = null
|
passwordView.error = null
|
||||||
binding.httpPasswordView.error = null
|
httpPasswordView.error = null
|
||||||
|
|
||||||
// Store values at the time of the login attempt.
|
// Store values at the time of the login attempt.
|
||||||
val url = binding.urlView.text.toString()
|
val url = urlView.text.toString()
|
||||||
val login = binding.loginView.text.toString()
|
val login = loginView.text.toString()
|
||||||
val httpLogin = binding.httpLoginView.text.toString()
|
val httpLogin = httpLoginView.text.toString()
|
||||||
val password = binding.passwordView.text.toString()
|
val password = passwordView.text.toString()
|
||||||
val httpPassword = binding.httpPasswordView.text.toString()
|
val httpPassword = httpPasswordView.text.toString()
|
||||||
|
|
||||||
var cancel = false
|
var cancel = false
|
||||||
var focusView: View? = null
|
var focusView: View? = null
|
||||||
|
|
||||||
if (!url.isBaseUrlValid(this@LoginActivity)) {
|
if (!url.isBaseUrlValid(this@LoginActivity)) {
|
||||||
binding.urlView.error = getString(R.string.login_url_problem)
|
urlView.error = getString(R.string.login_url_problem)
|
||||||
focusView = binding.urlView
|
focusView = urlView
|
||||||
cancel = true
|
cancel = true
|
||||||
inValidCount++
|
inValidCount++
|
||||||
if (inValidCount == 3) {
|
if (inValidCount == 3) {
|
||||||
@ -164,28 +161,28 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
if (isWithLogin) {
|
if (isWithLogin) {
|
||||||
if (TextUtils.isEmpty(password)) {
|
if (TextUtils.isEmpty(password)) {
|
||||||
binding.passwordView.error = getString(R.string.error_invalid_password)
|
passwordView.error = getString(R.string.error_invalid_password)
|
||||||
focusView = binding.passwordView
|
focusView = passwordView
|
||||||
cancel = true
|
cancel = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextUtils.isEmpty(login)) {
|
if (TextUtils.isEmpty(login)) {
|
||||||
binding.loginView.error = getString(R.string.error_field_required)
|
loginView.error = getString(R.string.error_field_required)
|
||||||
focusView = binding.loginView
|
focusView = loginView
|
||||||
cancel = true
|
cancel = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWithHTTPLogin) {
|
if (isWithHTTPLogin) {
|
||||||
if (TextUtils.isEmpty(httpPassword)) {
|
if (TextUtils.isEmpty(httpPassword)) {
|
||||||
binding.httpPasswordView.error = getString(R.string.error_invalid_password)
|
httpPasswordView.error = getString(R.string.error_invalid_password)
|
||||||
focusView = binding.httpPasswordView
|
focusView = httpPasswordView
|
||||||
cancel = true
|
cancel = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextUtils.isEmpty(httpLogin)) {
|
if (TextUtils.isEmpty(httpLogin)) {
|
||||||
binding.httpLoginView.error = getString(R.string.error_field_required)
|
httpLoginView.error = getString(R.string.error_field_required)
|
||||||
focusView = binding.httpLoginView
|
focusView = httpLoginView
|
||||||
cancel = true
|
cancel = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,11 +216,11 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
editor.remove("password")
|
editor.remove("password")
|
||||||
editor.remove("httpPassword")
|
editor.remove("httpPassword")
|
||||||
editor.apply()
|
editor.apply()
|
||||||
binding.urlView.error = getString(R.string.wrong_infos)
|
urlView.error = getString(R.string.wrong_infos)
|
||||||
binding.loginView.error = getString(R.string.wrong_infos)
|
loginView.error = getString(R.string.wrong_infos)
|
||||||
binding.passwordView.error = getString(R.string.wrong_infos)
|
passwordView.error = getString(R.string.wrong_infos)
|
||||||
binding.httpLoginView.error = getString(R.string.wrong_infos)
|
httpLoginView.error = getString(R.string.wrong_infos)
|
||||||
binding.httpPasswordView.error = getString(R.string.wrong_infos)
|
httpPasswordView.error = getString(R.string.wrong_infos)
|
||||||
showProgress(false)
|
showProgress(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,28 +248,28 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
private fun showProgress(show: Boolean) {
|
private fun showProgress(show: Boolean) {
|
||||||
val shortAnimTime = resources.getInteger(android.R.integer.config_shortAnimTime)
|
val shortAnimTime = resources.getInteger(android.R.integer.config_shortAnimTime)
|
||||||
|
|
||||||
binding.loginForm.visibility = if (show) View.GONE else View.VISIBLE
|
loginForm.visibility = if (show) View.GONE else View.VISIBLE
|
||||||
binding.loginForm
|
loginForm
|
||||||
.animate()
|
.animate()
|
||||||
.setDuration(shortAnimTime.toLong())
|
.setDuration(shortAnimTime.toLong())
|
||||||
.alpha(
|
.alpha(
|
||||||
if (show) 0F else 1F
|
if (show) 0F else 1F
|
||||||
).setListener(object : AnimatorListenerAdapter() {
|
).setListener(object : AnimatorListenerAdapter() {
|
||||||
override fun onAnimationEnd(animation: Animator) {
|
override fun onAnimationEnd(animation: Animator) {
|
||||||
binding.loginForm.visibility = if (show) View.GONE else View.VISIBLE
|
loginForm.visibility = if (show) View.GONE else View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.loginProgress.visibility = if (show) View.VISIBLE else View.GONE
|
loginProgress.visibility = if (show) View.VISIBLE else View.GONE
|
||||||
binding.loginProgress
|
loginProgress
|
||||||
.animate()
|
.animate()
|
||||||
.setDuration(shortAnimTime.toLong())
|
.setDuration(shortAnimTime.toLong())
|
||||||
.alpha(
|
.alpha(
|
||||||
if (show) 1F else 0F
|
if (show) 1F else 0F
|
||||||
).setListener(object : AnimatorListenerAdapter() {
|
).setListener(object : AnimatorListenerAdapter() {
|
||||||
override fun onAnimationEnd(animation: Animator) {
|
override fun onAnimationEnd(animation: Animator) {
|
||||||
binding.loginProgress.visibility = if (show) View.VISIBLE else View.GONE
|
loginProgress.visibility = if (show) View.VISIBLE else View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -4,18 +4,12 @@ import android.content.Intent
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.preference.PreferenceManager
|
import android.preference.PreferenceManager
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ActivityAddSourceBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ActivityMainBinding
|
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
private lateinit var binding: ActivityMainBinding
|
|
||||||
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
setContentView(R.layout.activity_main)
|
||||||
val view = binding.root
|
|
||||||
setContentView(view)
|
|
||||||
|
|
||||||
val intent = Intent(this, LoginActivity::class.java)
|
val intent = Intent(this, LoginActivity::class.java)
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@ import androidx.room.Room
|
|||||||
import apps.amine.bou.readerforselfoss.api.selfoss.Item
|
import apps.amine.bou.readerforselfoss.api.selfoss.Item
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ActivityImageBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ActivityReaderBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.fragments.ArticleFragment
|
import apps.amine.bou.readerforselfoss.fragments.ArticleFragment
|
||||||
import apps.amine.bou.readerforselfoss.persistence.database.AppDatabase
|
import apps.amine.bou.readerforselfoss.persistence.database.AppDatabase
|
||||||
import apps.amine.bou.readerforselfoss.persistence.entities.ActionEntity
|
import apps.amine.bou.readerforselfoss.persistence.entities.ActionEntity
|
||||||
@ -37,6 +35,7 @@ import apps.amine.bou.readerforselfoss.utils.persistence.toEntity
|
|||||||
import apps.amine.bou.readerforselfoss.utils.succeeded
|
import apps.amine.bou.readerforselfoss.utils.succeeded
|
||||||
import apps.amine.bou.readerforselfoss.utils.toggleStar
|
import apps.amine.bou.readerforselfoss.utils.toggleStar
|
||||||
import com.ftinc.scoop.Scoop
|
import com.ftinc.scoop.Scoop
|
||||||
|
import kotlinx.android.synthetic.main.activity_reader.*
|
||||||
import me.relex.circleindicator.CircleIndicator
|
import me.relex.circleindicator.CircleIndicator
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
@ -55,7 +54,6 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private lateinit var db: AppDatabase
|
private lateinit var db: AppDatabase
|
||||||
private lateinit var prefs: SharedPreferences
|
private lateinit var prefs: SharedPreferences
|
||||||
private lateinit var binding: ActivityReaderBinding
|
|
||||||
|
|
||||||
private var activeAlignment: Int = 1
|
private var activeAlignment: Int = 1
|
||||||
val JUSTIFY = 1
|
val JUSTIFY = 1
|
||||||
@ -78,10 +76,8 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityReaderBinding.inflate(layoutInflater)
|
|
||||||
val view = binding.root
|
|
||||||
|
|
||||||
setContentView(view)
|
setContentView(R.layout.activity_reader)
|
||||||
|
|
||||||
db = Room.databaseBuilder(
|
db = Room.databaseBuilder(
|
||||||
applicationContext,
|
applicationContext,
|
||||||
@ -89,12 +85,12 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
).addMigrations(MIGRATION_1_2).addMigrations(MIGRATION_2_3).addMigrations(MIGRATION_3_4).build()
|
).addMigrations(MIGRATION_1_2).addMigrations(MIGRATION_2_3).addMigrations(MIGRATION_3_4).build()
|
||||||
|
|
||||||
val scoop = Scoop.getInstance()
|
val scoop = Scoop.getInstance()
|
||||||
scoop.bind(this, Toppings.PRIMARY.value, binding.toolBar)
|
scoop.bind(this, Toppings.PRIMARY.value, toolBar)
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
setSupportActionBar(binding.toolBar)
|
setSupportActionBar(toolBar)
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||||
|
|
||||||
@ -123,9 +119,9 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
readItem(allItems[currentItem])
|
readItem(allItems[currentItem])
|
||||||
|
|
||||||
binding.pager.adapter =
|
pager.adapter =
|
||||||
ScreenSlidePagerAdapter(supportFragmentManager, AppColors(this@ReaderActivity))
|
ScreenSlidePagerAdapter(supportFragmentManager, AppColors(this@ReaderActivity))
|
||||||
binding.pager.currentItem = currentItem
|
pager.currentItem = currentItem
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
@ -133,10 +129,10 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
notifyAdapter()
|
notifyAdapter()
|
||||||
|
|
||||||
binding.pager.setPageTransformer(true, DepthPageTransformer())
|
pager.setPageTransformer(true, DepthPageTransformer())
|
||||||
(binding.indicator as CircleIndicator).setViewPager(binding.pager)
|
(indicator as CircleIndicator).setViewPager(pager)
|
||||||
|
|
||||||
binding.pager.addOnPageChangeListener(
|
pager.addOnPageChangeListener(
|
||||||
object : ViewPager.SimpleOnPageChangeListener() {
|
object : ViewPager.SimpleOnPageChangeListener() {
|
||||||
|
|
||||||
override fun onPageSelected(position: Int) {
|
override fun onPageSelected(position: Int) {
|
||||||
@ -146,7 +142,7 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
} else {
|
} else {
|
||||||
canFavorite()
|
canFavorite()
|
||||||
}
|
}
|
||||||
readItem(allItems[binding.pager.currentItem])
|
readItem(allItems[pager.currentItem])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -185,19 +181,19 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun notifyAdapter() {
|
private fun notifyAdapter() {
|
||||||
(binding.pager.adapter as ScreenSlidePagerAdapter).notifyDataSetChanged()
|
(pager.adapter as ScreenSlidePagerAdapter).notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
if (markOnScroll) {
|
if (markOnScroll) {
|
||||||
binding.pager.clearOnPageChangeListeners()
|
pager.clearOnPageChangeListeners()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(oldInstanceState: Bundle) {
|
override fun onSaveInstanceState(oldInstanceState: Bundle) {
|
||||||
super.onSaveInstanceState(oldInstanceState)
|
super.onSaveInstanceState(oldInstanceState)
|
||||||
oldInstanceState.clear()
|
oldInstanceState!!.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class ScreenSlidePagerAdapter(fm: FragmentManager, val appColors: AppColors) :
|
private inner class ScreenSlidePagerAdapter(fm: FragmentManager, val appColors: AppColors) :
|
||||||
@ -249,14 +245,14 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
fun afterSave() {
|
fun afterSave() {
|
||||||
allItems[binding.pager.currentItem] =
|
allItems[pager.currentItem] =
|
||||||
allItems[binding.pager.currentItem].toggleStar()
|
allItems[pager.currentItem].toggleStar()
|
||||||
notifyAdapter()
|
notifyAdapter()
|
||||||
canRemoveFromFavorite()
|
canRemoveFromFavorite()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun afterUnsave() {
|
fun afterUnsave() {
|
||||||
allItems[binding.pager.currentItem] = allItems[binding.pager.currentItem].toggleStar()
|
allItems[pager.currentItem] = allItems[pager.currentItem].toggleStar()
|
||||||
notifyAdapter()
|
notifyAdapter()
|
||||||
canFavorite()
|
canFavorite()
|
||||||
}
|
}
|
||||||
@ -268,7 +264,7 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
R.id.save -> {
|
R.id.save -> {
|
||||||
if (this@ReaderActivity.isNetworkAccessible(null)) {
|
if (this@ReaderActivity.isNetworkAccessible(null)) {
|
||||||
api.starrItem(allItems[binding.pager.currentItem].id)
|
api.starrItem(allItems[pager.currentItem].id)
|
||||||
.enqueue(object : Callback<SuccessResponse> {
|
.enqueue(object : Callback<SuccessResponse> {
|
||||||
override fun onResponse(
|
override fun onResponse(
|
||||||
call: Call<SuccessResponse>,
|
call: Call<SuccessResponse>,
|
||||||
@ -290,14 +286,14 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
thread {
|
thread {
|
||||||
db.actionsDao().insertAllActions(ActionEntity(allItems[binding.pager.currentItem].id, false, false, true, false))
|
db.actionsDao().insertAllActions(ActionEntity(allItems[pager.currentItem].id, false, false, true, false))
|
||||||
afterSave()
|
afterSave()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
R.id.unsave -> {
|
R.id.unsave -> {
|
||||||
if (this@ReaderActivity.isNetworkAccessible(null)) {
|
if (this@ReaderActivity.isNetworkAccessible(null)) {
|
||||||
api.unstarrItem(allItems[binding.pager.currentItem].id)
|
api.unstarrItem(allItems[pager.currentItem].id)
|
||||||
.enqueue(object : Callback<SuccessResponse> {
|
.enqueue(object : Callback<SuccessResponse> {
|
||||||
override fun onResponse(
|
override fun onResponse(
|
||||||
call: Call<SuccessResponse>,
|
call: Call<SuccessResponse>,
|
||||||
@ -319,7 +315,7 @@ class ReaderActivity : AppCompatActivity() {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
thread {
|
thread {
|
||||||
db.actionsDao().insertAllActions(ActionEntity(allItems[binding.pager.currentItem].id, false, false, false, true))
|
db.actionsDao().insertAllActions(ActionEntity(allItems[pager.currentItem].id, false, false, false, true))
|
||||||
afterUnsave()
|
afterUnsave()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,12 @@ import android.widget.Toast
|
|||||||
import apps.amine.bou.readerforselfoss.adapters.SourcesListAdapter
|
import apps.amine.bou.readerforselfoss.adapters.SourcesListAdapter
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.Source
|
import apps.amine.bou.readerforselfoss.api.selfoss.Source
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ActivityImageBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ActivitySourcesBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.themes.AppColors
|
import apps.amine.bou.readerforselfoss.themes.AppColors
|
||||||
import apps.amine.bou.readerforselfoss.themes.Toppings
|
import apps.amine.bou.readerforselfoss.themes.Toppings
|
||||||
import apps.amine.bou.readerforselfoss.utils.Config
|
import apps.amine.bou.readerforselfoss.utils.Config
|
||||||
import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible
|
import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible
|
||||||
import com.ftinc.scoop.Scoop
|
import com.ftinc.scoop.Scoop
|
||||||
|
import kotlinx.android.synthetic.main.activity_sources.*
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
@ -26,34 +25,31 @@ import retrofit2.Response
|
|||||||
class SourcesActivity : AppCompatActivity() {
|
class SourcesActivity : AppCompatActivity() {
|
||||||
|
|
||||||
private lateinit var appColors: AppColors
|
private lateinit var appColors: AppColors
|
||||||
private lateinit var binding: ActivitySourcesBinding
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
appColors = AppColors(this@SourcesActivity)
|
appColors = AppColors(this@SourcesActivity)
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivitySourcesBinding.inflate(layoutInflater)
|
|
||||||
val view = binding.root
|
|
||||||
|
|
||||||
setContentView(view)
|
setContentView(R.layout.activity_sources)
|
||||||
|
|
||||||
val scoop = Scoop.getInstance()
|
val scoop = Scoop.getInstance()
|
||||||
scoop.bind(this, Toppings.PRIMARY.value, binding.toolbar)
|
scoop.bind(this, Toppings.PRIMARY.value, toolbar)
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
setSupportActionBar(binding.toolbar)
|
setSupportActionBar(toolbar)
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||||
|
|
||||||
binding.fab.rippleColor = appColors.colorAccentDark
|
fab.rippleColor = appColors.colorAccentDark
|
||||||
binding.fab.backgroundTintList = ColorStateList.valueOf(appColors.colorAccent)
|
fab.backgroundTintList = ColorStateList.valueOf(appColors.colorAccent)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
super.onStop()
|
super.onStop()
|
||||||
binding.recyclerView.clearOnScrollListeners()
|
recyclerView.clearOnScrollListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
@ -72,8 +68,8 @@ class SourcesActivity : AppCompatActivity() {
|
|||||||
)
|
)
|
||||||
var items: ArrayList<Source> = ArrayList()
|
var items: ArrayList<Source> = ArrayList()
|
||||||
|
|
||||||
binding.recyclerView.setHasFixedSize(true)
|
recyclerView.setHasFixedSize(true)
|
||||||
binding.recyclerView.layoutManager = mLayoutManager
|
recyclerView.layoutManager = mLayoutManager
|
||||||
|
|
||||||
if (this@SourcesActivity.isNetworkAccessible(this@SourcesActivity.findViewById(R.id.recyclerView))) {
|
if (this@SourcesActivity.isNetworkAccessible(this@SourcesActivity.findViewById(R.id.recyclerView))) {
|
||||||
api.sources.enqueue(object : Callback<List<Source>> {
|
api.sources.enqueue(object : Callback<List<Source>> {
|
||||||
@ -85,7 +81,7 @@ class SourcesActivity : AppCompatActivity() {
|
|||||||
items = response.body() as ArrayList<Source>
|
items = response.body() as ArrayList<Source>
|
||||||
}
|
}
|
||||||
val mAdapter = SourcesListAdapter(this@SourcesActivity, items, api)
|
val mAdapter = SourcesListAdapter(this@SourcesActivity, items, api)
|
||||||
binding.recyclerView.adapter = mAdapter
|
recyclerView.adapter = mAdapter
|
||||||
mAdapter.notifyDataSetChanged()
|
mAdapter.notifyDataSetChanged()
|
||||||
if (items.isEmpty()) {
|
if (items.isEmpty()) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
@ -106,7 +102,7 @@ class SourcesActivity : AppCompatActivity() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.fab.setOnClickListener {
|
fab.setOnClickListener {
|
||||||
startActivity(Intent(this@SourcesActivity, AddSourceActivity::class.java))
|
startActivity(Intent(this@SourcesActivity, AddSourceActivity::class.java))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ import apps.amine.bou.readerforselfoss.R
|
|||||||
import apps.amine.bou.readerforselfoss.api.selfoss.Item
|
import apps.amine.bou.readerforselfoss.api.selfoss.Item
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
||||||
import apps.amine.bou.readerforselfoss.databinding.CardItemBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.persistence.database.AppDatabase
|
import apps.amine.bou.readerforselfoss.persistence.database.AppDatabase
|
||||||
import apps.amine.bou.readerforselfoss.persistence.entities.ActionEntity
|
import apps.amine.bou.readerforselfoss.persistence.entities.ActionEntity
|
||||||
import apps.amine.bou.readerforselfoss.themes.AppColors
|
import apps.amine.bou.readerforselfoss.themes.AppColors
|
||||||
@ -35,6 +34,11 @@ import com.amulyakhare.textdrawable.util.ColorGenerator
|
|||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.like.LikeButton
|
import com.like.LikeButton
|
||||||
import com.like.OnLikeListener
|
import com.like.OnLikeListener
|
||||||
|
import kotlinx.android.synthetic.main.card_item.view.*
|
||||||
|
import kotlinx.android.synthetic.main.card_item.view.itemImage
|
||||||
|
import kotlinx.android.synthetic.main.card_item.view.sourceTitleAndDate
|
||||||
|
import kotlinx.android.synthetic.main.card_item.view.title
|
||||||
|
import kotlinx.android.synthetic.main.list_item.view.*
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
@ -60,79 +64,77 @@ class ItemCardAdapter(
|
|||||||
c.resources.getDimension(R.dimen.card_image_max_height).toInt()
|
c.resources.getDimension(R.dimen.card_image_max_height).toInt()
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
val binding = CardItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
val v = LayoutInflater.from(c).inflate(R.layout.card_item, parent, false) as CardView
|
||||||
return ViewHolder(binding)
|
return ViewHolder(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
with(holder) {
|
val itm = items[position]
|
||||||
val itm = items[position]
|
|
||||||
|
|
||||||
|
|
||||||
binding.favButton.isLiked = itm.starred
|
holder.mView.favButton.isLiked = itm.starred
|
||||||
binding.title.text = itm.getTitleDecoded()
|
holder.mView.title.text = itm.getTitleDecoded()
|
||||||
binding.title.setTextColor(ContextCompat.getColor(
|
holder.mView.title.setTextColor(ContextCompat.getColor(
|
||||||
c,
|
c,
|
||||||
appColors.textColor
|
appColors.textColor
|
||||||
))
|
))
|
||||||
binding.title.setOnTouchListener(LinkOnTouchListener())
|
holder.mView.title.setOnTouchListener(LinkOnTouchListener())
|
||||||
|
|
||||||
binding.title.setLinkTextColor(appColors.colorAccent)
|
holder.mView.title.setLinkTextColor(appColors.colorAccent)
|
||||||
|
|
||||||
binding.sourceTitleAndDate.text = itm.sourceAndDateText()
|
holder.mView.sourceTitleAndDate.text = itm.sourceAndDateText()
|
||||||
|
|
||||||
binding.sourceTitleAndDate.setTextColor(ContextCompat.getColor(
|
holder.mView.sourceTitleAndDate.setTextColor(ContextCompat.getColor(
|
||||||
c,
|
c,
|
||||||
appColors.textColor
|
appColors.textColor
|
||||||
))
|
))
|
||||||
|
|
||||||
if (!fullHeightCards) {
|
if (!fullHeightCards) {
|
||||||
binding.itemImage.maxHeight = imageMaxHeight
|
holder.mView.itemImage.maxHeight = imageMaxHeight
|
||||||
binding.itemImage.scaleType = ScaleType.CENTER_CROP
|
holder.mView.itemImage.scaleType = ScaleType.CENTER_CROP
|
||||||
}
|
|
||||||
|
|
||||||
if (itm.getThumbnail(c).isEmpty()) {
|
|
||||||
binding.itemImage.visibility = View.GONE
|
|
||||||
Glide.with(c).clear(binding.itemImage)
|
|
||||||
binding.itemImage.setImageDrawable(null)
|
|
||||||
} else {
|
|
||||||
binding.itemImage.visibility = View.VISIBLE
|
|
||||||
c.bitmapCenterCrop(config, itm.getThumbnail(c), binding.itemImage)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itm.getIcon(c).isEmpty()) {
|
|
||||||
val color = generator.getColor(itm.getSourceTitle())
|
|
||||||
|
|
||||||
val drawable =
|
|
||||||
TextDrawable
|
|
||||||
.builder()
|
|
||||||
.round()
|
|
||||||
.build(itm.getSourceTitle().toTextDrawableString(c), color)
|
|
||||||
binding.sourceImage.setImageDrawable(drawable)
|
|
||||||
} else {
|
|
||||||
c.circularBitmapDrawable(config, itm.getIcon(c), binding.sourceImage)
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.favButton.isLiked = itm.starred
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (itm.getThumbnail(c).isEmpty()) {
|
||||||
|
holder.mView.itemImage.visibility = View.GONE
|
||||||
|
Glide.with(c).clear(holder.mView.itemImage)
|
||||||
|
holder.mView.itemImage.setImageDrawable(null)
|
||||||
|
} else {
|
||||||
|
holder.mView.itemImage.visibility = View.VISIBLE
|
||||||
|
c.bitmapCenterCrop(config, itm.getThumbnail(c), holder.mView.itemImage)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itm.getIcon(c).isEmpty()) {
|
||||||
|
val color = generator.getColor(itm.getSourceTitle())
|
||||||
|
|
||||||
|
val drawable =
|
||||||
|
TextDrawable
|
||||||
|
.builder()
|
||||||
|
.round()
|
||||||
|
.build(itm.getSourceTitle().toTextDrawableString(c), color)
|
||||||
|
holder.mView.sourceImage.setImageDrawable(drawable)
|
||||||
|
} else {
|
||||||
|
c.circularBitmapDrawable(config, itm.getIcon(c), holder.mView.sourceImage)
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.mView.favButton.isLiked = itm.starred
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int {
|
||||||
return items.size
|
return items.size
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class ViewHolder(val binding: CardItemBinding) : RecyclerView.ViewHolder(binding.root) {
|
inner class ViewHolder(val mView: CardView) : RecyclerView.ViewHolder(mView) {
|
||||||
init {
|
init {
|
||||||
binding.root.setCardBackgroundColor(appColors.cardBackgroundColor)
|
mView.setCardBackgroundColor(appColors.cardBackgroundColor)
|
||||||
handleClickListeners()
|
handleClickListeners()
|
||||||
handleCustomTabActions()
|
handleCustomTabActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleClickListeners() {
|
private fun handleClickListeners() {
|
||||||
|
|
||||||
binding.favButton.setOnLikeListener(object : OnLikeListener {
|
mView.favButton.setOnLikeListener(object : OnLikeListener {
|
||||||
override fun liked(likeButton: LikeButton) {
|
override fun liked(likeButton: LikeButton) {
|
||||||
val (id) = items[bindingAdapterPosition]
|
val (id) = items[adapterPosition]
|
||||||
if (c.isNetworkAccessible(null)) {
|
if (c.isNetworkAccessible(null)) {
|
||||||
api.starrItem(id).enqueue(object : Callback<SuccessResponse> {
|
api.starrItem(id).enqueue(object : Callback<SuccessResponse> {
|
||||||
override fun onResponse(
|
override fun onResponse(
|
||||||
@ -145,7 +147,7 @@ class ItemCardAdapter(
|
|||||||
call: Call<SuccessResponse>,
|
call: Call<SuccessResponse>,
|
||||||
t: Throwable
|
t: Throwable
|
||||||
) {
|
) {
|
||||||
binding.favButton.isLiked = false
|
mView.favButton.isLiked = false
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
c,
|
c,
|
||||||
R.string.cant_mark_favortie,
|
R.string.cant_mark_favortie,
|
||||||
@ -161,7 +163,7 @@ class ItemCardAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun unLiked(likeButton: LikeButton) {
|
override fun unLiked(likeButton: LikeButton) {
|
||||||
val (id) = items[bindingAdapterPosition]
|
val (id) = items[adapterPosition]
|
||||||
if (c.isNetworkAccessible(null)) {
|
if (c.isNetworkAccessible(null)) {
|
||||||
api.unstarrItem(id).enqueue(object : Callback<SuccessResponse> {
|
api.unstarrItem(id).enqueue(object : Callback<SuccessResponse> {
|
||||||
override fun onResponse(
|
override fun onResponse(
|
||||||
@ -174,7 +176,7 @@ class ItemCardAdapter(
|
|||||||
call: Call<SuccessResponse>,
|
call: Call<SuccessResponse>,
|
||||||
t: Throwable
|
t: Throwable
|
||||||
) {
|
) {
|
||||||
binding.favButton.isLiked = true
|
mView.favButton.isLiked = true
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
c,
|
c,
|
||||||
R.string.cant_unmark_favortie,
|
R.string.cant_unmark_favortie,
|
||||||
@ -190,13 +192,13 @@ class ItemCardAdapter(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
binding.shareBtn.setOnClickListener {
|
mView.shareBtn.setOnClickListener {
|
||||||
val item = items[bindingAdapterPosition]
|
val item = items[adapterPosition]
|
||||||
c.shareLink(item.getLinkDecoded(), item.getTitleDecoded())
|
c.shareLink(item.getLinkDecoded(), item.getTitleDecoded())
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.browserBtn.setOnClickListener {
|
mView.browserBtn.setOnClickListener {
|
||||||
c.openInBrowserAsNewTask(items[bindingAdapterPosition])
|
c.openInBrowserAsNewTask(items[adapterPosition])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,11 +206,11 @@ class ItemCardAdapter(
|
|||||||
val customTabsIntent = c.buildCustomTabsIntent()
|
val customTabsIntent = c.buildCustomTabsIntent()
|
||||||
helper.bindCustomTabsService(app)
|
helper.bindCustomTabsService(app)
|
||||||
|
|
||||||
binding.root.setOnClickListener {
|
mView.setOnClickListener {
|
||||||
c.openItemUrl(
|
c.openItemUrl(
|
||||||
items,
|
items,
|
||||||
bindingAdapterPosition,
|
adapterPosition,
|
||||||
items[bindingAdapterPosition].getLinkDecoded(),
|
items[adapterPosition].getLinkDecoded(),
|
||||||
customTabsIntent,
|
customTabsIntent,
|
||||||
internalBrowser,
|
internalBrowser,
|
||||||
articleViewer,
|
articleViewer,
|
||||||
|
@ -18,7 +18,6 @@ import apps.amine.bou.readerforselfoss.R
|
|||||||
import apps.amine.bou.readerforselfoss.api.selfoss.Item
|
import apps.amine.bou.readerforselfoss.api.selfoss.Item
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ListItemBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.persistence.database.AppDatabase
|
import apps.amine.bou.readerforselfoss.persistence.database.AppDatabase
|
||||||
import apps.amine.bou.readerforselfoss.themes.AppColors
|
import apps.amine.bou.readerforselfoss.themes.AppColors
|
||||||
import apps.amine.bou.readerforselfoss.utils.Config
|
import apps.amine.bou.readerforselfoss.utils.Config
|
||||||
@ -36,6 +35,7 @@ import com.amulyakhare.textdrawable.TextDrawable
|
|||||||
import com.amulyakhare.textdrawable.util.ColorGenerator
|
import com.amulyakhare.textdrawable.util.ColorGenerator
|
||||||
import com.like.LikeButton
|
import com.like.LikeButton
|
||||||
import com.like.OnLikeListener
|
import com.like.OnLikeListener
|
||||||
|
import kotlinx.android.synthetic.main.list_item.view.*
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
@ -59,57 +59,59 @@ class ItemListAdapter(
|
|||||||
private val c: Context = app.baseContext
|
private val c: Context = app.baseContext
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
val binding = ListItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
val v = LayoutInflater.from(c).inflate(
|
||||||
return ViewHolder(binding)
|
R.layout.list_item,
|
||||||
|
parent,
|
||||||
|
false
|
||||||
|
) as ConstraintLayout
|
||||||
|
return ViewHolder(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
with(holder) {
|
val itm = items[position]
|
||||||
val itm = items[position]
|
|
||||||
|
|
||||||
|
|
||||||
binding.title.text = itm.getTitleDecoded()
|
holder.mView.title.text = itm.getTitleDecoded()
|
||||||
|
|
||||||
binding.title.setTextColor(ContextCompat.getColor(
|
holder.mView.title.setTextColor(ContextCompat.getColor(
|
||||||
c,
|
c,
|
||||||
appColors.textColor
|
appColors.textColor
|
||||||
))
|
))
|
||||||
|
|
||||||
binding.title.setOnTouchListener(LinkOnTouchListener())
|
holder.mView.title.setOnTouchListener(LinkOnTouchListener())
|
||||||
|
|
||||||
binding.title.setLinkTextColor(appColors.colorAccent)
|
holder.mView.title.setLinkTextColor(appColors.colorAccent)
|
||||||
|
|
||||||
binding.sourceTitleAndDate.text = itm.sourceAndDateText()
|
holder.mView.sourceTitleAndDate.text = itm.sourceAndDateText()
|
||||||
|
|
||||||
binding.sourceTitleAndDate.setTextColor(ContextCompat.getColor(
|
holder.mView.sourceTitleAndDate.setTextColor(ContextCompat.getColor(
|
||||||
c,
|
c,
|
||||||
appColors.textColor
|
appColors.textColor
|
||||||
))
|
))
|
||||||
|
|
||||||
if (itm.getThumbnail(c).isEmpty()) {
|
if (itm.getThumbnail(c).isEmpty()) {
|
||||||
|
|
||||||
if (itm.getIcon(c).isEmpty()) {
|
if (itm.getIcon(c).isEmpty()) {
|
||||||
val color = generator.getColor(itm.getSourceTitle())
|
val color = generator.getColor(itm.getSourceTitle())
|
||||||
|
|
||||||
val drawable =
|
val drawable =
|
||||||
TextDrawable
|
TextDrawable
|
||||||
.builder()
|
.builder()
|
||||||
.round()
|
.round()
|
||||||
.build(itm.getSourceTitle().toTextDrawableString(c), color)
|
.build(itm.getSourceTitle().toTextDrawableString(c), color)
|
||||||
|
|
||||||
binding.itemImage.setImageDrawable(drawable)
|
holder.mView.itemImage.setImageDrawable(drawable)
|
||||||
} else {
|
|
||||||
c.circularBitmapDrawable(config, itm.getIcon(c), binding.itemImage)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
c.bitmapCenterCrop(config, itm.getThumbnail(c), binding.itemImage)
|
c.circularBitmapDrawable(config, itm.getIcon(c), holder.mView.itemImage)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
c.bitmapCenterCrop(config, itm.getThumbnail(c), holder.mView.itemImage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int = items.size
|
override fun getItemCount(): Int = items.size
|
||||||
|
|
||||||
inner class ViewHolder(val binding: ListItemBinding) : RecyclerView.ViewHolder(binding.root) {
|
inner class ViewHolder(val mView: ConstraintLayout) : RecyclerView.ViewHolder(mView) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
handleCustomTabActions()
|
handleCustomTabActions()
|
||||||
@ -119,11 +121,11 @@ class ItemListAdapter(
|
|||||||
val customTabsIntent = c.buildCustomTabsIntent()
|
val customTabsIntent = c.buildCustomTabsIntent()
|
||||||
helper.bindCustomTabsService(app)
|
helper.bindCustomTabsService(app)
|
||||||
|
|
||||||
binding.root.setOnClickListener {
|
mView.setOnClickListener {
|
||||||
c.openItemUrl(
|
c.openItemUrl(
|
||||||
items,
|
items,
|
||||||
bindingAdapterPosition,
|
adapterPosition,
|
||||||
items[bindingAdapterPosition].getLinkDecoded(),
|
items[adapterPosition].getLinkDecoded(),
|
||||||
customTabsIntent,
|
customTabsIntent,
|
||||||
internalBrowser,
|
internalBrowser,
|
||||||
articleViewer,
|
articleViewer,
|
||||||
|
@ -12,13 +12,13 @@ import apps.amine.bou.readerforselfoss.R
|
|||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.Source
|
import apps.amine.bou.readerforselfoss.api.selfoss.Source
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
||||||
import apps.amine.bou.readerforselfoss.databinding.SourceListItemBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.utils.Config
|
import apps.amine.bou.readerforselfoss.utils.Config
|
||||||
import apps.amine.bou.readerforselfoss.utils.glide.circularBitmapDrawable
|
import apps.amine.bou.readerforselfoss.utils.glide.circularBitmapDrawable
|
||||||
import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible
|
import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible
|
||||||
import apps.amine.bou.readerforselfoss.utils.toTextDrawableString
|
import apps.amine.bou.readerforselfoss.utils.toTextDrawableString
|
||||||
import com.amulyakhare.textdrawable.TextDrawable
|
import com.amulyakhare.textdrawable.TextDrawable
|
||||||
import com.amulyakhare.textdrawable.util.ColorGenerator
|
import com.amulyakhare.textdrawable.util.ColorGenerator
|
||||||
|
import kotlinx.android.synthetic.main.source_list_item.view.*
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
@ -31,11 +31,14 @@ class SourcesListAdapter(
|
|||||||
private val c: Context = app.baseContext
|
private val c: Context = app.baseContext
|
||||||
private val generator: ColorGenerator = ColorGenerator.MATERIAL
|
private val generator: ColorGenerator = ColorGenerator.MATERIAL
|
||||||
private lateinit var config: Config
|
private lateinit var config: Config
|
||||||
private lateinit var binding: SourceListItemBinding
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
binding = SourceListItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
val v = LayoutInflater.from(c).inflate(
|
||||||
return ViewHolder(binding.root)
|
R.layout.source_list_item,
|
||||||
|
parent,
|
||||||
|
false
|
||||||
|
) as ConstraintLayout
|
||||||
|
return ViewHolder(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
@ -50,12 +53,12 @@ class SourcesListAdapter(
|
|||||||
.builder()
|
.builder()
|
||||||
.round()
|
.round()
|
||||||
.build(itm.getTitleDecoded().toTextDrawableString(c), color)
|
.build(itm.getTitleDecoded().toTextDrawableString(c), color)
|
||||||
binding.itemImage.setImageDrawable(drawable)
|
holder.mView.itemImage.setImageDrawable(drawable)
|
||||||
} else {
|
} else {
|
||||||
c.circularBitmapDrawable(config, itm.getIcon(c), binding.itemImage)
|
c.circularBitmapDrawable(config, itm.getIcon(c), holder.mView.itemImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.sourceTitle.text = itm.getTitleDecoded()
|
holder.mView.sourceTitle.text = itm.getTitleDecoded()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int = items.size
|
override fun getItemCount(): Int = items.size
|
||||||
|
@ -172,15 +172,6 @@ class SelfossApi(
|
|||||||
fun allItems(): Call<List<Item>> =
|
fun allItems(): Call<List<Item>> =
|
||||||
service.allItems(userName, password)
|
service.allItems(userName, password)
|
||||||
|
|
||||||
fun allNewItems(): Call<List<Item>> =
|
|
||||||
getItems("unread", null, null, null, 200, 0)
|
|
||||||
|
|
||||||
fun allReadItems(): Call<List<Item>> =
|
|
||||||
getItems("read", null, null, null, 200, 0)
|
|
||||||
|
|
||||||
fun allStarredItems(): Call<List<Item>> =
|
|
||||||
getItems("read", null, null, null, 200, 0)
|
|
||||||
|
|
||||||
private fun getItems(
|
private fun getItems(
|
||||||
type: String,
|
type: String,
|
||||||
tag: String?,
|
tag: String?,
|
||||||
@ -215,9 +206,6 @@ class SelfossApi(
|
|||||||
fun update(): Call<String> =
|
fun update(): Call<String> =
|
||||||
service.update(userName, password)
|
service.update(userName, password)
|
||||||
|
|
||||||
val apiVersion: Call<ApiVersion>
|
|
||||||
get() = service.version()
|
|
||||||
|
|
||||||
val sources: Call<List<Source>>
|
val sources: Call<List<Source>>
|
||||||
get() = service.sources(userName, password)
|
get() = service.sources(userName, password)
|
||||||
|
|
||||||
|
@ -48,19 +48,6 @@ data class Spout(
|
|||||||
@SerializedName("description") val description: String
|
@SerializedName("description") val description: String
|
||||||
)
|
)
|
||||||
|
|
||||||
data class ApiVersion(
|
|
||||||
@SerializedName("version") val version: String?,
|
|
||||||
@SerializedName("apiversion") val apiversion: String?
|
|
||||||
) {
|
|
||||||
fun getApiMajorVersion() : Int {
|
|
||||||
var versionNumber = 0
|
|
||||||
if (apiversion != null) {
|
|
||||||
versionNumber = apiversion.substringBefore(".").toInt()
|
|
||||||
}
|
|
||||||
return versionNumber
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data class Source(
|
data class Source(
|
||||||
@SerializedName("id") val id: String,
|
@SerializedName("id") val id: String,
|
||||||
@SerializedName("title") val title: String,
|
@SerializedName("title") val title: String,
|
||||||
@ -169,7 +156,7 @@ data class Item(
|
|||||||
fun preloadImages(context: Context) : Boolean {
|
fun preloadImages(context: Context) : Boolean {
|
||||||
val imageUrls = this.getImages()
|
val imageUrls = this.getImages()
|
||||||
|
|
||||||
val glideOptions = RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.ALL).timeout(10000)
|
val glideOptions = RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.ALL)
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -177,7 +164,7 @@ data class Item(
|
|||||||
if ( URLUtil.isValidUrl(url)) {
|
if ( URLUtil.isValidUrl(url)) {
|
||||||
val image = Glide.with(context).asBitmap()
|
val image = Glide.with(context).asBitmap()
|
||||||
.apply(glideOptions)
|
.apply(glideOptions)
|
||||||
.load(url).submit()
|
.load(url).submit().get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e : Error) {
|
} catch (e : Error) {
|
||||||
|
@ -103,9 +103,6 @@ internal interface SelfossService {
|
|||||||
@Query("password") password: String
|
@Query("password") password: String
|
||||||
): Call<List<Source>>
|
): Call<List<Source>>
|
||||||
|
|
||||||
@GET("api/about")
|
|
||||||
fun version(): Call<ApiVersion>
|
|
||||||
|
|
||||||
@DELETE("source/{id}")
|
@DELETE("source/{id}")
|
||||||
fun deleteSource(
|
fun deleteSource(
|
||||||
@Path("id") id: String,
|
@Path("id") id: String,
|
||||||
|
@ -66,7 +66,7 @@ class LoadingWorker(val context: Context, params: WorkerParameters) : Worker(con
|
|||||||
sharedPref.getString("api_timeout", "-1")!!.toLong()
|
sharedPref.getString("api_timeout", "-1")!!.toLong()
|
||||||
)
|
)
|
||||||
|
|
||||||
api.allNewItems().enqueue(object : Callback<List<Item>> {
|
api.allItems().enqueue(object : Callback<List<Item>> {
|
||||||
override fun onFailure(call: Call<List<Item>>, t: Throwable) {
|
override fun onFailure(call: Call<List<Item>>, t: Throwable) {
|
||||||
Timer("", false).schedule(4000) {
|
Timer("", false).schedule(4000) {
|
||||||
notificationManager.cancel(1)
|
notificationManager.cancel(1)
|
||||||
@ -77,38 +77,42 @@ class LoadingWorker(val context: Context, params: WorkerParameters) : Worker(con
|
|||||||
call: Call<List<Item>>,
|
call: Call<List<Item>>,
|
||||||
response: Response<List<Item>>
|
response: Response<List<Item>>
|
||||||
) {
|
) {
|
||||||
storeItems(response, true, notifyNewItems, notificationManager)
|
thread {
|
||||||
}
|
if (response.body() != null) {
|
||||||
})
|
val apiItems = (response.body() as ArrayList<Item>)
|
||||||
api.allReadItems().enqueue(object : Callback<List<Item>> {
|
db.itemsDao().deleteAllItems()
|
||||||
override fun onFailure(call: Call<List<Item>>, t: Throwable) {
|
db.itemsDao()
|
||||||
Timer("", false).schedule(4000) {
|
.insertAllItems(*(apiItems.map { it.toEntity() }).toTypedArray())
|
||||||
notificationManager.cancel(1)
|
|
||||||
|
val newSize = apiItems.filter { it.unread }.size
|
||||||
|
if (notifyNewItems && newSize > 0) {
|
||||||
|
|
||||||
|
val intent = Intent(context, MainActivity::class.java).apply {
|
||||||
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||||
|
}
|
||||||
|
val pendingIntent: PendingIntent = PendingIntent.getActivity(context, 0, intent, 0)
|
||||||
|
|
||||||
|
val newItemsNotification = NotificationCompat.Builder(applicationContext, Config.newItemsChannelId)
|
||||||
|
.setContentTitle(context.getString(R.string.new_items_notification_title))
|
||||||
|
.setContentText(context.getString(R.string.new_items_notification_text, newSize))
|
||||||
|
.setPriority(PRIORITY_DEFAULT)
|
||||||
|
.setChannelId(Config.newItemsChannelId)
|
||||||
|
.setContentIntent(pendingIntent)
|
||||||
|
.setAutoCancel(true)
|
||||||
|
.setSmallIcon(R.drawable.ic_tab_fiber_new_black_24dp)
|
||||||
|
|
||||||
|
Timer("", false).schedule(4000) {
|
||||||
|
notificationManager.notify(2, newItemsNotification.build())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
apiItems.map {it.preloadImages(context)}
|
||||||
|
}
|
||||||
|
Timer("", false).schedule(4000) {
|
||||||
|
notificationManager.cancel(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResponse(
|
|
||||||
call: Call<List<Item>>,
|
|
||||||
response: Response<List<Item>>
|
|
||||||
) {
|
|
||||||
storeItems(response, false, notifyNewItems, notificationManager)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
api.allStarredItems().enqueue(object : Callback<List<Item>> {
|
|
||||||
override fun onFailure(call: Call<List<Item>>, t: Throwable) {
|
|
||||||
Timer("", false).schedule(4000) {
|
|
||||||
notificationManager.cancel(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResponse(
|
|
||||||
call: Call<List<Item>>,
|
|
||||||
response: Response<List<Item>>
|
|
||||||
) {
|
|
||||||
storeItems(response, false, notifyNewItems, notificationManager)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
thread {
|
thread {
|
||||||
val actions = db.actionsDao().actions()
|
val actions = db.actionsDao().actions()
|
||||||
|
|
||||||
@ -128,46 +132,6 @@ class LoadingWorker(val context: Context, params: WorkerParameters) : Worker(con
|
|||||||
return Result.success()
|
return Result.success()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun storeItems(response: Response<List<Item>>, newItems: Boolean, notifyNewItems: Boolean, notificationManager: NotificationManager) {
|
|
||||||
thread {
|
|
||||||
if (response.body() != null) {
|
|
||||||
val apiItems = (response.body() as ArrayList<Item>)
|
|
||||||
|
|
||||||
if (newItems) {
|
|
||||||
db.itemsDao().deleteAllItems()
|
|
||||||
}
|
|
||||||
db.itemsDao()
|
|
||||||
.insertAllItems(*(apiItems.map { it.toEntity() }).toTypedArray())
|
|
||||||
|
|
||||||
val newSize = apiItems.filter { it.unread }.size
|
|
||||||
if (newItems && notifyNewItems && newSize > 0) {
|
|
||||||
|
|
||||||
val intent = Intent(context, MainActivity::class.java).apply {
|
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
|
||||||
}
|
|
||||||
val pendingIntent: PendingIntent = PendingIntent.getActivity(context, 0, intent, 0)
|
|
||||||
|
|
||||||
val newItemsNotification = NotificationCompat.Builder(applicationContext, Config.newItemsChannelId)
|
|
||||||
.setContentTitle(context.getString(R.string.new_items_notification_title))
|
|
||||||
.setContentText(context.getString(R.string.new_items_notification_text, newSize))
|
|
||||||
.setPriority(PRIORITY_DEFAULT)
|
|
||||||
.setChannelId(Config.newItemsChannelId)
|
|
||||||
.setContentIntent(pendingIntent)
|
|
||||||
.setAutoCancel(true)
|
|
||||||
.setSmallIcon(R.drawable.ic_tab_fiber_new_black_24dp)
|
|
||||||
|
|
||||||
Timer("", false).schedule(4000) {
|
|
||||||
notificationManager.notify(2, newItemsNotification.build())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
apiItems.map { it.preloadImages(context) }
|
|
||||||
}
|
|
||||||
Timer("", false).schedule(4000) {
|
|
||||||
notificationManager.cancel(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun <T> doAndReportOnFail(call: Call<T>, action: ActionEntity) {
|
private fun <T> doAndReportOnFail(call: Call<T>, action: ActionEntity) {
|
||||||
call.enqueue(object : Callback<T> {
|
call.enqueue(object : Callback<T> {
|
||||||
override fun onResponse(
|
override fun onResponse(
|
||||||
|
@ -29,7 +29,6 @@ import apps.amine.bou.readerforselfoss.api.mercury.ParsedContent
|
|||||||
import apps.amine.bou.readerforselfoss.api.selfoss.Item
|
import apps.amine.bou.readerforselfoss.api.selfoss.Item
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
||||||
import apps.amine.bou.readerforselfoss.databinding.FragmentArticleBinding
|
|
||||||
import apps.amine.bou.readerforselfoss.persistence.database.AppDatabase
|
import apps.amine.bou.readerforselfoss.persistence.database.AppDatabase
|
||||||
import apps.amine.bou.readerforselfoss.persistence.entities.ActionEntity
|
import apps.amine.bou.readerforselfoss.persistence.entities.ActionEntity
|
||||||
import apps.amine.bou.readerforselfoss.persistence.migrations.MIGRATION_1_2
|
import apps.amine.bou.readerforselfoss.persistence.migrations.MIGRATION_1_2
|
||||||
@ -51,6 +50,7 @@ import com.bumptech.glide.Glide
|
|||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import com.github.rubensousa.floatingtoolbar.FloatingToolbar
|
import com.github.rubensousa.floatingtoolbar.FloatingToolbar
|
||||||
|
import kotlinx.android.synthetic.main.fragment_article.view.*
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
@ -77,8 +77,8 @@ class ArticleFragment : Fragment() {
|
|||||||
private lateinit var db: AppDatabase
|
private lateinit var db: AppDatabase
|
||||||
private lateinit var textAlignment: String
|
private lateinit var textAlignment: String
|
||||||
private lateinit var config: Config
|
private lateinit var config: Config
|
||||||
private var _binding: FragmentArticleBinding? = null
|
|
||||||
private val binding get() = _binding!!
|
private var rootView: ViewGroup? = null
|
||||||
|
|
||||||
private lateinit var prefs: SharedPreferences
|
private lateinit var prefs: SharedPreferences
|
||||||
|
|
||||||
@ -94,16 +94,16 @@ class ArticleFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
appColors = AppColors(requireActivity())
|
appColors = AppColors(activity!!)
|
||||||
config = Config(requireActivity())
|
config = Config(activity!!)
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
pageNumber = requireArguments().getInt(ARG_POSITION)
|
pageNumber = arguments!!.getInt(ARG_POSITION)
|
||||||
allItems = requireArguments().getParcelableArrayList<Item>(ARG_ITEMS) as ArrayList<Item>
|
allItems = arguments!!.getParcelableArrayList<Item>(ARG_ITEMS) as ArrayList<Item>
|
||||||
|
|
||||||
db = Room.databaseBuilder(
|
db = Room.databaseBuilder(
|
||||||
requireContext(),
|
context!!,
|
||||||
AppDatabase::class.java, "selfoss-database"
|
AppDatabase::class.java, "selfoss-database"
|
||||||
).addMigrations(MIGRATION_1_2).addMigrations(MIGRATION_2_3).addMigrations(MIGRATION_3_4).build()
|
).addMigrations(MIGRATION_1_2).addMigrations(MIGRATION_2_3).addMigrations(MIGRATION_3_4).build()
|
||||||
}
|
}
|
||||||
@ -114,12 +114,13 @@ class ArticleFragment : Fragment() {
|
|||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
try {
|
try {
|
||||||
_binding = FragmentArticleBinding.inflate(inflater, container, false)
|
rootView = inflater
|
||||||
|
.inflate(R.layout.fragment_article, container, false) as ViewGroup
|
||||||
|
|
||||||
url = allItems[pageNumber.toInt()].getLinkDecoded()
|
url = allItems[pageNumber.toInt()].getLinkDecoded()
|
||||||
contentText = allItems[pageNumber.toInt()].content
|
contentText = allItems[pageNumber.toInt()].content
|
||||||
contentTitle = allItems[pageNumber.toInt()].getTitleDecoded()
|
contentTitle = allItems[pageNumber.toInt()].getTitleDecoded()
|
||||||
contentImage = allItems[pageNumber.toInt()].getThumbnail(requireActivity())
|
contentImage = allItems[pageNumber.toInt()].getThumbnail(activity!!)
|
||||||
contentSource = allItems[pageNumber.toInt()].sourceAndDateText()
|
contentSource = allItems[pageNumber.toInt()].sourceAndDateText()
|
||||||
allImages = allItems[pageNumber.toInt()].getImages()
|
allImages = allItems[pageNumber.toInt()].getImages()
|
||||||
|
|
||||||
@ -129,11 +130,11 @@ class ArticleFragment : Fragment() {
|
|||||||
|
|
||||||
font = prefs.getString("reader_font", "")!!
|
font = prefs.getString("reader_font", "")!!
|
||||||
if (font.isNotEmpty()) {
|
if (font.isNotEmpty()) {
|
||||||
resId = requireContext().resources.getIdentifier(font, "font", requireContext().packageName)
|
resId = context!!.resources.getIdentifier(font, "font", context!!.packageName)
|
||||||
typeface = try {
|
typeface = try {
|
||||||
ResourcesCompat.getFont(requireContext(), resId)!!
|
ResourcesCompat.getFont(context!!, resId)!!
|
||||||
} catch (e: java.lang.Exception) {
|
} catch (e: java.lang.Exception) {
|
||||||
// ACRA.getErrorReporter().maybeHandleSilentException(Throwable("Font loading issue: ${e.message}"), requireContext())
|
// ACRA.getErrorReporter().maybeHandleSilentException(Throwable("Font loading issue: ${e.message}"), context!!)
|
||||||
// Just to be sure
|
// Just to be sure
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
@ -141,27 +142,27 @@ class ArticleFragment : Fragment() {
|
|||||||
|
|
||||||
refreshAlignment()
|
refreshAlignment()
|
||||||
|
|
||||||
val settings = requireActivity().getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE)
|
val settings = activity!!.getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE)
|
||||||
|
|
||||||
val api = SelfossApi(
|
val api = SelfossApi(
|
||||||
requireContext(),
|
context!!,
|
||||||
requireActivity(),
|
activity!!,
|
||||||
settings.getBoolean("isSelfSignedCert", false),
|
settings.getBoolean("isSelfSignedCert", false),
|
||||||
prefs.getString("api_timeout", "-1")!!.toLong()
|
prefs.getString("api_timeout", "-1")!!.toLong()
|
||||||
)
|
)
|
||||||
|
|
||||||
fab = binding.fab
|
fab = rootView!!.fab
|
||||||
|
|
||||||
fab.backgroundTintList = ColorStateList.valueOf(appColors.colorAccent)
|
fab.backgroundTintList = ColorStateList.valueOf(appColors.colorAccent)
|
||||||
|
|
||||||
fab.rippleColor = appColors.colorAccentDark
|
fab.rippleColor = appColors.colorAccentDark
|
||||||
|
|
||||||
val floatingToolbar: FloatingToolbar = binding.floatingToolbar
|
val floatingToolbar: FloatingToolbar = rootView!!.floatingToolbar
|
||||||
floatingToolbar.attachFab(fab)
|
floatingToolbar.attachFab(fab)
|
||||||
|
|
||||||
floatingToolbar.background = ColorDrawable(appColors.colorAccent)
|
floatingToolbar.background = ColorDrawable(appColors.colorAccent)
|
||||||
|
|
||||||
val customTabsIntent = requireActivity().buildCustomTabsIntent()
|
val customTabsIntent = activity!!.buildCustomTabsIntent()
|
||||||
mCustomTabActivityHelper = CustomTabActivityHelper()
|
mCustomTabActivityHelper = CustomTabActivityHelper()
|
||||||
mCustomTabActivityHelper!!.bindCustomTabsService(activity)
|
mCustomTabActivityHelper!!.bindCustomTabsService(activity)
|
||||||
|
|
||||||
@ -171,17 +172,17 @@ class ArticleFragment : Fragment() {
|
|||||||
override fun onItemClick(item: MenuItem) {
|
override fun onItemClick(item: MenuItem) {
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.more_action -> getContentFromMercury(customTabsIntent, prefs)
|
R.id.more_action -> getContentFromMercury(customTabsIntent, prefs)
|
||||||
R.id.share_action -> requireActivity().shareLink(url, contentTitle)
|
R.id.share_action -> activity!!.shareLink(url, contentTitle)
|
||||||
R.id.open_action -> requireActivity().openItemUrl(
|
R.id.open_action -> activity!!.openItemUrl(
|
||||||
allItems,
|
allItems,
|
||||||
pageNumber.toInt(),
|
pageNumber.toInt(),
|
||||||
url,
|
url,
|
||||||
customTabsIntent,
|
customTabsIntent,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
requireActivity()
|
activity!!
|
||||||
)
|
)
|
||||||
R.id.unread_action -> if ((context != null && requireContext().isNetworkAccessible(null)) || context == null) {
|
R.id.unread_action -> if ((context != null && context!!.isNetworkAccessible(null)) || context == null) {
|
||||||
api.unmarkItem(allItems[pageNumber.toInt()].id).enqueue(
|
api.unmarkItem(allItems[pageNumber.toInt()].id).enqueue(
|
||||||
object : Callback<SuccessResponse> {
|
object : Callback<SuccessResponse> {
|
||||||
override fun onResponse(
|
override fun onResponse(
|
||||||
@ -211,35 +212,35 @@ class ArticleFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.source.text = contentSource
|
rootView!!.source.text = contentSource
|
||||||
if (typeface != null) {
|
if (typeface != null) {
|
||||||
binding.source.typeface = typeface
|
rootView!!.source.typeface = typeface
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentText.isEmptyOrNullOrNullString()) {
|
if (contentText.isEmptyOrNullOrNullString()) {
|
||||||
getContentFromMercury(customTabsIntent, prefs)
|
getContentFromMercury(customTabsIntent, prefs)
|
||||||
} else {
|
} else {
|
||||||
binding.titleView.text = contentTitle
|
rootView!!.titleView.text = contentTitle
|
||||||
if (typeface != null) {
|
if (typeface != null) {
|
||||||
binding.titleView.typeface = typeface
|
rootView!!.titleView.typeface = typeface
|
||||||
}
|
}
|
||||||
|
|
||||||
htmlToWebview()
|
htmlToWebview()
|
||||||
|
|
||||||
if (!contentImage.isEmptyOrNullOrNullString() && context != null) {
|
if (!contentImage.isEmptyOrNullOrNullString() && context != null) {
|
||||||
binding.imageView.visibility = View.VISIBLE
|
rootView!!.imageView.visibility = View.VISIBLE
|
||||||
Glide
|
Glide
|
||||||
.with(requireContext())
|
.with(context!!)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.loadMaybeBasicAuth(config, contentImage)
|
.loadMaybeBasicAuth(config, contentImage)
|
||||||
.apply(RequestOptions.fitCenterTransform())
|
.apply(RequestOptions.fitCenterTransform())
|
||||||
.into(binding.imageView)
|
.into(rootView!!.imageView)
|
||||||
} else {
|
} else {
|
||||||
binding.imageView.visibility = View.GONE
|
rootView!!.imageView.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.nestedScrollView.setOnScrollChangeListener(
|
rootView!!.nestedScrollView.setOnScrollChangeListener(
|
||||||
NestedScrollView.OnScrollChangeListener { _, _, scrollY, _, oldScrollY ->
|
NestedScrollView.OnScrollChangeListener { _, _, scrollY, _, oldScrollY ->
|
||||||
if (scrollY > oldScrollY) {
|
if (scrollY > oldScrollY) {
|
||||||
fab.hide()
|
fab.hide()
|
||||||
@ -250,27 +251,22 @@ class ArticleFragment : Fragment() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
} catch (e: InflateException) {
|
} catch (e: InflateException) {
|
||||||
AlertDialog.Builder(requireContext())
|
AlertDialog.Builder(context!!)
|
||||||
.setMessage(requireContext().getString(R.string.webview_dialog_issue_message))
|
.setMessage(context!!.getString(R.string.webview_dialog_issue_message))
|
||||||
.setTitle(requireContext().getString(R.string.webview_dialog_issue_title))
|
.setTitle(context!!.getString(R.string.webview_dialog_issue_title))
|
||||||
.setPositiveButton(android.R.string.ok
|
.setPositiveButton(android.R.string.ok
|
||||||
) { dialog, which ->
|
) { dialog, which ->
|
||||||
val sharedPref = PreferenceManager.getDefaultSharedPreferences(requireContext())
|
val sharedPref = PreferenceManager.getDefaultSharedPreferences(context!!)
|
||||||
val editor = sharedPref.edit()
|
val editor = sharedPref.edit()
|
||||||
editor.putBoolean("prefer_article_viewer", false)
|
editor.putBoolean("prefer_article_viewer", false)
|
||||||
editor.commit()
|
editor.commit()
|
||||||
requireActivity().finish()
|
activity!!.finish()
|
||||||
}
|
}
|
||||||
.create()
|
.create()
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
return binding.root
|
return rootView
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroyView() {
|
|
||||||
super.onDestroyView()
|
|
||||||
_binding = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun refreshAlignment() {
|
private fun refreshAlignment() {
|
||||||
@ -285,8 +281,8 @@ class ArticleFragment : Fragment() {
|
|||||||
customTabsIntent: CustomTabsIntent,
|
customTabsIntent: CustomTabsIntent,
|
||||||
prefs: SharedPreferences
|
prefs: SharedPreferences
|
||||||
) {
|
) {
|
||||||
if ((context != null && requireContext().isNetworkAccessible(null)) || context == null) {
|
if ((context != null && context!!.isNetworkAccessible(null)) || context == null) {
|
||||||
binding.progressBar.visibility = View.VISIBLE
|
rootView!!.progressBar.visibility = View.VISIBLE
|
||||||
val parser = MercuryApi()
|
val parser = MercuryApi()
|
||||||
|
|
||||||
parser.parseUrl(url).enqueue(
|
parser.parseUrl(url).enqueue(
|
||||||
@ -299,9 +295,9 @@ class ArticleFragment : Fragment() {
|
|||||||
try {
|
try {
|
||||||
if (response.body() != null && response.body()!!.content != null && !response.body()!!.content.isNullOrEmpty()) {
|
if (response.body() != null && response.body()!!.content != null && !response.body()!!.content.isNullOrEmpty()) {
|
||||||
try {
|
try {
|
||||||
binding.titleView.text = response.body()!!.title
|
rootView!!.titleView.text = response.body()!!.title
|
||||||
if (typeface != null) {
|
if (typeface != null) {
|
||||||
binding.titleView.typeface = typeface
|
rootView!!.titleView.typeface = typeface
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// Note: Mercury may return relative urls... If it does the url val will not be changed.
|
// Note: Mercury may return relative urls... If it does the url val will not be changed.
|
||||||
@ -321,18 +317,18 @@ class ArticleFragment : Fragment() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (response.body()!!.lead_image_url != null && !response.body()!!.lead_image_url.isNullOrEmpty() && context != null) {
|
if (response.body()!!.lead_image_url != null && !response.body()!!.lead_image_url.isNullOrEmpty() && context != null) {
|
||||||
binding.imageView.visibility = View.VISIBLE
|
rootView!!.imageView.visibility = View.VISIBLE
|
||||||
try {
|
try {
|
||||||
Glide
|
Glide
|
||||||
.with(requireContext())
|
.with(context!!)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.loadMaybeBasicAuth(config, response.body()!!.lead_image_url.orEmpty())
|
.loadMaybeBasicAuth(config, response.body()!!.lead_image_url.orEmpty())
|
||||||
.apply(RequestOptions.fitCenterTransform())
|
.apply(RequestOptions.fitCenterTransform())
|
||||||
.into(binding.imageView)
|
.into(rootView!!.imageView)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
binding.imageView.visibility = View.GONE
|
rootView!!.imageView.visibility = View.GONE
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
@ -340,9 +336,9 @@ class ArticleFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
binding.nestedScrollView.scrollTo(0, 0)
|
rootView!!.nestedScrollView.scrollTo(0, 0)
|
||||||
|
|
||||||
binding.progressBar.visibility = View.GONE
|
rootView!!.progressBar.visibility = View.GONE
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
}
|
}
|
||||||
@ -374,32 +370,32 @@ class ArticleFragment : Fragment() {
|
|||||||
val stringColor = String.format("#%06X", 0xFFFFFF and appColors.colorAccent)
|
val stringColor = String.format("#%06X", 0xFFFFFF and appColors.colorAccent)
|
||||||
|
|
||||||
val attrs: IntArray = intArrayOf(android.R.attr.fontFamily)
|
val attrs: IntArray = intArrayOf(android.R.attr.fontFamily)
|
||||||
val a: TypedArray = requireContext().obtainStyledAttributes(resId, attrs)
|
val a: TypedArray = context!!.obtainStyledAttributes(resId, attrs)
|
||||||
|
|
||||||
|
|
||||||
binding.webcontent.settings.standardFontFamily = a.getString(0)
|
rootView!!.webcontent.settings.standardFontFamily = a.getString(0)
|
||||||
binding.webcontent.visibility = View.VISIBLE
|
rootView!!.webcontent.visibility = View.VISIBLE
|
||||||
val (textColor, backgroundColor) = if (appColors.isDarkTheme) {
|
val (textColor, backgroundColor) = if (appColors.isDarkTheme) {
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
binding.webcontent.setBackgroundColor(
|
rootView!!.webcontent.setBackgroundColor(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
requireContext(),
|
context!!,
|
||||||
R.color.dark_webview
|
R.color.dark_webview
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
Pair(ContextCompat.getColor(requireContext(), R.color.dark_webview_text), ContextCompat.getColor(requireContext(), R.color.dark_webview))
|
Pair(ContextCompat.getColor(context!!, R.color.dark_webview_text), ContextCompat.getColor(context!!, R.color.dark_webview))
|
||||||
} else {
|
} else {
|
||||||
Pair(null, null)
|
Pair(null, null)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
binding.webcontent.setBackgroundColor(
|
rootView!!.webcontent.setBackgroundColor(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
requireContext(),
|
context!!,
|
||||||
R.color.light_webview
|
R.color.light_webview
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
Pair(ContextCompat.getColor(requireContext(), R.color.light_webview_text), ContextCompat.getColor(requireContext(), R.color.light_webview))
|
Pair(ContextCompat.getColor(context!!, R.color.light_webview_text), ContextCompat.getColor(context!!, R.color.light_webview))
|
||||||
} else {
|
} else {
|
||||||
Pair(null, null)
|
Pair(null, null)
|
||||||
}
|
}
|
||||||
@ -417,14 +413,14 @@ class ArticleFragment : Fragment() {
|
|||||||
"#FFFFFF"
|
"#FFFFFF"
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.webcontent.settings.useWideViewPort = true
|
rootView!!.webcontent.settings.useWideViewPort = true
|
||||||
binding.webcontent.settings.loadWithOverviewMode = true
|
rootView!!.webcontent.settings.loadWithOverviewMode = true
|
||||||
binding.webcontent.settings.javaScriptEnabled = false
|
rootView!!.webcontent.settings.javaScriptEnabled = false
|
||||||
|
|
||||||
binding.webcontent.webViewClient = object : WebViewClient() {
|
rootView!!.webcontent.webViewClient = object : WebViewClient() {
|
||||||
override fun shouldOverrideUrlLoading(view: WebView?, url : String): Boolean {
|
override fun shouldOverrideUrlLoading(view: WebView?, url : String): Boolean {
|
||||||
if (binding.webcontent.hitTestResult.type != WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
|
if (rootView!!.webcontent.hitTestResult.type != WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
|
||||||
requireContext().startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
|
rootView!!.context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -460,13 +456,13 @@ class ArticleFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
binding.webcontent.setOnTouchListener { _, event -> gestureDetector.onTouchEvent(event)}
|
rootView!!.webcontent.setOnTouchListener { _, event -> gestureDetector.onTouchEvent(event)}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
binding.webcontent.settings.layoutAlgorithm =
|
rootView!!.webcontent.settings.layoutAlgorithm =
|
||||||
WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING
|
WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING
|
||||||
} else {
|
} else {
|
||||||
binding.webcontent.settings.layoutAlgorithm = WebSettings.LayoutAlgorithm.SINGLE_COLUMN
|
rootView!!.webcontent.settings.layoutAlgorithm = WebSettings.LayoutAlgorithm.SINGLE_COLUMN
|
||||||
}
|
}
|
||||||
|
|
||||||
var baseUrl: String? = null
|
var baseUrl: String? = null
|
||||||
@ -495,7 +491,7 @@ class ArticleFragment : Fragment() {
|
|||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.webcontent.loadDataWithBaseURL(
|
rootView!!.webcontent.loadDataWithBaseURL(
|
||||||
baseUrl,
|
baseUrl,
|
||||||
"""<html>
|
"""<html>
|
||||||
|<head>
|
|<head>
|
||||||
@ -548,15 +544,15 @@ class ArticleFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun openInBrowserAfterFailing(customTabsIntent: CustomTabsIntent) {
|
private fun openInBrowserAfterFailing(customTabsIntent: CustomTabsIntent) {
|
||||||
binding.progressBar.visibility = View.GONE
|
rootView!!.progressBar.visibility = View.GONE
|
||||||
requireActivity().openItemUrl(
|
activity!!.openItemUrl(
|
||||||
allItems,
|
allItems,
|
||||||
pageNumber.toInt(),
|
pageNumber.toInt(),
|
||||||
url,
|
url,
|
||||||
customTabsIntent,
|
customTabsIntent,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
requireActivity()
|
activity!!
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,10 +574,10 @@ class ArticleFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun performClick(): Boolean {
|
fun performClick(): Boolean {
|
||||||
if (binding.webcontent.hitTestResult.type == WebView.HitTestResult.IMAGE_TYPE ||
|
if (rootView!!.webcontent.hitTestResult.type == WebView.HitTestResult.IMAGE_TYPE ||
|
||||||
binding.webcontent.hitTestResult.type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
|
rootView!!.webcontent.hitTestResult.type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
|
||||||
|
|
||||||
val position : Int = allImages.indexOf(binding.webcontent.hitTestResult.extra)
|
val position : Int = allImages.indexOf(rootView!!.webcontent.hitTestResult.extra)
|
||||||
|
|
||||||
val intent = Intent(activity, ImageActivity::class.java)
|
val intent = Intent(activity, ImageActivity::class.java)
|
||||||
intent.putExtra("allImages", allImages)
|
intent.putExtra("allImages", allImages)
|
||||||
|
@ -4,17 +4,15 @@ import android.os.Bundle
|
|||||||
import android.view.*
|
import android.view.*
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import apps.amine.bou.readerforselfoss.R
|
import apps.amine.bou.readerforselfoss.R
|
||||||
import apps.amine.bou.readerforselfoss.databinding.FragmentImageBinding
|
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
|
import kotlinx.android.synthetic.main.fragment_image.view.*
|
||||||
|
|
||||||
class ImageFragment : Fragment() {
|
class ImageFragment : Fragment() {
|
||||||
|
|
||||||
private lateinit var imageUrl : String
|
private lateinit var imageUrl : String
|
||||||
private val glideOptions = RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.ALL)
|
private val glideOptions = RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.ALL)
|
||||||
private var _binding: FragmentImageBinding? = null
|
|
||||||
private val binding get() = _binding
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@ -23,24 +21,18 @@ class ImageFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
_binding = FragmentImageBinding.inflate(inflater, container, false)
|
val view : View = inflater.inflate(R.layout.fragment_image, container, false)
|
||||||
val view = binding?.root
|
|
||||||
|
|
||||||
binding!!.photoView.visibility = View.VISIBLE
|
view.photoView.visibility = View.VISIBLE
|
||||||
Glide.with(activity)
|
Glide.with(activity)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.apply(glideOptions)
|
.apply(glideOptions)
|
||||||
.load(imageUrl)
|
.load(imageUrl)
|
||||||
.into(binding!!.photoView)
|
.into(view.photoView)
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
|
||||||
super.onDestroyView()
|
|
||||||
_binding = null
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val ARG_IMAGE = "imageUrl"
|
private const val ARG_IMAGE = "imageUrl"
|
||||||
|
|
||||||
|
@ -40,8 +40,6 @@ class Config(c: Context) {
|
|||||||
|
|
||||||
const val newItemsChannelId = "new-items-channel-id"
|
const val newItemsChannelId = "new-items-channel-id"
|
||||||
|
|
||||||
var dateTimeFormatter = "yyyy-MM-dd HH:mm:ss"
|
|
||||||
|
|
||||||
fun logoutAndRedirect(
|
fun logoutAndRedirect(
|
||||||
c: Context,
|
c: Context,
|
||||||
callingActivity: Activity,
|
callingActivity: Activity,
|
||||||
|
@ -22,7 +22,7 @@ fun String.toTextDrawableString(c: Context): String {
|
|||||||
fun Item.sourceAndDateText(): String {
|
fun Item.sourceAndDateText(): String {
|
||||||
val formattedDate: String = try {
|
val formattedDate: String = try {
|
||||||
" " + DateUtils.getRelativeTimeSpanString(
|
" " + DateUtils.getRelativeTimeSpanString(
|
||||||
SimpleDateFormat(Config.dateTimeFormatter).parse(this.datetime).time,
|
SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(this.datetime).time,
|
||||||
Date().time,
|
Date().time,
|
||||||
DateUtils.MINUTE_IN_MILLIS,
|
DateUtils.MINUTE_IN_MILLIS,
|
||||||
DateUtils.FORMAT_ABBREV_RELATIVE
|
DateUtils.FORMAT_ABBREV_RELATIVE
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Els articles no es guardaran a la memòria del dispositiu i l\'aplicació no es podrà utilitzar sense connexió.</string>
|
<string name="pref_switch_items_caching_off">Els articles no es guardaran a la memòria del dispositiu i l\'aplicació no es podrà utilitzar sense connexió.</string>
|
||||||
<string name="pref_switch_items_caching_on">Els articles es guardaran a la memòria del dispositiu i es podran utilitzar sense connexió.</string>
|
<string name="pref_switch_items_caching_on">Els articles es guardaran a la memòria del dispositiu i es podran utilitzar sense connexió.</string>
|
||||||
<string name="pref_switch_items_caching">Guarda els elements per utilitzar-los sense connexió</string>
|
<string name="pref_switch_items_caching">Guarda els elements per utilitzar-los sense connexió</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Sense connexió!</string>
|
<string name="no_network_connectivity">Sense connexió!</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sincronitza els articles</string>
|
<string name="pref_switch_periodic_refresh">Sincronitza els articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Els articles no se sincronitzaran en segon pla</string>
|
<string name="pref_switch_periodic_refresh_off">Els articles no se sincronitzaran en segon pla</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Nicht verbunden !</string>
|
<string name="no_network_connectivity">Nicht verbunden !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Synchronisiere Artikel</string>
|
<string name="pref_switch_periodic_refresh">Synchronisiere Artikel</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Artikel werden nicht im Hintergrund synchronisiert</string>
|
<string name="pref_switch_periodic_refresh_off">Artikel werden nicht im Hintergrund synchronisiert</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Los artículos no se guardarán en la memoria del dispositivo y la aplicación no se podrá utilizar sin conexión.</string>
|
<string name="pref_switch_items_caching_off">Los artículos no se guardarán en la memoria del dispositivo y la aplicación no se podrá utilizar sin conexión.</string>
|
||||||
<string name="pref_switch_items_caching_on">Los artículos se guardarán en la memoria del dispositivo y se utilizarán para el uso sin conexión.</string>
|
<string name="pref_switch_items_caching_on">Los artículos se guardarán en la memoria del dispositivo y se utilizarán para el uso sin conexión.</string>
|
||||||
<string name="pref_switch_items_caching">Guardar elementos para uso sin conexión</string>
|
<string name="pref_switch_items_caching">Guardar elementos para uso sin conexión</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Sin conexión!</string>
|
<string name="no_network_connectivity">Sin conexión!</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sincronizar artículos</string>
|
<string name="pref_switch_periodic_refresh">Sincronizar artículos</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Los artículos no se sincronizarán en segundo plano</string>
|
<string name="pref_switch_periodic_refresh_off">Los artículos no se sincronizarán en segundo plano</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Not connected !</string>
|
<string name="no_network_connectivity">Not connected !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Les articles ne seront pas enregistrés et l\'application ne sera pas utilisable hors ligne.</string>
|
<string name="pref_switch_items_caching_off">Les articles ne seront pas enregistrés et l\'application ne sera pas utilisable hors ligne.</string>
|
||||||
<string name="pref_switch_items_caching_on">Les articles seront enregistrés et l\'application sera utilisable hors ligne.</string>
|
<string name="pref_switch_items_caching_on">Les articles seront enregistrés et l\'application sera utilisable hors ligne.</string>
|
||||||
<string name="pref_switch_items_caching">Sauvegarder les articles pour une utilisation hors ligne</string>
|
<string name="pref_switch_items_caching">Sauvegarder les articles pour une utilisation hors ligne</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Hors connexion !</string>
|
<string name="no_network_connectivity">Hors connexion !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Synchroniser les articles</string>
|
<string name="pref_switch_periodic_refresh">Synchroniser les articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Les articles ne seront pas synchronisés en arrière plan</string>
|
<string name="pref_switch_periodic_refresh_off">Les articles ne seront pas synchronisés en arrière plan</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Os artigos non se gardaran na memoria do dispositivo e non se poderá utilizar a aplicación sen conexión.</string>
|
<string name="pref_switch_items_caching_off">Os artigos non se gardaran na memoria do dispositivo e non se poderá utilizar a aplicación sen conexión.</string>
|
||||||
<string name="pref_switch_items_caching_on">Os artigos gardaranse na memoria do dispositivo e estarán dispoñibles sen conexión.</string>
|
<string name="pref_switch_items_caching_on">Os artigos gardaranse na memoria do dispositivo e estarán dispoñibles sen conexión.</string>
|
||||||
<string name="pref_switch_items_caching">Gardar elementos para uso sen conexión</string>
|
<string name="pref_switch_items_caching">Gardar elementos para uso sen conexión</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Non conectado!</string>
|
<string name="no_network_connectivity">Non conectado!</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sincronizar artigos</string>
|
<string name="pref_switch_periodic_refresh">Sincronizar artigos</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Os artigos non se sincronizarán coa aplicación de fondo</string>
|
<string name="pref_switch_periodic_refresh_off">Os artigos non se sincronizarán coa aplicación de fondo</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Not connected !</string>
|
<string name="no_network_connectivity">Not connected !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Not connected !</string>
|
<string name="no_network_connectivity">Not connected !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Not connected !</string>
|
<string name="no_network_connectivity">Not connected !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Not connected !</string>
|
<string name="no_network_connectivity">Not connected !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Not connected !</string>
|
<string name="no_network_connectivity">Not connected !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Not connected !</string>
|
<string name="no_network_connectivity">Not connected !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Not connected !</string>
|
<string name="no_network_connectivity">Not connected !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Not connected !</string>
|
<string name="no_network_connectivity">Not connected !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">文章不会被保存到设备内存,应用程序在离线时将无法阅读它们</string>
|
<string name="pref_switch_items_caching_off">文章不会被保存到设备内存,应用程序在离线时将无法阅读它们</string>
|
||||||
<string name="pref_switch_items_caching_on">文章将被保存到设备内存并可在离线时使用</string>
|
<string name="pref_switch_items_caching_on">文章将被保存到设备内存并可在离线时使用</string>
|
||||||
<string name="pref_switch_items_caching">保存项目以便离线使用</string>
|
<string name="pref_switch_items_caching">保存项目以便离线使用</string>
|
||||||
<string name="pref_switch_update_sources">检查新来源和标签</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">如果你的服务器接收过多的数据库查询,请禁用此功能。</string>
|
|
||||||
<string name="no_network_connectivity">未连接!</string>
|
<string name="no_network_connectivity">未连接!</string>
|
||||||
<string name="pref_switch_periodic_refresh">同步文章</string>
|
<string name="pref_switch_periodic_refresh">同步文章</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">文章将不会在后台同步</string>
|
<string name="pref_switch_periodic_refresh_off">文章将不会在后台同步</string>
|
||||||
|
@ -139,8 +139,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Not connected !</string>
|
<string name="no_network_connectivity">Not connected !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
||||||
|
@ -140,8 +140,6 @@
|
|||||||
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
<string name="pref_switch_items_caching_off">Articles won\'t be saved to the device memory, and the app won\'t be usable offline.</string>
|
||||||
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
<string name="pref_switch_items_caching_on">Articles will be saved to the device memory and will be used for offline use.</string>
|
||||||
<string name="pref_switch_items_caching">Save items for offline use</string>
|
<string name="pref_switch_items_caching">Save items for offline use</string>
|
||||||
<string name="pref_switch_update_sources">Check for new sources and tags</string>
|
|
||||||
<string name="pref_switch_update_sources_summary">Disable this if your server is receiving excessive amounts of database queries.</string>
|
|
||||||
<string name="no_network_connectivity">Not connected !</string>
|
<string name="no_network_connectivity">Not connected !</string>
|
||||||
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
<string name="pref_switch_periodic_refresh">Sync articles</string>
|
||||||
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
<string name="pref_switch_periodic_refresh_off">Articles will not be synced in the background</string>
|
||||||
|
@ -34,10 +34,4 @@
|
|||||||
android:key="notify_new_items"
|
android:key="notify_new_items"
|
||||||
android:dependency="periodic_refresh"
|
android:dependency="periodic_refresh"
|
||||||
android:title="@string/pref_switch_notify_new_items" />
|
android:title="@string/pref_switch_notify_new_items" />
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:key="update_sources"
|
|
||||||
android:summary="@string/pref_switch_update_sources_summary"
|
|
||||||
android:title="@string/pref_switch_update_sources" />
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
A new RSS reader for <a href="http://selfoss.aditu.de/">selfoss</a>.
|
|
||||||
|
|
||||||
What it does:
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Fetches read, unread, and favorite feeds.</li>
|
|
||||||
<li>Marking as read, marking as favorite.</li>
|
|
||||||
<li>Manage selfoss sources from the app.</li>
|
|
||||||
<li>Add an RSS feed from within the app, or by sharing a link from your browser.</li>
|
|
||||||
<li>Choose between multiple light and dark themes.</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
PS: It only works with Selfoss
|
|
Before Width: | Height: | Size: 266 KiB |
Before Width: | Height: | Size: 973 KiB |
Before Width: | Height: | Size: 457 KiB |
@ -1,3 +0,0 @@
|
|||||||
A new RSS reader for <a href="http://selfoss.aditu.de/">selfoss</a>.
|
|
||||||
|
|
||||||
It connects to your selfoss instance (works only with selfoss, and can't work without it), and you'll be able to read and manage all your RSS feeds.
|
|
@ -1 +0,0 @@
|
|||||||
Reader for Selfoss
|
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 422 KiB |