mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	added profile pic in settings
This commit is contained in:
		
							parent
							
								
									3656c7ee11
								
							
						
					
					
						commit
						ce452a731f
					
				
					 2 changed files with 54 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -8,13 +8,17 @@ import android.os.Bundle
 | 
			
		|||
import android.view.LayoutInflater
 | 
			
		||||
import android.view.View
 | 
			
		||||
import android.view.ViewGroup
 | 
			
		||||
import androidx.core.view.isVisible
 | 
			
		||||
import androidx.fragment.app.Fragment
 | 
			
		||||
import androidx.preference.Preference
 | 
			
		||||
import androidx.preference.PreferenceFragmentCompat
 | 
			
		||||
import androidx.preference.PreferenceManager
 | 
			
		||||
import com.lagradost.cloudstream3.R
 | 
			
		||||
import com.lagradost.cloudstream3.mvvm.logError
 | 
			
		||||
import com.lagradost.cloudstream3.syncproviders.OAuth2API
 | 
			
		||||
import com.lagradost.cloudstream3.ui.home.HomeFragment
 | 
			
		||||
import com.lagradost.cloudstream3.utils.UIHelper.navigate
 | 
			
		||||
import com.lagradost.cloudstream3.utils.UIHelper.setImage
 | 
			
		||||
import kotlinx.android.synthetic.main.main_settings.*
 | 
			
		||||
import java.io.File
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -97,6 +101,20 @@ class SettingsFragment : Fragment() {
 | 
			
		|||
 | 
			
		||||
        val isTrueTv = context?.isTrueTvSettings() == true
 | 
			
		||||
 | 
			
		||||
        for (syncApi in OAuth2API.OAuth2Apis) {
 | 
			
		||||
            val login = syncApi.loginInfo()
 | 
			
		||||
            val pic = login?.profilePicture ?: continue
 | 
			
		||||
            if (settings_profile_pic?.setImage(
 | 
			
		||||
                    pic,
 | 
			
		||||
                    errorImageDrawable = HomeFragment.errorProfilePic
 | 
			
		||||
                ) == true
 | 
			
		||||
            ) {
 | 
			
		||||
                settings_profile_text?.text = login.name
 | 
			
		||||
                settings_profile?.isVisible = true
 | 
			
		||||
                break
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        listOf(
 | 
			
		||||
            Pair(settings_player, R.id.action_navigation_settings_to_navigation_settings_player),
 | 
			
		||||
            Pair(settings_credits, R.id.action_navigation_settings_to_navigation_settings_account),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
        xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
        xmlns:tools="http://schemas.android.com/tools"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:background="?attr/primaryBlackBackground"
 | 
			
		||||
        android:layout_height="match_parent">
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +18,41 @@
 | 
			
		|||
                android:layout_width="match_parent"
 | 
			
		||||
                android:layout_height="wrap_content">
 | 
			
		||||
 | 
			
		||||
            <LinearLayout
 | 
			
		||||
                    android:visibility="gone"
 | 
			
		||||
                    tools:visibility="visible"
 | 
			
		||||
                    android:id="@+id/settings_profile"
 | 
			
		||||
                    android:padding="20dp"
 | 
			
		||||
                    android:orientation="horizontal"
 | 
			
		||||
                    android:layout_width="match_parent"
 | 
			
		||||
                    android:layout_height="wrap_content">
 | 
			
		||||
 | 
			
		||||
                <androidx.cardview.widget.CardView
 | 
			
		||||
                        app:cardCornerRadius="25dp"
 | 
			
		||||
                        android:layout_width="50dp"
 | 
			
		||||
                        android:layout_height="50dp">
 | 
			
		||||
 | 
			
		||||
                    <ImageView
 | 
			
		||||
                            android:id="@+id/settings_profile_pic"
 | 
			
		||||
                            android:layout_width="match_parent"
 | 
			
		||||
                            android:layout_height="match_parent"
 | 
			
		||||
                            tools:ignore="ContentDescription" />
 | 
			
		||||
                </androidx.cardview.widget.CardView>
 | 
			
		||||
 | 
			
		||||
                <TextView
 | 
			
		||||
                        android:id="@+id/settings_profile_text"
 | 
			
		||||
                        android:textSize="18sp"
 | 
			
		||||
                        android:textStyle="normal"
 | 
			
		||||
                        android:paddingStart="10dp"
 | 
			
		||||
                        android:paddingEnd="10dp"
 | 
			
		||||
                        tools:text="Hello world"
 | 
			
		||||
                        android:layout_gravity="center_vertical"
 | 
			
		||||
                        android:gravity="center_vertical"
 | 
			
		||||
                        android:textColor="?attr/textColor"
 | 
			
		||||
                        android:layout_width="wrap_content"
 | 
			
		||||
                        android:layout_height="wrap_content" />
 | 
			
		||||
            </LinearLayout>
 | 
			
		||||
 | 
			
		||||
            <TextView
 | 
			
		||||
                    android:nextFocusDown="@id/settings_lang"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue