| | |
| | | import android.view.ViewGroup; |
| | | import android.widget.AdapterView; |
| | | import android.widget.AdapterView.OnItemClickListener; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.LinearLayout.LayoutParams; |
| | | import android.widget.ListView; |
| | | import android.widget.TextView; |
| | | |
| | | import com.lcjian.library.util.common.DateUtils; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.db.MessageTable; |
| | | import com.weikou.beibeivideo.ui.BaseActivity; |
| | | import com.yeshi.buwanshequ.R; |
| | | import com.weikou.beibeivideo.util.ui.TopStatusSettings; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | |
| | | private View v_message_detail; |
| | | |
| | | private TextView tv_empty; |
| | | private LinearLayout ll_empty; |
| | | |
| | | private MessageAdapter mSysAdapter; |
| | | |
| | |
| | | super.onCreate(arg0); |
| | | setContentView(R.layout.system_message_activity); |
| | | |
| | | /* |
| | | * 计算状态栏高度并设置 |
| | | */ |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| | | int result = 0; |
| | | int resourceId = getResources().getIdentifier("status_bar_height", |
| | | "dimen", "android"); |
| | | if (resourceId > 0) { |
| | | result = getResources().getDimensionPixelSize(resourceId); |
| | | } |
| | | LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, |
| | | result); |
| | | findViewById(R.id.v_status_bar).setLayoutParams(params); |
| | | } else { |
| | | findViewById(R.id.v_status_bar).setVisibility(View.GONE); |
| | | } |
| | | tv_top_bar_left = (TextView) findViewById(R.id.tv_top_bar_left); |
| | | tv_top_bar_middle = (TextView) findViewById(R.id.tv_top_bar_middle); |
| | | tv_top_bar_left.setText("返回"); |
| | | TopStatusSettings.setStatusViewAndDeepColor(this); |
| | | tv_top_bar_left = findViewById(R.id.tv_top_bar_left); |
| | | tv_top_bar_middle = findViewById(R.id.tv_top_bar_middle); |
| | | tv_top_bar_left.setOnClickListener(this); |
| | | tv_top_bar_middle.setText(R.string.mine_message); |
| | | |
| | | lv_message_list = (ListView) findViewById(R.id.lv_message_list); |
| | | lv_message_list = findViewById(R.id.lv_message_list); |
| | | |
| | | v_message_detail = findViewById(R.id.v_message_detail); |
| | | tv_empty = (TextView) findViewById(R.id.tv_empty); |
| | | ll_empty = findViewById(R.id.ll_empty); |
| | | |
| | | mSysAdapter = new MessageAdapter(getApplicationContext(), null, true);// |
| | | getSupportLoaderManager().initLoader(0, null, this); |
| | |
| | | // old cursor once we return.) |
| | | mSysAdapter.swapCursor(data); |
| | | if (data == null || data.getCount() == 0) { |
| | | tv_empty.setVisibility(View.VISIBLE); |
| | | ll_empty.setVisibility(View.VISIBLE); |
| | | lv_message_list.setVisibility(View.GONE); |
| | | } else { |
| | | tv_empty.setVisibility(View.GONE); |
| | | ll_empty.setVisibility(View.GONE); |
| | | lv_message_list.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | |
| | | // above is about to be closed. We need to make sure we are no |
| | | // longer using it. |
| | | mSysAdapter.swapCursor(null); |
| | | tv_empty.setVisibility(View.VISIBLE); |
| | | ll_empty.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | @Override |
| | |
| | | ((TextView) v_message_detail.findViewById(R.id.tv_date)).setText(DateUtils |
| | | .convertDateToStr(new Date(cursor.getLong(cursor |
| | | .getColumnIndex(MessageTable.CREATE_TIME))))); |
| | | ((TextView) v_message_detail.findViewById(R.id.tv_time)).setText(DateUtils.convertDateToStr( |
| | | ((TextView)v_message_detail.findViewById(R.id.tv_time)).setText(DateUtils.convertDateToStr( |
| | | new Date(cursor.getLong(cursor |
| | | .getColumnIndex(MessageTable.CREATE_TIME))), |
| | | "HH:mm")); |
| | | ((TextView) v_message_detail.findViewById(R.id.tv_text)) |
| | | ((TextView)v_message_detail.findViewById(R.id.tv_text)) |
| | | .setSingleLine(false); |
| | | ((TextView) v_message_detail.findViewById(R.id.tv_text)) |
| | | ((TextView)v_message_detail.findViewById(R.id.tv_text)) |
| | | .setText(cursor.getString(cursor |
| | | .getColumnIndex(MessageTable.MESSAGE_CONTENT))); |
| | | lv_message_list.setVisibility(View.GONE); |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | // EventBus.getDefault().register(this); |
| | | MobclickAgent.onPageStart("我的消息"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | // EventBus.getDefault().unregister(this); |
| | | MobclickAgent.onPageEnd("我的消息"); |
| | | } |
| | | |
| | | @Override |