mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-12-27 22:18:58 +00:00
Fixed fragments issue
This commit is contained in:
parent
6c0ea90ff8
commit
c63f9904a5
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -55,7 +55,7 @@
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -80,7 +80,7 @@ public class ConversationsListFragment extends Fragment {
|
||||
userHelper = new GetUsersHelper(getActivity(), dbHelper);
|
||||
|
||||
//Create the conversation list helper
|
||||
conversationsListHelper = new ConversationsListHelper(getActivity());
|
||||
conversationsListHelper = new ConversationsListHelper(getActivity(), dbHelper);
|
||||
|
||||
//Get the conversation target list view
|
||||
conversationsListView = view.findViewById(R.id.fragment_conversationslist_list);
|
||||
@ -91,7 +91,7 @@ public class ConversationsListFragment extends Fragment {
|
||||
protected ArrayList<ConversationsInfo> doInBackground(Void... params) {
|
||||
|
||||
//Get the list of conversations
|
||||
ArrayList<ConversationsInfo> list = conversationsListHelper.download();
|
||||
ArrayList<ConversationsInfo> list = conversationsListHelper.get();
|
||||
process_conversations_list(list);
|
||||
return list;
|
||||
|
||||
|
@ -80,6 +80,14 @@ public class FriendsListFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_friendslist, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
rootView = view;
|
||||
|
||||
//Save application context
|
||||
mContext = getActivity().getApplicationContext();
|
||||
@ -93,10 +101,6 @@ public class FriendsListFragment extends Fragment {
|
||||
//Retain the fragment
|
||||
//setRetainInstance(true);
|
||||
|
||||
//Inflate the layout for this fragment
|
||||
rootView = inflater.inflate(R.layout.fragment_friendslist, container, false);
|
||||
return rootView;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,6 +10,7 @@ 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.R;
|
||||
import org.communiquons.android.comunic.client.data.Account.AccountUtils;
|
||||
@ -43,7 +44,12 @@ public class UserInfosFragment extends Fragment {
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
||||
View result = inflater.inflate(R.layout.fragment_userinfos, container, false);
|
||||
return inflater.inflate(R.layout.fragment_userinfos, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
//Get context
|
||||
mContext = getActivity().getApplicationContext();
|
||||
@ -53,8 +59,8 @@ public class UserInfosFragment extends Fragment {
|
||||
dbHelper = new DatabaseHelper(mContext);
|
||||
|
||||
//Get required views
|
||||
final ImageView imageView = (ImageView) result.findViewById(R.id.fragments_userinfos_account_image);
|
||||
final TextView userNameView = (TextView) result.findViewById(R.id.fragments_userinfos_user_name);
|
||||
final ImageView imageView = (ImageView) view.findViewById(R.id.fragments_userinfos_account_image);
|
||||
final TextView userNameView = (TextView) view.findViewById(R.id.fragments_userinfos_user_name);
|
||||
|
||||
//Retrieve user informations in order to display them
|
||||
int user_id = new AccountUtils(mContext).get_current_user_id();
|
||||
@ -62,6 +68,12 @@ public class UserInfosFragment extends Fragment {
|
||||
@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());
|
||||
|
||||
@ -70,6 +82,5 @@ public class UserInfosFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -50,4 +50,5 @@
|
||||
<string name="date_m">m</string>
|
||||
<string name="date_s">s</string>
|
||||
<string name="date_hours">date_hours</string>
|
||||
<string name="err_get_user_info">Couldn\'t get user information !</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user