();
public MessageChannelFragment() {
// Required empty public constructor
@@ -22,7 +30,7 @@ public class MessageChannelFragment extends Fragment {
public static MessageChannelFragment newInstance(String messageCategoryTitle) {
MessageChannelFragment fragment = new MessageChannelFragment();
Bundle args = new Bundle();
- args.putString(ARG_CATEGORY_TITLE,messageCategoryTitle);
+ args.putString(ARG_CATEGORY_TITLE, messageCategoryTitle);
fragment.setArguments(args);
return fragment;
}
@@ -30,35 +38,42 @@ public class MessageChannelFragment extends Fragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- try{
- messageCategoryTitle = (String)getArguments().getString(ARG_CATEGORY_TITLE);
- }catch (java.lang.NullPointerException e){
+ try {
+ messageCategoryTitle = (String) getArguments().getString(ARG_CATEGORY_TITLE);
+ } catch (java.lang.NullPointerException e) {
System.out.println("TesFragment getArg error!");
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
+ Bundle savedInstanceState) {
View view;
- if(messageCategoryTitle.equals(" 私信 "))
- {
+ if (messageCategoryTitle.equals(" 私信 ")) {
view = inflater.inflate(R.layout.fragment_private_msg,container,false);
+ RecyclerView recyclerView = (RecyclerView)view.findViewById(R.id.list_private_msg);
+ LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
+ recyclerView.setLayoutManager(layoutManager);
+ getMsgList();
+ MsgAdapter msgAdapter = new MsgAdapter(msgList);
+ recyclerView.setAdapter(msgAdapter);
+
+ } else if (messageCategoryTitle.equals(" 评论 ")) {
+ view = inflater.inflate(R.layout.fragment_comment, container, false);
+ } else if (messageCategoryTitle.equals(" 粉丝 ")) {
+ view = inflater.inflate(R.layout.fragment_fans, container, false);
+ } else if (messageCategoryTitle.equals(" 赞 ")) {
+ view = inflater.inflate(R.layout.fragment_nice, container, false);
+ } else {
+ view = inflater.inflate(R.layout.fragment_message_channel, container, false);
+ mTitleField = (TextView) view.findViewById(R.id.messageCategoryTitle);
+ mTitleField.setText(messageCategoryTitle);
}
- else if(messageCategoryTitle.equals(" 评论 ")){
- view = inflater.inflate(R.layout.fragment_comment,container,false);
- }
- else if(messageCategoryTitle.equals(" 粉丝 ")){
- view = inflater.inflate(R.layout.fragment_fans,container,false);
- }
- else if(messageCategoryTitle.equals(" 赞 ")){
- view = inflater.inflate(R.layout.fragment_nice,container,false);
- }
- else{
- view = inflater.inflate(R.layout.fragment_message_channel, container, false);
- mTitleField = (TextView) view.findViewById(R.id.messageCategoryTitle);
- mTitleField.setText(messageCategoryTitle);
- }
return view;
}
+
+ private void getMsgList(){
+ Msg msg = new Msg(R.drawable.img_user1, "张三", " ");
+ msgList.add(msg);
+ }
}
diff --git a/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/MyFragment.java b/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/MyFragment.java
index 2d6d60d..013c8d6 100644
--- a/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/MyFragment.java
+++ b/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/MyFragment.java
@@ -9,7 +9,6 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
import com.example.leudaemialikeme.Activity.APNActivity;
import com.example.leudaemialikeme.Activity.AboutActivity;
@@ -43,25 +42,6 @@ public class MyFragment extends Fragment {
public MyFragment() {
// Required empty public constructor
}
- public static PrivateMsgFragment newInstance(String param1, String param2) {
- PrivateMsgFragment fragment = new PrivateMsgFragment();
- Bundle args = new Bundle();
- args.putString(ARG_PARAM1, param1);
- args.putString(ARG_PARAM2, param2);
- fragment.setArguments(args);
- return fragment;
- }
-
- /**
- * Use this factory method to create a new instance of
- * this fragment using the provided parameters.
- *
- * @param param1 Parameter 1.
- * @param param2 Parameter 2.
- * @return A new instance of fragment MyFragment.
- */
- // TODO: Rename and change types and number of parameters
-
@Override
public void onCreate(Bundle savedInstanceState) {
diff --git a/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/PrivateMsgFragment.java b/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/PrivateMsgFragment.java
index dea6d06..2ad5762 100644
--- a/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/PrivateMsgFragment.java
+++ b/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/PrivateMsgFragment.java
@@ -1,123 +1,48 @@
package com.example.leudaemialikeme.Fragment;
-import android.content.Context;
-import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
-import androidx.viewpager.widget.ViewPager;
import com.example.leudaemialikeme.R;
-/**
- * A simple {@link Fragment} subclass.
- * Activities that contain this fragment must implement the
- * {@link PrivateMsgFragment.OnFragmentInteractionListener} interface
- * to handle interaction events.
- * Use the {@link PrivateMsgFragment#newInstance} factory method to
- * create an instance of this fragment.
- */
-public class PrivateMsgFragment extends Fragment implements ViewPager.OnPageChangeListener {
+
+public class PrivateMsgFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
- private String mParam1;
- private String mParam2;
private View view;
- private OnFragmentInteractionListener mListener;
public PrivateMsgFragment() {
// Required empty public constructor
}
+ public static PrivateMsgFragment newInstance(){
+ PrivateMsgFragment privateMsgFragment = new PrivateMsgFragment();
+ return privateMsgFragment;
+ }
- /**
- * Use this factory method to create a new instance of
- * this fragment using the provided parameters.
- *
- * @param param1 Parameter 1.
- * @param param2 Parameter 2.
- * @return A new instance of fragment PrivateMsgFragment.
- */
- // TODO: Rename and change types and number of parameters
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (getArguments() != null) {
- mParam1 = getArguments().getString(ARG_PARAM1);
- mParam2 = getArguments().getString(ARG_PARAM2);
- }
+
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- // Inflate the layout for this fragment
- // return inflater.inflate(R.layout.fragment_private_msg2, container, false);
super.onCreate(savedInstanceState);
View view = inflater.inflate(R.layout.fragment_private_msg,container,false);
return view;
}
- // TODO: Rename method, update argument and hook method into UI event
- public void onButtonPressed(Uri uri) {
- if (mListener != null) {
- mListener.onFragmentInteraction(uri);
- }
- }
-
- @Override
- public void onAttach(Context context) {
- super.onAttach(context);
- if (context instanceof OnFragmentInteractionListener) {
- mListener = (OnFragmentInteractionListener) context;
- } else {
- throw new RuntimeException(context.toString()
- + " must implement OnFragmentInteractionListener");
- }
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
- mListener = null;
- }
-
- @Override
- public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
- }
-
- @Override
- public void onPageSelected(int position) {
-
- }
-
- @Override
- public void onPageScrollStateChanged(int state) {
-
- }
-
- /**
- * This interface must be implemented by activities that contain this
- * fragment to allow an interaction in this fragment to be communicated
- * to the activity and potentially other fragments contained in that
- * activity.
- *
- * See the Android Training lesson Communicating with Other Fragments for more information.
- */
- public interface OnFragmentInteractionListener {
- // TODO: Update argument type and name
- void onFragmentInteraction(Uri uri);
- }
}
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/drawable/bubble_left.9.png b/Code/LeudaemiaLikeMe/app/src/main/res/drawable/bubble_left.9.png
new file mode 100644
index 0000000..15c18d0
Binary files /dev/null and b/Code/LeudaemiaLikeMe/app/src/main/res/drawable/bubble_left.9.png differ
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/drawable/bubble_right.9.png b/Code/LeudaemiaLikeMe/app/src/main/res/drawable/bubble_right.9.png
new file mode 100644
index 0000000..1c500d8
Binary files /dev/null and b/Code/LeudaemiaLikeMe/app/src/main/res/drawable/bubble_right.9.png differ
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/layout/activity_chat.xml b/Code/LeudaemiaLikeMe/app/src/main/res/layout/activity_chat.xml
new file mode 100644
index 0000000..6618510
--- /dev/null
+++ b/Code/LeudaemiaLikeMe/app/src/main/res/layout/activity_chat.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/layout/fragment_private_msg.xml b/Code/LeudaemiaLikeMe/app/src/main/res/layout/fragment_private_msg.xml
index 4dd30c7..334c9ab 100644
--- a/Code/LeudaemiaLikeMe/app/src/main/res/layout/fragment_private_msg.xml
+++ b/Code/LeudaemiaLikeMe/app/src/main/res/layout/fragment_private_msg.xml
@@ -1,13 +1,15 @@
-
+
-
+ android:layout_margin="20dp"
+ android:background="#ffffff">
-
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+
+
+
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/layout/msg_content_item.xml b/Code/LeudaemiaLikeMe/app/src/main/res/layout/msg_content_item.xml
new file mode 100644
index 0000000..250b5c9
--- /dev/null
+++ b/Code/LeudaemiaLikeMe/app/src/main/res/layout/msg_content_item.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/layout/pivate_msg_item.xml b/Code/LeudaemiaLikeMe/app/src/main/res/layout/pivate_msg_item.xml
index 4b4bcce..c9db3b7 100644
--- a/Code/LeudaemiaLikeMe/app/src/main/res/layout/pivate_msg_item.xml
+++ b/Code/LeudaemiaLikeMe/app/src/main/res/layout/pivate_msg_item.xml
@@ -26,14 +26,14 @@
android:id="@+id/text_nickname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="匿名用户" />
+ android:text="--" />
+ android:text="" />
\ No newline at end of file
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/left_back.png b/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/left_back.png
new file mode 100644
index 0000000..ed780f9
Binary files /dev/null and b/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/left_back.png differ