package com.weikou.beibeivideo.ui.discover;
|
|
import android.os.Build;
|
import android.os.Bundle;
|
import android.support.v4.app.Fragment;
|
import android.support.v4.app.FragmentManager;
|
import android.view.View;
|
import android.view.Window;
|
import android.view.WindowManager;
|
import android.widget.LinearLayout;
|
import android.widget.TextView;
|
|
import com.weikou.beibeivideo.ui.BaseActivity;
|
import com.weikou.beibeivideo.ui.main.DiscoverNowFragment;
|
import com.yeshi.buwanshequ.R;
|
|
/**
|
* Created by weikou2015 on 2016/8/17.
|
*/
|
public class SpecificListActivity extends BaseActivity implements View.OnClickListener {
|
|
TextView tv_top_left, tv_top_middle;
|
|
@Override
|
protected void onCreate(Bundle arg0) {
|
super.onCreate(arg0);
|
setContentView(R.layout.activity_specific_list);
|
tv_top_left = (TextView) findViewById(R.id.tv_top_bar_left);
|
tv_top_left.setOnClickListener(this);
|
tv_top_middle = (TextView) findViewById(R.id.tv_top_bar_middle);
|
tv_top_middle.setText("专题合辑");
|
FragmentManager fm = getSupportFragmentManager();
|
Fragment fragment = fm.findFragmentByTag("DiscoverNowFragment");
|
if (fragment == null) {
|
fragment = new DiscoverNowFragment();
|
fm.beginTransaction().add(R.id.fl_add_container, fragment, "DiscoverNowFragment").commitAllowingStateLoss();
|
}
|
|
/*
|
* 计算状态栏高度并设置
|
*/
|
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);
|
}
|
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);
|
}
|
}
|
|
@Override
|
public void onClick(View v) {
|
switch (v.getId()) {
|
case R.id.tv_top_bar_left:
|
finish();
|
break;
|
}
|
}
|
}
|