package cn.droidlover.xdroidmvp.demo.ui;

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;

import butterknife.BindView;
import butterknife.OnClick;
import cn.droidlover.xdroidmvp.demo.R;
import cn.droidlover.xdroidmvp.mvp.XActivity;
import cn.droidlover.xdroidmvp.router.Router;

/**
 * Created by wanglei on 2016/12/31.
 */

public class AboutActivity extends XActivity {
    @BindView(R.id.toolbar)
    Toolbar toolbar;


    @Override
    public void initData(Bundle savedInstanceState) {
        initToolbar();
    }

    private void initToolbar() {
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_arrow_white_24dp);
        getSupportActionBar().setTitle("关于XDroidMvp");
    }

    @OnClick({
            R.id.tv_githubMvc,
            R.id.tv_githubMvp
    })
    public void clickEvent(View view) {
        switch (view.getId()) {

            case R.id.tv_githubMvc:
                WebActivity.launch(context, "https://github.com/limedroid/XDroid", "XDroid");
                break;

            case R.id.tv_githubMvp:
                WebActivity.launch(context, "https://github.com/limedroid/XDroidMvp", "XDroid");
                break;
        }
    }

    public static void launch(Activity activity) {
        Router.newIntent(activity)
                .to(AboutActivity.class)
                .data(new Bundle())
                .launch();
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_about;
    }

    @Override
    public Object newP() {
        return null;
    }
}

@@ -132,16 +132,46 @@
 oolbar;%0A
+import android.view.MenuItem;%0A
 import a
@@ -754,16 +754,74 @@
 (true);%0A
+        getSupportActionBar().setHomeButtonEnabled(true);%0A
         
@@ -1797,11 +1797,250 @@
 l;%0A    %7D
+%0A%0A    @Override%0A    public boolean onOptionsItemSelected(MenuItem item) %7B%0A        if (item.getItemId() == android.R.id.home) %7B%0A            finish();%0A            return true;%0A        %7D%0A        return super.onOptionsItemSelected(item);%0A    %7D
 %0A%7D%0A

修复 About页面toobar回退键 点击无效