android.widget.FrameLayout#setOnLongClickListener ( )源码实例Demo

下面列出了android.widget.FrameLayout#setOnLongClickListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Xndroid   文件: BookmarksFragment.java
private void setupNavigationButton(@NonNull View view, @IdRes int buttonId, @IdRes int imageId) {
    FrameLayout frameButton = view.findViewById(buttonId);
    frameButton.setOnClickListener(this);
    frameButton.setOnLongClickListener(this);
    ImageView buttonImage = view.findViewById(imageId);
    buttonImage.setColorFilter(mIconColor, PorterDuff.Mode.SRC_IN);
}
 
源代码2 项目: JumpGo   文件: BookmarksFragment.java
private void setupNavigationButton(@NonNull View view, @IdRes int buttonId, @IdRes int imageId) {
    FrameLayout frameButton = view.findViewById(buttonId);
    frameButton.setOnClickListener(this);
    frameButton.setOnLongClickListener(this);
    ImageView buttonImage = view.findViewById(imageId);
    buttonImage.setColorFilter(mIconColor, PorterDuff.Mode.SRC_IN);
}
 
源代码3 项目: secrecy   文件: FilesListAdapter.java
public ViewHolder(View itemView) {
    super(itemView);
    name = (TextView) itemView.findViewById(R.id.name);
    type = (TextView) itemView.findViewById(R.id.type);
    size = (TextView) itemView.findViewById(R.id.size);
    date = (TextView) itemView.findViewById(R.id.date);
    thumbnail = (ImageView) itemView.findViewById(R.id.thumbNail);
    frame = (FrameLayout) itemView.findViewById(R.id.frame);
    frame.setTag(this);
    animator = (ViewAnimator) itemView.findViewById(R.id.viewAnimator);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBar);
    frame.setOnClickListener(this);
    frame.setOnLongClickListener(this);
}
 
源代码4 项目: CSipSimple   文件: ActivityChooserView.java
/**
 * Create a new instance.
 *
 * @param context The application environment.
 * @param attrs A collection of attributes.
 * @param defStyle The default style to apply to this view.
 */
public ActivityChooserView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mContext = context;

    TypedArray attributesArray = context.obtainStyledAttributes(attrs,
            R.styleable.SherlockActivityChooserView, defStyle, 0);

    mInitialActivityCount = attributesArray.getInt(
            R.styleable.SherlockActivityChooserView_initialActivityCount,
            ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_DEFAULT);

    Drawable expandActivityOverflowButtonDrawable = attributesArray.getDrawable(
            R.styleable.SherlockActivityChooserView_expandActivityOverflowButtonDrawable);

    attributesArray.recycle();

    LayoutInflater inflater = LayoutInflater.from(mContext);
    inflater.inflate(R.layout.abs__activity_chooser_view, this, true);

    mCallbacks = new Callbacks();

    mActivityChooserContent = (IcsLinearLayout) findViewById(R.id.abs__activity_chooser_view_content);
    mActivityChooserContentBackground = mActivityChooserContent.getBackground();

    mDefaultActivityButton = (FrameLayout) findViewById(R.id.abs__default_activity_button);
    mDefaultActivityButton.setOnClickListener(mCallbacks);
    mDefaultActivityButton.setOnLongClickListener(mCallbacks);
    mDefaultActivityButtonImage = (ImageView) mDefaultActivityButton.findViewById(R.id.abs__image);

    mExpandActivityOverflowButton = (FrameLayout) findViewById(R.id.abs__expand_activities_button);
    mExpandActivityOverflowButton.setOnClickListener(mCallbacks);
    mExpandActivityOverflowButtonImage =
        (ImageView) mExpandActivityOverflowButton.findViewById(R.id.abs__image);
    mExpandActivityOverflowButtonImage.setImageDrawable(expandActivityOverflowButtonDrawable);

    mAdapter = new ActivityChooserViewAdapter();
    mAdapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            super.onChanged();
            updateAppearance();
        }
    });

    Resources resources = context.getResources();
    mListPopupMaxWidth = Math.max(resources.getDisplayMetrics().widthPixels / 2,
          resources.getDimensionPixelSize(R.dimen.abs__config_prefDialogWidth));
}
 
源代码5 项目: Ouroboros   文件: CardDialogFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState){
    final InfiniteDbHelper infiniteDbHelper = new InfiniteDbHelper(getActivity());

    String postNo;
    String repliesPostNo;
    final String boardName;

    if(getArguments().getString("postNo") != null){
        postNo = getArguments().getString("postNo");
        boardName = getArguments().getString("boardName");
        cursor = infiniteDbHelper.getPost(postNo);
    } else {
        repliesPostNo = getArguments().getString("repliesPostNo");
        boardName = getArguments().getString("boardName");
        cursor = infiniteDbHelper.getReplies(repliesPostNo);
    }

    final View view = inflater.inflate(R.layout.fragment_card_dialog, container, false);
    view.setBackgroundColor(Color.argb(77, 00, 00, 00));

    FrameLayout background = (FrameLayout) view.findViewById(R.id.card_dialog_background);
    background.setLongClickable(true);
    background.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            getActivity().onBackPressed();
            return true;
        }
    });


    final RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.postList);
    LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());

    final DisplayMetrics metrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);

    view.post(new Runnable() {
        @Override
        public void run() {
            int h = metrics.heightPixels;
            int w = recyclerView.getWidth();
            ThreadAdapter threadAdapter = new ThreadAdapter(cursor, getFragmentManager(), boardName, getActivity(), infiniteDbHelper, w, h);
            recyclerView.setAdapter(threadAdapter);
        }
    });

    recyclerView.setLayoutManager(layoutManager);
    return view;
}
 
源代码6 项目: android-apps   文件: ActivityChooserView.java
/**
 * Create a new instance.
 *
 * @param context The application environment.
 * @param attrs A collection of attributes.
 * @param defStyle The default style to apply to this view.
 */
public ActivityChooserView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mContext = context;

    TypedArray attributesArray = context.obtainStyledAttributes(attrs,
            R.styleable.SherlockActivityChooserView, defStyle, 0);

    mInitialActivityCount = attributesArray.getInt(
            R.styleable.SherlockActivityChooserView_initialActivityCount,
            ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_DEFAULT);

    Drawable expandActivityOverflowButtonDrawable = attributesArray.getDrawable(
            R.styleable.SherlockActivityChooserView_expandActivityOverflowButtonDrawable);

    attributesArray.recycle();

    LayoutInflater inflater = LayoutInflater.from(mContext);
    inflater.inflate(R.layout.abs__activity_chooser_view, this, true);

    mCallbacks = new Callbacks();

    mActivityChooserContent = (IcsLinearLayout) findViewById(R.id.abs__activity_chooser_view_content);
    mActivityChooserContentBackground = mActivityChooserContent.getBackground();

    mDefaultActivityButton = (FrameLayout) findViewById(R.id.abs__default_activity_button);
    mDefaultActivityButton.setOnClickListener(mCallbacks);
    mDefaultActivityButton.setOnLongClickListener(mCallbacks);
    mDefaultActivityButtonImage = (ImageView) mDefaultActivityButton.findViewById(R.id.abs__image);

    mExpandActivityOverflowButton = (FrameLayout) findViewById(R.id.abs__expand_activities_button);
    mExpandActivityOverflowButton.setOnClickListener(mCallbacks);
    mExpandActivityOverflowButtonImage =
        (ImageView) mExpandActivityOverflowButton.findViewById(R.id.abs__image);
    mExpandActivityOverflowButtonImage.setImageDrawable(expandActivityOverflowButtonDrawable);

    mAdapter = new ActivityChooserViewAdapter();
    mAdapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            super.onChanged();
            updateAppearance();
        }
    });

    Resources resources = context.getResources();
    mListPopupMaxWidth = Math.max(resources.getDisplayMetrics().widthPixels / 2,
          resources.getDimensionPixelSize(R.dimen.abs__config_prefDialogWidth));
}
 
源代码7 项目: zen4android   文件: ActivityChooserView.java
/**
 * Create a new instance.
 *
 * @param context The application environment.
 * @param attrs A collection of attributes.
 * @param defStyle The default style to apply to this view.
 */
public ActivityChooserView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mContext = context;

    TypedArray attributesArray = context.obtainStyledAttributes(attrs,
            R.styleable.SherlockActivityChooserView, defStyle, 0);

    mInitialActivityCount = attributesArray.getInt(
            R.styleable.SherlockActivityChooserView_initialActivityCount,
            ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_DEFAULT);

    Drawable expandActivityOverflowButtonDrawable = attributesArray.getDrawable(
            R.styleable.SherlockActivityChooserView_expandActivityOverflowButtonDrawable);

    attributesArray.recycle();

    LayoutInflater inflater = LayoutInflater.from(mContext);
    inflater.inflate(R.layout.abs__activity_chooser_view, this, true);

    mCallbacks = new Callbacks();

    mActivityChooserContent = (IcsLinearLayout) findViewById(R.id.abs__activity_chooser_view_content);
    mActivityChooserContentBackground = mActivityChooserContent.getBackground();

    mDefaultActivityButton = (FrameLayout) findViewById(R.id.abs__default_activity_button);
    mDefaultActivityButton.setOnClickListener(mCallbacks);
    mDefaultActivityButton.setOnLongClickListener(mCallbacks);
    mDefaultActivityButtonImage = (ImageView) mDefaultActivityButton.findViewById(R.id.abs__image);

    mExpandActivityOverflowButton = (FrameLayout) findViewById(R.id.abs__expand_activities_button);
    mExpandActivityOverflowButton.setOnClickListener(mCallbacks);
    mExpandActivityOverflowButtonImage =
        (ImageView) mExpandActivityOverflowButton.findViewById(R.id.abs__image);
    mExpandActivityOverflowButtonImage.setImageDrawable(expandActivityOverflowButtonDrawable);

    mAdapter = new ActivityChooserViewAdapter();
    mAdapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            super.onChanged();
            updateAppearance();
        }
    });

    Resources resources = context.getResources();
    mListPopupMaxWidth = Math.max(resources.getDisplayMetrics().widthPixels / 2,
          resources.getDimensionPixelSize(R.dimen.abs__config_prefDialogWidth));
}
 
源代码8 项目: zhangshangwuda   文件: ActivityChooserView.java
/**
 * Create a new instance.
 *
 * @param context The application environment.
 * @param attrs A collection of attributes.
 * @param defStyle The default style to apply to this view.
 */
public ActivityChooserView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mContext = context;

    TypedArray attributesArray = context.obtainStyledAttributes(attrs,
            R.styleable.SherlockActivityChooserView, defStyle, 0);

    mInitialActivityCount = attributesArray.getInt(
            R.styleable.SherlockActivityChooserView_initialActivityCount,
            ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_DEFAULT);

    Drawable expandActivityOverflowButtonDrawable = attributesArray.getDrawable(
            R.styleable.SherlockActivityChooserView_expandActivityOverflowButtonDrawable);

    attributesArray.recycle();

    LayoutInflater inflater = LayoutInflater.from(mContext);
    inflater.inflate(R.layout.abs__activity_chooser_view, this, true);

    mCallbacks = new Callbacks();

    mActivityChooserContent = (IcsLinearLayout) findViewById(R.id.abs__activity_chooser_view_content);
    mActivityChooserContentBackground = mActivityChooserContent.getBackground();

    mDefaultActivityButton = (FrameLayout) findViewById(R.id.abs__default_activity_button);
    mDefaultActivityButton.setOnClickListener(mCallbacks);
    mDefaultActivityButton.setOnLongClickListener(mCallbacks);
    mDefaultActivityButtonImage = (ImageView) mDefaultActivityButton.findViewById(R.id.abs__image);

    mExpandActivityOverflowButton = (FrameLayout) findViewById(R.id.abs__expand_activities_button);
    mExpandActivityOverflowButton.setOnClickListener(mCallbacks);
    mExpandActivityOverflowButtonImage =
        (ImageView) mExpandActivityOverflowButton.findViewById(R.id.abs__image);
    mExpandActivityOverflowButtonImage.setImageDrawable(expandActivityOverflowButtonDrawable);

    mAdapter = new ActivityChooserViewAdapter();
    mAdapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            super.onChanged();
            updateAppearance();
        }
    });

    Resources resources = context.getResources();
    mListPopupMaxWidth = Math.max(resources.getDisplayMetrics().widthPixels / 2,
          resources.getDimensionPixelSize(R.dimen.abs__config_prefDialogWidth));
}
 
/**
 * Create a new instance.
 *
 * @param context The application environment.
 * @param attrs A collection of attributes.
 * @param defStyle The default style to apply to this view.
 */
public ActivityChooserView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mContext = context;

    TypedArray attributesArray = context.obtainStyledAttributes(attrs,
            R.styleable.SherlockActivityChooserView, defStyle, 0);

    mInitialActivityCount = attributesArray.getInt(
            R.styleable.SherlockActivityChooserView_initialActivityCount,
            ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_DEFAULT);

    Drawable expandActivityOverflowButtonDrawable = attributesArray.getDrawable(
            R.styleable.SherlockActivityChooserView_expandActivityOverflowButtonDrawable);

    attributesArray.recycle();

    LayoutInflater inflater = LayoutInflater.from(mContext);
    inflater.inflate(R.layout.abs__activity_chooser_view, this, true);

    mCallbacks = new Callbacks();

    mActivityChooserContent = (IcsLinearLayout) findViewById(R.id.abs__activity_chooser_view_content);
    mActivityChooserContentBackground = mActivityChooserContent.getBackground();

    mDefaultActivityButton = (FrameLayout) findViewById(R.id.abs__default_activity_button);
    mDefaultActivityButton.setOnClickListener(mCallbacks);
    mDefaultActivityButton.setOnLongClickListener(mCallbacks);
    mDefaultActivityButtonImage = (ImageView) mDefaultActivityButton.findViewById(R.id.abs__image);

    mExpandActivityOverflowButton = (FrameLayout) findViewById(R.id.abs__expand_activities_button);
    mExpandActivityOverflowButton.setOnClickListener(mCallbacks);
    mExpandActivityOverflowButtonImage =
        (ImageView) mExpandActivityOverflowButton.findViewById(R.id.abs__image);
    mExpandActivityOverflowButtonImage.setImageDrawable(expandActivityOverflowButtonDrawable);

    mAdapter = new ActivityChooserViewAdapter();
    mAdapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            super.onChanged();
            updateAppearance();
        }
    });

    Resources resources = context.getResources();
    mListPopupMaxWidth = Math.max(resources.getDisplayMetrics().widthPixels / 2,
          resources.getDimensionPixelSize(R.dimen.abs__config_prefDialogWidth));
}