Skip to content

Commit

Permalink
tuning and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Feb 15, 2024
1 parent 9a96130 commit 0e36e6f
Show file tree
Hide file tree
Showing 14 changed files with 408 additions and 396 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ target/
build/
**/*.project
**/*.classpath
**/.directory

# Local configuration file (sdk path, etc)
local.properties
Expand Down
10 changes: 8 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android {
// Version code schema:
// "1.2.3-beta4" -> 1020304
// "1.2.3" -> 1020395
versionCode 3020095
versionName "3.2.0"
versionCode 3020096
versionName "3.2.1"

def commit = ""
try {
Expand Down Expand Up @@ -65,6 +65,12 @@ android {
signingConfig signingConfigs.releaseConfig
}
}
applicationVariants.all { variant ->
variant.outputs.all { output ->
def applicationName = "PodVinci"
outputFileName = "${applicationName}_${variant.buildType.name}_${defaultConfig.versionName}.apk"
}
}


androidResources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import java.lang.ref.WeakReference
*/
open class EpisodeItemListAdapter(mainActivity: MainActivity) : SelectableAdapter<EpisodeItemViewHolder?>(mainActivity),
View.OnCreateContextMenuListener {

private val mainActivityRef: WeakReference<MainActivity> = WeakReference<MainActivity>(mainActivity)
private var episodes: List<FeedItem> = ArrayList()
var longPressedItem: FeedItem? = null
Expand Down Expand Up @@ -178,18 +179,22 @@ open class EpisodeItemListAdapter(mainActivity: MainActivity) : SelectableAdapte
}

fun onContextItemSelected(item: MenuItem): Boolean {
if (item.itemId == R.id.multi_select) {
startSelectMode(longPressedPosition)
return true
} else if (item.itemId == R.id.select_all_above) {
setSelected(0, longPressedPosition, true)
return true
} else if (item.itemId == R.id.select_all_below) {
shouldSelectLazyLoadedItems = true
setSelected(longPressedPosition + 1, itemCount, true)
return true
when (item.itemId) {
R.id.multi_select -> {
startSelectMode(longPressedPosition)
return true
}
R.id.select_all_above -> {
setSelected(0, longPressedPosition, true)
return true
}
R.id.select_all_below -> {
shouldSelectLazyLoadedItems = true
setSelected(longPressedPosition + 1, itemCount, true)
return true
}
else -> return false
}
return false
}

val selectedItems: List<Any>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ac.mdiq.podvinci.R
*/
abstract class SelectableAdapter<T : RecyclerView.ViewHolder?>(private val activity: Activity) :
RecyclerView.Adapter<T>() {

private var actionMode: ActionMode? = null
private val selectedIds = HashSet<Long>()
private var onSelectModeListener: OnSelectModeListener? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,8 @@ class FeedItemlistFragment : Fragment(), AdapterView.OnItemClickListener, Toolba
.subscribe(
{ result: Feed? ->
feed = result
if (feed != null) swipeActions?.setFilter(feed!!.itemFilter)
Log.d(TAG, "loadItems subscribe called ${feed?.title}")
swipeActions?.setFilter(feed?.itemFilter)
refreshHeaderView()
viewBinding!!.progressBar.visibility = View.GONE
adapter?.setDummyViews(0)
Expand All @@ -541,11 +542,12 @@ class FeedItemlistFragment : Fragment(), AdapterView.OnItemClickListener, Toolba

private fun loadData(): Feed? {
val feed: Feed = DBReader.getFeed(feedID, true) ?: return null
Log.d(TAG, "loadData got feed ${feed.title} with items: ${feed.items.size} ${feed.items[0].getPubDate()}")
if (feed.items.isNotEmpty()) {
DBReader.loadAdditionalFeedItemListData(feed.items)
if (feed.sortOrder != null) {
val feedItems: MutableList<FeedItem> = feed.items
FeedItemPermutors.getPermutor(feed.sortOrder!!).reorder(feedItems.toMutableList())
FeedItemPermutors.getPermutor(feed.sortOrder!!).reorder(feedItems)
feed.items = feedItems
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultCallback
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.result.contract.ActivityResultContracts.CreateDocument
Expand All @@ -33,12 +32,10 @@ import ac.mdiq.podvinci.core.export.ExportWriter
import ac.mdiq.podvinci.core.export.favorites.FavoritesWriter
import ac.mdiq.podvinci.core.export.html.HtmlWriter
import ac.mdiq.podvinci.core.export.opml.OpmlWriter
import ac.mdiq.podvinci.core.storage.DatabaseExporter
import ac.mdiq.podvinci.core.storage.DatabaseTransporter
import io.reactivex.Completable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.functions.Action
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import java.io.File
import java.text.SimpleDateFormat
Expand Down Expand Up @@ -237,7 +234,7 @@ class ImportExportPreferencesFragment : PreferenceFragmentCompat() {
}
val uri = result.data!!.data
progressDialog!!.show()
disposable = Completable.fromAction { DatabaseExporter.importBackup(uri, requireContext()) }
disposable = Completable.fromAction { DatabaseTransporter.importBackup(uri, requireContext()) }
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
Expand All @@ -251,7 +248,7 @@ class ImportExportPreferencesFragment : PreferenceFragmentCompat() {
return
}
progressDialog!!.show()
disposable = Completable.fromAction { DatabaseExporter.exportToDocument(uri, requireContext()) }
disposable = Completable.fromAction { DatabaseTransporter.exportToDocument(uri, requireContext()) }
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
Expand Down
Loading

0 comments on commit 0e36e6f

Please sign in to comment.