From 9b559dce3dcd1dcc3580926f058a153e0eb18e0f Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 30 Jul 2018 15:25:38 +0200 Subject: [PATCH] Deleted useless fragment. --- .../client/ui/activities/MainActivity.java | 13 --- .../ui/fragments/UserInfosFragment.java | 100 ------------------ .../main/res/layout/fragment_userinfos.xml | 33 ------ 3 files changed, 146 deletions(-) delete mode 100644 app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserInfosFragment.java delete mode 100644 app/src/main/res/layout/fragment_userinfos.xml diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java index 4f00eb1..abce3f4 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java @@ -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.FriendsListFragment; 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.UserInfosFragment; import org.communiquons.android.comunic.client.ui.fragments.UserPageFragment; @@ -371,17 +369,6 @@ public class MainActivity extends AppCompatActivity implements openConversationL 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 * diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserInfosFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserInfosFragment.java deleted file mode 100644 index e4744bd..0000000 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserInfosFragment.java +++ /dev/null @@ -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); - } -} diff --git a/app/src/main/res/layout/fragment_userinfos.xml b/app/src/main/res/layout/fragment_userinfos.xml deleted file mode 100644 index dab18c5..0000000 --- a/app/src/main/res/layout/fragment_userinfos.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file