我的-》我的帖子 跳转子项完成..

我的界面还缺少资讯和帖子的跳转...
master
Toyga 3 years ago
parent e7371cc45f
commit 5f1bdad856

@ -26,14 +26,13 @@
<activity android:name=".ClockDetail" /> <activity android:name=".ClockDetail" />
<activity android:name=".Activity.AnswerActivity" /> <activity android:name=".Activity.AnswerActivity" />
<activity android:name=".Activity.QuestionDetailActivity" /> <activity android:name=".Activity.QuestionDetailActivity" />
<activity android:name=".Activity.BlogDetailActivity"/> <activity android:name=".Activity.BlogDetailActivity" />
<activity android:name=".Activity.BlogSearchResultActivity" <activity
android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:name=".Activity.BlogSearchResultActivity"
></activity> android:theme="@style/Theme.AppCompat.Light.NoActionBar"></activity>
<activity <activity
android:name=".Activity.BlogSearchActivity" android:name=".Activity.BlogSearchActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
/>
<meta-data <meta-data
android:name="com.google.android.actions" android:name="com.google.android.actions"
@ -41,34 +40,26 @@
<activity <activity
android:name=".Activity.BaseActivity" android:name=".Activity.BaseActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
/>
<activity <activity
android:name=".Activity.MainActivity" android:name=".Activity.MainActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity <activity
android:name=".Activity.ChatActivity" android:name=".Activity.ChatActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
/> <activity
<activity android:name=".Activity.AttentionActivity" android:name=".Activity.AttentionActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
/> <activity
<activity android:name=".Activity.HistoryActivity" android:name=".Activity.HistoryActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
/> <activity
<activity android:name=".Activity.CollectActivity" android:name=".Activity.CollectActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
/> <activity
<activity android:name=".Activity.SafetyActivity" android:name=".Activity.SafetyActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
/>
<activity android:name=".Activity.AboutActivity" /> <activity android:name=".Activity.AboutActivity" />
<activity android:name=".Activity.MyQuestionActivity" /> <activity android:name=".Activity.MyQuestionActivity" />
<activity android:name=".Activity.ConcernedProblemActivity" /> <activity android:name=".Activity.ConcernedProblemActivity" />
@ -81,13 +72,20 @@
<activity android:name=".Activity.APNActivity" /> <activity android:name=".Activity.APNActivity" />
<activity android:name=".Activity.EventActivity" /> <activity android:name=".Activity.EventActivity" />
<activity android:name=".Activity.NewsDetailActivity" /> <activity android:name=".Activity.NewsDetailActivity" />
<activity android:name=".Activity.NewsSearchResultActivity"/> <activity android:name=".Activity.NewsSearchResultActivity" />
<activity android:name=".Activity.NewsSearchActivity"/> <activity android:name=".Activity.NewsSearchActivity" />
<receiver <receiver
android:name=".CallAlarm" android:name=".CallAlarm"
android:process=".remote" /> android:process=".remote" />
<activity android:name=".Activity.LoginActivity"/> <activity android:name=".Activity.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </application>
</manifest> </manifest>

@ -1,5 +1,7 @@
package com.example.leudaemialikeme.Adapter; package com.example.leudaemialikeme.Adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -8,6 +10,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.example.leudaemialikeme.Activity.BlogDetailActivity;
import com.example.leudaemialikeme.Model.Blog; import com.example.leudaemialikeme.Model.Blog;
import com.example.leudaemialikeme.R; import com.example.leudaemialikeme.R;
import com.example.leudaemialikeme.Utils.TimeUtil; import com.example.leudaemialikeme.Utils.TimeUtil;
@ -17,24 +20,30 @@ import java.util.List;
public class MyBlogAdapter extends RecyclerView.Adapter<MyBlogAdapter.ViewHolder>{ public class MyBlogAdapter extends RecyclerView.Adapter<MyBlogAdapter.ViewHolder>{
List<Blog> blogList = new ArrayList<>(); List<Blog> blogList = new ArrayList<>();
Context context;
public MyBlogAdapter(List<Blog> blogList){ public MyBlogAdapter(List<Blog> blogList, Context context){
this.blogList = blogList; this.blogList = blogList;
this.context = context;
} }
static class ViewHolder extends RecyclerView.ViewHolder{ static class ViewHolder extends RecyclerView.ViewHolder{
private TextView text_my_blog_id; private TextView text_my_blog_id;
private TextView text_my_blog_uid;
private TextView text_my_blog_title; private TextView text_my_blog_title;
private TextView text_my_blog_content; private TextView text_my_blog_content;
private TextView text_my_blog_browse; private TextView text_my_blog_browse;
private TextView text_my_blog_time; private TextView text_my_blog_time;
private TextView text_my_blog_flag; private TextView text_my_blog_flag;
private TextView text_my_blog_collect;
public ViewHolder(@NonNull View itemView) { public ViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
text_my_blog_id = itemView.findViewById(R.id.text_my_blog_id); text_my_blog_id = itemView.findViewById(R.id.text_my_blog_id);
text_my_blog_uid = itemView.findViewById(R.id.text_my_blog_uid);
text_my_blog_title = itemView.findViewById(R.id.text_my_blog_title); text_my_blog_title = itemView.findViewById(R.id.text_my_blog_title);
text_my_blog_content = itemView.findViewById(R.id.text_my_blog_content); text_my_blog_content = itemView.findViewById(R.id.text_my_blog_content);
text_my_blog_collect = itemView.findViewById(R.id.text_my_blog_collect);
text_my_blog_browse = itemView.findViewById(R.id.text_my_blog_browse); text_my_blog_browse = itemView.findViewById(R.id.text_my_blog_browse);
text_my_blog_time = itemView.findViewById(R.id.text_my_blog_time); text_my_blog_time = itemView.findViewById(R.id.text_my_blog_time);
text_my_blog_flag = itemView.findViewById(R.id.text_my_blog_flag); text_my_blog_flag = itemView.findViewById(R.id.text_my_blog_flag);
@ -50,6 +59,14 @@ public class MyBlogAdapter extends RecyclerView.Adapter<MyBlogAdapter.ViewHolder
@Override @Override
public void onClick(View v) { public void onClick(View v) {
//TODO 跳转到帖子的详情页 //TODO 跳转到帖子的详情页
Intent intent = new Intent(context, BlogDetailActivity.class);
intent.putExtra("bid",holder.text_my_blog_id.getText().toString());
intent.putExtra("bContent", holder.text_my_blog_content.getText().toString());
intent.putExtra("bTitle",holder.text_my_blog_title.getText().toString());
intent.putExtra("bColNum",holder.text_my_blog_collect.getText().toString());
intent.putExtra("bViewNum",holder.text_my_blog_browse.getText().toString());
intent.putExtra("uid", holder.text_my_blog_uid.getText().toString());
context.startActivity(intent);
} }
}); });
return holder; return holder;
@ -59,8 +76,10 @@ public class MyBlogAdapter extends RecyclerView.Adapter<MyBlogAdapter.ViewHolder
public void onBindViewHolder(@NonNull MyBlogAdapter.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull MyBlogAdapter.ViewHolder holder, int position) {
Blog blog = blogList.get(position); Blog blog = blogList.get(position);
holder.text_my_blog_id.setText(String.valueOf(blog.getBid())); holder.text_my_blog_id.setText(String.valueOf(blog.getBid()));
holder.text_my_blog_uid.setText(String.valueOf(blog.getUid()));
holder.text_my_blog_title.setText(blog.getBtittle()); holder.text_my_blog_title.setText(blog.getBtittle());
holder.text_my_blog_content.setText(blog.getBcontent()); holder.text_my_blog_content.setText(blog.getBcontent());
holder.text_my_blog_collect.setText(String.valueOf(blog.getBcollectNum()));
holder.text_my_blog_browse.setText(String.valueOf(blog.getBbrowse())); holder.text_my_blog_browse.setText(String.valueOf(blog.getBbrowse()));
holder.text_my_blog_time.setText(TimeUtil.timeToString(blog.getBtime())); holder.text_my_blog_time.setText(TimeUtil.timeToString(blog.getBtime()));
if(blog.getFlag()==1) if(blog.getFlag()==1)

@ -75,7 +75,7 @@ public class APNChannelFragment extends Fragment {
blogRecyclerview = view.findViewById(R.id.list_community); blogRecyclerview = view.findViewById(R.id.list_community);
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
blogRecyclerview.setLayoutManager(layoutManager); blogRecyclerview.setLayoutManager(layoutManager);
MyBlogAdapter adapter = new MyBlogAdapter(blogList); MyBlogAdapter adapter = new MyBlogAdapter(blogList, getContext());
blogRecyclerview.setAdapter(adapter); blogRecyclerview.setAdapter(adapter);
getMyBlogList(); getMyBlogList();
} else { } else {
@ -103,7 +103,7 @@ public class APNChannelFragment extends Fragment {
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
MyBlogAdapter adapter = new MyBlogAdapter(blogList); MyBlogAdapter adapter = new MyBlogAdapter(blogList, getContext());
blogRecyclerview.setAdapter(adapter); blogRecyclerview.setAdapter(adapter);
} }
}); });

@ -14,6 +14,12 @@
android:layout_height="0dp" android:layout_height="0dp"
android:text="" /> android:text="" />
<TextView
android:id="@+id/text_my_blog_uid"
android:layout_width="0dp"
android:layout_height="0dp"
android:text="" />
<TextView <TextView
android:id="@+id/text_my_blog_title" android:id="@+id/text_my_blog_title"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -41,6 +47,13 @@
android:gravity="bottom" android:gravity="bottom"
android:layout_marginTop="5dp"> android:layout_marginTop="5dp">
<TextView
android:id="@+id/text_my_blog_collect"
android:layout_width="0dp"
android:layout_height="0dp"
android:text=""
/>
<TextView <TextView
android:id="@+id/text_my_blog_browse" android:id="@+id/text_my_blog_browse"
android:layout_width="wrap_content" android:layout_width="wrap_content"

Loading…
Cancel
Save