Search in sources :

Example 1 with ABaseFragment

use of org.aisen.android.ui.fragment.ABaseFragment in project AisenWeiBo by wangdan.

the class MainActivity method onMenuClicked.

/**
 * 选择了侧边栏,切换侧边栏菜单
 *
 * @param item
 * @return
 */
@Override
public void onMenuClicked(MenuFragment.NavMenuItem item, boolean closeDrawer) {
    invalidateOptionsMenu();
    ABaseFragment fragment = null;
    // 切换ContentFragment,或者跳转到新的界面
    switch(item.id) {
        // 首页
        case MenuFragment.MENU_MAIN:
            fabGroupsFragment.triggerLastPosition();
            break;
        // 通知
        case MenuFragment.MENU_NOTIFICATION:
            fragment = NotificationPagerFragment.newInstance(newIntentNotificationIndex);
            newIntentNotificationIndex = -1;
            break;
        // 提及
        case MenuFragment.MENU_MENTION:
            fragment = MentionPagerFragment.newInstance();
            break;
        // 评论
        case MenuFragment.MENU_CMT:
            fragment = CommentPagerFragment.newInstance();
            break;
        // 私信
        case MenuFragment.MENU_MD:
            new IAction(MainActivity.this, new WebLoginAction(MainActivity.this, BizFragment.createBizFragment(this))) {

                @Override
                public void doAction() {
                    WeiboClientActivity.launchDM(MainActivity.this);
                }
            }.run();
            UMengUtil.onEvent(MainActivity.this, "md");
            break;
        // 热门微博
        case MenuFragment.MENU_HOT_STATUS:
            new IAction(MainActivity.this, new WebLoginAction(MainActivity.this, BizFragment.createBizFragment(this))) {

                @Override
                public void doAction() {
                    TimelineHotFragment.launch(MainActivity.this);
                }
            }.run();
            UMengUtil.onEvent(MainActivity.this, "hot_status");
            break;
        // 热门话题
        case MenuFragment.MENU_HOT_TOPICS:
            new IAction(MainActivity.this, new WebLoginAction(MainActivity.this, BizFragment.createBizFragment(this))) {

                @Override
                public void doAction() {
                    TopicsHotPagerFragment.launch(MainActivity.this);
                }
            }.run();
            UMengUtil.onEvent(MainActivity.this, "hot_topics");
            break;
        // 草稿箱
        case MenuFragment.MENU_DRAT:
            fragment = DraftFragment.newInstance();
            break;
        // 相册
        case MenuFragment.MENU_IMAGES:
            new IAction(this, new SdcardPermissionAction(this, null)) {

                @Override
                public void doAction() {
                    ImagesPagerFragment.launch(MainActivity.this);
                }
            }.run();
            break;
        // 设置
        case MenuFragment.MENU_SETTINGS:
            SettingsPagerFragment.launch(this);
            break;
        // 轻松一刻
        case MenuFragment.MENU_JOKE:
            fragment = JokesPagerFragment.newInstance();
            UMengUtil.onEvent(this, "menu_joke");
            break;
        case MenuFragment.MENU_FAV:
            BizFragment.createBizFragment(this).checkProfile(new BizFragment.CheckProfileCallback() {

                @Override
                public void onCheckProfileSuccess() {
                    TimelineFavoritesFragment.launch(MainActivity.this);
                }

                @Override
                public void onCheckProfileFaild() {
                }
            });
            break;
        // 精美壁纸
        case MenuFragment.MENU_WALLPAPER:
            fragment = WallpaperFragment.newInstance();
            UMengUtil.onEvent(this, "menu_wallpaper");
            break;
    }
    if (fragment != null) {
        setFragemnt(fragment, getString(item.toolbarRes));
    }
    // 隐藏Fab按钮
    if (item.id == 1) {
        fabBtn.setVisibility(View.VISIBLE);
        // 显示Fab
        BizFragment.createBizFragment(this).getFabAnimator().show();
    } else {
        fabBtn.setVisibility(View.GONE);
    }
    // 关闭侧边栏
    if (closeDrawer) {
        mHandler.postDelayed(new Runnable() {

            @Override
            public void run() {
                closeDrawer();
            }
        }, 300);
    }
}
Also used : ABaseFragment(org.aisen.android.ui.fragment.ABaseFragment) IAction(org.aisen.android.support.action.IAction) SdcardPermissionAction(org.aisen.weibo.sina.support.permissions.SdcardPermissionAction) BizFragment(org.aisen.weibo.sina.ui.fragment.base.BizFragment) WebLoginAction(org.aisen.weibo.sina.support.action.WebLoginAction)

Example 2 with ABaseFragment

use of org.aisen.android.ui.fragment.ABaseFragment in project AisenWeiBo by wangdan.

the class BilateralFragment method newInstance.

public static ABaseFragment newInstance(WeiBoUser user) {
    ABaseFragment fragment = new BilateralFragment();
    Bundle args = new Bundle();
    args.putSerializable("user", user);
    args.putBoolean("launch", false);
    fragment.setArguments(args);
    return fragment;
}
Also used : ABaseFragment(org.aisen.android.ui.fragment.ABaseFragment) Bundle(android.os.Bundle)

Example 3 with ABaseFragment

use of org.aisen.android.ui.fragment.ABaseFragment in project AisenWeiBo by wangdan.

the class PublishActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ui_fragment_container);
    getSupportActionBar().setDisplayShowHomeEnabled(false);
    // 接收分享
    if (savedInstanceState == null) {
        Intent intent = getIntent();
        String action = intent.getAction();
        String type = intent.getType();
        if (!TextUtils.isEmpty(action)) {
            if (action.equals(Intent.ACTION_SEND) && !TextUtils.isEmpty(type)) {
                if (!AppContext.isLoggedIn()) {
                    // AccountFragment.launch(this);
                    showMessage(R.string.publish_please_login);
                    finish();
                    return;
                }
                if ("text/plain".equals(type)) {
                    handleSendText(intent);
                } else if (type.startsWith("image/")) {
                    handleSendImage(intent);
                } else {
                    finish();
                }
                return;
            }
        }
    }
    typeStr = savedInstanceState == null ? getIntent().getStringExtra("type") : savedInstanceState.getString("type");
    bean = savedInstanceState == null ? (PublishBean) getIntent().getSerializableExtra("bean") : (PublishBean) savedInstanceState.getSerializable("bean");
    if (savedInstanceState == null) {
        if (TextUtils.isEmpty(typeStr)) {
            finish();
            return;
        }
        PublishType type = PublishType.valueOf(typeStr);
        ABaseFragment fragment = null;
        switch(type) {
            case status:
                fragment = PublishStatusFragment.newInstance(bean);
                break;
            case commentReply:
                fragment = PublishCommentReplyFragment.newInstance(bean);
                break;
            case commentCreate:
                fragment = PublishStatusCommentFragment.newInstance(bean);
                break;
            case statusRepost:
                fragment = PublishStatusRepostFragment.newInstance(bean);
                break;
            default:
                break;
        }
        if (fragment != null)
            getFragmentManager().beginTransaction().add(R.id.fragmentContainer, fragment, "PublishFragment").commit();
    }
}
Also used : PublishBean(org.aisen.weibo.sina.support.bean.PublishBean) ABaseFragment(org.aisen.android.ui.fragment.ABaseFragment) Intent(android.content.Intent) PublishType(org.aisen.weibo.sina.support.bean.PublishType)

Example 4 with ABaseFragment

use of org.aisen.android.ui.fragment.ABaseFragment in project AisenWeiBo by wangdan.

the class TimelineTopicsFragment method newInstance.

public static ABaseFragment newInstance(String q) {
    ABaseFragment fragment = new TimelineTopicsFragment();
    Bundle args = new Bundle();
    args.putString("q", q);
    fragment.setArguments(args);
    return fragment;
}
Also used : ABaseFragment(org.aisen.android.ui.fragment.ABaseFragment) Bundle(android.os.Bundle)

Example 5 with ABaseFragment

use of org.aisen.android.ui.fragment.ABaseFragment in project AisenWeiBo by wangdan.

the class FollowersFragment method newInstance.

public static ABaseFragment newInstance(WeiBoUser user) {
    ABaseFragment fragment = new FollowersFragment();
    Bundle args = new Bundle();
    args.putSerializable("user", user);
    args.putBoolean("launch", false);
    fragment.setArguments(args);
    return fragment;
}
Also used : ABaseFragment(org.aisen.android.ui.fragment.ABaseFragment) Bundle(android.os.Bundle)

Aggregations

ABaseFragment (org.aisen.android.ui.fragment.ABaseFragment)13 Bundle (android.os.Bundle)4 BizFragment (org.aisen.weibo.sina.ui.fragment.base.BizFragment)2 Fragment (android.app.Fragment)1 Intent (android.content.Intent)1 Uri (android.net.Uri)1 Method (java.lang.reflect.Method)1 IAction (org.aisen.android.support.action.IAction)1 FragmentArgs (org.aisen.android.ui.activity.container.FragmentArgs)1 ATabsTabLayoutFragment (org.aisen.android.ui.fragment.ATabsTabLayoutFragment)1 AsToolbar (org.aisen.android.ui.widget.AsToolbar)1 PicUrls (org.aisen.weibo.sina.sinasdk.bean.PicUrls)1 WebLoginAction (org.aisen.weibo.sina.support.action.WebLoginAction)1 PublishBean (org.aisen.weibo.sina.support.bean.PublishBean)1 PublishType (org.aisen.weibo.sina.support.bean.PublishType)1 SdcardPermissionAction (org.aisen.weibo.sina.support.permissions.SdcardPermissionAction)1 MainActivity (org.aisen.weibo.sina.ui.activity.base.MainActivity)1 SinaCommonActivity (org.aisen.weibo.sina.ui.activity.base.SinaCommonActivity)1