refactor profiles, add scrolling to fragments (#101)

* refactor profiles, add scrolling

* Undo unwanted changes by merge
This commit is contained in:
Wv5twkFEKh54vo4tta9yu7dHa3 2020-04-10 12:55:02 +02:00 committed by GitHub
parent a14310bbfc
commit 2333e5ec11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 224 additions and 406 deletions

View File

@ -17,7 +17,7 @@ import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.h.pixeldroid.fragments.CameraFragment
import com.h.pixeldroid.fragments.feeds.HomeFragment
import com.h.pixeldroid.fragments.MyProfileFragment
import com.h.pixeldroid.fragments.ProfileFragment
import com.h.pixeldroid.fragments.feeds.NotificationsFragment
class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
@ -46,10 +46,11 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
val tabs = arrayOf(
HomeFragment(),
Fragment(),
CameraFragment(),
Fragment(),
CameraFragment(),
NotificationsFragment(),
MyProfileFragment())
ProfileFragment()
)
setupTabs(tabs)
}

View File

@ -1,104 +1,45 @@
package com.h.pixeldroid
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.graphics.Typeface
import android.net.Uri
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import android.view.ViewGroup
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.h.pixeldroid.api.PixelfedAPI
import com.h.pixeldroid.fragments.ProfileFragment
import com.h.pixeldroid.fragments.ProfilePostsRecyclerViewAdapter
import com.h.pixeldroid.objects.Account
import com.h.pixeldroid.objects.Account.Companion.ACCOUNT_TAG
import com.h.pixeldroid.objects.Status
import com.h.pixeldroid.utils.ImageConverter.Companion.setRoundImageFromURL
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class ProfileActivity : AppCompatActivity() {
private lateinit var adapter : ProfilePostsRecyclerViewAdapter
private lateinit var recycler : RecyclerView
private lateinit var preferences: SharedPreferences
lateinit var profileFragment : ProfileFragment
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_profile)
// Set RecyclerView as a grid with 3 columns
recycler = findViewById(R.id.profilePostsRecyclerView)
recycler.layoutManager = GridLayoutManager(this, 3)
adapter = ProfilePostsRecyclerViewAdapter(this)
recycler.adapter = adapter
preferences = getSharedPreferences(
"${BuildConfig.APPLICATION_ID}.pref", Context.MODE_PRIVATE
)
// Set profile according to given account
val account = intent.getSerializableExtra(ACCOUNT_TAG) as Account
setContent(account)
// Set profile picture
val profilePicture = findViewById<ImageView>(R.id.profilePictureImageView)
setRoundImageFromURL(View(this), account.avatar, profilePicture)
profileFragment = ProfileFragment()
val arguments = Bundle()
arguments.putSerializable("profileTag", account)
profileFragment.arguments = arguments
setPosts(account)
supportFragmentManager.beginTransaction()
.add(R.id.profileFragmentSingle, profileFragment).commit()
}
private fun setContent(account: Account) {
val profilePicture = findViewById<ImageView>(R.id.profilePictureImageView)
setRoundImageFromURL(View(this), account.avatar, profilePicture)
val description = findViewById<TextView>(R.id.descriptionTextView)
description.text = account.note
val accountName = findViewById<TextView>(R.id.accountNameTextView)
accountName.text = account.username
val nbPosts = findViewById<TextView>(R.id.nbPostsTextView)
nbPosts.text = "${account.statuses_count}\nPosts"
nbPosts.setTypeface(null, Typeface.BOLD)
val nbFollowers = findViewById<TextView>(R.id.nbFollowersTextView)
nbFollowers.text = "${account.followers_count}\nFollowers"
nbFollowers.setTypeface(null, Typeface.BOLD)
val nbFollowing = findViewById<TextView>(R.id.nbFollowingTextView)
nbFollowing.text = "${account.following_count}\nFollowing"
nbFollowing.setTypeface(null, Typeface.BOLD)
}
// Populate profile page with user's posts
private fun setPosts(account: Account) {
val pixelfedAPI = PixelfedAPI.create("${preferences.getString("domain", "")}")
val accessToken = preferences.getString("accessToken", "")
pixelfedAPI.accountPosts("Bearer $accessToken", account_id = account.id).enqueue(object :
Callback<List<Status>> {
override fun onFailure(call: Call<List<Status>>, t: Throwable) {
Log.e("ProfileFragment.Posts:", t.toString())
}
override fun onResponse(
call: Call<List<Status>>,
response: Response<List<Status>>
) {
if(response.code() == 200) {
val posts = ArrayList<Status>()
val statuses = response.body()!!
for(status in statuses) {
posts.add(status)
}
adapter.addPosts(posts)
}
}
})
}
}
}

View File

@ -1,135 +0,0 @@
package com.h.pixeldroid.fragments
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.graphics.Typeface
import android.net.Uri
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.h.pixeldroid.BuildConfig
import com.h.pixeldroid.R
import com.h.pixeldroid.api.PixelfedAPI
import com.h.pixeldroid.objects.Account
import com.h.pixeldroid.objects.Status
import com.h.pixeldroid.utils.ImageConverter.Companion.setRoundImageFromURL
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class MyProfileFragment : Fragment() {
private lateinit var preferences: SharedPreferences
private lateinit var adapter : ProfilePostsRecyclerViewAdapter
private lateinit var recycler : RecyclerView
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
preferences = this.requireActivity().getSharedPreferences(
"${BuildConfig.APPLICATION_ID}.pref", Context.MODE_PRIVATE
)
val view = inflater.inflate(R.layout.fragment_my_profile, container, false)
// Edit button redirects to pixelfed's "edit account" page
val editButton: Button = view.findViewById(R.id.editButton)
editButton.setOnClickListener((View.OnClickListener { onClickEditButton() }))
// Set RecyclerView as a grid with 3 columns
recycler = view.findViewById(R.id.myProfilePostsRecyclerView)
recycler.layoutManager = GridLayoutManager(context, 3)
adapter = ProfilePostsRecyclerViewAdapter(requireContext())
recycler.adapter = adapter
return view
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val pixelfedAPI = PixelfedAPI.create("${preferences.getString("domain", "")}")
val accessToken = preferences.getString("accessToken", "")
pixelfedAPI.verifyCredentials("Bearer $accessToken")
.enqueue(object : Callback<Account> {
override fun onResponse(call: Call<Account>, response: Response<Account>) {
if(response.code() == 200) {
val account = response.body()!!
setContent(view, account)
// Populate profile page with user's posts
pixelfedAPI.accountPosts("Bearer $accessToken", account_id = account.id).enqueue(object : Callback<List<Status>> {
override fun onFailure(call: Call<List<Status>>, t: Throwable) {
Log.e("ProfileFragment.Posts:", t.toString())
}
override fun onResponse(
call: Call<List<Status>>,
response: Response<List<Status>>
) {
if(response.code() == 200) {
val posts = ArrayList<Status>()
val statuses = response.body()!!
for (status in statuses) {
posts.add(status)
}
adapter.addPosts(posts)
}
}
})
}
}
override fun onFailure(call: Call<Account>, t: Throwable) {
Log.e("ProfileFragment:", t.toString())
}
})
}
// Populate myProfile page with user's data
private fun setContent(view: View, account: Account) {
val profilePicture = view.findViewById<ImageView>(R.id.profilePictureImageView)
setRoundImageFromURL(view, account.avatar, profilePicture)
val description = view.findViewById<TextView>(R.id.descriptionTextView)
description.text = account.note
val accountName = view.findViewById<TextView>(R.id.accountNameTextView)
accountName.text = account.username
accountName.setTypeface(null, Typeface.BOLD)
val nbPosts = view.findViewById<TextView>(R.id.nbPostsTextView)
nbPosts.text = "${account.statuses_count}\nPosts"
nbPosts.setTypeface(null, Typeface.BOLD)
val nbFollowers = view.findViewById<TextView>(R.id.nbFollowersTextView)
nbFollowers.text = "${account.followers_count}\nFollowers"
nbFollowers.setTypeface(null, Typeface.BOLD)
val nbFollowing = view.findViewById<TextView>(R.id.nbFollowingTextView)
nbFollowing.text = "${account.following_count}\nFollowing"
nbFollowing.setTypeface(null, Typeface.BOLD)
}
private fun onClickEditButton() {
val url = "${preferences.getString("domain", "")}/settings/home"
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
if(activity != null && browserIntent.resolveActivity(activity!!.packageManager) != null) {
startActivity(browserIntent)
} else {
val text = "Cannot open this link"
Log.e("ProfileFragment", text)
}
}
}

View File

@ -0,0 +1,127 @@
package com.h.pixeldroid.fragments
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.net.Uri
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.h.pixeldroid.BuildConfig
import com.h.pixeldroid.R
import com.h.pixeldroid.api.PixelfedAPI
import com.h.pixeldroid.objects.Account
import com.h.pixeldroid.objects.Status
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class ProfileFragment : Fragment() {
private lateinit var preferences: SharedPreferences
private lateinit var adapter : ProfilePostsRecyclerViewAdapter
private lateinit var recycler : RecyclerView
private var account: Account? = null
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
preferences = this.requireActivity().getSharedPreferences(
"${BuildConfig.APPLICATION_ID}.pref", Context.MODE_PRIVATE
)
account = arguments?.getSerializable("profileTag") as Account?
val view = inflater.inflate(R.layout.profile_fragment, container, false)
if(account == null) {
// Edit button redirects to Pixelfed's "edit account" page
val editButton: Button = view.findViewById(R.id.editButton)
editButton.visibility = View.VISIBLE
val followButton: Button = view.findViewById(R.id.followButton)
followButton.visibility = View.GONE
editButton.setOnClickListener((View.OnClickListener { onClickEditButton() }))
}
// Set RecyclerView as a grid with 3 columns
recycler = view.findViewById(R.id.profilePostsRecyclerView)
recycler.layoutManager = GridLayoutManager(context, 3)
adapter = ProfilePostsRecyclerViewAdapter(context!!)
recycler.adapter = adapter
return view
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val pixelfedAPI = PixelfedAPI.create("${preferences.getString("domain", "")}")
val accessToken = preferences.getString("accessToken", "")
if(account == null) {
pixelfedAPI.verifyCredentials("Bearer $accessToken")
.enqueue(object : Callback<Account> {
override fun onResponse(call: Call<Account>, response: Response<Account>) {
if (response.code() == 200) {
val account = response.body()!!
account.setContent(view)
// Populate profile page with user's posts
setPosts(account)
}
}
override fun onFailure(call: Call<Account>, t: Throwable) {
Log.e("ProfileFragment:", t.toString())
}
})
} else {
account!!.setContent(view)
setPosts(account!!)
}
}
// Populate profile page with user's posts
private fun setPosts(account: Account) {
val pixelfedAPI = PixelfedAPI.create("${preferences.getString("domain", "")}")
val accessToken = preferences.getString("accessToken", "")
pixelfedAPI.accountPosts("Bearer $accessToken", account_id = account.id).enqueue(object :
Callback<List<Status>> {
override fun onFailure(call: Call<List<Status>>, t: Throwable) {
Log.e("ProfileFragment.Posts:", t.toString())
}
override fun onResponse(
call: Call<List<Status>>,
response: Response<List<Status>>
) {
if(response.code() == 200) {
val posts = ArrayList<Status>()
val statuses = response.body()!!
for(status in statuses) {
posts.add(status)
}
adapter.addPosts(posts)
}
}
})
}
private fun onClickEditButton() {
val url = "${preferences.getString("domain", "")}/settings/home"
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
if(activity != null && browserIntent.resolveActivity(requireActivity().packageManager) != null) {
startActivity(browserIntent)
} else {
val text = "Cannot open this link"
Log.e("ProfileFragment", text)
}
}
}

View File

@ -2,8 +2,14 @@ package com.h.pixeldroid.objects
import android.content.Context
import android.content.Intent
import android.graphics.Typeface
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat.startActivity
import com.h.pixeldroid.ProfileActivity
import com.h.pixeldroid.R
import com.h.pixeldroid.utils.ImageConverter
import java.io.Serializable
/*
@ -48,5 +54,29 @@ data class Account(
intent.putExtra(Account.ACCOUNT_TAG, this)
startActivity(context, intent, null)
}
// Populate myProfile page with user's data
fun setContent(view: View) {
val profilePicture = view.findViewById<ImageView>(R.id.profilePictureImageView)
ImageConverter.setRoundImageFromURL(view, this.avatar, profilePicture)
val description = view.findViewById<TextView>(R.id.descriptionTextView)
description.text = this.note
val accountName = view.findViewById<TextView>(R.id.accountNameTextView)
accountName.text = this.username
accountName.setTypeface(null, Typeface.BOLD)
val nbPosts = view.findViewById<TextView>(R.id.nbPostsTextView)
nbPosts.text = "${this.statuses_count}\nPosts"
nbPosts.setTypeface(null, Typeface.BOLD)
val nbFollowers = view.findViewById<TextView>(R.id.nbFollowersTextView)
nbFollowers.text = "${this.followers_count}\nFollowers"
nbFollowers.setTypeface(null, Typeface.BOLD)
val nbFollowing = view.findViewById<TextView>(R.id.nbFollowingTextView)
nbFollowing.text = "${this.following_count}\nFollowing"
nbFollowing.setTypeface(null, Typeface.BOLD)
}
}

View File

@ -23,7 +23,7 @@ data class Status(
val visibility: Visibility,
val sensitive: Boolean,
val spoiler_text: String,
val media_attachments: List<Attachment>,
val media_attachments: List<Attachment>?,
val application: Application,
//Rendering attributes
val mentions: List<Mention>,
@ -56,9 +56,9 @@ data class Status(
const val POST_FRAG_TAG = "postFragTag"
}
fun getPostUrl() : String? = media_attachments.getOrNull(0)?.url
fun getPostUrl() : String? = media_attachments?.getOrNull(0)?.url
fun getProfilePicUrl() : String? = account.avatar
fun getPostPreviewURL() : String? = media_attachments.getOrNull(0)?.preview_url
fun getPostPreviewURL() : String? = media_attachments?.getOrNull(0)?.preview_url
fun getDescription() : CharSequence {
val description = content as CharSequence

View File

@ -6,156 +6,12 @@
android:layout_height="match_parent"
tools:context=".ProfileActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent"
android:layout_margin="20dp">
<ImageView
android:id="@+id/profilePictureImageView"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_weight="1"
tools:srcCompat="@tools:sample/avatars" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="10"
android:orientation="horizontal">
<TextView
android:id="@+id/nbPostsTextView"
android:layout_width="15dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="-\nPosts" />
<TextView
android:id="@+id/nbFollowersTextView"
android:layout_width="15dp"
android:layout_height="120dp"
android:layout_weight="1"
android:gravity="center"
android:text="-\nFollowers" />
<TextView
android:id="@+id/nbFollowingTextView"
android:layout_width="15dp"
android:layout_height="120dp"
android:layout_weight="1"
android:gravity="center"
android:text="-\nFollowing" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp">
<TextView
android:id="@+id/accountNameTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="No Username"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp">
<TextView
android:id="@+id/descriptionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:layout_marginLeft="50dp"
android:layout_marginBottom="15dp">
<Button
android:id="@+id/followButton"
android:layout_width="100dp"
android:layout_height="30dp"
android:background="@color/browser_actions_divider_color"
android:text="Follow"
android:textColor="@color/colorPrimary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent">
<ImageButton
android:id="@+id/postsButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:src="@android:drawable/ic_dialog_dialer" />
<ImageButton
android:id="@+id/collectionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:src="@android:drawable/ic_menu_gallery" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/profilePostsRecyclerView"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="16dp"
app:layoutManager="LinearLayoutManager"
tools:context=".fragments.MyProfileFragment"
tools:listitem="@layout/fragment_profile_posts"/>
</LinearLayout>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/profileFragmentSingle"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -6,18 +6,15 @@
android:layout_height="wrap_content"
tools:context=".fragments.PostFragment">
<androidx.constraintlayout.widget.ConstraintLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="0dp">
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
@ -52,9 +49,9 @@
<ImageView
android:id="@+id/postPicture"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@ -124,9 +121,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</FrameLayout>

View File

@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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:layout_height="match_parent"
tools:context=".fragments.MyProfileFragment">
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/linearlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -23,9 +23,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent"
android:layout_margin="20dp">
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/profilePictureImageView"
@ -72,8 +72,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_marginRight="20dp">
<TextView
@ -88,10 +88,10 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp">
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/descriptionTextView"
@ -104,10 +104,20 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="15dp">
<Button
android:id="@+id/followButton"
android:layout_width="100dp"
android:layout_height="30dp"
android:background="@color/browser_actions_divider_color"
android:text="Follow"
android:textColor="@color/colorPrimary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/editButton"
android:layout_width="match_parent"
@ -115,6 +125,7 @@
android:background="@color/colorPrimary"
android:text="Edit profile"
android:textColor="@color/cardview_light_background"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@ -145,29 +156,21 @@
android:layout_weight="1"
android:background="@color/colorPrimary"
android:src="@android:drawable/ic_menu_gallery" />
<ImageButton
android:id="@+id/bookmarkButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:src="@android:drawable/ic_input_get" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/profilePostsRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/myProfilePostsRecyclerView"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="16dp"
android:layout_marginRight="5dp"
app:layoutManager="LinearLayoutManager"
tools:context=".fragments.MyProfileFragment"
tools:listitem="@layout/fragment_profile_posts"/>
tools:context=".fragments.ProfileFragment"
tools:listitem="@layout/fragment_profile_posts" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -211,7 +211,7 @@ fun assertStatusEqualsToReference(actual: Status){
actual.account.avatar_static=="https://pixelfed.de/storage/avatars/011/511/416/644/397/056/0/ZhaopLJWTWJ3hsVCS5pS_avatar.png?v=d4735e3a265e16eee03f59718b9b5d03019c07d8b6c51f90da3a666eec13ab35"&&
actual.account.header==""&& actual.account.header_static=="") && !actual.account.locked && actual.account.emojis== emptyList<Emoji>() && !actual.account.discoverable && actual.account.created_at=="2019-12-24T15:42:35.000000Z" && actual.account.statuses_count==71 && actual.account.followers_count==14 && actual.account.following_count==0 && actual.account.moved==null && actual.account.fields==null && !actual.account.bot && actual.account.source==null && actual.content == """Day 8 <a href="https://pixelfed.de/discover/tags/rotavicentina?src=hash" title="#rotavicentina" class="u-url hashtag" rel="external nofollow noopener">#rotavicentina</a> <a href="https://pixelfed.de/discover/tags/hiking?src=hash" title="#hiking" class="u-url hashtag" rel="external nofollow noopener">#hiking</a> <a href="https://pixelfed.de/discover/tags/nature?src=hash" title="#nature" class="u-url hashtag" rel="external nofollow noopener">#nature</a>""" && actual.visibility==Status.Visibility.public) && !actual.sensitive && actual.spoiler_text==""
)
val attchmnt = actual.media_attachments[0]
val attchmnt = actual.media_attachments!![0]
assert(attchmnt.id == "15888" && attchmnt.type == Attachment.AttachmentType.image && attchmnt.url=="https://pixelfed.de/storage/m/113a3e2124a33b1f5511e531953f5ee48456e0c7/34dd6d9fb1762dac8c7ddeeaf789d2d8fa083c9f/JtjO0eAbELpgO1UZqF5ydrKbCKRVyJUM1WAaqIeB.jpeg" &&
attchmnt.preview_url =="https://pixelfed.de/storage/m/113a3e2124a33b1f5511e531953f5ee48456e0c7/34dd6d9fb1762dac8c7ddeeaf789d2d8fa083c9f/JtjO0eAbELpgO1UZqF5ydrKbCKRVyJUM1WAaqIeB_thumb.jpeg" &&
attchmnt.remote_url ==null && attchmnt.text_url==null && attchmnt.description==null && attchmnt.blurhash==null )