Search in sources :

Example 1 with PublishBean

use of org.aisen.weibo.sina.support.bean.PublishBean in project AisenWeiBo by wangdan.

the class PublishManager method cancelPublish.

public void cancelPublish() {
    removeMessages(publishDelay);
    PublishBean bean = publishQueue.poll();
    if (bean != null) {
        bean.setStatus(PublishStatus.draft);
        PublishDB.addPublish(bean, loggedIn);
        publishNotifier.notifyPublishCancelled(bean);
        refreshDraftbox();
        onPublish(publishQueue.peek());
    }
}
Also used : PublishBean(org.aisen.weibo.sina.support.bean.PublishBean)

Example 2 with PublishBean

use of org.aisen.weibo.sina.support.bean.PublishBean in project AisenWeiBo by wangdan.

the class PublishManager method publishInit.

/**
 * 将添加状态的消息都加入到队列当中
 */
public void publishInit() {
    List<PublishBean> beans = PublishDB.getPublishOfAddStatus(loggedIn);
    for (PublishBean bean : beans) publishQueue.add(bean);
    onPublish(publishQueue.peek());
}
Also used : PublishBean(org.aisen.weibo.sina.support.bean.PublishBean)

Example 3 with PublishBean

use of org.aisen.weibo.sina.support.bean.PublishBean in project AisenWeiBo by wangdan.

the class PublishManager method handleMessage.

@Override
public void handleMessage(Message msg) {
    super.handleMessage(msg);
    switch(msg.what) {
        case publishDelay:
            PublishBean bean = (PublishBean) msg.obj;
            onPublish(bean);
            break;
    }
}
Also used : PublishBean(org.aisen.weibo.sina.support.bean.PublishBean)

Example 4 with PublishBean

use of org.aisen.weibo.sina.support.bean.PublishBean in project AisenWeiBo by wangdan.

the class PublishStatusRepostFragment method generateBean.

public static PublishBean generateBean(StatusContent status) {
    PublishBean bean = new PublishBean();
    bean.setStatusContent(status);
    bean.setType(PublishType.statusRepost);
    bean.setStatus(PublishStatus.create);
    bean.setParams(new Params());
    // bean.getParams().addParameter("id", status.getRetweeted_status() != null ? status.getRetweeted_status().getId() : status.getId());
    bean.getParams().addParameter("id", status.getId() + "");
    // 是否在转发的同时发表评论,0:否、1:评论给当前微博、2:评论给原微博、3:都评论,默认为0 。
    bean.getParams().addParameter("is_comment", "0");
    return bean;
}
Also used : PublishBean(org.aisen.weibo.sina.support.bean.PublishBean) Params(org.aisen.android.network.http.Params)

Example 5 with PublishBean

use of org.aisen.weibo.sina.support.bean.PublishBean in project AisenWeiBo by wangdan.

the class APublishFragment method refreshUI.

/**
 * 刷新视图
 */
void refreshUI() {
    if (getPublishBean() == null)
        return;
    PublishBean bean = getPublishBean();
    // 显示图片
    if (bean.getExtras() != null && (bean.getPics() != null || bean.getParams().containsKey("url"))) {
        String[] images = bean.getPics();
        if (images == null) {
            images = new String[] { bean.getParams().getParameter("url") };
        }
        if (TextUtils.isEmpty(editContent.getText().toString().trim()) && TextUtils.isEmpty(getPublishBean().getText())) {
        // getPublishBean().setText(getString(R.string.publish_share_pic) + " ");
        }
        // 修改为支持多图
        if (true) {
            layImageCover.setVisibility(View.GONE);
            picShow.setVisibility(View.GONE);
        }
        ImageConfig config = new ImageConfig();
        config.setLoadfaildRes(R.drawable.bg_timeline_loading);
        config.setLoadingRes(R.drawable.bg_timeline_loading);
        config.setMaxWidth(SystemUtils.getScreenWidth(getActivity()));
        config.setMaxHeight(SystemUtils.getScreenHeight(getActivity()) / 2);
        config.setBitmapCompress(TimelineBitmapCompress.class);
        config.setProgress(new PublishDownloadProcess());
        if (layPicContainer != null) {
            layPicContainer.removeAllViews();
            scrollPicContainer.setVisibility(View.VISIBLE);
        }
        for (String path : images) {
            View itemView = View.inflate(getActivity(), R.layout.item_publish_pic, null);
            ImageView img = (ImageView) itemView.findViewById(R.id.img);
            itemView.setTag(path);
            itemView.setOnClickListener(onPictureClickListener);
            if (path.toString().startsWith("content://")) {
                Logger.v(TAG, "相册图片地址, path = " + path);
                config.setDownloaderClass(ContentProviderDownloader.class);
            } else if (path.toString().startsWith("http://") || path.toString().startsWith("https://")) {
                Logger.v(TAG, "网络图片地址, path = " + path);
            } else {
                path = path.toString().replace("file://", "");
                Logger.v(TAG, "拍照图片地址, path = " + path);
                // 扫描文件
                SystemUtils.scanPhoto(getActivity(), new File(path));
                config.setDownloaderClass(SdcardDownloader.class);
            }
            BitmapLoader.getInstance().display(this, path, img, config);
            if (layPicContainer != null) {
                layPicContainer.addView(itemView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
            }
        }
    } else {
        if (scrollPicContainer != null)
            scrollPicContainer.setVisibility(View.GONE);
        layImageCover.setVisibility(View.GONE);
        picShow.setVisibility(View.GONE);
    }
    // 文字内容
    if (!TextUtils.isEmpty(bean.getText())) {
        editContent.setText(bean.getText());
        // 如果是意见反馈,不默认将光标移动到最后
        if (bean.getExtras() != null && bean.getExtras().containsKey("feedback"))
            ;
        else
            editContent.setSelection(editContent.getText().toString().length());
    }
}
Also used : ImageConfig(org.aisen.android.component.bitmaploader.core.ImageConfig) PublishBean(org.aisen.weibo.sina.support.bean.PublishBean) SpannableString(android.text.SpannableString) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) TextView(android.widget.TextView) File(java.io.File) LinearLayout(android.widget.LinearLayout) SdcardDownloader(org.aisen.android.component.bitmaploader.download.SdcardDownloader)

Aggregations

PublishBean (org.aisen.weibo.sina.support.bean.PublishBean)16 Params (org.aisen.android.network.http.Params)8 Intent (android.content.Intent)3 SpannableString (android.text.SpannableString)2 View (android.view.View)2 HorizontalScrollView (android.widget.HorizontalScrollView)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 File (java.io.File)2 ObjectAnimator (android.animation.ObjectAnimator)1 Uri (android.net.Uri)1 Message (android.os.Message)1 LinearLayout (android.widget.LinearLayout)1 PhotoChoice (org.aisen.android.common.utils.PhotoChoice)1 ImageConfig (org.aisen.android.component.bitmaploader.core.ImageConfig)1 SdcardDownloader (org.aisen.android.component.bitmaploader.download.SdcardDownloader)1 ABaseFragment (org.aisen.android.ui.fragment.ABaseFragment)1 PublishType (org.aisen.weibo.sina.support.bean.PublishType)1