mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
account name and pfp on settings page
This commit is contained in:
parent
1ff0b5dccd
commit
d6c5c69b97
3 changed files with 53 additions and 15 deletions
|
@ -19,11 +19,16 @@ import com.lagradost.cloudstream3.R
|
|||
import com.lagradost.cloudstream3.databinding.MainSettingsBinding
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.accountManagers
|
||||
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.aniListApi
|
||||
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.malApi
|
||||
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.simklApi
|
||||
import com.lagradost.cloudstream3.syncproviders.AuthAPI
|
||||
import com.lagradost.cloudstream3.ui.home.HomeFragment
|
||||
import com.lagradost.cloudstream3.ui.result.txt
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
|
||||
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
||||
import com.lagradost.cloudstream3.utils.UIHelper
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.clipboardHelper
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.navigate
|
||||
|
@ -136,8 +141,23 @@ class SettingsFragment : Fragment() {
|
|||
activity?.navigate(id, Bundle())
|
||||
}
|
||||
|
||||
// used to debug leaks showToast(activity,"${VideoDownloadManager.downloadStatusEvent.size} : ${VideoDownloadManager.downloadProgressEvent.size}")
|
||||
/** used to debug leaks
|
||||
showToast(activity,"${VideoDownloadManager.downloadStatusEvent.size} :
|
||||
${VideoDownloadManager.downloadProgressEvent.size}") **/
|
||||
// Check login status for each OAuth2 API
|
||||
val isSyncing = simklApi.loginInfo() != null || malApi.loginInfo() != null || aniListApi.loginInfo() != null
|
||||
|
||||
// show local account image and pfp when not syncing with any api.
|
||||
if (!isSyncing) {
|
||||
val currentAccount = DataStoreHelper.accounts.firstOrNull {
|
||||
it.keyIndex == DataStoreHelper.selectedKeyIndex
|
||||
} ?: DataStoreHelper.getDefaultAccount(activity ?: requireActivity())
|
||||
val name = currentAccount.name
|
||||
val image = currentAccount.image
|
||||
|
||||
binding?.settingsProfilePic?.setImage(image)
|
||||
binding?.settingsProfileText?.text = name
|
||||
} else {
|
||||
for (syncApi in accountManagers) {
|
||||
val login = syncApi.loginInfo()
|
||||
val pic = login?.profilePicture ?: continue
|
||||
|
@ -151,6 +171,8 @@ class SettingsFragment : Fragment() {
|
|||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding?.apply {
|
||||
listOf(
|
||||
settingsGeneral to R.id.action_navigation_global_to_navigation_settings_general,
|
||||
|
|
13
app/src/main/res/drawable/rounded_outline.xml
Normal file
13
app/src/main/res/drawable/rounded_outline.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@android:color/white">
|
||||
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="?attr/white" />
|
||||
<corners android:radius="@dimen/rounded_image_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
|
@ -24,7 +24,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
|
@ -36,7 +35,11 @@
|
|||
android:id="@+id/settings_profile_pic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:scaleType="centerCrop"
|
||||
android:foreground="@drawable/rounded_outline"
|
||||
tools:src="@drawable/profile_bg_orange"
|
||||
android:contentDescription="@string/account"/>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<TextView
|
||||
|
@ -50,7 +53,7 @@
|
|||
android:textColor="?attr/textColor"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="normal"
|
||||
tools:text="Hello world" />
|
||||
tools:text="Indus Aryan" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue