use of com.gapcoder.weico.Index.FG.WeicoFG in project weibo by dingdangmao123.
the class index method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_index);
ButterKnife.bind(this);
ActivityList.add(this);
tab.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.weico)
bar.hide(false);
FragmentTransaction tran = fm.beginTransaction();
hideFragments(tran);
int id = item.getItemId();
if (!flag.contains(id)) {
tran.add(R.id.container, map.get(id));
flag.add(id);
}
tran.show(map.get(id));
tran.commit();
return true;
}
});
bar = new QBadgeView(this);
bar.bindTarget(tab).setBadgeGravity(Gravity.CENTER | Gravity.START);
bar.setGravityOffset(40, 0, true);
FragmentTransaction tran = fm.beginTransaction();
hideFragments(tran);
Fragment fg = new WeicoFG();
map.put(R.id.weico, fg);
map.put(R.id.title, new TitleFG());
map.put(R.id.account, new AccountFG());
tran.add(R.id.container, fg);
flag.add(R.id.weico);
tran.commit();
receiver = new MessageReceiver();
filter = new IntentFilter();
filter.addAction("com.gapcoder.weico.MESSAGE");
registerReceiver(receiver, filter);
Intent service = new Intent(this, MessageService.class);
startService(service);
}
Aggregations