Java Code Examples for android.widget.LinearLayout.setOnClickListener()

The following are Jave code examples for showing how to use setOnClickListener() of the android.widget.LinearLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: RantApp   File: ManagerRantAdapter.java   View Source Code Vote up 6 votes
public ViewHolder(View itemView, int flag) {
    super(itemView);
    upCheckbox = (CheckBox) itemView.findViewById(R.id.item_rant_item_checkbox_up);
    downCheckbox = (CheckBox) itemView.findViewById(R.id.item_rant_item_checkbox_down);

    valueTextView = (TextView) itemView.findViewById(R.id.item_rant_item_tv_value);
    contentTextView = (TextView)itemView.findViewById(R.id.item_rant_item_tv_content);
    nameTextView = (TextView)itemView.findViewById(R.id.item_rant_item_tv_name);
    commentNumTextView = (TextView)itemView.findViewById(R.id.item_rant_item_tv_comment_num);
    dateTextView = (TextView)itemView.findViewById(R.id.item_rant_item_tv_date);
    linearLayout = (LinearLayout) itemView.findViewById(R.id.item_rant_item_ll_clickable);
    actionTextView = (TextView) itemView.findViewById(R.id.item_rant_item_tv_action);
    actionTextView.setText(flag==1?"删除":"取消");
    linearLayout.setOnClickListener(this);


}
 
Example 2
Project: Orin   File: BreadCrumbLayout.java   View Source Code Vote up 6 votes
public void addCrumb(@NonNull Crumb crumb, boolean refreshLayout) {
    LinearLayout view = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.bread_crumb, this, false);
    view.setTag(mCrumbs.size());
    view.setOnClickListener(this);

    ImageView iv = (ImageView) view.getChildAt(1);
    if (Build.VERSION.SDK_INT >= 19 && iv.getDrawable() != null) {
        iv.getDrawable().setAutoMirrored(true);
    }
    iv.setVisibility(View.GONE);

    mChildFrame.addView(view, new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mCrumbs.add(crumb);
    if (refreshLayout) {
        mActive = mCrumbs.size() - 1;
        requestLayout();
    }
    invalidateActivatedAll();
}
 
Example 3
Project: buildAPKsApps   File: LinkSettingRenderer.java   View Source Code Vote up 6 votes
public View getView(LayoutInflater inflater, Setting setting, View convertView, Context context) {
	
	if (mView != null) return mView;
	mView = convertView = inflater.inflate(R.layout.row_setting_link, null);
	
	// re-initialize views
	mTitle = (TextView) convertView.findViewById(R.id.title_view);
	mDescr = (TextView) convertView.findViewById(R.id.descr_view);
	mIcon = (ImageView) convertView.findViewById(R.id.icon_view);
	LinearLayout clicableLeft = (LinearLayout) convertView.findViewById(R.id.clickable_left);

	// set values
	mSetting = setting;
	
	// set listeners
	clicableLeft.setOnClickListener(this);
	clicableLeft.setOnLongClickListener(setting.prefs == null ? null : this);

	// update view
	updateView();
	
	return convertView;
}
 
Example 4
Project: yyox   File: HelpCenterTypeChildActivity.java   View Source Code Vote up 6 votes
@Override
protected void initWidgets() {
    super.initWidgets();
    mReminderLayout = (LinearLayout) findViewById(R.id.kf5_serch_reminder_layout);
    mReminderLayout.setOnClickListener(this);
    mSearchLayout = (RelativeLayout) findViewById(R.id.kf5_search_layout_content);
    mEditText = (EditText) findViewById(R.id.kf5_search_content_edittext);
    mEditText.setOnKeyListener(this);
    mImageDelete = (ImageView) findViewById(R.id.kf5_img_delete_content);
    mImageDelete.setOnClickListener(this);
    mListView = (RefreshListView) findViewById(R.id.kf5_help_center_listview);
    mListView.setOnScrollState(this);
    mListView.setOnScrollChange(this);
    mListView.addFooterView();
    mListView.setOnRefreshListener(this);
    mListView.setOnItemClickListener(this);
    mHelpCenterAdapter = new HelpCenterAdapter(mActivity, listItem);
    mListView.setAdapter(mHelpCenterAdapter);
    mTitleView = (TextView) findViewById(R.id.kf5_title);
    mTitleView.setText(R.string.kf5_article_list);
    mRightView = (TextView) findViewById(R.id.kf5_right_text_view);
    mRightView.setOnClickListener(this);
    mTimer = new Timer();
    mBackImage = (ImageView) findViewById(R.id.kf5_return_img);
    mBackImage.setOnClickListener(this);
}
 
Example 5
Project: yyox   File: HelpCenterTypeActivity.java   View Source Code Vote up 6 votes
@Override
protected void initWidgets() {
    super.initWidgets();
    mReminderLayout = (LinearLayout) findViewById(R.id.kf5_serch_reminder_layout);
    mReminderLayout.setOnClickListener(this);
    mSearchLayout = (RelativeLayout) findViewById(R.id.kf5_search_layout_content);
    mEditText = (EditText) findViewById(R.id.kf5_search_content_edittext);
    mEditText.setOnKeyListener(this);
    mImageDelete = (ImageView) findViewById(R.id.kf5_img_delete_content);
    mImageDelete.setOnClickListener(this);
    mListView = (RefreshListView) findViewById(R.id.kf5_help_center_listview);
    mListView.setOnScrollState(this);
    mListView.setOnScrollChange(this);
    mListView.addFooterView();
    mListView.setOnRefreshListener(this);
    mListView.setOnItemClickListener(this);
    mHelpCenterAdapter = new HelpCenterAdapter(mActivity, listItem);
    mListView.setAdapter(mHelpCenterAdapter);
    mTitleView = (TextView) findViewById(R.id.kf5_title);
    mTitleView.setText(R.string.kf5_article_section);
    mRightView = (TextView) findViewById(R.id.kf5_right_text_view);
    mRightView.setOnClickListener(this);
    mTimer = new Timer();
    mBackImage = (ImageView) findViewById(R.id.kf5_return_img);
    mBackImage.setOnClickListener(this);
}
 
Example 6
Project: GlossikaSchedule   File: NewScheduleScheduleFragment.java   View Source Code Vote up 6 votes
private void loadScheduleDescriptions(FlexboxLayout descriptionContainer, int minutes) {
	int index = 0;
	for (ScheduleType scheduleType : schedules.get(minutes)) {
		View descriptionView = inflater.inflate(R.layout.item_schedule_description, descriptionContainer, false);
		// set up onclick listener
		LinearLayout scheduleLayout = descriptionView.findViewById(R.id.scheduleLayout);
		scheduleLayout.setOnClickListener(view -> {
			loadScheduleDetails(scheduleType);
		});
		// update textviews
		TextView monthsLabel = descriptionView.findViewById(R.id.bigLengthLabel);
		TextView weeksLabel = descriptionView.findViewById(R.id.smallLengthLabel);
		TextView repsLabel = descriptionView.findViewById(R.id.repsLabel);
		monthsLabel.setText(scheduleType.getCourseLength());
		weeksLabel.setText(scheduleType.getCourseLengthSmall());
		repsLabel.setText(scheduleType.getRepsAsString());
		// if it's the last one, don't show the "or"
		if (++index == schedules.get(minutes).size()) {
			TextView orLabel = descriptionView.findViewById(R.id.orLabel);
			orLabel.setVisibility(View.GONE);
		}
		// add view to container
		descriptionContainer.addView(descriptionView);
	}
}
 
Example 7
Project: zxing_qrcode_demo   File: ScanActivity.java   View Source Code Vote up 6 votes
private void initView() {
    LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linear1);
    linearLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!isOpen) {
                CodeUtils.isLightEnable(true);
                isOpen = true;
            } else {
                CodeUtils.isLightEnable(false);
                isOpen = false;
            }

        }
    });
}
 
Example 8
Project: EyeShopping   File: ActivityRecommendProducts.java   View Source Code Vote up 6 votes
public RecommendProduct_ListView(Context context, final RecommendProduct_ListItem aItem) {
    super(context);

    LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.recommend_list_view_item, this, true);

    number_text = (TextView)findViewById(R.id.recommend_product_number_text);
    number_text.setText(aItem.getNumber());

    keyword_text = (TextView)findViewById(R.id.recommend_product_keyword_text);
    keyword_text.setText(aItem.getKeyword());

    listitem_layout = (LinearLayout)findViewById(R.id.recommend_layout);

    listitem_layout.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getApplicationContext(), ActivityRecommendProductsSelect.class);
            intent.putExtra("url", aItem.getUrl());
            intent.putExtra("keyword", aItem.getKeyword() );
            startActivityForResult(intent, SELECT_REQUEST);
        }
    });
}
 
Example 9
Project: MobileMedia   File: PersonCenterFragment.java   View Source Code Vote up 5 votes
@Override
protected void initView() {
    mLinearLayout = (LinearLayout) findViewById(R.id.ll_about_mobile_video);
    mLinearLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

        }
    });
}
 
Example 10
Project: qmui   File: QMUIBottomSheet.java   View Source Code Vote up 5 votes
public BottomGridSheetBuilder addItem(int imageRes, CharSequence text, Object tag, @Style int style, int subscriptRes) {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    // 给机会让用的人自定义ItemView
    LinearLayout itemView = (LinearLayout) inflater.inflate(R.layout.qmui_bottom_sheet_grid_item, null, false);
    // 字体加粗
    TextView titleTV = (TextView) itemView.findViewById(R.id.grid_item_title);
    if(mItemTextTypeFace != null){
        titleTV.setTypeface(mItemTextTypeFace);
    }
    titleTV.setText(text);

    itemView.setTag(tag);
    itemView.setOnClickListener(this);
    AppCompatImageView imageView = (AppCompatImageView) itemView.findViewById(R.id.grid_item_image);
    imageView.setImageResource(imageRes);

    if (subscriptRes != 0) {
        ViewStub stub = (ViewStub) itemView.findViewById(R.id.grid_item_subscript);
        View inflated = stub.inflate();
        ((ImageView) inflated).setImageResource(subscriptRes);
    }

    switch (style) {
        case FIRST_LINE:
            mFirstLineViews.append(mFirstLineViews.size(), itemView);
            break;
        case SECOND_LINE:
            mSecondLineViews.append(mSecondLineViews.size(), itemView);
            break;
    }
    return this;
}
 
Example 11
Project: cda-app   File: MainActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //::::: Action Bar
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    //::::::: Action Split profile
    navigation_split_profile = (LinearLayout) findViewById(R.id.navigation_split_profile );
    navigation_split_profile.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            nextLayout = new Intent(MainActivity.this, ProfileActivity.class);
            startActivity(nextLayout);
            finish();
        }
    });

    drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open,
            R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);                                    //to add a listener and

    // Split Menu - (open split)
    MenuSplit();

    //:::FRAGMENT
    if (savedInstanceState == null)
        positionSplit = 0;

    selectFragment(positionSplit);
}
 
Example 12
Project: rongyunDemo   File: GroupDetailActivity.java   View Source Code Vote up 5 votes
private void initViews() {
    messageTop = (SwitchButton) findViewById(R.id.sw_group_top);
    messageNotification = (SwitchButton) findViewById(R.id.sw_group_notfaction);
    messageTop.setOnCheckedChangeListener(this);
    messageNotification.setOnCheckedChangeListener(this);
    LinearLayout groupClean = (LinearLayout) findViewById(R.id.group_clean);
    mGridView = (DemoGridView) findViewById(R.id.gridview);
    mTextViewMemberSize = (TextView) findViewById(R.id.group_member_size);
    mGroupHeader = (SelectableRoundedImageView) findViewById(R.id.group_header);
    LinearLayout mGroupDisplayName = (LinearLayout) findViewById(R.id.group_displayname);
    mGroupDisplayNameText = (TextView) findViewById(R.id.group_displayname_text);
    mGroupName = (TextView) findViewById(R.id.group_name);
    mQuitBtn = (Button) findViewById(R.id.group_quit);
    mDismissBtn = (Button) findViewById(R.id.group_dismiss);
    RelativeLayout totalGroupMember = (RelativeLayout) findViewById(R.id.group_member_size_item);
    LinearLayout mGroupPortL = (LinearLayout) findViewById(R.id.ll_group_port);
    LinearLayout mGroupNameL = (LinearLayout) findViewById(R.id.ll_group_name);
    mGroupAnnouncementDividerLinearLayout = (LinearLayout) findViewById(R.id.ac_ll_group_announcement_divider);
    mGroupNotice = (LinearLayout) findViewById(R.id.group_announcement);
    mSearchMessagesLinearLayout = (LinearLayout) findViewById(R.id.ac_ll_search_chatting_records);
    mGroupPortL.setOnClickListener(this);
    mGroupNameL.setOnClickListener(this);
    totalGroupMember.setOnClickListener(this);
    mGroupDisplayName.setOnClickListener(this);
    mQuitBtn.setOnClickListener(this);
    mDismissBtn.setOnClickListener(this);
    groupClean.setOnClickListener(this);
    mGroupNotice.setOnClickListener(this);
    mSearchMessagesLinearLayout.setOnClickListener(this);
}
 
Example 13
Project: thesis-project   File: ExamAddActivity.java   View Source Code Vote up 5 votes
private void init() {
    linearLayoutActivity = (LinearLayout) findViewById(add_add4);
    recyclerView = (RecyclerView) findViewById(add_recycler4);
    btnBackButton = (Button) findViewById(add_back4);
    linearLayoutGrades =(LinearLayout) findViewById(add_grade4);
    linearLayoutGrades.setOnClickListener(this);

    linearLayoutActivity.setOnClickListener(this);
    btnBackButton.setOnClickListener(this);
}
 
Example 14
Project: GitHub   File: MainInfoActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_info_fragment_layout);
    top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back);
    top_bar_linear_back.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            MainInfoActivity.this.finish();
        }
    });
    top_bar_title=(TextView)this.findViewById(R.id.top_bar_title);
    top_bar_title.setText("Fragment+ViewPager+FragmentStatePagerAdapter实例");
}
 
Example 15
Project: TYT   File: T_ContactsCompanyDetailsMoreInlandFragment.java   View Source Code Vote up 5 votes
public ViewHolder(final View itemView) {
    super(itemView);
    tv_saleOrder = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_top_left);
    tv_orderCommodityName = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_down_left);
    tv_orderCommodityAmount = (AppCompatTextView) itemView.findViewById(R.id.tv_top_right);
    tv_createDate = (AppCompatTextView) itemView.findViewById(R.id.tv_down_right);

    ll_content = (LinearLayout) itemView.findViewById(R.id.ll_content);
    ll_content.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
        }
    });
}
 
Example 16
Project: thesis-project   File: ExamAddActivityF.java   View Source Code Vote up 5 votes
private void init() {
    linearLayoutGrades = (LinearLayout)findViewById(R.id.add_grade1);
    linearLayoutActivity = (LinearLayout) findViewById(add_add4);
    recyclerView = (RecyclerView) findViewById(add_recycler4);
    btnBackButton = (Button) findViewById(add_back4);
    linearLayoutGrades.setOnClickListener(this);

    linearLayoutActivity.setOnClickListener(this);
    btnBackButton.setOnClickListener(this);
}
 
Example 17
Project: YCStateLayout   File: MainActivity.java   View Source Code Vote up 5 votes
/**
 * 点击重新刷新
 */
private void initErrorDataView() {
    statusLayoutManager.showError();
    LinearLayout ll_error_data = (LinearLayout) findViewById(R.id.ll_error_data);
    ll_error_data.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            initData();
            adapter.notifyDataSetChanged();
            showContent();
        }
    });
}
 
Example 18
Project: Mire   File: FragmentAbout.java   View Source Code Vote up 5 votes
private void setupIntentContact()
{
	contact = (LinearLayout)root.findViewById(R.id.id_contact);
	contact.setOnClickListener(new View.OnClickListener()
	{
		@Override
		public void onClick(View view)
		{
			Preferences.start(getActivity(), ActivityContact.class);
		}
	});
}
 
Example 19
Project: android-project-gallery   File: Wo2bAppListActivity.java   View Source Code Vote up 4 votes
@Override
public void realOnBindViewHolder(RecyclerViewHolder holder, int position)
{
	ImageView image = holder.findViewById(R.id.image);
	ImageView icon_app_level = holder.findViewById(R.id.icon_app_level);
	TextView name = holder.findViewById(R.id.name);
	TextView download_count = holder.findViewById(R.id.download_count);
	TextView size = holder.findViewById(R.id.size);
	TextView status = holder.findViewById(R.id.status);
	LinearLayout operation = holder.findViewById(R.id.operation);
	
	AppInfo appInfo = realGetItem(position);
	name.setText(getString(R.string.position_title, position + 1, appInfo.getAppname()));
	download_count.setText(formatDownloadCount(15000));
	size.setText(FileUtils.formatByte(appInfo.getSize()));

	// 服务器端为10分制, 分1-2, 3-4, 5-6, 7-8, 9-10共五个等级.
	icon_app_level.setImageResource(APP_LEVEL_ICON_ARRAY[appInfo.getRatings() - 1]);
	
	Drawable drawable = null;
	if (appInfo.isInstall())
	{
		// 已安装
		if (appInfo.isSelf())
		{
			// 该app为当前使用的app
			drawable = getResources().getDrawable(R.drawable.apk_used_now);
			status.setText(R.string.running_now);
		}
		else
		{
			drawable = getResources().getDrawable(R.drawable.apk_open);
			status.setText(R.string.open);
		}
	}
	else if (appInfo.isDownloaded())
	{
		// 已下载
		drawable = getResources().getDrawable(R.drawable.apk_install);
		status.setText(R.string.click_to_install);
	}
	else
	{
		// 待下载
		drawable = getResources().getDrawable(R.drawable.apk_download);
		status.setText(R.string.download);
	}
	
	drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
	status.setCompoundDrawablePadding(ViewUtils.dip2px(mContext, 5));
	status.setCompoundDrawables(null, drawable, null, null);
	
	operation.setOnClickListener(new OnOperationClickListener(appInfo));
	
	mImageLoader.displayImage(appInfo.getLogo(), image, mOptions);
}
 
Example 20
Project: GCSApp   File: GroupDetailsActivity.java   View Source Code Vote up 4 votes
@Override
        public View getView(final int position, View convertView, final ViewGroup parent) {
            ViewHolder holder = null;
            if (convertView == null) {
                holder = new ViewHolder();
                convertView = LayoutInflater.from(getContext()).inflate(res, null);
                holder.imageView = (ImageView) convertView.findViewById(R.id.iv_avatar);
                holder.textView = (TextView) convertView.findViewById(R.id.tv_name);
                holder.badgeDeleteView = (ImageView) convertView.findViewById(R.id.badge_delete);
                convertView.setTag(holder);
            } else {
                holder = (ViewHolder) convertView.getTag();
            }

            final LinearLayout button = (LinearLayout) convertView.findViewById(R.id.button_avatar);

            final String username = getItem(position);
            convertView.setVisibility(View.VISIBLE);
            button.setVisibility(View.VISIBLE);
            EaseUserUtils.setUserNick(username, holder.textView);
            EaseUserUtils.setUserAvatar(getContext(), username, holder.imageView);

            LinearLayout id_background = (LinearLayout) convertView.findViewById(R.id.l_bg_id);
            id_background.setBackgroundColor(convertView.getResources().getColor(
                    position == 0 ? R.color.holo_red_light : R.color.holo_orange_light));
            button.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
//                    if (!isCurrentOwner(group)) {
//                        return;
//                    }
//                    if (username.equals(group.getOwner())) {
//                        return;
//                    }
//                    operationUserId = username;
//                    Dialog dialog = createMemberMenuDialog();
//                    dialog.show();
//
//                    boolean[] adminVisibilities = {
//                            true,       //R.id.menu_item_transfer_owner,
//                            false,      //R.id.menu_item_add_admin,
//                            true,       //R.id.menu_item_rm_admin,
//                            false,      //R.id.menu_item_remove_member,
//                            false,      //R.id.menu_item_add_to_blacklist,
//                            false,      //R.id.menu_item_remove_from_blacklist,
//                            false,      //R.id.menu_item_mute,
//                            false,      //R.id.menu_item_unmute
//                    };
//                    try {
//                        setVisibility(dialog, ids, adminVisibilities);
//                    } catch (Exception e) {
//                        e.printStackTrace();
//                    }
                }
            });
            return convertView;
        }