mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-27 15:59:29 +00:00
Deleted useless fragment.
This commit is contained in:
parent
b279fbbe3f
commit
9b559dce3d
@ -41,9 +41,7 @@ import org.communiquons.android.comunic.client.ui.fragments.ConversationFragment
|
|||||||
import org.communiquons.android.comunic.client.ui.fragments.ConversationsListFragment;
|
import org.communiquons.android.comunic.client.ui.fragments.ConversationsListFragment;
|
||||||
import org.communiquons.android.comunic.client.ui.fragments.FriendsListFragment;
|
import org.communiquons.android.comunic.client.ui.fragments.FriendsListFragment;
|
||||||
import org.communiquons.android.comunic.client.ui.fragments.NotificationsFragment;
|
import org.communiquons.android.comunic.client.ui.fragments.NotificationsFragment;
|
||||||
import org.communiquons.android.comunic.client.ui.fragments.SettingsFragment;
|
|
||||||
import org.communiquons.android.comunic.client.ui.fragments.UpdateConversationFragment;
|
import org.communiquons.android.comunic.client.ui.fragments.UpdateConversationFragment;
|
||||||
import org.communiquons.android.comunic.client.ui.fragments.UserInfosFragment;
|
|
||||||
import org.communiquons.android.comunic.client.ui.fragments.UserPageFragment;
|
import org.communiquons.android.comunic.client.ui.fragments.UserPageFragment;
|
||||||
|
|
||||||
|
|
||||||
@ -371,17 +369,6 @@ public class MainActivity extends AppCompatActivity implements openConversationL
|
|||||||
transaction.commit();
|
transaction.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Open the user information fragment
|
|
||||||
*/
|
|
||||||
void openUserInfosFragment(){
|
|
||||||
UserInfosFragment userInfosFragment = new UserInfosFragment();
|
|
||||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
|
||||||
transaction.replace(R.id.main_fragment, userInfosFragment);
|
|
||||||
transaction.addToBackStack(null);
|
|
||||||
transaction.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the page of the specified user
|
* Open the page of the specified user
|
||||||
*
|
*
|
||||||
|
@ -1,100 +0,0 @@
|
|||||||
package org.communiquons.android.comunic.client.ui.fragments;
|
|
||||||
|
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
|
|
||||||
import org.communiquons.android.comunic.client.R;
|
|
||||||
import org.communiquons.android.comunic.client.data.utils.AccountUtils;
|
|
||||||
import org.communiquons.android.comunic.client.data.helpers.DatabaseHelper;
|
|
||||||
import org.communiquons.android.comunic.client.data.asynctasks.ImageLoadTask;
|
|
||||||
import org.communiquons.android.comunic.client.data.asynctasks.GetUsersInfos;
|
|
||||||
import org.communiquons.android.comunic.client.data.models.UserInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* User informations fragment
|
|
||||||
*
|
|
||||||
* This fragment display informations about the user
|
|
||||||
*
|
|
||||||
* @author Pierre HUBERT
|
|
||||||
* Created by pierre on 11/11/17.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class UserInfosFragment extends Fragment {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Application context
|
|
||||||
*/
|
|
||||||
Context mContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Database helper
|
|
||||||
*/
|
|
||||||
DatabaseHelper dbHelper;
|
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
return inflater.inflate(R.layout.fragment_userinfos, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
|
|
||||||
//Get context
|
|
||||||
mContext = getActivity().getApplicationContext();
|
|
||||||
|
|
||||||
//Open DBHelper if required
|
|
||||||
if(dbHelper == null)
|
|
||||||
dbHelper = DatabaseHelper.getInstance(mContext);
|
|
||||||
|
|
||||||
//Get required views
|
|
||||||
final ImageView imageView = view.findViewById(R.id.fragments_userinfos_account_image);
|
|
||||||
final TextView userNameView = view.findViewById(R.id.fragments_userinfos_user_name);
|
|
||||||
|
|
||||||
//Retrieve user information in order to display them
|
|
||||||
int user_id = new AccountUtils(mContext).get_current_user_id();
|
|
||||||
new GetUsersInfos(mContext, dbHelper).get(user_id, new GetUsersInfos.getUserInfosCallback() {
|
|
||||||
@Override
|
|
||||||
public void callback(UserInfo info) {
|
|
||||||
|
|
||||||
//Check for errors
|
|
||||||
if(info == null){
|
|
||||||
Toast.makeText(mContext, R.string.err_get_user_info, Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set the name of the user
|
|
||||||
userNameView.setText(info.getFullName());
|
|
||||||
|
|
||||||
//Get and show the user account image
|
|
||||||
new ImageLoadTask(mContext, info.getAcountImageURL(), imageView).execute();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
|
|
||||||
//Update the title
|
|
||||||
getActivity().setTitle(R.string.fragment_userinfos_title);
|
|
||||||
|
|
||||||
//Update the bottom navigation menu
|
|
||||||
((MainActivity) getActivity())
|
|
||||||
.setSelectedNavigationItem(R.id.main_bottom_navigation_me_view);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_centerHorizontal="true">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/fragments_userinfos_account_image"
|
|
||||||
android:layout_width="64dp"
|
|
||||||
android:layout_height="64dp"
|
|
||||||
android:contentDescription="User account image"
|
|
||||||
android:src="@drawable/default_account_image"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/fragments_userinfos_user_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginStart="6dp"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
tools:text="Full user name"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
Loading…
Reference in New Issue
Block a user