mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Created Advanced User information fragment.
This commit is contained in:
parent
9b559dce3d
commit
0c7c2cbead
@ -0,0 +1,44 @@
|
|||||||
|
package org.communiquons.android.comunic.client.ui.adapters;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentPagerAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Based on the following SO answer :
|
||||||
|
* https://stackoverflow.com/a/41656303/3781411
|
||||||
|
*/
|
||||||
|
public class FragmentPagerBaseAdapter extends FragmentPagerAdapter {
|
||||||
|
|
||||||
|
private final List<Fragment> mFragmentList = new ArrayList<>();
|
||||||
|
private final List<String> mFragmentTitleList = new ArrayList<>();
|
||||||
|
|
||||||
|
public FragmentPagerBaseAdapter(FragmentManager manager) {
|
||||||
|
super(manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Fragment getItem(int position) {
|
||||||
|
return mFragmentList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return mFragmentList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addFragment(Fragment fragment, String title) {
|
||||||
|
mFragmentList.add(fragment);
|
||||||
|
mFragmentTitleList.add(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getPageTitle(int position) {
|
||||||
|
return mFragmentTitleList.get(position);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
package org.communiquons.android.comunic.client.ui.fragments;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.communiquons.android.comunic.client.R;
|
||||||
|
import org.communiquons.android.comunic.client.data.models.AdvancedUserInfo;
|
||||||
|
import org.communiquons.android.comunic.client.data.utils.Utilities;
|
||||||
|
import org.communiquons.android.comunic.client.ui.utils.UiUtils;
|
||||||
|
import org.communiquons.android.comunic.client.ui.views.WebUserAccountImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Advanced user information fragment
|
||||||
|
*
|
||||||
|
* @author Pierre HUBERT
|
||||||
|
*/
|
||||||
|
public class AdvancedUserInfoFragment extends Fragment {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Advanced information about the user
|
||||||
|
*/
|
||||||
|
private AdvancedUserInfo mAdvancedUserInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User account image
|
||||||
|
*/
|
||||||
|
private WebUserAccountImage mUserAccountImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the user
|
||||||
|
*/
|
||||||
|
private TextView mUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Target for the time the user has been a member of the group
|
||||||
|
*/
|
||||||
|
private TextView mMemberSinceTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set advanced information about the user
|
||||||
|
*
|
||||||
|
* Warning! This method must be called before the fragment is started, else a NullPointerException
|
||||||
|
* will be thrown
|
||||||
|
*
|
||||||
|
* @param advancedUserInfo Advanced information about the user
|
||||||
|
*/
|
||||||
|
public void setAdvancedUserInfo(AdvancedUserInfo advancedUserInfo) {
|
||||||
|
this.mAdvancedUserInfo = advancedUserInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
return inflater.inflate(R.layout.fragment_advanced_user_info, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
//Get the views
|
||||||
|
mUserAccountImage = view.findViewById(R.id.user_account_image);
|
||||||
|
mUserName = view.findViewById(R.id.user_name);
|
||||||
|
mMemberSinceTarget = view.findViewById(R.id.member_since_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
|
||||||
|
//Apply user information
|
||||||
|
mUserAccountImage.setUser(mAdvancedUserInfo);
|
||||||
|
mUserName.setText(mAdvancedUserInfo.getDisplayFullName());
|
||||||
|
mMemberSinceTarget.setText(new Utilities(getActivity()).timeToString(
|
||||||
|
Utilities.time() - mAdvancedUserInfo.getAccount_creation_time()));
|
||||||
|
}
|
||||||
|
}
|
@ -1,29 +1,25 @@
|
|||||||
package org.communiquons.android.comunic.client.ui.fragments;
|
package org.communiquons.android.comunic.client.ui.fragments;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Fragment;
|
import android.support.annotation.NonNull;
|
||||||
import android.app.FragmentTransaction;
|
import android.support.v4.app.Fragment;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.ArrayMap;
|
import android.support.design.widget.TabLayout;
|
||||||
|
import android.support.v4.app.FragmentPagerAdapter;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.communiquons.android.comunic.client.R;
|
import org.communiquons.android.comunic.client.R;
|
||||||
import org.communiquons.android.comunic.client.data.arrays.PostsList;
|
|
||||||
import org.communiquons.android.comunic.client.data.helpers.DatabaseHelper;
|
import org.communiquons.android.comunic.client.data.helpers.DatabaseHelper;
|
||||||
import org.communiquons.android.comunic.client.data.helpers.GetUsersHelper;
|
import org.communiquons.android.comunic.client.data.helpers.GetUsersHelper;
|
||||||
import org.communiquons.android.comunic.client.data.helpers.ImageLoadHelper;
|
|
||||||
import org.communiquons.android.comunic.client.data.helpers.PostsHelper;
|
|
||||||
import org.communiquons.android.comunic.client.data.models.AdvancedUserInfo;
|
import org.communiquons.android.comunic.client.data.models.AdvancedUserInfo;
|
||||||
import org.communiquons.android.comunic.client.data.models.Post;
|
|
||||||
import org.communiquons.android.comunic.client.data.models.UserInfo;
|
|
||||||
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
|
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
|
||||||
|
import org.communiquons.android.comunic.client.ui.adapters.FragmentPagerBaseAdapter;
|
||||||
import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener;
|
import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener;
|
||||||
import org.communiquons.android.comunic.client.ui.utils.UiUtils;
|
import org.communiquons.android.comunic.client.ui.utils.UiUtils;
|
||||||
|
|
||||||
@ -36,7 +32,7 @@ import org.communiquons.android.comunic.client.ui.utils.UiUtils;
|
|||||||
* Created by pierre on 1/13/18.
|
* Created by pierre on 1/13/18.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class UserPageFragment extends Fragment implements PostsCreateFormFragment.OnPostCreated {
|
public class UserPageFragment extends Fragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug tag
|
* Debug tag
|
||||||
@ -59,65 +55,30 @@ public class UserPageFragment extends Fragment implements PostsCreateFormFragmen
|
|||||||
private AdvancedUserInfo userInfo;
|
private AdvancedUserInfo userInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User posts
|
* Loading alert dialog
|
||||||
*/
|
*/
|
||||||
private PostsList mPostsList;
|
private AlertDialog loadingDialog;
|
||||||
|
|
||||||
/**
|
|
||||||
* User information
|
|
||||||
*/
|
|
||||||
private ArrayMap<Integer, UserInfo> mUsersInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get user helper
|
* Get user helper
|
||||||
*/
|
*/
|
||||||
private GetUsersHelper getUsersHelper;
|
private GetUsersHelper getUsersHelper;
|
||||||
|
|
||||||
/**
|
|
||||||
* Posts helper
|
|
||||||
*/
|
|
||||||
private PostsHelper mPostsHelper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loading alert dialog
|
|
||||||
*/
|
|
||||||
private AlertDialog loadingDialog;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* User account name
|
|
||||||
*/
|
|
||||||
private TextView user_name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* User account image
|
|
||||||
*/
|
|
||||||
private ImageView user_image;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No post notice
|
|
||||||
*/
|
|
||||||
private TextView mNoPostNotice;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Posts list fragment
|
|
||||||
*/
|
|
||||||
private PostsListFragment mPostsListFragment;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a post on user page button
|
|
||||||
*/
|
|
||||||
private ImageView mCreatePostButton;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a post on user page form
|
|
||||||
*/
|
|
||||||
private View mCreatePostForm;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User page open listener
|
* User page open listener
|
||||||
*/
|
*/
|
||||||
private onOpenUsersPageListener mOpenUsersPageListener;
|
private onOpenUsersPageListener mOpenUsersPageListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View pager of the fragment
|
||||||
|
*/
|
||||||
|
private ViewPager mPager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tab layout
|
||||||
|
*/
|
||||||
|
private TabLayout mTabLayout;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
@ -132,47 +93,23 @@ public class UserPageFragment extends Fragment implements PostsCreateFormFragmen
|
|||||||
//Create getUserHelper instance
|
//Create getUserHelper instance
|
||||||
getUsersHelper = new GetUsersHelper(getActivity(), dbHelper);
|
getUsersHelper = new GetUsersHelper(getActivity(), dbHelper);
|
||||||
|
|
||||||
//Create posts helper instance
|
|
||||||
mPostsHelper = new PostsHelper(getActivity());
|
|
||||||
|
|
||||||
//Get the open user page listener
|
//Get the open user page listener
|
||||||
mOpenUsersPageListener = (onOpenUsersPageListener) getActivity();
|
mOpenUsersPageListener = (onOpenUsersPageListener) getActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_user_page, container, false);
|
return inflater.inflate(R.layout.fragment_user_page, container, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
//Get the user views
|
//Get required views
|
||||||
user_image = view.findViewById(R.id.user_account_image);
|
mPager = view.findViewById(R.id.viewpager);
|
||||||
user_name = view.findViewById(R.id.user_account_name);
|
mTabLayout = view.findViewById(R.id.tab_layout);
|
||||||
|
|
||||||
//Get the no post notice
|
|
||||||
mNoPostNotice = view.findViewById(R.id.no_post_notice);
|
|
||||||
mNoPostNotice.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
//Get the view related to the create post form
|
|
||||||
mCreatePostButton = view.findViewById(R.id.create_post_button);
|
|
||||||
mCreatePostForm = view.findViewById(R.id.create_post_form);
|
|
||||||
|
|
||||||
//Trigger the form
|
|
||||||
mCreatePostForm.setVisibility(View.GONE);
|
|
||||||
mCreatePostButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
mCreatePostForm.setVisibility(
|
|
||||||
mCreatePostForm.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//Create the fragment
|
|
||||||
init_create_post_fragment();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -203,23 +140,17 @@ public class UserPageFragment extends Fragment implements PostsCreateFormFragmen
|
|||||||
else
|
else
|
||||||
onGotUserInfo(userInfo);
|
onGotUserInfo(userInfo);
|
||||||
|
|
||||||
//Render the list of post (if available)
|
|
||||||
render_list_posts();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
||||||
//Remove loading dialog
|
|
||||||
if(loadingDialog != null)
|
|
||||||
loadingDialog.dismiss();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called on the main thread once we got user informations
|
* This function is called on the main thread once we got user informations
|
||||||
*
|
*
|
||||||
* @param info Informations about the user
|
* @param info Information about the user
|
||||||
*/
|
*/
|
||||||
public void onGotUserInfo(@Nullable AdvancedUserInfo info){
|
public void onGotUserInfo(@Nullable AdvancedUserInfo info){
|
||||||
|
|
||||||
@ -248,128 +179,24 @@ public class UserPageFragment extends Fragment implements PostsCreateFormFragmen
|
|||||||
getActivity().setTitle(userInfo.getDisplayFullName());
|
getActivity().setTitle(userInfo.getDisplayFullName());
|
||||||
|
|
||||||
//Update activity menu dock
|
//Update activity menu dock
|
||||||
//if(AccountUtils.getID(getActivity()) == mUserID)
|
((MainActivity) getActivity()).setSelectedNavigationItem(
|
||||||
((MainActivity) getActivity()).setSelectedNavigationItem(
|
|
||||||
R.id.main_bottom_navigation_me_view);
|
R.id.main_bottom_navigation_me_view);
|
||||||
/*else
|
|
||||||
((MainActivity) getActivity()).setSelectedNavigationItem(
|
|
||||||
R.id.main_bottom_navigation_users_view);*/
|
|
||||||
|
|
||||||
//Update user name and account image
|
//Initialize view pager
|
||||||
user_name.setText(userInfo.getDisplayFullName());
|
FragmentPagerBaseAdapter adapter = new FragmentPagerBaseAdapter(getChildFragmentManager());
|
||||||
ImageLoadHelper.remove(user_image);
|
|
||||||
ImageLoadHelper.load(getActivity(), userInfo.getAcountImageURL(), user_image);
|
|
||||||
|
|
||||||
//Check if the user can post text on this page
|
//User advanced information fragment
|
||||||
mCreatePostButton.setVisibility(userInfo.isCanPostText() ? View.VISIBLE : View.GONE);
|
AdvancedUserInfoFragment infoFragment = new AdvancedUserInfoFragment();
|
||||||
|
infoFragment.setAdvancedUserInfo(userInfo);
|
||||||
|
adapter.addFragment(infoFragment, UiUtils.getString(getActivity(),
|
||||||
|
R.string.tab_user_advanced_info));
|
||||||
|
|
||||||
|
//Posts fragment
|
||||||
|
adapter.addFragment(new Fragment(), UiUtils.getString(getActivity(),
|
||||||
|
R.string.tab_posts));
|
||||||
|
|
||||||
|
|
||||||
//Load the list of posts of the user
|
mPager.setAdapter(adapter);
|
||||||
load_posts();
|
mTabLayout.setupWithViewPager(mPager);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load the posts of the user
|
|
||||||
*/
|
|
||||||
private void load_posts(){
|
|
||||||
|
|
||||||
new AsyncTask<Void, Void, PostsList>(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected PostsList doInBackground(Void... params) {
|
|
||||||
PostsList list = mPostsHelper.get_user(mUserID);
|
|
||||||
|
|
||||||
//Get the information about the users who created the posts
|
|
||||||
if(list != null)
|
|
||||||
mUsersInfo = getUsersHelper.getMultiple(list.getUsersId());
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(PostsList posts) {
|
|
||||||
if(getActivity() != null)
|
|
||||||
display_posts(posts);
|
|
||||||
}
|
|
||||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the posts of the user
|
|
||||||
*
|
|
||||||
* @param list the list of posts / null in case of failure
|
|
||||||
*/
|
|
||||||
private void display_posts(@Nullable PostsList list){
|
|
||||||
|
|
||||||
//Check for errors
|
|
||||||
if(list == null){
|
|
||||||
Toast.makeText(getActivity(), R.string.err_get_user_posts, Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Check we didn't get user information
|
|
||||||
if(mUsersInfo == null){
|
|
||||||
Toast.makeText(getActivity(), R.string.err_get_users_info, Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Save the list of posts
|
|
||||||
mPostsList = list;
|
|
||||||
|
|
||||||
//Render the list of posts
|
|
||||||
render_list_posts();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render the list of posts
|
|
||||||
*/
|
|
||||||
private void render_list_posts(){
|
|
||||||
|
|
||||||
//Check we have got required information
|
|
||||||
if(mPostsList == null || mUsersInfo == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//Create the fragment
|
|
||||||
mPostsListFragment = new PostsListFragment();
|
|
||||||
mPostsListFragment.setPostsList(mPostsList);
|
|
||||||
mPostsListFragment.setUsersInfos(mUsersInfo);
|
|
||||||
|
|
||||||
//Set the fragment
|
|
||||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
|
||||||
transaction.replace(R.id.fragment_user_page, mPostsListFragment);
|
|
||||||
transaction.commit();
|
|
||||||
|
|
||||||
//Check if there is not any post on the page
|
|
||||||
mNoPostNotice.setVisibility(mPostsList.size() == 0 ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create and create post fragment
|
|
||||||
*/
|
|
||||||
private void init_create_post_fragment(){
|
|
||||||
|
|
||||||
//Create bundle
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putInt(PostsCreateFormFragment.PAGE_TYPE_ARG, PostsCreateFormFragment.PAGE_TYPE_USER);
|
|
||||||
args.putInt(PostsCreateFormFragment.PAGE_ID_ARG, mUserID);
|
|
||||||
|
|
||||||
//Create fragment
|
|
||||||
PostsCreateFormFragment fragment = new PostsCreateFormFragment();
|
|
||||||
fragment.setArguments(args);
|
|
||||||
fragment.setOnPostCreatedListener(this);
|
|
||||||
|
|
||||||
//Perform transaction
|
|
||||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
|
||||||
transaction.replace(R.id.create_post_form, fragment);
|
|
||||||
transaction.commit();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPostCreated(Post post) {
|
|
||||||
//Reload the list of post
|
|
||||||
mPostsList = null;
|
|
||||||
init_create_post_fragment();
|
|
||||||
load_posts();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
85
app/src/main/res/layout/fragment_advanced_user_info.xml
Normal file
85
app/src/main/res/layout/fragment_advanced_user_info.xml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView 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">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingTop="16dp">
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:id="@+id/constraintLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="83dp"
|
||||||
|
android:layout_marginBottom="32dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/scrollView2"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<org.communiquons.android.comunic.client.ui.views.WebUserAccountImage
|
||||||
|
android:id="@+id/user_account_image"
|
||||||
|
android:layout_width="@dimen/account_image_default_width"
|
||||||
|
android:layout_height="@dimen/account_image_default_height"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:src="@drawable/default_account_image"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/user_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/user_account_image"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/user_account_image"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/user_account_image"
|
||||||
|
tools:text="User name" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
tools:layout_editor_absoluteX="134dp"
|
||||||
|
tools:layout_editor_absoluteY="96dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/member_for"
|
||||||
|
android:textAlignment="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/member_since_value"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
tools:layout_editor_absoluteX="88dp"
|
||||||
|
tools:layout_editor_absoluteY="167dp"
|
||||||
|
tools:text="6 Months" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
@ -1,77 +1,38 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/fragment_user_page"
|
android:id="@+id/fragment_user_page"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<FrameLayout
|
<android.support.design.widget.CoordinatorLayout
|
||||||
style="@style/UserPageHeader"
|
android:id="@+id/main_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<!-- User name and account image -->
|
<android.support.design.widget.AppBarLayout
|
||||||
<LinearLayout
|
android:id="@+id/appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||||
|
|
||||||
<ImageView
|
<android.support.design.widget.TabLayout
|
||||||
android:id="@+id/user_account_image"
|
android:id="@+id/tab_layout"
|
||||||
android:layout_width="@dimen/account_image_default_width"
|
app:tabTextColor="@android:color/darker_gray"
|
||||||
android:layout_height="@dimen/account_image_default_height"
|
app:tabSelectedTextColor="@android:color/white"
|
||||||
android:contentDescription="@string/user_image_description"
|
app:tabIndicatorColor="@color/colorPrimary"
|
||||||
android:src="@drawable/default_account_image" />
|
android:layout_width="match_parent"
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/user_account_name"
|
|
||||||
style="@style/UserPageName"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:text="User name" />
|
app:tabMode="scrollable"/>
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
<View
|
<android.support.v4.view.ViewPager
|
||||||
android:layout_width="0dp"
|
android:id="@+id/viewpager"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_weight="1" />
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
|
||||||
<ImageView
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
android:id="@+id/create_post_button"
|
|
||||||
style="@style/AddUserPostButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:contentDescription="@string/btn_show_create_form_description"
|
|
||||||
android:src="@android:drawable/ic_menu_add" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<!-- Include post creation form -->
|
|
||||||
<FrameLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/create_post_form"
|
|
||||||
layout="@layout/post_create_form" />
|
|
||||||
|
|
||||||
<!-- No post on user page notice -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/no_post_notice"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/notice_no_post_user_page"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginTop="10dp"/>
|
|
||||||
|
|
||||||
<!-- User posts -->
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/user_posts"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -191,4 +191,8 @@
|
|||||||
<string name="notice_no_latest_posts">You do not have any latest posts to display here.</string>
|
<string name="notice_no_latest_posts">You do not have any latest posts to display here.</string>
|
||||||
<string name="main_menu_search_user">Search user</string>
|
<string name="main_menu_search_user">Search user</string>
|
||||||
<string name="activity_view_pdf_label">View PDF</string>
|
<string name="activity_view_pdf_label">View PDF</string>
|
||||||
|
<string name="title_activity_settings">Settings</string>
|
||||||
|
<string name="tab_user_advanced_info">User Info</string>
|
||||||
|
<string name="tab_posts">Posts</string>
|
||||||
|
<string name="member_for">Member for</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user