- 浏览: 272295 次
- 性别:
- 来自: 成都
博客专栏
-
Android腾讯微博客户...
浏览量:94485
文章分类
最新评论
-
依旧如风:
u012209919 写道一按“添加用户”就出错了,
Android腾讯微薄客户端开发十五:终结篇(分享源代码) -
bn922:
wxw1111wang 写道楼主黑屏怎么解决啊?急求你看看是不 ...
利用ffmpeg和SDL实现一个跨android版本的音视频播放器 -
wxw1111wang:
楼主黑屏怎么解决啊?急求
利用ffmpeg和SDL实现一个跨android版本的音视频播放器 -
lwbao28:
为什么下载下来解压后没有后缀名,都不知道怎么打开。
利用ffmpeg和SDL实现一个跨android版本的音视频播放器 -
璇儿0227:
为什么打开后页面显示不出来,而且没法添加账户?代码也没有显示错 ...
Android腾讯微薄客户端开发十五:终结篇(分享源代码)
如果是自己的微博,可以干掉它
下面三幅图是转播,对话以及点评界面
public class WeiboDetailActivity extends Activity { private DataHelper dataHelper; private UserInfo user; private MyWeiboSync weibo; private Handler handler; private AsyncImageLoader asyncImageLoader; private GetDetailThread thread; private String weiboid; private String returnJsonStr; private JSONObject dataObj ; private ImageView show_headicon; private ImageView show_image; private TextView show_count_mcount; private ImageView show_delete; private TextView show_nick; private TextView show_email; private TextView show_origtext; private TextView show_time; private TextView show_from; private Button to_userinfo_btn; private Button show_star_btn; private Button show_back_btn; private TextView show_rebroad_btn; private TextView show_dialog_btn; private TextView show_remark_btn; private Button show_tohome_btn; private RelativeLayout show_top; private View weibodetail_bottom3_bar; private JSONObject source = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.weibo_detail); setUpViews();//设置view setUpListeners();//设置listenter asyncImageLoader = new AsyncImageLoader(); Intent intent = getIntent(); weiboid = intent.getStringExtra("weiboid"); dataHelper = new DataHelper(WeiboDetailActivity.this); weibo = new MyWeiboSync(); List<UserInfo> userList = dataHelper.GetUserList(false); SharedPreferences preferences = getSharedPreferences("default_user",Activity.MODE_PRIVATE); String nick = preferences.getString("user_default_nick", ""); if (nick != "") { user = dataHelper.getUserByName(nick,userList); } weibo.setAccessTokenKey(user.getToken()); weibo.setAccessTokenSecrect(user.getTokenSecret()); handler = new DealHandler(); thread = new GetDetailThread(); thread.start();//开启一个线程获取数据 } private void setUpViews(){ show_headicon = (ImageView) findViewById(R.id.show_headicon); show_delete = (ImageView) findViewById(R.id.show_delete); show_nick = (TextView) findViewById(R.id.show_nick); show_email = (TextView) findViewById(R.id.show_email); show_origtext = (TextView) findViewById(R.id.show_origtext); show_image = (ImageView) findViewById(R.id.show_image); show_count_mcount = (TextView)findViewById(R.id.show_count_mcount); show_time = (TextView) findViewById(R.id.show_time); show_from = (TextView) findViewById(R.id.show_from); to_userinfo_btn = (Button) findViewById(R.id.to_userinfo_btn); show_star_btn = (Button) findViewById(R.id.show_star_btn); show_back_btn = (Button) findViewById(R.id.show_back_btn); weibodetail_bottom3_bar = (View)findViewById(R.id.weibo_detail_bottom_bar); show_rebroad_btn = (TextView)weibodetail_bottom3_bar.findViewById(R.id.show_rebroad_btn); show_dialog_btn = (TextView)weibodetail_bottom3_bar.findViewById(R.id.show_dialog_btn); show_remark_btn = (TextView)weibodetail_bottom3_bar.findViewById(R.id.show_remark_btn); show_tohome_btn = (Button) findViewById(R.id.show_tohome_btn); show_top = (RelativeLayout)findViewById(R.id.show_top); } private void setUpListeners(){ show_top.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(WeiboDetailActivity.this,UserInfoActivity.class); try { intent.putExtra("name", dataObj.getString("name")); intent.putExtra("nick", dataObj.getString("nick")); intent.putExtra("origtext", dataObj.getString("origtext")); intent.putExtra("timestamp", TimeUtil.getStandardTime(dataObj.getLong("timestamp"))); } catch (JSONException e) { e.printStackTrace(); } startActivity(intent);//跳转到用户信息界面 } }); to_userinfo_btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(WeiboDetailActivity.this,UserInfoActivity.class); try { intent.putExtra("name", dataObj.getString("name")); intent.putExtra("nick", dataObj.getString("nick")); intent.putExtra("origtext", dataObj.getString("origtext")); intent.putExtra("timestamp", TimeUtil.getStandardTime(dataObj.getLong("timestamp"))); } catch (JSONException e) { e.printStackTrace(); } startActivity(intent);//跳转到用户信息界面 } }); show_image.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { //跳到大图浏览界面. } }); show_count_mcount.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { //此微博的转播和点评 Toast.makeText(WeiboDetailActivity.this, "将显示此微博的转播和点评列表", Toast.LENGTH_SHORT).show(); } }); show_rebroad_btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) {//转播此条微博 Intent intent = new Intent(WeiboDetailActivity.this,AddWeiboActivity.class); try { if(source!=null){ intent.putExtra("tip", "转播 "+source.getString("nick")); }else{ intent.putExtra("tip", "转播 "+dataObj.getString("nick")); } if(dataObj.getString("origtext")!=null&&!"".equals(dataObj.getString("origtext"))){ intent.putExtra("content", "|| @"+dataObj.getString("nick")+": "+dataObj.getString("origtext")); intent.putExtra("reid", dataObj.getString("id")); }else{ intent.putExtra("content", "|| @"+source.getString("nick")+": "); intent.putExtra("reid", source.getString("id")); } intent.putExtra("from_flag", "rebroad"); } catch (JSONException e) { e.printStackTrace(); } startActivity(intent); } }); show_dialog_btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) {//对话此条微博所有者 Intent intent = new Intent(WeiboDetailActivity.this,AddWeiboActivity.class); try { intent.putExtra("tip", "对话 "+dataObj.getString("nick")); intent.putExtra("to",dataObj.getString("name"));//对话人的name intent.putExtra("from_flag", "private"); intent.putExtra("content", ""); } catch (JSONException e) { e.printStackTrace(); } startActivity(intent); } }); show_remark_btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) {//点评此条微博 Intent intent = new Intent(WeiboDetailActivity.this,AddWeiboActivity.class); try { if(source!=null){ intent.putExtra("tip", "点评 "+source.getString("nick")); }else{ intent.putExtra("tip", "点评 "+dataObj.getString("nick")); } if(dataObj.getString("origtext")!=null&&!"".equals(dataObj.getString("origtext"))){ intent.putExtra("content", "|| @"+dataObj.getString("nick")+": "+dataObj.getString("origtext")); intent.putExtra("reid", dataObj.getString("id")); }else{ intent.putExtra("content", "|| @"+source.getString("nick")+": "); intent.putExtra("reid", source.getString("id")); } intent.putExtra("from_flag", "comment"); } catch (JSONException e) { e.printStackTrace(); } startActivity(intent); } }); } class GetDetailThread extends Thread { @Override public void run() { returnJsonStr = weibo.getWeiboDetail(weibo.getAccessTokenKey(), weibo.getAccessTokenSecrect(), weiboid); Message msg = handler.obtainMessage(); handler.sendMessage(msg); } } class DealHandler extends Handler { @Override public void handleMessage(Message msg){ Drawable cachedImage; try { dataObj = new JSONObject(returnJsonStr).getJSONObject("data"); cachedImage = asyncImageLoader.loadDrawable(dataObj.getString("head")+"/100",show_headicon, new ImageCallback(){ @Override public void imageLoaded(Drawable imageDrawable,ImageView imageView, String imageUrl) { imageView.setImageDrawable(imageDrawable); } }); if (cachedImage == null) { show_headicon.setImageResource(R.drawable.icon); } else { show_headicon.setImageDrawable(cachedImage); } String count_mcount_text = "转播和点评("+(dataObj.getInt("count")+dataObj.getInt("mcount"))+")";//加下划线 SpannableStringBuilder underlineSpannable=new SpannableStringBuilder(count_mcount_text); CharacterStyle span=new UnderlineSpan(); underlineSpannable.setSpan(span, 0, count_mcount_text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); show_count_mcount.setText(underlineSpannable); show_nick.setText(dataObj.getString("nick")); show_email.setText("@"+dataObj.getString("name")); show_origtext.setText(dataObj.getString("origtext")); show_time.setText(TimeUtil.getStandardTime(dataObj.getLong("timestamp"))); show_from.setText("来自"+dataObj.getString("from")); if(dataObj.getString("nick").equals(user.getUserName())){ show_delete.setVisibility(View.VISIBLE); } JSONArray imageArray = dataObj.optJSONArray("image");//如果此微博有图片内容,就显示出来 if(imageArray!=null&&imageArray.length()>0){ String imageUrl = imageArray.optString(0)+"/460";//为什么加/460,腾讯规定的,支持160,2000,460还有一些,记不住了 Drawable drawable = asyncImageLoader.loadDrawable(imageUrl,show_image, new ImageCallback(){ @Override public void imageLoaded(Drawable imageDrawable,ImageView imageView, String imageUrl) { imageView.setImageDrawable(imageDrawable); } }); show_image.setVisibility(View.VISIBLE); } if(!"null".equals(dataObj.getString("source"))){ source = dataObj.getJSONObject("source"); } } catch (JSONException e) { e.printStackTrace(); } } } }
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/widget28" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffffff" xmlns:android="http://schemas.android.com/apk/res/android"> <RelativeLayout android:id="@+id/show_top" android:paddingTop="5.0dip" android:layout_width="fill_parent" android:layout_height="60.0dip" android:background="#c7cbd6" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"> <ImageView android:id="@+id/show_headicon" android:layout_marginLeft="8.0dip" android:layout_width="45.0dip" android:layout_height="45.0dip" android:layout_alignParentLeft="true"/> <TextView android:id="@+id/show_nick" android:layout_marginLeft="5.0dip" android:layout_width="wrap_content" android:layout_toRightOf="@id/show_headicon" android:textColor="#384050" android:layout_height="wrap_content"/> <TextView android:id="@+id/show_email" android:layout_width="wrap_content" android:layout_marginLeft="10.0dip" android:layout_toRightOf="@id/show_headicon" android:textColor="#687888" android:layout_height="wrap_content" android:layout_below="@id/show_nick"/> <Button android:id="@+id/to_userinfo_btn" android:layout_width="wrap_content" android:background="@drawable/arrow_more_info_selector" android:layout_height="wrap_content" android:layout_alignParentRight="true"/> </RelativeLayout> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/show_top" android:paddingTop="5.0dip"> <TextView android:id="@+id/show_origtext" android:layout_width="fill_parent" android:layout_marginLeft="5.0dip" android:textSize="16.0sp" android:textColor="#707878" android:layout_height="wrap_content"/> <ImageView android:id="@+id/show_image" android:visibility="gone" android:layout_centerInParent="true" android:layout_below="@id/show_origtext" android:layout_width="fill_parent" android:layout_height="120.0dip"/> <TextView android:id="@+id/show_count_mcount" android:layout_below="@id/show_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="18.0sp" android:textColor="#1d5884"/> <TextView android:id="@+id/show_time" android:layout_width="wrap_content" android:layout_marginLeft="5.0dip" android:layout_marginTop="10.0dip" android:textSize="12.0sp" android:layout_height="wrap_content" android:layout_below="@id/show_count_mcount"/> <TextView android:id="@+id/show_from" android:layout_width="wrap_content" android:layout_marginLeft="3.0dip" android:layout_marginTop="10.0dip" android:textSize="12.0sp" android:layout_height="wrap_content" android:layout_below="@id/show_count_mcount" android:layout_toRightOf="@id/show_time"/> <Button android:id="@+id/show_star_btn" android:layout_width="wrap_content" android:layout_marginRight="5.0dip" android:layout_marginTop="10.0dip" android:layout_height="wrap_content" android:background="@drawable/btn_fav" android:layout_below="@id/show_count_mcount" android:layout_alignParentRight="true"/> <ImageView android:id="@+id/show_delete" android:src="@drawable/delete" android:layout_width="wrap_content" android:layout_marginRight="3.0dip" android:layout_marginTop="10.0dip" android:visibility="invisible" android:layout_height="wrap_content" android:layout_below="@id/show_count_mcount" android:layout_toLeftOf="@id/show_star_btn"/> </RelativeLayout> <RelativeLayout android:layout_width="fill_parent" android:layout_height="40.0dip" android:layout_alignParentBottom="true"> <Button android:id="@+id/show_back_btn" android:layout_width="40.0dip" android:drawableTop="@drawable/btn_back_selector" android:background="@drawable/bottom_back_bg" android:layout_height="40.0dip" android:layout_alignParentLeft="true"/> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="70.0dip"> <include android:id="@+id/weibo_detail_bottom_bar" layout="@layout/weibodetail_bottombar_3"/> </LinearLayout> <Button android:id="@+id/show_tohome_btn" android:layout_width="40.0dip" android:layout_height="40.0dip" android:drawableTop="@drawable/btn_home_selector" android:background="@drawable/bottom_home_bg" android:layout_alignParentRight="true"/> </RelativeLayout> </RelativeLayout>
<?xml version="1.0" encoding="UTF-8"?> <LinearLayout android:orientation="horizontal" android:id="@id/bottom_bar" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <TextView android:textSize="16.0dip" android:text="转播" android:textColor="@color/bottom_button_text_selector" android:gravity="center" android:id="@+id/show_rebroad_btn" android:background="@drawable/bottom_3btn_l_selector" android:focusable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:textSize="16.0dip" android:text="对话" android:textColor="@color/bottom_button_text_selector" android:gravity="center" android:id="@+id/show_dialog_btn" android:background="@drawable/bottom_3btn_m_selector" android:focusable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:textSize="16.0dip" android:text="点评" android:textColor="@color/bottom_button_text_selector" android:gravity="center" android:id="@+id/show_remark_btn" android:background="@drawable/bottom_3btn_r_selector" android:focusable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout>
发表评论
-
Android腾讯微薄客户端开发十五:终结篇(分享源代码)
2011-08-01 19:38 22733【有问题的同学请先仔 ... -
Android腾讯微薄客户端开发十四:首页menu菜单
2011-08-01 19:10 4665覆写onCreateOptionsMenu方法 @Over ... -
Android腾讯微薄客户端开发十三:提及篇(与我有关的微博)
2011-07-31 18:53 3081public class ReferActivity ext ... -
Android腾讯微薄客户端开发十二:博主的偶像
2011-07-31 18:34 2565点击收听,显示此博主的偶像列表,点击列表,将显示偶像的详情界 ... -
Android腾讯微薄客户端开发十一:博主的粉丝
2011-07-31 18:19 2324点击听众,显示博主的粉丝列表,点击列表中的粉丝,显示此粉丝详 ... -
Android腾讯微薄客户端开发十:博主广播篇
2011-07-31 17:59 2418点击广播,显示此博主所发表的所有微博 public cl ... -
Android腾讯微薄客户端开发九:博主详情界面篇(广播,听众,收听)
2011-07-31 17:52 3050点击顶部的标题栏,界面跳转到此博主的关注界面 关注界面,此 ... -
Android腾讯微薄客户端开发七:图片加圆角以及时间处理工具类
2011-07-30 13:36 4017给图片加上圆角效果好看多了。 public class ... -
Android腾讯微博客户端开发六:给用户加VIP认证以及美化微博显示内容
2011-07-30 13:07 3574哈哈,通过VIP标志看到赵薇是冒牌的,李开复和冯小刚是正品。 ... -
Android腾讯微博客户端开发5:利用FootView实现ListView滑动动态加载实现分页
2011-07-27 01:34 11152老规矩,先上图 这张图片左边部分和右边部分还是有很大的不同,不 ... -
Android腾讯微博客户端开发四:微博发送篇(QQ表情,@搜索)
2011-07-25 00:55 6176凌晨发帖不容易啊, 有一个问题,谁做过android的自定义 ... -
Android腾讯微博客户端开发三:多账号管理的实现
2011-07-22 19:41 7616先看看效果。。 列表中的账号是保存在sqlite数据库中的, ... -
Android腾讯微博客户端开发二:相关工具篇
2011-07-22 18:19 5574工欲善其事,必先利其器。先给大家介绍3个我在做腾讯微博客户端开 ... -
Android腾讯微博客户端开发一:在下方的Tab的实现
2011-07-20 18:58 12546javaEye处女贴 下面的是res下drawabl ...
相关推荐
Android腾讯微博客户端开发
Android腾讯微博客户端开发五利用FootView实现ListView滑动动态
Android腾讯微博客户端开发一在下方的Tab的实现
Android 腾讯微博客户端源码
android腾讯微博客户端源码,功能基本齐全。
Android 腾讯微博客户端源码
android 实现腾讯微博客户端 源代码
Android 腾讯微博客户端源码.rar
Android程序研发源码Android 腾讯微博客户端源码.zip
腾讯微博客户端源码,可用于客户端类开发的联系
Android腾讯微博客户端源码1.zip
Android 腾讯微博客户端源码1.rar
Android腾讯微博客户端源代码,大公司的Java程序,代码编写规范、注释丰富,可读性强,学习价值高。腾讯微博程序在Andorid程序中也算比较流行的程序,通过这个源代码你或许会学习到一些意想不到的Java Android编程...
[腾讯微博Android客户端开发]课程文档及源代码
安卓版腾讯微博客户端源代码,虽然不是最新版,但很完整,必竟大公司开发的android应用软件,参考价值大代码架构和规范都做的很不错,做同类客户端的朋友可考虑参考。