Java Code Examples for android.view.View

The following are top voted examples for showing how to use android.view.View. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Musicoco   File: RecentMostPlayActivity.java   View source code 7 votes vote down vote up
private void initViews() {

        list = (RecyclerView) findViewById(R.id.rmp_a_list);

        adapter = new RMPAdapter(this, data);
        list.setLayoutManager(new LinearLayoutManager(this));

        line = findViewById(R.id.rmp_a_line);
        title = (TextView) findViewById(R.id.rmp_a_title);
        toolbar = (Toolbar) findViewById(R.id.rmp_a_toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        first = new FirstThreeViewHolder(this, FirstThreeViewHolder.FIRST);
        second = new FirstThreeViewHolder(this, FirstThreeViewHolder.SECOND);
        third = new FirstThreeViewHolder(this, FirstThreeViewHolder.THIRD);
        first.setVisible(View.INVISIBLE);
        second.setVisible(View.INVISIBLE);
        third.setVisible(View.INVISIBLE);

    }
 
Example 2
Project: CXJPadProject   File: YRecycleview.java   View source code 6 votes vote down vote up
@Override
public void onChanged() {
    Adapter<?> adapter = getAdapter();
    if (adapter != null && mEmptyView != null) {
        int emptyCount = 0;
        if (pullRefreshEnabled) {
            emptyCount++;
        }
        if (loadMoreEnabled) {
            emptyCount++;
        }
        if (adapter.getItemCount() == emptyCount) {
            mEmptyView.setVisibility(View.VISIBLE);
            YRecycleview.this.setVisibility(View.GONE);
        } else {
            mEmptyView.setVisibility(View.GONE);
            YRecycleview.this.setVisibility(View.VISIBLE);
        }
    }
    if (mWrapAdapter != null) {
        mWrapAdapter.notifyDataSetChanged();
    }
}
 
Example 3
Project: face-landmark-android   File: OrnamentAdapter.java   View source code 6 votes vote down vote up
@Override
public void onBindViewHolder(MyViewHolder holder, final int position) {
    final Ornament bean = mData.get(position);
    if (bean != null) {
        holder.ivImg.setColorFilter(Color.WHITE);
        holder.ivImg.setImageResource(bean.getImgResId());

        holder.ivImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (onItemClickListener != null) {
                    onItemClickListener.onItemClick(position);
                }
            }
        });
    } else {
        holder.ivImg.setImageResource(0);
    }
}
 
Example 4
Project: GeekZone   File: SpecialListAdapter.java   View source code 6 votes vote down vote up
@Override
public void onBindData2View(final StoriesBean data) {
    desc.setText(data.getTitle());
    if (data.getImages() != null
            && data.getImages().size() > 0) {
        avatar.setVisibility(View.VISIBLE);
        loadAvatar(data.getImages().get(0), avatar);
    } else {
        avatar.setVisibility(View.GONE);
    }
    hotContentView.setOnClickListener(
            new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Context context = v.getContext();
                    Intent intent = new Intent(context, ArticleDetailActivity.class);
                    intent.putExtra(EXTRA_ARTICLE_ID, data.getId());
                    intent.putExtra(EXTRA_ARTICLE_TYPE, EXTRA_TYPE_ZHIHU_NEWS);
                    context.startActivity(intent);
                }
            });
}
 
Example 5
Project: EMQ-Android-Toolkit   File: DashboardActivity.java   View source code 6 votes vote down vote up
@OnClick(R.id.fab)
    public void onClick() {
        if (!isConnected()){
            TipUtil.showSnackbar(mCoordinatorLayout, getString(R.string.hint_disconnect), getString(R.string.connect), new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    connect();
                }
            });
            return;
        }

        if (mCurrentMode == SUBSCRIPTION) {
//            startActivityForResult(SubscriptionActivity.class, SUBSCRIPTION);
            SubscriptionFragment subscriptionFragment = new SubscriptionFragment();
            subscriptionFragment.show(getSupportFragmentManager(), "Subscription");
        } else if (mCurrentMode == PUBLICATION) {
            startActivityForResult(PublicationActivity.class, PUBLICATION);
        }


    }
 
Example 6
Project: chromium-for-android-56-debug-video   File: CustomTabToolbar.java   View source code 6 votes vote down vote up
@Override
public boolean onLongClick(View v) {
    if (v == mCloseButton) {
        return showAccessibilityToast(v, getResources().getString(R.string.close_tab));
    } else if (v == mCustomActionButton) {
        return showAccessibilityToast(v, mCustomActionButton.getContentDescription());
    } else if (v == mTitleUrlContainer) {
        ClipboardManager clipboard = (ClipboardManager) getContext()
                .getSystemService(Context.CLIPBOARD_SERVICE);
        Tab tab = getCurrentTab();
        if (tab == null) return false;
        String url = tab.getOriginalUrl();
        ClipData clip = ClipData.newPlainText("url", url);
        clipboard.setPrimaryClip(clip);
        Toast.makeText(getContext(), R.string.url_copied, Toast.LENGTH_SHORT).show();
        return true;
    }
    return false;
}
 
Example 7
Project: GitHub   File: EasyPopup.java   View source code 6 votes vote down vote up
/**
 * 相对anchor view显示,适用 宽高不为match_parent
 * <p>
 * 注意:如果使用 VerticalGravity 和 HorizontalGravity 时,请确保使用之后 PopupWindow 没有超出屏幕边界,
 * 如果超出屏幕边界,VerticalGravity 和 HorizontalGravity 可能无效,从而达不到你想要的效果。
 *
 * @param anchor
 * @param vertGravity  垂直方向的对齐方式
 * @param horizGravity 水平方向的对齐方式
 * @param x            水平方向的偏移
 * @param y            垂直方向的偏移
 */
public void showAtAnchorView(@NonNull View anchor, @VerticalGravity final int vertGravity, @HorizontalGravity int horizGravity, int x, int y) {
    if (mPopupWindow == null) {
        return;
    }
    mAnchorView = anchor;
    mOffsetX = x;
    mOffsetY = y;
    mVerticalGravity = vertGravity;
    mHorizontalGravity = horizGravity;
    isOnlyGetWH = false;
    //处理背景变暗
    handleBackgroundDim();
    final View contentView = getContentView();
    addGlobalLayoutListener(contentView);
    contentView.measure(0, View.MeasureSpec.UNSPECIFIED);
    final int measuredW = contentView.getMeasuredWidth();
    final int measuredH = contentView.getMeasuredHeight();

    x = calculateX(anchor, horizGravity, measuredW, x);
    y = calculateY(anchor, vertGravity, measuredH, y);
    Log.i(TAG, "showAtAnchorView: w=" + measuredW + ",y=" + measuredH);
    PopupWindowCompat.showAsDropDown(mPopupWindow, anchor, x, y, Gravity.NO_GRAVITY);
}
 
Example 8
Project: qmui   File: QDEmptyViewFragment.java   View source code 6 votes vote down vote up
private void initTopBar() {
    mTopBar.addLeftBackImageButton().setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            popBackStack();
        }
    });

    // 切换其他情况的按钮
    mTopBar.addRightImageButton(R.mipmap.icon_topbar_overflow, R.id.topbar_right_change_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showBottomSheetList();
        }
    });

    mTopBar.setTitle(mQDItemDescription.getName());
}
 
Example 9
Project: APIJSON-Android-RxJava   File: UserListFragment.java   View source code 6 votes vote down vote up
@Override
public void initEvent() {//必须调用
	super.initEvent();

	lvBaseList.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			toActivity(UserActivity.createIntent(context, id));
		}
	});
}
 
Example 10
Project: rongyunDemo   File: UserDetailActivity.java   View source code 6 votes vote down vote up
private void initBlackListStatusView() {
    if (mIsFriendsRelationship) {
        Button rightButton = getHeadRightButton();
        rightButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.main_activity_contact_more));
        rightButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(final View v) {
                RongIM.getInstance().getBlacklistStatus(mFriend.getUserId(), new RongIMClient.ResultCallback<RongIMClient.BlacklistStatus>() {
                    @Override
                    public void onSuccess(RongIMClient.BlacklistStatus blacklistStatus) {
                        SinglePopWindow morePopWindow = new SinglePopWindow(UserDetailActivity.this, mFriend, blacklistStatus);
                        morePopWindow.showPopupWindow(v);
                    }

                    @Override
                    public void onError(RongIMClient.ErrorCode e) {

                    }
                });
            }
        });
    }
}
 
Example 11
Project: ZhidaoDaily-android   File: PhotoActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_photo);
    ButterKnife.bind(this);
    setupActionBar(toolbar, "", true);
    final String url = getIntent().getStringExtra("imgUrl");
    with(this).load(url).into(mPhotoView);
    mPhotoView.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            savePic(url);
            return true;
        }
    });
}
 
Example 12
Project: GitHub   File: ContactsPage.java   View source code 6 votes vote down vote up
public boolean onKeyEvent(int keyCode, KeyEvent event) {
	try {
		int resId = ResHelper.getIdRes(activity, "llSearch");
		if (keyCode == KeyEvent.KEYCODE_BACK
				&& event.getAction() == KeyEvent.ACTION_DOWN
				&& activity.findViewById(resId).getVisibility() == View.VISIBLE) {
			activity.findViewById(resId).setVisibility(View.GONE);
			resId = ResHelper.getIdRes(activity, "llTitle");
			activity.findViewById(resId).setVisibility(View.VISIBLE);
			etSearch.setText("");
			return true;
		}
	} catch (Exception e) {
		SMSLog.getInstance().w(e);
	}
	return super.onKeyEvent(keyCode, event);
}
 
Example 13
Project: NSMPlayer-Android   File: EssayDetailActivity.java   View source code 6 votes vote down vote up
@Override
public void onVideoItemChangeToFullScreenClick(EssayAdapter.VideoViewHolder videoViewHolder) {
    // 这里这个ViewGroup 是Window的
    final ViewGroup vp = (ViewGroup)(findViewById(Window.ID_ANDROID_CONTENT));

    videoViewHolder.basicVideoView.setPlayer(null);

    final BasicVideoView newBasicVideoView = (BasicVideoView) View.inflate(this, R.layout.basic_videoview, null);
    newBasicVideoView.setPlayer(mPlayer);
    View changeToInsetScreen = newBasicVideoView.findViewById(R.id.changeToInsetScreen);
    changeToInsetScreen.setOnClickListener(this);

    final FrameLayout.LayoutParams lpParent = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    final FrameLayout frameLayout = new FrameLayout(this);
    frameLayout.setId(R.id.full_screen_id);

    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    lp.gravity = Gravity.CENTER;
    frameLayout.addView(newBasicVideoView, lp);
    vp.addView(frameLayout, lpParent);
    mPlayer.seekTo(mPlayer.getCurrentPosition() - 20);
}
 
Example 14
Project: boohee_v5.6   File: SportPlayActivity.java   View source code 6 votes vote down vote up
protected void initViews() {
    this.mVideoView = (ExVideoView) findViewById(R.id.video);
    this.mHeaderView = findViewById(R.id.header);
    this.mBtnBack = findViewById(R.id.btn_back);
    this.mVideoView.setExpandState(true);
    this.mVideoView.setStatus(2);
    this.mVideoView.setContinueVideo(this.mUri);
    this.mVideoView.getVideoView().setOnCompletionListener(new OnCompletionListener() {
        public void onCompletion(MediaPlayer mp) {
            SportPlayActivity.this.setResult(-1);
            SportPlayActivity.this.finish();
        }
    });
    this.mVideoView.getControllerView().addBindView(this.mHeaderView);
    this.mBtnBack.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            SportPlayActivity.this.onBackPressed();
        }
    });
}
 
Example 15
Project: GitHub   File: Demo1Fragment.java   View source code 6 votes vote down vote up
@Override
public void onWidgetClick(View view) {
    tvAboutFragment.setText("");
    switch (view.getId()) {
        case R.id.btn_show_about_fragment:
            tvAboutFragment.setText("lastAdd: " + FragmentUtils.getLastAddFragment(getFragmentManager()).getClass().getSimpleName()
                    + "\nlastAddInStack: " + (FragmentUtils.getLastAddFragmentInStack(getFragmentManager()) != null ? FragmentUtils.getLastAddFragmentInStack(getFragmentManager()).getClass().getSimpleName() : "null")
                    + "\ntopShow: " + FragmentUtils.getTopShowFragment(getFragmentManager()).getClass().getSimpleName()
                    + "\ntopShowInStack: " + (FragmentUtils.getTopShowFragmentInStack(getFragmentManager()) != null ? FragmentUtils.getTopShowFragmentInStack(getFragmentManager()).getClass().getSimpleName() : "null")
                    + "\n---all of fragments---\n"
                    + FragmentUtils.getAllFragments(getFragmentManager()).toString()
                    + "\n----------------------\n\n"
                    + "---stack top---\n"
                    + FragmentUtils.getAllFragmentsInStack(getFragmentManager()).toString()
                    + "\n---stack bottom---\n\n"
            );
            break;
        case R.id.btn_hide_show:
            FragmentUtils.hideAllShowFragment(((FragmentActivity) getActivity()).rootFragment);
            break;
    }
}
 
Example 16
Project: tenor-android-demo-search   File: TagItemVH.java   View source code 5 votes vote down vote up
public TagItemVH(@NonNull View itemView, CTX context) {
    super(itemView, context);

    mImage = itemView.findViewById(R.id.it_iv_image);
    mName = itemView.findViewById(R.id.it_tv_name);
    mLoadingProgress = itemView.findViewById(R.id.it_pb_loading);

    itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onClicked();
        }
    });
}
 
Example 17
Project: Hotspot-master-devp   File: ViewCompat.java   View source code 5 votes vote down vote up
public static void setLayerType(View view, int layerType) {
	view.setLayerType(layerType, null);
}
 
Example 18
Project: ViewpagerMoreTabDemo   File: ChooseTabActivityAdapter.java   View source code 5 votes vote down vote up
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
    int action = motionEvent.getAction();
    switch (action) {
        case MotionEvent.ACTION_DOWN: {
            recyclerview.startDrag(this);
            break;
        }
    }
    return false;
}
 
Example 19
Project: S3-16-simone   File: GoogleApiHelper.java   View source code 5 votes vote down vote up
/**
 * Initialization of the GoogleApiClient with Callbacks, Listeners and View for popups.
 * @param activity
 * @param view
 */
public void buildGoogleApiClient(FullscreenBaseGameActivity activity, View view) {
    mGoogleApiClient = new GoogleApiClient.Builder(context)
            .addConnectionCallbacks(activity)
            .addOnConnectionFailedListener(activity)
            .addScope(Games.SCOPE_GAMES)
            .setViewForPopups(view)
            .addApi(Games.API).build();
    mGoogleApiClient.connect();
}
 
Example 20
Project: Cable-Android   File: RegistrationActivity.java   View source code 5 votes vote down vote up
@Override
public void onClick(View v) {
  if (informationView.getVisibility() == View.VISIBLE) {
    informationView.setVisibility(View.GONE);
    informationToggleText.setText(R.string.RegistrationActivity_more_information);
  } else {
    informationView.setVisibility(View.VISIBLE);
    informationToggleText.setText(R.string.RegistrationActivity_less_information);
  }
}
 
Example 21
Project: PlusGram   File: StaggeredGridLayoutManager.java   View source code 5 votes vote down vote up
private void recycleFromEnd(RecyclerView.Recycler recycler, int line) {
    final int childCount = getChildCount();
    int i;
    for (i = childCount - 1; i >= 0; i--) {
        View child = getChildAt(i);
        if (mPrimaryOrientation.getDecoratedStart(child) >= line) {
            LayoutParams lp = (LayoutParams) child.getLayoutParams();
            // Don't recycle the last View in a span not to lose span's start/end lines
            if (lp.mFullSpan) {
                for (int j = 0; j < mSpanCount; j++) {
                    if (mSpans[j].mViews.size() == 1) {
                        return;
                    }
                }
                for (int j = 0; j < mSpanCount; j++) {
                    mSpans[j].popEnd();
                }
            } else {
                if (lp.mSpan.mViews.size() == 1) {
                    return;
                }
                lp.mSpan.popEnd();
            }
            removeAndRecycleView(child, recycler);
        } else {
            return;// done
        }
    }
}
 
Example 22
Project: GitHub   File: EmoticonsAdapter.java   View source code 5 votes vote down vote up
protected void updateUI(ViewHolder viewHolder, ViewGroup parent) {
    if(mDefalutItemHeight != mItemHeight){
        viewHolder.iv_emoticon.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mItemHeight));
    }
    mItemHeightMax = this.mItemHeightMax != 0 ? this.mItemHeightMax : (int) (mItemHeight * mItemHeightMaxRatio);
    mItemHeightMin = this.mItemHeightMin != 0 ? this.mItemHeightMin : mItemHeight;
    int realItemHeight = ((View) parent.getParent()).getMeasuredHeight() / mEmoticonPageEntity.getLine();
    realItemHeight = Math.min(realItemHeight, mItemHeightMax);
    realItemHeight = Math.max(realItemHeight, mItemHeightMin);
    viewHolder.ly_root.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, realItemHeight));
}
 
Example 23
Project: TheMovies   File: MovieViewHolder.java   View source code 5 votes vote down vote up
public MovieViewHolder(View itemView, Activity activity, int numberOfColumns) {
    super(itemView);
    ButterKnife.bind(this, itemView);
    rootView = itemView;
    this.activity = activity;
    this.numberOfColumns = numberOfColumns;
    setListeners();
}
 
Example 24
Project: GitHub   File: CoreBaseActivity.java   View source code 5 votes vote down vote up
private View getContainer() {
    RelativeLayout container = new RelativeLayout(this);
    swipeBackLayout = new SwipeBackLayout(this);
    swipeBackLayout.setDragEdge(SwipeBackLayout.DragEdge.LEFT);
    ivShadow = new ImageView(this);
    ivShadow.setBackgroundColor(getResources().getColor(R.color.theme_black_7f));
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    container.addView(ivShadow, params);
    container.addView(swipeBackLayout);
    swipeBackLayout.setOnSwipeBackListener((fa, fs) -> ivShadow.setAlpha(1 - fs));
    return container;
}
 
Example 25
Project: iosched-reader   File: SessionDetailFragment.java   View source code 5 votes vote down vote up
private void displaySpeakersData(SessionDetailModel data) {
    final ViewGroup speakersGroup = (ViewGroup) getActivity()
            .findViewById(R.id.session_speakers_block);

    // Remove all existing speakers (everything but first child, which is the header)
    for (int i = speakersGroup.getChildCount() - 1; i >= 1; i--) {
        speakersGroup.removeViewAt(i);
    }

    final LayoutInflater inflater = getActivity().getLayoutInflater();

    boolean hasSpeakers = false;

    List<SessionDetailModel.Speaker> speakers = data.getSpeakers();

    for (final SessionDetailModel.Speaker speaker : speakers) {

        String speakerHeader = speaker.getName();
        if (!TextUtils.isEmpty(speaker.getCompany())) {
            speakerHeader += ", " + speaker.getCompany();
        }

        final View speakerView = inflater
                .inflate(R.layout.speaker_detail, speakersGroup, false);
        final TextView speakerHeaderView = (TextView) speakerView
                .findViewById(R.id.speaker_header);
        final ImageView speakerImageView = (ImageView) speakerView
                .findViewById(R.id.speaker_image);
        final TextView speakerAbstractView = (TextView) speakerView
                .findViewById(R.id.speaker_abstract);
        final ImageView plusOneIcon = (ImageView) speakerView.findViewById(R.id.gplus_icon_box);
        final ImageView twitterIcon = (ImageView) speakerView.findViewById(
                R.id.twitter_icon_box);

        setUpSpeakerSocialIcon(speaker, twitterIcon, speaker.getTwitterUrl(),
                UIUtils.TWITTER_COMMON_NAME, UIUtils.TWITTER_PACKAGE_NAME);

        setUpSpeakerSocialIcon(speaker, plusOneIcon, speaker.getPlusoneUrl(),
                UIUtils.GOOGLE_PLUS_COMMON_NAME, UIUtils.GOOGLE_PLUS_PACKAGE_NAME);

        // A speaker may have both a Twitter and GPlus page, only a Twitter page or only a
        // GPlus page, or neither. By default, align the Twitter icon to the right and the GPlus
        // icon to its left. If only a single icon is displayed, align it to the right.
        determineSocialIconPlacement(plusOneIcon, twitterIcon);

        if (!TextUtils.isEmpty(speaker.getImageUrl()) && mSpeakersImageLoader != null) {
            mSpeakersImageLoader.loadImage(speaker.getImageUrl(), speakerImageView);
        }

        speakerHeaderView.setText(speakerHeader);
        speakerImageView.setContentDescription(
                getString(R.string.speaker_googleplus_profile, speakerHeader));
        UIUtils.setTextMaybeHtml(speakerAbstractView, speaker.getAbstract());

        if (!TextUtils.isEmpty(speaker.getUrl())) {
            speakerImageView.setEnabled(true);
            speakerImageView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Intent speakerProfileIntent = new Intent(Intent.ACTION_VIEW,
                            Uri.parse(speaker.getUrl()));
                    speakerProfileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
                    UIUtils.preferPackageForIntent(getActivity(),
                            speakerProfileIntent,
                            UIUtils.GOOGLE_PLUS_PACKAGE_NAME);
                    startActivity(speakerProfileIntent);
                }
            });
        } else {
            speakerImageView.setEnabled(false);
            speakerImageView.setOnClickListener(null);
        }

        speakersGroup.addView(speakerView);
        hasSpeakers = true;
    }

    speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE);
    updateEmptyView(data);
}
 
Example 26
Project: 2017.1-Trezentos   File: CreateClassActivity.java   View source code 5 votes vote down vote up
public boolean confirmInformation(UserClassControl userClassControl, String className,
                                  String institution, String password,
                                  String cutOff, String sizeGroups,
                                  String addition) throws UserException {
    if(cutOff.isEmpty() || addition.isEmpty() || sizeGroups.isEmpty()){
        classNameField.setError("Preencha todos os campos!");
    }
    progressBar.setVisibility(View.GONE);
    String errorMessage;
    errorMessage = userClassControl.validateInformation(className, institution,
            cutOff, password, addition, sizeGroups);

    return verifyValidMessage(errorMessage);
}
 
Example 27
Project: 72GGames_Demo   File: GameFragment.java   View source code 5 votes vote down vote up
@Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        //开启服务,下载apk
//        Intent intent = new Intent(getActivity(), DownLoadService.class);
//        intent.putExtra(Constant.DOWNLOAD,list.get(position).getDownLoadUrl());
//        getActivity().startService(intent);
    }
 
Example 28
Project: Bailan   File: DefaultFooter.java   View source code 5 votes vote down vote up
@Override
public View createView(LayoutInflater inflater, ViewGroup parent) {
    ViewGroup v = (ViewGroup) inflater.inflate(R.layout.prj_ptr_footer_default, parent, true);
    View child = v.getChildAt(v.getChildCount() - 1);
    mStringIndicator = (TextView) child.findViewById(R.id.tv_footer);
    progress_wheell = (ProgressWheel) v.findViewById(R.id.progress_wheell);
    default_rim_color = progress_wheell.getRimColor();
    return child;
}
 
Example 29
Project: MovieApp   File: HomeTvFragment.java   View source code 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_home_tv, container, false);
    init(view);
    return view;
}
 
Example 30
Project: GitHub   File: UltimateRecyclerView.java   View source code 5 votes vote down vote up
/**
 * Set the parallax header of the recyclerview
 *
 * @param header the view
 */
public void setParallaxHeader(View header) {
    mHeader = new CustomRelativeWrapper(header.getContext());
    mHeader.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mHeader.addView(header, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    isParallaxHeader = true;
}
 
Example 31
Project: ChatExchange-old   File: SlidingFragmentActivity.java   View source code 5 votes vote down vote up
@Override
public View findViewById(int id)
{
    View v = super.findViewById(id);
    if (v != null)
    {
        return v;
    }
    return mHelper.findViewById(id);
}
 
Example 32
Project: Mix   File: MainCoordinatorActivity.java   View source code 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_top:
            Intent intent_top = new Intent(MainCoordinatorActivity.this, BackTopActivity.class);
            startActivity(intent_top);
            break;
        case R.id.btn_zhihu:
            Intent intent_zhihu = new Intent(MainCoordinatorActivity.this, ZhiHuActivity.class);
            startActivity(intent_zhihu);
            break;
        case R.id.btn_cover:
            Intent intent_bottom = new Intent(MainCoordinatorActivity.this, BottomSheetActivity.class);
            startActivity(intent_bottom);
            break;
        case R.id.btn_delete:
            Intent intent_del = new Intent(MainCoordinatorActivity.this, SwipeDismissBehaviorActivity.class);
            startActivity(intent_del);
            break;
        case R.id.btn_vs:
            Intent intent_vs = new Intent(MainCoordinatorActivity.this,ViewSwitchActivity.class);
            startActivity(intent_vs);
            break;
        default:
            break;
    }
}
 
Example 33
Project: QuizApp-Android   File: QuestionActivity.java   View source code 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.button1:
            Log.e("QuestionActivity", "Optiunea 1");
            checkAnswer(1);
            break;
        case R.id.button2:
            Log.e("QuestionActivity", "Optiunea 2");
            checkAnswer(2);
            break;
        case R.id.button3:
            Log.e("QuestionActivity", "Optiunea 3");
            checkAnswer(3);
            break;
        case R.id.button4:
            Log.e("QuestionActivity", "Optiunea 4");
            checkAnswer(4);
            break;
        case R.id.nextQuestion:
            Log.e("QuestionActivity", "Next Question");
            counter++;

            if (counter == 15) {
                showFragScore();
            } else {
                answer.setText("");
                currentIndexQuestion = randomNr(0, nrOfQuestions);//generate a random index
                qid = vectorOfIds.get(currentIndexQuestion);
                nextQuestion(qid);
                vectorOfIds.remove(currentIndexQuestion);
                nrOfQuestions--;
                break;
            }
    }
}
 
Example 34
Project: LaunchEnr   File: Workspace.java   View source code 5 votes vote down vote up
/**
 * At bind time, we use the rank (screenId) to compute x and y for hotseat items.
 * See {@link #addInScreen}.
 */
public void addInScreenFromBind(View child, ItemInfo info) {
    int x = info.cellX;
    int y = info.cellY;
    if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
        int screenId = (int) info.screenId;
        x = mLauncher.getHotseat().getCellXFromOrder(screenId);
        y = mLauncher.getHotseat().getCellYFromOrder(screenId);
    }
    addInScreen(child, info.container, info.screenId, x, y, info.spanX, info.spanY);
}
 
Example 35
Project: QMUI_Android   File: QDSpanFragment.java   View source code 5 votes vote down vote up
private void initTopBar() {
    mTopBar.addLeftBackImageButton().setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            popBackStack();
        }
    });

    mTopBar.setTitle(mQDItemDescription.getName());
}
 
Example 36
Project: FloatingNew   File: FloatingActionMenu.java   View source code 5 votes vote down vote up
/**
 * Finds and returns the main content view from the Activity context.
 *
 * @return the main content view
 */
public View getActivityContentView() {
    try {
        return ((Activity) mainActionView.getContext()).getWindow().getDecorView().findViewById(android.R.id.content);
    } catch (ClassCastException e) {
        throw new ClassCastException("Please provide an Activity context for this FloatingActionMenu.");
    }
}
 
Example 37
Project: javaide   File: TerminalKeyboard.java   View source code 5 votes vote down vote up
/**
 * Called by the framework when your view for showing candidates needs to
 * be generated, like {@link #onCreateInputView}.
 */
@Override
public View onCreateCandidatesView() {
    mCandidateView = new CandidateView(this);
    mCandidateView.setService(this);

    return mCandidateView;
}
 
Example 38
Project: ChenYan   File: JoinedUserActivity.java   View source code 5 votes vote down vote up
private void back() {
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            finish();
        }
    });
}
 
Example 39
Project: LiteReader   File: DailyArticleItemViewModel.java   View source code 5 votes vote down vote up
@Override
public void onViewAttached(View view) {
    getSelfView().getBinding().title.setText(article.data.title);
    getSelfView().getBinding().author.setText("作者:" + article.data.author);
    getSelfView().getBinding().content.setRichText(article.data.content);
    getSelfView().getBinding().ivRandom.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (onAction != null) onAction.call();
        }
    });
}
 
Example 40
Project: mapbox-plugins-android   File: MarkerManager.java   View source code 5 votes vote down vote up
@Override
public View getInfoWindow(Marker marker) {
  Collection collection = mAllMarkers.get(marker);
  if (collection != null && collection.mInfoWindowAdapter != null) {
    return collection.mInfoWindowAdapter.getInfoWindow(marker);
  }
  return null;
}