<commit_before>package com.joy.library.activity.frame;

import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;

import com.joy.library.R;
import com.joy.library.utils.DeviceUtil;
import com.joy.library.utils.DimenCons;
import com.joy.library.utils.ToastUtil;
import com.joy.library.utils.ViewUtil;

/**
 * 基本的UI框架
 * Created by KEVIN.DAI on 15/7/16.
 */
public abstract class BaseUiActivity extends AppCompatActivity implements DimenCons {

    private Toolbar mToolbar;

    @Override
    public void setContentView(@LayoutRes int layoutResID) {

        setContentView(inflateLayout(layoutResID));
    }

    @Override
    public void setContentView(View contentView) {

        FrameLayout flRoot = new FrameLayout(this);
        wrapContentView(flRoot, contentView);
        super.setContentView(flRoot);

        initData();
        initTitleView();
        initContentView();
    }

    protected void wrapContentView(FrameLayout rootView, View contentView) {

        // toolbar
        mToolbar = (Toolbar) inflateLayout(R.layout.lib_view_toolbar);
        setSupportActionBar(mToolbar);
        LayoutParams toolbarLp = new LayoutParams(LayoutParams.MATCH_PARENT, TITLE_BAR_HEIGHT);
        toolbarLp.gravity = Gravity.TOP;
        rootView.addView(mToolbar, toolbarLp);

        // content view
        LayoutParams contentLp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
//        contentLp.topMargin = TITLE_BAR_HEIGHT;
        rootView.addView(contentView, contentLp);
    }

    protected void initData() {
    }

    protected void initTitleView() {
    }

    protected void initContentView() {
    }

    protected Toolbar getToolbar() {

        return mToolbar;
    }

    protected LayoutParams getToolbarLp() {<commit_msg>删除隐藏代码<commit_after>package com.joy.library.activity.frame;

import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;

import com.joy.library.R;
import com.joy.library.utils.DeviceUtil;
import com.joy.library.utils.DimenCons;
import com.joy.library.utils.ToastUtil;
import com.joy.library.utils.ViewUtil;

/**
 * 基本的UI框架
 * Created by KEVIN.DAI on 15/7/16.
 */
public abstract class BaseUiActivity extends AppCompatActivity implements DimenCons {

    private Toolbar mToolbar;

    @Override
    public void setContentView(@LayoutRes int layoutResID) {

        setContentView(inflateLayout(layoutResID));
    }

    @Override
    public void setContentView(View contentView) {

        FrameLayout flRoot = new FrameLayout(this);
        wrapContentView(flRoot, contentView);
        super.setContentView(flRoot);

        initData();
        initTitleView();
        initContentView();
    }

    protected void wrapContentView(FrameLayout rootView, View contentView) {

        // toolbar
        mToolbar = (Toolbar) inflateLayout(R.layout.lib_view_toolbar);
        setSupportActionBar(mToolbar);
        LayoutParams toolbarLp = new LayoutParams(LayoutParams.MATCH_PARENT, TITLE_BAR_HEIGHT);
        toolbarLp.gravity = Gravity.TOP;
        rootView.addView(mToolbar, toolbarLp);

        // content view
        LayoutParams contentLp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        contentLp.topMargin = TITLE_BAR_HEIGHT;
        rootView.addView(contentView, contentLp);
    }

    protected void initData() {
    }

    protected void initTitleView() {
    }

    protected void initContentView() {
    }

    protected Toolbar getToolbar() {

        return mToolbar;
    }

    protected LayoutParams getToolbarLp() {
{'fraction_non_alphanumeric': 0.0906540038851716, 'fraction_numerical': 0.00302180012950572, 'mean_word_length': 3.822060353798127, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2141737', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1338, 'n_words': 258}