Search in sources :

Example 1 with UiSettings

use of com.amap.api.maps.UiSettings 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)

Aggregations

Bundle (android.os.Bundle)1 Nullable (android.support.annotation.Nullable)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 TextUtils (android.text.TextUtils)1 View (android.view.View)1 Button (android.widget.Button)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 OnClick (butterknife.OnClick)1 AMap (com.amap.api.maps.AMap)1 CameraUpdateFactory (com.amap.api.maps.CameraUpdateFactory)1 TextureMapView (com.amap.api.maps.TextureMapView)1 UiSettings (com.amap.api.maps.UiSettings)1 SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)1 R (com.rideread.rideread.R)1 UserMomentsAdapter (com.rideread.rideread.common.adapter.UserMomentsAdapter)1 BaseActivity (com.rideread.rideread.common.base.BaseActivity)1