android.widget.TextView Java Examples

The following examples show how to use android.widget.TextView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: FimiX8-RE   Author: wladimir-computin   File: X8AiFollowConfirmUi.java    License: MIT License 6 votes vote down vote up
public void initViews(View rootView) {
    this.imgReturn = rootView.findViewById(R.id.img_ai_follow_return);
    this.btnOk = rootView.findViewById(R.id.btn_ai_follow_confirm_ok);
    this.cbTip = (CheckBox) rootView.findViewById(R.id.cb_ai_follow_confirm_ok);
    this.vItemSelect = rootView.findViewById(R.id.ll_ai_follow_item);
    this.vConfirm = rootView.findViewById(R.id.rl_ai_follow_info_confirm);
    this.tvTitle = (TextView) rootView.findViewById(R.id.tv_ai_follow_title);
    this.tvContentTip1 = (TextView) rootView.findViewById(R.id.tv_ai_follow_confirm_title1);
    this.tvContentTip2 = (TextView) rootView.findViewById(R.id.tv_ai_follow_confirm_title2);
    this.svTips = (ScrollView) rootView.findViewById(R.id.sv_ai_items);
    this.vItem1 = rootView.findViewById(R.id.rl_ai_follow_normal);
    this.vItem2 = rootView.findViewById(R.id.rl_ai_follow_parallel);
    this.vItem3 = rootView.findViewById(R.id.rl_ai_follow_lockup);
    this.vItemSelect.setVisibility(0);
    this.vConfirm.setVisibility(8);
    this.tvTitle.setText(this.contentView.getContext().getString(R.string.x8_ai_fly_follow));
    this.imgFlag = (ImageView) rootView.findViewById(R.id.img_follow_flag);
}
 
Example #2
Source Project: AndroidProjects   Author: why168   File: LongListActivity.java    License: MIT License 6 votes vote down vote up
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    // Inflate list items.
    if (null == convertView) {
        convertView = layoutInflater.inflate(R.layout.list_item, null);
    }

    convertView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((TextView) findViewById(R.id.selection_row_value)).setText(
                    String.valueOf(position));
        }
    });

    return super.getView(position, convertView, parent);
}
 
Example #3
Source Project: Popeens-DSub   Author: popeen   File: ArtistAdapter.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onBindHeaderHolder(UpdateView.UpdateViewHolder holder, String header, int sectionIndex) {
	TextView folderName = (TextView) holder.getView().findViewById(R.id.select_artist_folder_2);

	String musicFolderId = Util.getSelectedMusicFolderId(context);
	if(musicFolderId != null) {
		for (MusicFolder musicFolder : musicFolders) {
			if (musicFolder.getId().equals(musicFolderId)) {
				folderName.setText(musicFolder.getName());
				break;
			}
		}
	} else {
		folderName.setText(R.string.select_artist_all_folders);
	}
}
 
Example #4
Source Project: Mp4Composer-android   Author: MasayukiSuda   File: VideoListAdapter.java    License: MIT License 6 votes vote down vote up
@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    VideoItem data = getItem(position);

    if (null == convertView) {
        convertView = layoutInflater.inflate(R.layout.row_video_list, null);
    }

    ImageView imageView = convertView.findViewById(R.id.image);
    TextView textView = convertView.findViewById(R.id.txt_image_name);

    Glide.with(getContext().getApplicationContext())
            .load(data.getPath())
            .into(imageView);

    textView.setText(data.getPath());

    return convertView;
}
 
Example #5
Source Project: QRefreshLayout   Author: zhangxq   File: DefaultLoadView.java    License: MIT License 6 votes vote down vote up
public DefaultLoadView(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    tvContent = new TextView(context);
    tvContent.setId(View.generateViewId());
    addView(tvContent);
    RelativeLayout.LayoutParams contentParams = (LayoutParams) tvContent.getLayoutParams();
    contentParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    progressBar = new ProgressBar(context);
    addView(progressBar);
    final float density = getContext().getResources().getDisplayMetrics().density;
    RelativeLayout.LayoutParams params = (LayoutParams) progressBar.getLayoutParams();
    params.width = (int) (20 * density);
    params.height = (int) (20 * density);
    params.addRule(RelativeLayout.CENTER_IN_PARENT);
    params.rightMargin = (int) (10 * density);
    params.addRule(RelativeLayout.LEFT_OF, tvContent.getId());
    progressBar.setLayoutParams(params);
}
 
Example #6
Source Project: FragmentMaster   Author: fengdai   File: ReceiveResult.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mResultView = (TextView) view.findViewById(R.id.resultView);
    view.findViewById(R.id.button).setOnClickListener(
            new OnClickListener() {
                @Override
                public void onClick(View v) {
                    startFragmentForResult(NumbersList.class, REQUEST_CODE);
                }
            });
    FragmentManager fragmentManager = getChildFragmentManager();
    if (fragmentManager.findFragmentByTag("TAG_CHILD") == null) {
        FragmentTransaction ft = fragmentManager.beginTransaction();
        ft.add(R.id.childContainer, new Child(), "TAG_CHILD");
        ft.commitAllowingStateLoss();
        fragmentManager.executePendingTransactions();
    }
}
 
Example #7
Source Project: BlackList   Author: kaliturin   File: ProgressDialogHolder.java    License: Apache License 2.0 6 votes vote down vote up
public void show(Context context, @StringRes int titleId, @StringRes int messageId,
                 DialogInterface.OnCancelListener listener) {
    dismiss();
    DialogBuilder builder = new DialogBuilder(context);
    if (titleId > 0) {
        builder.setTitle(titleId);
    }
    LayoutInflater inflater = LayoutInflater.from(context);
    View itemView = inflater.inflate(R.layout.row_progress, null);
    messageTextView = (TextView) itemView.findViewById(R.id.text_progress);
    if (messageId > 0) {
        messageTextView.setText(messageId);
    }
    builder.addItem(itemView);
    builder.setOnCancelListener(listener);
    dialog = builder.show();
}
 
Example #8
Source Project: Kernel-Tuner   Author: pedja1   File: TMAdapter.java    License: GNU General Public License v3.0 6 votes vote down vote up
private ViewHolder getViewHolder(final View workingView)
{
    final Object tag = workingView.getTag();
    ViewHolder viewHolder = null;


    if (null == tag || !(tag instanceof ViewHolder))
    {
        viewHolder = new ViewHolder();

        viewHolder.nameView = (TextView) workingView.findViewById(R.id.name);
        viewHolder.mbView = (TextView) workingView.findViewById(R.id.mb);
        viewHolder.imageView = (ImageView) workingView.findViewById(R.id.icon);
        viewHolder.killView = (Button) workingView.findViewById(R.id.kill);
        viewHolder.pidView = (TextView) workingView.findViewById(R.id.pid);

        workingView.setTag(viewHolder);

    }
    else
    {
        viewHolder = (ViewHolder) tag;
    }

    return viewHolder;
}
 
Example #9
Source Project: react-native-android-wear-demo   Author: bevkoski   File: MainActivity.java    License: MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  btnIncreaseCounter = (Button) findViewById(R.id.btnWearIncreaseCounter);
  btnIncreaseCounter.getBackground().setColorFilter(0xFF1194F7, PorterDuff.Mode.MULTIPLY);
  tvCounter = (TextView) findViewById(R.id.tvCounter);
  tvCounter.setText(Integer.toString(count));

  client = new GoogleApiClient.Builder(this).addApi(Wearable.API)
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this)
    .build();

  btnIncreaseCounter.setOnClickListener(clickListener);
}
 
Example #10
Source Project: WifiChat   Author: hillfly   File: SettingInfoActivity.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void initViews() {

    mIvAvater = (ImageView) findViewById(R.id.setting_my_avater_img);
    mEtNickname = (EditText) findViewById(R.id.setting_my_nickname);
    mRgGender = (RadioGroup) findViewById(R.id.setting_baseinfo_rg_gender);
    mHtvConstellation = (TextView) findViewById(R.id.setting_birthday_htv_constellation);
    mHtvAge = (TextView) findViewById(R.id.setting_birthday_htv_age);
    mDpBirthday = (DatePicker) findViewById(R.id.setting_birthday_dp_birthday);

    mRbBoy = (RadioButton) findViewById(R.id.setting_baseinfo_rb_male);
    mRbGirl = (RadioButton) findViewById(R.id.setting_baseinfo_rb_female);

    mBtnBack = (Button) findViewById(R.id.setting_btn_back);
    mBtnNext = (Button) findViewById(R.id.setting_btn_next);

}
 
Example #11
Source Project: AndrOBD   Author: fr3ts0n   File: BtDeviceListActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3)
{
	// Cancel discovery because it's costly and we're about to connect
	mBtAdapter.cancelDiscovery();

	// Get the device MAC address, which is the last 17 chars in the View
	String info = ((TextView) v).getText().toString();
	String address = info.substring(info.length() - 17);
	//String address = "00:0D:18:A0:4E:35"; //FORCE OBD MAC Address
	// Create the result Intent and include the MAC address
	Intent intent = new Intent();
	intent.putExtra(EXTRA_DEVICE_ADDRESS, address);

	// Set result and finish this Activity
	setResult(Activity.RESULT_OK, intent);
	log.log(Level.FINE, "Sending Result...");
	finish();
}
 
Example #12
Source Project: xDrip-plus   Author: jamorham   File: ThinJamActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = ActivityThinJamBinding.inflate(getLayoutInflater());
    binding.setVm(new ViewModel(this));
    setContentView(binding.getRoot());
    JoH.fixActionBar(this);

    scanMeister.setFilter(customFilter);
    scanMeister.allowWide().unlimitedMatches();
    scanMeister.addCallBack2(this, TAG);

    ((TextView) findViewById(R.id.tjLogText)).setMovementMethod(new ScrollingMovementMethod());

    // handle incoming extras - TODO do we need to wait for service connect?
    final Bundle bundle = getIntent().getExtras();
    processIncomingBundle(bundle);

    LocationHelper.requestLocationForBluetooth(this);
}
 
Example #13
Source Project: AirFree-Client   Author: 1anc3r   File: TalkActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void init() {
        iLanguage();
        sendMessage("talk", getIPAddress() + strJoinToChatroom);
        app = (ApplicationUtil) this.getApplication();
        tvShow = (TextView) findViewById(R.id.tv_show);
        tvShow.setText(strShow);
        btnBack = (Button) findViewById(R.id.btn_back);
        btnBack.setOnClickListener(this);
        btnSend = (Button) findViewById(R.id.btn_send);
        btnSend.setText(strSend);
        btnSend.setOnClickListener(this);
        etContent = (EditText) findViewById(R.id.et_content);
        lvTalk = (ListView) findViewById(R.id.lv_talk);
        lvTalk.setDividerHeight(0);
        adapter = new TalkAdapter(this, list);
        lvTalk.setAdapter(adapter);
        lvTalk.smoothScrollToPosition(adapter.getCount() - 1);
//        tHandler.post(tRunnable);
        mThreadClient = new Thread(tRunnable);
        mThreadClient.start();
    }
 
Example #14
Source Project: BotLibre   Author: BotLibre   File: ForumActivity.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public void resetView() {
       setContentView(R.layout.activity_forum);
	
       ForumConfig instance = (ForumConfig)MainActivity.instance;

       super.resetView();

       if (instance.isExternal) {
       	findViewById(R.id.newPostButton).setVisibility(View.GONE);
       	findViewById(R.id.postsButton).setVisibility(View.GONE);
       }

   	TextView text = (TextView) findViewById(R.id.postsLabel);
       if (instance.posts != null && instance.posts.length() > 0) {
        text.setText(instance.posts + " posts");
       } else {
        text.setText("");        	
       }
}
 
Example #15
Source Project: Trebuchet   Author: talentlo   File: ThirdPartyWallpaperPickerListAdapter.java    License: GNU General Public License v3.0 6 votes vote down vote up
public View getView(int position, View convertView, ViewGroup parent) {
    View view;

    if (convertView == null) {
        view = mInflater.inflate(R.layout.wallpaper_picker_third_party_item, parent, false);
    } else {
        view = convertView;
    }

    ResolveInfo info = mThirdPartyWallpaperPickers.get(position).mResolveInfo;
    TextView label = (TextView) view.findViewById(R.id.wallpaper_item_label);
    label.setText(info.loadLabel(mPackageManager));
    Drawable icon = info.loadIcon(mPackageManager);
    icon.setBounds(new Rect(0, 0, mIconSize, mIconSize));
    label.setCompoundDrawables(null, icon, null, null);
    return view;
}
 
Example #16
Source Project: permiso   Author: greysonp   File: PermisoDialogFragment.java    License: MIT License 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), mThemeId);

    // Title
    if (mTitle != null) {
        builder.setTitle(mTitle);
    }

    // Message
    if (mHasHtml) {
        TextView msg = new TextView(getActivity());
        msg.setText(Html.fromHtml(mMessage));
        msg.setMovementMethod(LinkMovementMethod.getInstance());
        builder.setView(msg);
    } else if (mMessage != null) {
        builder.setMessage(mMessage);
    }

    // Button text
    String buttonText;
    if (mButtonText != null) {
        buttonText = mButtonText;
    } else {
        buttonText = getString(android.R.string.ok);
    }
    builder.setPositiveButton(buttonText, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (mOnCloseListener != null) {
                mOnCloseListener.onClose();
            }
        }
    });
    return builder.create();
}
 
Example #17
Source Project: styT   Author: stytooldex   File: SampleAdapter.java    License: Apache License 2.0 5 votes vote down vote up
public HeaderViewHolder(View itemView) {
    super(itemView);
    linearLayout = (LinearLayout) itemView.findViewById(R.id.lxw_id_item_helps_include_avertor);
    userimg = (nico.styTool.CircleImageView) linearLayout.findViewById(R.id.lxw_id_item_helps_userimg);
    username = (TextView) linearLayout.findViewById(R.id.lxw_id_item_helps_username);
    personality = (TextView) linearLayout.findViewById(R.id.lxw_id_item_helps_user_personality);
    creatTime = (TextView) linearLayout.findViewById(R.id.lxw_id_item_helps_create_time);
    content = (TextView) itemView.findViewById(R.id.lxw_id_item_helps_content);
    frameLayout = (FrameLayout) itemView.findViewById(R.id.lxw_id_item_helps_include_img);
    gridView = (GridView) frameLayout.findViewById(R.id.lxw_id_item_helps_gridview);
    contentImg = (ImageView) frameLayout.findViewById(R.id.lxw_id_item_helps_content_img);
}
 
Example #18
Source Project: opentasks   Author: dmfs   File: ChoicesFieldEditor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent)
{
    if (convertView == null)
    {
        // inflate a new view and add a tag
        convertView = mLayoutInflater.inflate(R.layout.integer_choices_spinner_item, parent, false);
        SpinnerItemTag tag = new SpinnerItemTag();
        tag.image = (ImageView) convertView.findViewById(R.id.integer_choice_item_image);
        tag.text = (TextView) convertView.findViewById(R.id.integer_choice_item_text);
        convertView.setTag(tag);
    }

    populateView(position, convertView);

    return convertView;
}
 
Example #19
Source Project: Sparkplug   Author: Cirrus-Link   File: MessageListItemAdapter.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@NonNull
@Override
public View getView(final int position, View convertView, @NonNull ViewGroup parent){
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.message_list_item, parent, false);

    // Set up the topic tokens
    TextView topicTextView = (TextView) rowView.findViewById(R.id.message_topic_text);
    String[] topicTokens = messages.get(position).getTopic().split("/");
    if (messages.get(position).getMessageType() == MessageType.Published) {
        topicTextView.setText(topicTokens[1] + " :: " + topicTokens[3] + " :: Published");
    } else if (messages.get(position).getMessageType() == MessageType.Received) {
        topicTextView.setText(topicTokens[1] + " :: " + topicTokens[3] + " :: Received");
    }


    // Set up the payload
    try {
        PayloadDecoder<SparkplugBPayload> decoder = new SparkplugBPayloadDecoder();
        SparkplugBPayload incomingPayload = decoder.buildFromByteArray(messages.get(position).getMessage().getPayload());

        TextView payloadTextView = (TextView) rowView.findViewById(R.id.message_payload_text);

        StringBuilder sb = new StringBuilder();
        for (Metric metric : incomingPayload.getMetrics()) {
            sb.append(metric.getName()).append("=").append(metric.getValue()).append("   ");
        }

        payloadTextView.setText(sb.toString());
    } catch (Exception e) {
        Log.d(TAG, "Failed to parse out payload", e);
    }

    TextView dateTextView = (TextView) rowView.findViewById(R.id.message_date_text);
    DateFormat dateTimeFormatter = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
    String shortDateStamp = dateTimeFormatter.format(messages.get(position).getTimestamp());
    dateTextView.setText(context.getString(R.string.message_time_fmt, shortDateStamp));

    return rowView;
}
 
Example #20
Source Project: fitness_Android   Author: djzhao627   File: MeFragment.java    License: Apache License 2.0 5 votes vote down vote up
public void findViewById(View v) {
    homepage = (LinearLayout) v.findViewById(R.id.me_homepage);
    comment = (LinearLayout) v.findViewById(R.id.me_item_comment);
    record = (LinearLayout) v.findViewById(R.id.me_item_reord);
    favor = (LinearLayout) v.findViewById(R.id.me_item_favor);

    usernameTV = (TextView) v.findViewById(R.id.me_homepage_username);
    exerciseTimeTextView = (TextView) v.findViewById(R.id.me_exercise_time);
    recordDaysTextView = (TextView) v.findViewById(R.id.me_record_days);
    exit = (TextView) v.findViewById(R.id.me_item_exit);
}
 
Example #21
@Override
public View getGroupView(int listPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
    String listTitle = (String) getGroup(listPosition);
    if (convertView == null) {
        LayoutInflater layoutInflater = (LayoutInflater) this.context.
                getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = layoutInflater.inflate(R.layout.list_group, null);
    }
    TextView listTitleTextView = (TextView) convertView
            .findViewById(R.id.listTitle);
    listTitleTextView.setTypeface(null, Typeface.BOLD);
    listTitleTextView.setText(listTitle);
    return convertView;
}
 
Example #22
Source Project: point-of-sale-android-sdk   Author: square   File: BikeModifierView.java    License: Apache License 2.0 5 votes vote down vote up
@Override protected void onFinishInflate() {
  super.onFinishInflate();
  modifierTitle = (TextView) findViewById(R.id.bike_image_modifier_title);
  textSwitcher = (TextSwitcher) findViewById(R.id.text_switcher);
  textSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
    @Override public View makeView() {
      return LayoutInflater.from(getContext()).inflate(R.layout.modifier_value_textview, null);
    }
  });
}
 
Example #23
Source Project: iBeebo   Author: andforce   File: ManageGroupActivity.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    View view = getActivity().getLayoutInflater().inflate(R.layout.managegroupactivity_list_item_layout, parent,
            false);
    TextView tv = (TextView) view;
    tv.setBackgroundColor(defaultBG);
    if (getListView().getCheckedItemPositions().get(position)) {
        tv.setBackgroundColor(checkedBG);
    }
    tv.setText(name.get(position));
    return view;
}
 
Example #24
Source Project: Android_Blog_Demos   Author: hongyangAndroid   File: LeftDrawerLayoutActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_left_drawer_layout);

    mLeftDrawerLayout = (LeftDrawerLayout) findViewById(R.id.id_drawerlayout);
    mContentTv = (TextView) findViewById(R.id.id_content_tv);

    FragmentManager fm = getSupportFragmentManager();
    mMenuFragment = (LeftMenuFragment) fm.findFragmentById(R.id.id_container_menu);
    if (mMenuFragment == null)
    {
        fm.beginTransaction().add(R.id.id_container_menu, mMenuFragment = new LeftMenuFragment()).commit();
    }

    mMenuFragment.setOnMenuItemSelectedListener(new LeftMenuFragment.OnMenuItemSelectedListener()
    {
        @Override
        public void menuItemSelected(String title)
        {
            mLeftDrawerLayout.closeDrawer();
            mContentTv.setText(title);
        }
    });

}
 
Example #25
Source Project: BigApp_Discuz_Android   Author: BigAppOS   File: AbstractWheelTextAdapter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Loads view from resources
 * @param resource the resource Id
 * @return the loaded view or null if resource is not set
 */
private View getView(int resource, ViewGroup parent) {
    switch (resource) {
    case NO_RESOURCE:
        return null;
    case TEXT_VIEW_ITEM_RESOURCE:
        return new TextView(context);
    default:
        return inflater.inflate(resource, parent, false);    
    }
}
 
Example #26
Source Project: goproxy-android   Author: snail007   File: MainActivity.java    License: GNU General Public License v3.0 5 votes vote down vote up
public View.OnClickListener stop(final TextView status, final EditText editText) {
    return new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Proxysdk.stop((serviceID));
            editText.setEnabled(true);
            status.setText(R.string.stopped);
        }
    };
}
 
Example #27
Source Project: edx-app-android   Author: edx   File: FormFieldSelectFragment.java    License: Apache License 2.0 5 votes vote down vote up
private static void addDetectedValueHeader(@NonNull ListView listView, @StringRes int labelRes, @NonNull String labelKey, @NonNull String labelValue, @NonNull String value, @NonNull Icon icon) {
    final TextView textView = (TextView) LayoutInflater.from(listView.getContext()).inflate(R.layout.edx_selectable_list_item, listView, false);
    {
        final SpannableString labelValueSpan = new SpannableString(labelValue);
        labelValueSpan.setSpan(new ForegroundColorSpan(listView.getResources().getColor(R.color.edx_brand_gray_base)), 0, labelValueSpan.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        textView.setText(ResourceUtil.getFormattedString(listView.getContext().getResources(), labelRes, labelKey, labelValueSpan));
    }
    Context context = textView.getContext();
    TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(textView,
            new IconDrawable(context, icon)
                    .sizeRes(context, R.dimen.edx_base)
                    .colorRes(context, R.color.edx_brand_gray_back)
            , null, null, null);
    listView.addHeaderView(textView, new FormOption(labelValue, value), true);
}
 
Example #28
Source Project: identity-samples   Author: android   File: PhoneNumberActivity.java    License: Apache License 2.0 5 votes vote down vote up
PhoneNumberUi(View root, String activityTitle) {
    title = (TextView) root.findViewById(R.id.phone_number_title);
    phoneField = (EditText) root.findViewById(R.id.phone_number_field);
    submit = (Button) root.findViewById(R.id.phone_number_submit);
    phoneFocus = new FocusControl(phoneField);

    title.setText(activityTitle);
    submit.setOnClickListener(this);
    phoneField.setOnClickListener(this);
    setSubmitEnabled(true);
}
 
Example #29
Source Project: friendspell   Author: chiuki   File: CustomMatchers.java    License: Apache License 2.0 5 votes vote down vote up
public static Matcher<View> withoutCompoundDrawable(final int position) {
  return new BoundedMatcher<View, TextView>(TextView.class) {
    @Override public void describeTo(Description description) {
      description.appendText(
          "does not have compound drawable at position " + position);
    }
    @Override public boolean matchesSafely(TextView textView) {
      Drawable drawables[] = textView.getCompoundDrawables();
      return (drawables[position] == null);
    }
  };
}
 
Example #30
Source Project: bleTester   Author: SouthAve   File: BleDeviceListAdapter.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressLint("InflateParams")
@Override
public View getView(int position, View view, ViewGroup arg2) {
	// TODO Auto-generated method stub

	ViewHolder viewholder;
	if (view == null) {
		view = mInflater.inflate(R.layout.item_devicelist, null);
		viewholder = new ViewHolder();
		viewholder.devicename = (TextView) view
				.findViewById(R.id.tv_devicelist_name);
		viewholder.deviceAddress = (TextView) view
				.findViewById(R.id.tv_devicelist_address);
		viewholder.deviceRSSI = (TextView) view
				.findViewById(R.id.tv_devicelist_rssi);
		viewholder.devicerecord = (TextView) view
				.findViewById(R.id.tv_devicelist_scanRecord);
		viewholder.devicerecord_name = (TextView) view
				.findViewById(R.id.tv_devicelist_scanRecord_name);
		view.setTag(viewholder);
	} else {
		viewholder = (ViewHolder) view.getTag();
	}
	String name = mLeDevices.get(position).getName();
	if (name != null)
		viewholder.devicename.setText(name);
	else
		viewholder.devicename.setText("Unknow Device");
	viewholder.deviceAddress.setText("��ַ�� "
			+ mLeDevices.get(position).getAddress());
	viewholder.deviceRSSI.setText("�źţ� " + RSSIs.get(position).toString());
	viewholder.devicerecord.setText("�㲥���� " + "\n"
			+ scanRecords.get(position));
	viewholder.devicerecord_name.setText("�㲥���е�����:"
			+ Utils.ParseScanRecord(scanRecords.get(position)));
	return view;
}