Java Code Examples for android.view.View.findViewById()

The following are Jave code examples for showing how to use findViewById() of the android.view.View 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: Remindy   File: ProgrammedLocationBasedTaskViewHolder.java   View Source Code Vote up 7 votes
public ProgrammedLocationBasedTaskViewHolder(View itemView, ViewHolderClickListener listener) {
    super(itemView);

    mClickListener = listener;

    mContainer = (RelativeLayout) itemView.findViewById(R.id.item_task_programmed_location_based_container);
    mCategoryIcon = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_category_icon);

    mAttachmentList = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_attachment_list);
    mAttachmentLink = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_attachment_link);
    mAttachmentAudio = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_attachment_audio);
    mAttachmentImage = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_attachment_image);
    mAttachmentText = (ImageView) itemView.findViewById(R.id.item_task_programmed_location_based_attachment_text);

    mTitle = (TextView) itemView.findViewById(R.id.item_task_programmed_location_based_title);
    mDescription = (TextView) itemView.findViewById(R.id.item_task_programmed_location_based_description);

    mLocation = (TextView) itemView.findViewById(R.id.item_task_programmed_location_based_location);
    mItemDecoration = itemView.findViewById(R.id.item_task_programmed_location_item_decoration);

}
 
Example 2
Project: proto-collecte   File: Informations_operateurs.java   View Source Code Vote up 7 votes
@Override
public void setView(View view) {
    super.setView(view);

    operateur = (TextView) view.findViewById(R.id.operateur);
    maListe = (ListView) view.findViewById(R.id.liste_systemes);

    //On utilise notre classe adapter à qui on envoie la liste que l'on souhaite traiter
    OperatorAdapter sup_adapter = new OperatorAdapter(getContext() , this.operateurs);

 //   operateur.setText(tv_operateur);

    if(operateurs.size() == 0)
    {
        operateur.setText("Non renseigné");
    }
    else
    {
        operateur.setText("Liste des opérateurs");
    }
    maListe.setAdapter(sup_adapter);

}
 
Example 3
Project: Android-Timeline-View   File: VerticalRecyclerViewAdapter.java   View Source Code Vote up 7 votes
public VerticalRecyclerViewHolder(View view) {
    super(view);

    time = (TextView) view.findViewById(R.id.tv_timeline_time);
    header = (TextView) view.findViewById(R.id.tv_timeline_header);
    header.setVisibility(View.INVISIBLE);

    timelineindicator_container = (RelativeLayout) view.findViewById(R.id.container_timeline_indicator);
    timelineindicator_line = (TextView) view.findViewById(R.id.tv_timeline_indicator_line);

    /*apply configs*/
    time.setTextColor(Color.parseColor(TimeLineConfig.getTimelineHeaderTextColour()));
    time.setTextSize(TimeLineConfig.getTimelineHeaderSize());
    timelineindicator_line.setBackgroundColor(Color.parseColor(TimeLineConfig.getTimelineIndicatorLineColour()));
    timelineindicator_container.setBackgroundColor(Color.parseColor(TimeLineConfig.getTimelineIndicatorBackgroundColour()));

    recyclerView = (RecyclerView) view.findViewById(R.id.rv_horizontal_timeline);

    LinearLayoutManager recyclerViewLayoutManager = new LinearLayoutManager(context);
    recyclerView.setLayoutManager(recyclerViewLayoutManager);
    LinearLayoutManager horizontalLinearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
    recyclerView.setLayoutManager(horizontalLinearLayoutManager);
}
 
Example 4
Project: dhbw-timetable-android   File: TodayFragment.java   View Source Code Vote up 6 votes
private void applyAgenda(View view) {
    agendaAppointmentSet.clear();
    String currDate = DateUtilities.Backport.GetCurrentDate();
    for (BackportAppointment a : TimetableManager.getInstance().getGlobalsAsList()) {
        if (a.getDate().equals(currDate)) {
            agendaAppointmentSet.add(new AgendaAppointment(a.getStartTime(), a.getEndTime(), a.getTitle(), a.getPersons(), a.getResources(), false));
        }
    }
    int size = agendaAppointmentSet.size();
    TextView placeholder = view.findViewById(R.id.agendaEmptyPlaceholder);
    if (size > 0) {
        placeholder.setText("");
        LinkedHashSet<AgendaAppointment> appointmentsWithBreaks = new LinkedHashSet<>();

        Object[] agendaAppointmentArray = agendaAppointmentSet.toArray();

        for (int i = 0; i < size; i++) {
            AgendaAppointment aa = (AgendaAppointment) agendaAppointmentArray[i];
            appointmentsWithBreaks.add(aa);
            if (i < size - 1) {
                AgendaAppointment following = (AgendaAppointment) agendaAppointmentArray[i + 1];
                // If break is present
                if (!aa.getEndTime().equals(following.getStartTime())) {
                    appointmentsWithBreaks.add(new AgendaAppointment(aa.getEndTime(), "DONOTUSE", "BREAK", "DONOTUSE", "DONOTUSE", true));
                }
            }
        }
        agendaAppointmentSet.clear();
        agendaAppointmentSet.addAll(appointmentsWithBreaks);

        String endTime = ((AgendaAppointment) agendaAppointmentArray[agendaAppointmentArray.length - 1]).getEndTime();
        agendaAppointmentSet.add(new AgendaAppointment(endTime, "", "END", "DONOTUSE", "DONOTUSE", true));

        aAdapter.notifyDataSetChanged();
    } else {
        placeholder.setText("No appointments");
    }
}
 
Example 5
Project: security-config   File: MainFragment.java   View Source Code Vote up 6 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {


    PostAdapter.PostAdapterCallback mPostLoadingListener = new PostAdapter.PostAdapterCallback() {

        @Override
        public void onPostImageLoadingError(String error, Exception e) {
            mPresenter.onLoadPostImageError(error, e);
        }
    };
    mPostAdapter = new PostAdapter(getContext(), mPostLoadingListener);

    // Inflate the layout for this fragment
    View layout = inflater.inflate(R.layout.fragment_main, container, false);
    mProgressBar = (ProgressBar) layout.findViewById(R.id.progressBar);
    mLayout = (CoordinatorLayout) layout.findViewById(R.id.layout_coordinator);
    mPostList = (RecyclerView) layout.findViewById(R.id.post_list);

    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mPostList.setLayoutManager(layoutManager);
    mPostList.setAdapter(mPostAdapter);

    layout.findViewById(R.id.load_posts).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onLoadPostsClick();
        }
    });

    //TODO: Remove - for testing only:
    onLoadPostsClick();

    return layout;
}
 
Example 6
Project: FloatingNew   File: RecyclerViewAdapterResultIconOnly.java   View Source Code Vote up 6 votes
DataViewHolder(View itemView) {
    super(itemView);
   // textView = (TextView) itemView.findViewById(R.id.tv2);
   // textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    imageView = (ImageView) itemView.findViewById(R.id.iv1);
    imageView.setOnClickListener(this);
}
 
Example 7
Project: sealtalk-android-master   File: MineFragment.java   View Source Code Vote up 6 votes
private void initViews(View mView) {
    mNewVersionView = (ImageView) mView.findViewById(R.id.new_version_icon);
    imageView = (SelectableRoundedImageView) mView.findViewById(R.id.mine_header);
    mName = (TextView) mView.findViewById(R.id.mine_name);

    //头像和name条目
    LinearLayout mUserProfile = (LinearLayout) mView.findViewById(R.id.start_user_profile);
    //账号设置条目
    LinearLayout mMineSetting = (LinearLayout) mView.findViewById(R.id.mine_setting);
    //我的红包条目
    LinearLayout mMinWallet = (LinearLayout) mView.findViewById(R.id.my_wallet);
    //意见反馈条目
    LinearLayout mMineService = (LinearLayout) mView.findViewById(R.id.mine_service);
    //小能客服条目
    LinearLayout mMineXN = (LinearLayout) mView.findViewById(R.id.mine_xiaoneng);
    //关于条目
    LinearLayout mMineAbout = (LinearLayout) mView.findViewById(R.id.mine_about);
    //如果是调试  则显示小能客服条目
    if(isDebug){
        mMineXN.setVisibility(View.VISIBLE);
    }else{
        mMineXN.setVisibility(View.GONE);
    }

    mUserProfile.setOnClickListener(this);
    mMineSetting.setOnClickListener(this);
    mMinWallet.setOnClickListener(this);
    mMineService.setOnClickListener(this);
    mMineAbout.setOnClickListener(this);
    mMineXN.setOnClickListener(this);
}
 
Example 8
Project: Hitalk   File: FriendSearchResultAdapter.java   View Source Code Vote up 6 votes
public FriendSearchItemHolder(View itemView) {
    super(itemView);

    avatarImv = (ImageView) itemView.findViewById(R.id.avatarImv);
    nickTv = (TextView) itemView.findViewById(R.id.nickTv);
    collegeTv = (TextView) itemView.findViewById(R.id.sInfo);
}
 
Example 9
Project: android-Ultra-Pull-To-Refresh   File: WithLongPressFragment.java   View Source Code Vote up 6 votes
/**
 * create a view from resource Xml file, and hold the view that may be used in displaying data.
 *
 * @param layoutInflater
 */
@Override
public View createView(LayoutInflater layoutInflater) {
    View view = layoutInflater.inflate(R.layout.with_long_press_list_view_item, null);
    mImageView = (CubeImageView) view.findViewById(R.id.with_long_press_list_image);
    return view;
}
 
Example 10
Project: 2017.1-Trezentos   File: ShowClassComponentsFragment.java   View Source Code Vote up 6 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    Intent intent = getActivity().getIntent();
    userClass = (UserClass) intent.getSerializableExtra("Class");
    userExam = (Exam) intent.getSerializableExtra("Exam");
    students = userClass.getStudents();



    View view = inflater.inflate(R.layout.fragment_show_class_components
            , container, false); // Inflate the layout for this fragment

    if(students != null) {

        RecyclerView recyclerView = (RecyclerView) view
                .findViewById(R.id.recycler_class_components);
        recyclerView.setAdapter(new ShowClassComponentsFragment
                .ShowClassComponentAdapter(students, getActivity()
                .getApplicationContext(), recyclerView));

        final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(layoutManager);
    }

    return view;
}
 
Example 11
Project: Quadro   File: PostListFragment.java   View Source Code Vote up 6 votes
@Override
public View onCreateView (LayoutInflater inflater, ViewGroup container,
                          Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View rootView = inflater.inflate(R.layout.fragment_all_posts, container, false);

    // [START create_database_reference]
    mDatabase = FirebaseDatabase.getInstance().getReference();
    // [END create_database_reference]

    mRecycler = (RecyclerView) rootView.findViewById(R.id.messages_list);
    mRecycler.setHasFixedSize(true);

    return rootView;
}
 
Example 12
Project: android-dev-challenge   File: GreenAdapter.java   View Source Code Vote up 6 votes
/**
 * Constructor for our ViewHolder. Within this constructor, we get a reference to our
 * TextViews and set an onClickListener to listen for clicks. Those will be handled in the
 * onClick method below.
 * @param itemView The View that you inflated in
 *                 {@link GreenAdapter#onCreateViewHolder(ViewGroup, int)}
 */
public NumberViewHolder(View itemView) {
    super(itemView);

    listItemNumberView = (TextView) itemView.findViewById(R.id.tv_item_number);

    // TODO (11) Use itemView.findViewById to get a reference to tv_view_holder_instance
    viewHolderIndex = (TextView) itemView.findViewById(R.id.tv_view_holder_instance);
}
 
Example 13
Project: MyFire   File: ViewHolderUtil.java   View Source Code Vote up 6 votes
@SuppressWarnings("unchecked")
public static <T extends View> T get(View view, int id) {
	SparseArray<View> viewHolder = (SparseArray<View>) view.getTag();
	if (viewHolder == null) {
		viewHolder = new SparseArray<View>();
		view.setTag(viewHolder);
	}
	View childView = viewHolder.get(id);
	if (childView == null) {
		childView = view.findViewById(id);
		viewHolder.put(id, childView);
	}
	return (T) childView;
}
 
Example 14
Project: FlycoTabLayout   File: SimpleCardFragment.java   View Source Code Vote up 6 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fr_simple_card, null);
    TextView card_title_tv = (TextView) v.findViewById(R.id.card_title_tv);
    card_title_tv.setText(mTitle);

    return v;
}
 
Example 15
Project: edslider   File: MyAdapter.java   View Source Code Vote up 5 votes
public MyHolder(View v)
{
    super(v);
    button = (Button) v.findViewById(R.id.button);
    button.setOnLongClickListener(this);
}
 
Example 16
Project: Musicoco   File: PlayListAdapter.java   View Source Code Vote up 5 votes
ViewHolder(View convertView) {
    name = (TextView) convertView.findViewById(R.id.play_list_item_name);
    number = (TextView) convertView.findViewById(R.id.play_list_item_number);
    arts = (TextView) convertView.findViewById(R.id.play_list_item_arts);
    remove = (ImageButton) convertView.findViewById(R.id.play_list_item_remove);
}
 
Example 17
Project: AndroidBackendlessChat   File: ContactsExpandableListAdapter.java   View Source Code Vote up 5 votes
@Override
    public View getChildView(int groupPosition, final int childPosition,
                             boolean isLastChild, View convertView, ViewGroup parent) {

        user = getChild(groupPosition, childPosition);
        final String childText = user.getMetaName();

        if (convertView == null) {
            convertView = inflater.inflate(R.layout.chat_sdk_row_contact, null);
        }

        txtContactName = (TextView) convertView.findViewById(R.id.chat_sdk_txt);
        imgPicture = (CircleImageView) convertView.findViewById(R.id.img_profile_picture);

        txtContactName.setText(childText);

/*        // TODO delete this only for testing the contact icon
        user.pictureURL = "http://www.wandake.com/blog/wp-content/uploads/2011/07/bender-289x300.jpg";
        user.pictureExist = true;
        // TODO delete this only for testing the contact icon*/
/*FIXME need to work with url
        Bitmap bitmap = user.getMetaPicture();
        if (bitmap != null)
        {
            imgPicture.setImageBitmap(bitmap);
        }*/
/*        else if (user.pictureExist)
        {
//            imgPicture.setImageResource(0);
//            imageLoader.DisplayImage(user.pictureURL, imgPicture);
            VolleyUtills.getImageLoader().get(user.pictureURL,
                                VolleyUtills.getImageLoader().getImageListener(imgPicture,
                                        R.drawable.ic_user, android.R.drawable.stat_notify_error));
        }*/
       /* else
        {
            imgPicture.setImageResource(R.drawable.ic_user);
        }
*/
        return convertView;
    }
 
Example 18
Project: OSchina_resources_android   File: SkillAdapter.java   View Source Code Vote up 5 votes
SkillHolder(View itemView) {
    super(itemView);
    mCheck = (CheckBox) itemView.findViewById(R.id.cb_selected);
    mTextSkill = (TextView) itemView.findViewById(R.id.tv_skill);
}
 
Example 19
Project: 2017.1-Trezentos   File: CustomAdapter.java   View Source Code Vote up 5 votes
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    // Get the data item for this position
    UserClass userClass = getItem(position);
    // Check if an existing view is being reused, otherwise inflate the view
    ViewHolder viewHolder; // view lookup cache stored in tag

    final View result;

    if (convertView == null) {

        viewHolder = new ViewHolder();
        LayoutInflater inflater = LayoutInflater.from(getContext());
        convertView = inflater.inflate(R.layout.row_item, parent, false);
        viewHolder.className = (TextView) convertView.findViewById(R.id.name);
        viewHolder.institution = (TextView) convertView.findViewById(R.id.type);
        //viewHolder.cutOff = (double) convertView.findViewById(R.id.version_number);
        // Teacher here
        viewHolder.info = (ImageView) convertView.findViewById(R.id.item_info);

        result=convertView;

        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
        result=convertView;
    }

    Animation animation = AnimationUtils.loadAnimation(mContext, (position > lastPosition)
            ? R.anim.down_from_top : R.anim.down_from_top);
    result.startAnimation(animation);
    lastPosition = position;

    viewHolder.className.setText(userClass.getClassName());
    viewHolder.institution.setText(userClass.getInstitution());
    //viewHolder.cutOff.setText(userClass.getCutOff());
    viewHolder.info.setOnClickListener(this);
    viewHolder.info.setTag(position);
    // Return the completed view to render on screen
    return convertView;
}
 
Example 20
Project: CosmoCalendar   File: MultipleSelectionBarAdapter.java   View Source Code Vote up 5 votes
public TitleViewHolder(View itemView) {
    super(itemView);
    tvTitle = (TextView) itemView.findViewById(R.id.tv_title);
}