app/src/main/java/net/nashlegend/sourcewall/activities/MessageCenterActivity.java

(完整代码) 1KB

package net.nashlegend.sourcewall.activities;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

import net.nashlegend.sourcewall.R;
import net.nashlegend.sourcewall.data.Mob;
import net.nashlegend.sourcewall.fragment.NoticesFragment;

public class MessageCenterActivity extends BaseActivity {

    NoticesFragment noticesFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message_center);
        Mob.onEvent(Mob.Event_Check_Notice);
        Toolbar toolbar = (Toolbar) findViewById(R.id.action_bar);
        setSupportActionBar(toolbar);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
        noticesFragment = new NoticesFragment();
        getSupportFragmentManager().beginTransaction().add(R.id.message_container, noticesFragment).commitAllowingStateLoss();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_message_center, menu);
        if (noticesFragment == null || !noticesFragment.takeOverMenuInflate(getMenuInflater(), menu)) {
            getMenuInflater().inflate(R.menu.menu_message_center, menu);
        }
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            finish();
            return super.onOptionsItemSelected(item);
        } else {
            return noticesFragment != null && noticesFragment.takeOverOptionsItemSelect(item) || super.onOptionsItemSelected(item);
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。