Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #211

Merged
merged 15 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
uses: actions/upload-artifact@v1
with:
name: apk
path: animeworld/build/outputs/apk/debug/animeworld-debug.apk
path: animeworld/build/outputs/apk/debug/animeworld-debug.apk
- name: Upload APK
uses: actions/upload-artifact@v1
with:
Expand Down
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

311 changes: 215 additions & 96 deletions UIViews/src/main/java/com/programmersbox/uiviews/AllFragment.kt

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions UIViews/src/main/java/com/programmersbox/uiviews/BaseFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,20 @@ abstract class BaseFragment : Fragment() {
}
}

abstract fun viewCreated(view: View, savedInstanceState: Bundle?)
}

abstract class BaseFragmentCompose : Fragment() {

private var hasInitializedRootView = false

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (!hasInitializedRootView) {
hasInitializedRootView = true
viewCreated(view, savedInstanceState)
}
}

abstract fun viewCreated(view: View, savedInstanceState: Bundle?)
}

This file was deleted.

14 changes: 11 additions & 3 deletions UIViews/src/main/java/com/programmersbox/uiviews/GenericInfo.kt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package com.programmersbox.uiviews

import android.content.Context
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable
import androidx.recyclerview.widget.RecyclerView
import com.programmersbox.favoritesdatabase.DbModel
import com.programmersbox.models.ApiService
import com.programmersbox.models.ChapterModel
import com.programmersbox.models.ItemModel
import com.programmersbox.sharedutils.AppUpdate

interface GenericInfo {

val apkString: AppUpdate.AppUpdates.() -> String?

fun createAdapter(context: Context, baseListFragment: BaseListFragment): ItemListAdapter<RecyclerView.ViewHolder>
fun createLayoutManager(context: Context): RecyclerView.LayoutManager
fun chapterOnClick(model: ChapterModel, allChapters: List<ChapterModel>, context: Context)
fun sourceList(): List<ApiService>
fun searchList(): List<ApiService> = sourceList()
Expand All @@ -23,4 +23,12 @@ interface GenericInfo {
@Composable
fun ComposeShimmerItem()

@Composable
fun ItemListView(
list: List<ItemModel>,
favorites: List<DbModel>,
listState: LazyListState,
onClick: (ItemModel) -> Unit
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.content.res.AppCompatResources
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
Expand All @@ -22,7 +25,7 @@ import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Cancel
import androidx.compose.material.icons.filled.CloudOff
import androidx.compose.material.icons.filled.VerticalAlignTop
import androidx.compose.material.icons.filled.KeyboardArrowUp
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.*
import androidx.compose.runtime.rxjava2.subscribeAsState
Expand Down Expand Up @@ -99,6 +102,7 @@ class GlobalSearchFragment : Fragment() {
var searchText by rememberSaveable { mutableStateOf(args.searchFor) }
val focusManager = LocalFocusManager.current
val listState = rememberLazyListState()
val showButton by remember { derivedStateOf { listState.firstVisibleItemIndex > 0 } }
val scope = rememberCoroutineScope()
val swipeRefreshState = rememberSwipeRefreshState(isRefreshing = false)
val list by searchPublisher.subscribeAsState(initial = emptyList())
Expand Down Expand Up @@ -206,9 +210,15 @@ class GlobalSearchFragment : Fragment() {
) {
Scaffold(
floatingActionButton = {
FloatingActionButton(
onClick = { scope.launch { listState.animateScrollToItem(0) } }
) { Icon(Icons.Default.VerticalAlignTop, null) }
AnimatedVisibility(
visible = showButton && searchText.isNotEmpty(),
enter = slideInVertically({ it / 2 }),
exit = slideOutVertically({ it / 2 })
) {
FloatingActionButton(
onClick = { scope.launch { listState.animateScrollToItem(0) } }
) { Icon(Icons.Default.KeyboardArrowUp, null) }
}
},
floatingActionButtonPosition = FabPosition.End
) {
Expand All @@ -227,7 +237,7 @@ class GlobalSearchFragment : Fragment() {
SearchCoverCard(
model = m,
placeHolder = AppCompatResources.getDrawable(LocalContext.current, mainLogo.logoId)
) { findNavController().navigate(GlobalSearchFragmentDirections.showDetails(m)) }
) { findNavController().navigate(GlobalNavDirections.showDetails(m)) }
}
}
}
Expand All @@ -251,20 +261,6 @@ class GlobalSearchFragment : Fragment() {
}
}
}

/*LaunchedEffect(key1 = searchText) {
snapshotFlow { searchText }
.debounce(1000)
.distinctUntilChanged()
.collect { s ->
println("Searching for $s")
searchForItems(
searchText = searchText,
onSubscribe = { swipeRefreshState.isRefreshing = true },
subscribe = { swipeRefreshState.isRefreshing = false }
)
}
}*/
}
}
}
Expand Down

This file was deleted.

Loading