package ml.puredark.hviewer.ui.activities;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.v7.widget.Toolbar;
import android.widget.ImageView;
import android.widget.TextView;
import java.io.IOException;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import ml.puredark.hviewer.R;
import ml.puredark.hviewer.helpers.MDStatusBarCompat;
import ml.puredark.hviewer.utils.SimpleFileUtil;
public class LicenseActivity extends BaseActivity {
@BindView(R.id.coordinator_layout)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.app_bar)
AppBarLayout appbar;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.btn_return)
ImageView btnReturn;
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.tv_license)
TextView tvLicense;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_text);
ButterKnife.bind(this);
MDStatusBarCompat.setSwipeBackToolBar(this, coordinatorLayout, appbar, toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
setContainer(coordinatorLayout);
/* 为返回按钮加载图标 */
setReturnButton(btnReturn);
tvTitle.setText("开源协议");
String license;
try {
license = SimpleFileUtil.getFromAssets(this, "License.txt");
} catch (IOException e) {
e.printStackTrace();
license = "获取失败";
}
tvLicense.setText(license);
}
@OnClick(R.id.btn_return)
void back() {
onBackPressed();
}
}