Code Monkey home page Code Monkey logo

basepopup-master's People

Watchers

 avatar  avatar

basepopup-master's Issues

显示异常

showPopupWindow时宽没有填充 @@是什么问题?

SlideFromTopPopup mSlideFromTopPopup = new SlideFromTopPopup(this,strLs,position);
mSlideFromTopPopup.showPopupWindow(mLayoutDate);

package com.cskid.thacher.mvp.ui.view;

import android.annotation.SuppressLint;
import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.OvershootInterpolator;
import android.view.animation.TranslateAnimation;

import com.cskid.thacher.R;
import com.cskid.thacher.mvp.ui.adapter.PopupAdapter;
import com.jess.arms.utils.ArmsUtils;

import java.util.List;

import razerdp.basepopup.BasePopupWindow;

/**

  • @description : TODO 从顶部下滑的Poup

  • @author : yuanweiwei

  • @Date : 2019/1/3 15:07
    */
    public class SlideFromTopPopup extends BasePopupWindow {

    /**

    • @description : TODO 定义点击事件接口
    • @author : yuanweiwei
    • @Date : 2018/12/28 15:51
    • @return : null
      */
      public interface OnItemClickListener {
      void onItemClick(View view, int position);
      }

    private OnItemClickListener mOnItemClickListener;

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
    mOnItemClickListener = onItemClickListener;
    }

    public SlideFromTopPopup(Context context,List strLs,int position) {
    super(context);
    setBackPressEnable(false);
    setAlignBackground(true);
    RecyclerView mRecyclerView = findViewById(R.id.rv_content);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
    PopupAdapter popupAdapter = new PopupAdapter(strLs);
    mRecyclerView.setAdapter(popupAdapter);
    popupAdapter.setSelection(position);
    popupAdapter.setOnItemClickListener(new PopupAdapter.OnItemClickListener() {
    @OverRide
    public void onItemClick(View view, int position) {
    mOnItemClickListener.onItemClick(view,position);
    }
    });
    }

    @OverRide
    protected Animation onCreateShowAnimation() {
    TranslateAnimation translateAnimation = new TranslateAnimation(0f, 0f, -ArmsUtils.dip2px(getContext(), 350f), 0);
    translateAnimation.setDuration(450);
    translateAnimation.setInterpolator(new OvershootInterpolator(1));
    return translateAnimation;
    }

    @SuppressLint("ResourceAsColor")
    @OverRide
    protected Animation onCreateDismissAnimation() {
    TranslateAnimation translateAnimation = new TranslateAnimation(0f, 0f, 0, -ArmsUtils.dip2px(getContext(), 350f));
    translateAnimation.setDuration(450);
    translateAnimation.setInterpolator(new OvershootInterpolator(-4));
    return translateAnimation;
    }

    @OverRide
    public View onCreateContentView() {
    return createPopupById(R.layout.layout_popup_date);
    }

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.