package com.haicaojie.android.ui.mine;
|
|
import android.os.Build;
|
import android.os.Bundle;
|
import android.view.View;
|
import android.view.Window;
|
import android.view.WindowManager;
|
import android.widget.LinearLayout;
|
import android.widget.TextView;
|
|
import com.lcjian.library.util.common.DateUtils;
|
import com.loopj.android.http.JsonHttpResponseHandler;
|
import com.haicaojie.android.R;
|
import com.haicaojie.android.ShoppingApi;
|
import com.haicaojie.android.entity.Message;
|
import com.haicaojie.android.ui.BaseActivity;
|
|
/**
|
* Created by weikou2015 on 2018/1/18.
|
* 站内信详情
|
*/
|
|
public class AppMailDetailActivity extends BaseActivity implements View.OnClickListener {
|
TextView tv_left, tv_middle;
|
TextView tv_time;
|
TextView tv_title;
|
TextView tv_detail;
|
|
@Override
|
protected void onCreate(Bundle savedInstanceState) {
|
super.onCreate(savedInstanceState);
|
setContentView(R.layout.activity_app_mail_detail);
|
/*
|
* 计算状态栏高度并设置
|
*/
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
Window window = getWindow();
|
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
|
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
int result = 0;
|
int resourceId = getResources().getIdentifier("status_bar_height",
|
"dimen", "android");
|
if (resourceId > 0) {
|
result = getResources().getDimensionPixelSize(resourceId);
|
}
|
//设置状态栏文字颜色及图标为深色
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
|
result);
|
findViewById(R.id.v_status_bar).setLayoutParams(params);
|
} else {
|
findViewById(R.id.v_status_bar).setVisibility(View.GONE);
|
}
|
tv_left = (TextView) findViewById(R.id.tv_top_bar_left);
|
tv_middle = (TextView) findViewById(R.id.tv_top_bar_middle);
|
tv_time = (TextView) findViewById(R.id.tv_time);
|
tv_title = (TextView) findViewById(R.id.tv_title);
|
tv_detail = (TextView) findViewById(R.id.tv_detail);
|
tv_middle.setText("信息详情");
|
Message info = (Message) getIntent().getSerializableExtra("msg");
|
openMsg(info.getId());
|
tv_time.setText(DateUtils.getTimeToString(Long.parseLong(info.getCreateTime())));
|
tv_title.setText(info.getTitle());
|
tv_detail.setText(info.getContent());
|
tv_left.setOnClickListener(this);
|
}
|
|
@Override
|
public void onClick(View view) {
|
switch (view.getId()) {
|
case R.id.tv_top_bar_left:
|
finish();
|
break;
|
}
|
}
|
|
private void openMsg(String id) {
|
ShoppingApi.openMessage(AppMailDetailActivity.this, getSharedPreferences("user", MODE_PRIVATE).getString("uid", "0"), id, new JsonHttpResponseHandler());
|
}
|
}
|