Search in sources :

Example 1 with TitleBuilder

use of com.rideread.rideread.common.util.TitleBuilder in project ride-read-android by Ride-Read.

the class PostMomentActivity method initView.

@Override
public void initView() {
    new TitleBuilder(this).setTitleText("发个阅圈").IsBack(true).setRightText("发送").build();
    //设置布局管理器
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    mRvPicContainer.setLayoutManager(linearLayoutManager);
    //设置适配器
    mPostPicAdapter = new PostPicAdapter(this, mSelectedPics);
    mRvPicContainer.setAdapter(mPostPicAdapter);
    mTvPostLoc.setText(AMapLocationUtils.getLocDetail());
}
Also used : TitleBuilder(com.rideread.rideread.common.util.TitleBuilder) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) PostPicAdapter(com.rideread.rideread.common.adapter.PostPicAdapter)

Example 2 with TitleBuilder

use of com.rideread.rideread.common.util.TitleBuilder in project ride-read-android by Ride-Read.

the class ChatSingleActivity method initView.

@Override
public void initView() {
    mUser = (UserBaseInfo) getIntent().getSerializableExtra(CHAT_USER);
    mUserName = getIntent().getStringExtra(CHAT_USER_NAME);
    if (TextUtils.isEmpty(mUserName))
        mUserName = "消息";
    new TitleBuilder(this).setTitleText(mUserName).IsBack(true).setLeftOnClickListener(v -> finish()).build();
    mSwipeRefreshLayout.setEnabled(false);
    layoutManager = new LinearLayoutManager(this);
    mRecycleView.setLayoutManager(layoutManager);
    mMsgAdapter = new ChatMsgAdapter();
    mRecycleView.setAdapter(mMsgAdapter);
    getConversation(mUser.getUid() + "");
    mSwipeRefreshLayout.setOnRefreshListener(() -> {
        AVIMMessage message = mMsgAdapter.getFirstMessage();
        if (null != mImConversation) {
            mImConversation.queryMessages(message.getMessageId(), message.getTimestamp(), 20, new AVIMMessagesQueryCallback() {

                @Override
                public void done(List<AVIMMessage> list, AVIMException e) {
                    mSwipeRefreshLayout.setRefreshing(false);
                    if (filterException(e)) {
                        if (null != list && list.size() > 0) {
                            mMsgAdapter.addMessageList(list);
                            mMsgAdapter.notifyDataSetChanged();
                            layoutManager.scrollToPositionWithOffset(list.size() - 1, 0);
                        }
                    }
                }
            });
        } else {
            mSwipeRefreshLayout.setRefreshing(false);
        }
    });
}
Also used : UserUtils(com.rideread.rideread.common.util.UserUtils) Arrays(java.util.Arrays) TitleBuilder(com.rideread.rideread.common.util.TitleBuilder) HashMap(java.util.HashMap) R(com.rideread.rideread.R) OnClick(butterknife.OnClick) BindView(butterknife.BindView) AVIMConversationCreatedCallback(com.avos.avoscloud.im.v2.callback.AVIMConversationCreatedCallback) UserBaseInfo(com.rideread.rideread.data.result.UserBaseInfo) AVIMMessage(com.avos.avoscloud.im.v2.AVIMMessage) AVIMConversationCallback(com.avos.avoscloud.im.v2.callback.AVIMConversationCallback) AVIMConversation(com.avos.avoscloud.im.v2.AVIMConversation) AVImClientManager(com.rideread.rideread.function.net.im.AVImClientManager) View(android.view.View) AVIMClient(com.avos.avoscloud.im.v2.AVIMClient) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) AVIMMessagesQueryCallback(com.avos.avoscloud.im.v2.callback.AVIMMessagesQueryCallback) AVIMTextMessage(com.avos.avoscloud.im.v2.messages.AVIMTextMessage) ChatMsgAdapter(com.rideread.rideread.common.adapter.ChatMsgAdapter) AVIMConversationQuery(com.avos.avoscloud.im.v2.AVIMConversationQuery) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) TextUtils(android.text.TextUtils) BaseActivity(com.rideread.rideread.common.base.BaseActivity) NotificationUtils(com.rideread.rideread.function.net.im.NotificationUtils) AVIMException(com.avos.avoscloud.im.v2.AVIMException) RecyclerView(android.support.v7.widget.RecyclerView) ImTypeMsgEvent(com.rideread.rideread.common.event.ImTypeMsgEvent) List(java.util.List) Subscribe(org.greenrobot.eventbus.Subscribe) MAIN(org.greenrobot.eventbus.ThreadMode.MAIN) AVIMConversationQueryCallback(com.avos.avoscloud.im.v2.callback.AVIMConversationQueryCallback) ImTypeMsgResendEvent(com.rideread.rideread.common.event.ImTypeMsgResendEvent) MsgUtils(com.rideread.rideread.common.util.MsgUtils) EditText(android.widget.EditText) AVIMMessagesQueryCallback(com.avos.avoscloud.im.v2.callback.AVIMMessagesQueryCallback) AVIMMessage(com.avos.avoscloud.im.v2.AVIMMessage) TitleBuilder(com.rideread.rideread.common.util.TitleBuilder) AVIMException(com.avos.avoscloud.im.v2.AVIMException) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ChatMsgAdapter(com.rideread.rideread.common.adapter.ChatMsgAdapter)

Example 3 with TitleBuilder

use of com.rideread.rideread.common.util.TitleBuilder in project ride-read-android by Ride-Read.

the class SettingActivity method initView.

@Override
public void initView() {
    new TitleBuilder(this).setTitleText(R.string.setting).IsBack(true).setLeftOnClickListener(v -> finish()).build();
    mHandler = new WeakHandler();
    countCache();
}
Also used : Fresco(com.facebook.drawee.backends.pipeline.Fresco) UserUtils(com.rideread.rideread.common.util.UserUtils) SwitchButton(com.kyleduo.switchbutton.SwitchButton) ConfirmDialogFragment(com.rideread.rideread.common.dialog.ConfirmDialogFragment) BaseCallback(com.rideread.rideread.function.net.retrofit.BaseCallback) TitleBuilder(com.rideread.rideread.common.util.TitleBuilder) R(com.rideread.rideread.R) BaseActivity(com.rideread.rideread.common.base.BaseActivity) File(java.io.File) OnClick(butterknife.OnClick) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View) DefJsonResult(com.rideread.rideread.data.result.DefJsonResult) WeakHandler(com.badoo.mobile.util.WeakHandler) BaseModel(com.rideread.rideread.function.net.retrofit.BaseModel) FrescoApp(com.rideread.rideread.rrapp.FrescoApp) ApiUtils(com.rideread.rideread.function.net.retrofit.ApiUtils) AppUtils(com.rideread.rideread.common.util.AppUtils) FileUtils(com.rideread.rideread.common.util.FileUtils) WeakHandler(com.badoo.mobile.util.WeakHandler) TitleBuilder(com.rideread.rideread.common.util.TitleBuilder)

Example 4 with TitleBuilder

use of com.rideread.rideread.common.util.TitleBuilder in project ride-read-android by Ride-Read.

the class UserMomentsActivity method initView.

@Override
public void initView() {
    mAMap = mMapViewBg.getMap();
    //实例化UiSettings类对象
    mUiSettings = mAMap.getUiSettings();
    mUiSettings.setZoomControlsEnabled(false);
    mAMap.moveCamera(CameraUpdateFactory.zoomTo(1F));
    mSelectedUid = getIntent().getIntExtra(SELECTED_UID, UserUtils.getUid());
    String username = getIntent().getStringExtra(SELECTED_USERNAME);
    if (TextUtils.isEmpty(username)) {
        username = "阅圈";
    } else {
        username = username + "的阅圈";
    }
    isMyself = mSelectedUid == UserUtils.getUid();
    new TitleBuilder(this).setTitleText(isMyself ? getString(R.string.my_circle) : username).IsBack(true).setLeftOnClickListener(v -> finish()).build();
    mMoments = new ArrayList<>();
    mSwipeRefreshLayout.setOnRefreshListener(() -> {
        mPages = 0;
        loadUserMoments();
    });
    mRecycleView.setHasFixedSize(true);
    mUserMomentsAdapter = new UserMomentsAdapter(this, mMoments);
    //        LayoutInflater layoutInflater = getLayoutInflater();
    //        if (!isMyself) {
    //            mMomentsHeaderView = layoutInflater.inflate(R.layout.view_user_info, null);
    //            mUserMomentsAdapter.addHeadView(mMomentsHeaderView);
    //        }
    mRecycleView.setAdapter(mUserMomentsAdapter);
    mLayoutManager = new LinearLayoutManager(this);
    mRecycleView.setLayoutManager(mLayoutManager);
    mRecycleView.setOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
        }

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            int lastVisibleItem = mLayoutManager.findLastVisibleItemPosition();
            int totalItemCount = mLayoutManager.getItemCount();
            // dy>0 表示向下滑动
            if (lastVisibleItem >= totalItemCount - 1 && dy > 0) {
                if (!isLoadingMore) {
                    //这里多线程也要手动控制isLoadingMore
                    loadUserMoments();
                }
            }
        }
    });
    if (isMyself) {
        mViewHeader.setVisibility(View.GONE);
        mLlFollowAction.setVisibility(View.GONE);
    } else {
        mViewHeader.attachTo(mRecycleView);
        getUserInfo(mSelectedUid);
    }
    loadUserMoments();
}
Also used : AMap(com.amap.api.maps.AMap) LinearLayout(android.widget.LinearLayout) UiSettings(com.amap.api.maps.UiSettings) ListUtils(com.rideread.rideread.common.util.ListUtils) UserUtils(com.rideread.rideread.common.util.UserUtils) Bundle(android.os.Bundle) BaseCallback(com.rideread.rideread.function.net.retrofit.BaseCallback) TitleBuilder(com.rideread.rideread.common.util.TitleBuilder) R(com.rideread.rideread.R) UserMomentsAdapter(com.rideread.rideread.common.adapter.UserMomentsAdapter) OnClick(butterknife.OnClick) NetworkUtils(com.rideread.rideread.common.util.NetworkUtils) ArrayList(java.util.ArrayList) BindView(butterknife.BindView) ImgLoader(com.rideread.rideread.common.util.ImgLoader) ToastUtils(com.rideread.rideread.common.util.ToastUtils) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) UserInfo(com.rideread.rideread.data.result.UserInfo) View(android.view.View) Button(android.widget.Button) ApiUtils(com.rideread.rideread.function.net.retrofit.ApiUtils) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) ConfirmDialogFragment(com.rideread.rideread.common.dialog.ConfirmDialogFragment) RecyclerViewHeader(com.rideread.rideread.common.widget.RecyclerViewHeader) DetailUserInfo(com.rideread.rideread.data.result.DetailUserInfo) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) TextUtils(android.text.TextUtils) BaseActivity(com.rideread.rideread.common.base.BaseActivity) RecyclerView(android.support.v7.widget.RecyclerView) List(java.util.List) TextView(android.widget.TextView) CameraUpdateFactory(com.amap.api.maps.CameraUpdateFactory) Moment(com.rideread.rideread.data.result.Moment) DefJsonResult(com.rideread.rideread.data.result.DefJsonResult) BaseModel(com.rideread.rideread.function.net.retrofit.BaseModel) Nullable(android.support.annotation.Nullable) TextureMapView(com.amap.api.maps.TextureMapView) TitleBuilder(com.rideread.rideread.common.util.TitleBuilder) UserMomentsAdapter(com.rideread.rideread.common.adapter.UserMomentsAdapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 5 with TitleBuilder

use of com.rideread.rideread.common.util.TitleBuilder in project ride-read-android by Ride-Read.

the class MsgActivity method initView.

@Override
public void initView() {
    new TitleBuilder(this).setTitleText("消息").IsBack(true).setLeftOnClickListener(v -> finish()).build();
    //        final AVIMClient client = AVImClientManager.getInstance().getClient();
    mMsgInfoList = new ArrayList<>();
    layoutManager = new LinearLayoutManager(this);
    mRecycleView.setLayoutManager(layoutManager);
    mMsgUserAdapter = new MsgUserAdapter(this, mMsgInfoList);
    mRecycleView.setAdapter(mMsgUserAdapter);
    mSwipeRefreshLayout.setOnRefreshListener(() -> {
        refreshMsgUserList();
    });
    refreshMsgUserList();
}
Also used : MsgInfo(com.rideread.rideread.data.been.MsgInfo) Iterator(java.util.Iterator) TitleBuilder(com.rideread.rideread.common.util.TitleBuilder) Set(java.util.Set) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) R(com.rideread.rideread.R) BaseActivity(com.rideread.rideread.common.base.BaseActivity) MsgUserAdapter(com.rideread.rideread.common.adapter.MsgUserAdapter) ArrayList(java.util.ArrayList) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) List(java.util.List) Subscribe(org.greenrobot.eventbus.Subscribe) MAIN(org.greenrobot.eventbus.ThreadMode.MAIN) EventBus(org.greenrobot.eventbus.EventBus) MsgListRefreshEvent(com.rideread.rideread.common.event.MsgListRefreshEvent) MsgUtils(com.rideread.rideread.common.util.MsgUtils) JSONObject(com.alibaba.fastjson.JSONObject) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) MsgUserAdapter(com.rideread.rideread.common.adapter.MsgUserAdapter) TitleBuilder(com.rideread.rideread.common.util.TitleBuilder) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

TitleBuilder (com.rideread.rideread.common.util.TitleBuilder)7 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 RecyclerView (android.support.v7.widget.RecyclerView)5 BindView (butterknife.BindView)5 R (com.rideread.rideread.R)5 BaseActivity (com.rideread.rideread.common.base.BaseActivity)5 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)4 List (java.util.List)4 View (android.view.View)3 OnClick (butterknife.OnClick)3 UserUtils (com.rideread.rideread.common.util.UserUtils)3 ApiUtils (com.rideread.rideread.function.net.retrofit.ApiUtils)3 BaseCallback (com.rideread.rideread.function.net.retrofit.BaseCallback)3 BaseModel (com.rideread.rideread.function.net.retrofit.BaseModel)3 ArrayList (java.util.ArrayList)3 TextUtils (android.text.TextUtils)2 TextView (android.widget.TextView)2 ConfirmDialogFragment (com.rideread.rideread.common.dialog.ConfirmDialogFragment)2 MsgUtils (com.rideread.rideread.common.util.MsgUtils)2 DefJsonResult (com.rideread.rideread.data.result.DefJsonResult)2