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 File: DefaultLoadView.java    From QRefreshLayout with 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 #2
Source File: ThirdPartyWallpaperPickerListAdapter.java    From Trebuchet with 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 #3
Source File: ArtistAdapter.java    From Popeens-DSub with 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 File: ReceiveResult.java    From FragmentMaster with 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 #5
Source File: ForumActivity.java    From BotLibre with 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 #6
Source File: VideoListAdapter.java    From Mp4Composer-android with 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 #7
Source File: TalkActivity.java    From AirFree-Client with 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 #8
Source File: ThinJamActivity.java    From xDrip-plus with 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 #9
Source File: LongListActivity.java    From AndroidProjects with 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 #10
Source File: BtDeviceListActivity.java    From AndrOBD with 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 #11
Source File: ProgressDialogHolder.java    From BlackList with 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 #12
Source File: SettingInfoActivity.java    From WifiChat with 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 #13
Source File: TMAdapter.java    From Kernel-Tuner with 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 #14
Source File: MainActivity.java    From react-native-android-wear-demo with 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 #15
Source File: MessageActivity.java    From Android7_Shortcuts_Demo with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.message);
    TextView msg = (TextView) findViewById(R.id.msg);
    msg.setText(getIntent().getStringExtra("msg"));
}
 
Example #16
Source File: ExpandableListAdapter.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
@Override
public View getChildView(int groupPosition, int childPosition,
                         boolean isLastChild, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.example_list_item2, null);
    }
    LinearLayout l = (LinearLayout) convertView;
    ((TextView) l.getChildAt(0)).setText(datas[groupPosition][childPosition]);
    if (isLastChild) {
        l.getChildAt(1).setVisibility(View.VISIBLE);
    } else {
        l.getChildAt(1).setVisibility(View.INVISIBLE);
    }
    final TextView textView = (TextView) convertView.findViewById(R.id.child_text);
    textView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.i("introduceFragment", "text is >>>>" + textView.getText());
            ((MainActivity)mContext).quitLongRecordMode();
            String text = textView.getText().toString();
            //隐藏introduce界面
            EventBus.getDefault().post(new IntroduceShowEvent(false));
            //添加到聊天界面
            EventBus.getDefault().post(new ChatMsgEvent(new SpeechMsg(text), null, null, null));
            //2.发送到AssistantService的robot处理
            Intent intent = new Intent(mContext, AssistantService.class);
            intent.putExtra(AssistantService.CMD, AssistantService.ServiceCmd.SEND_TO_ROBOT);
            intent.putExtra(AssistantService.TEXT, text);
            intent.putExtra(AssistantService.INPUT_TYPE, AssistantService.INPUT_VOICE);
            mContext.startService(intent);
        }
    });
    return convertView;
}
 
Example #17
Source File: DashboardActivity.java    From EMQ-Android-Toolkit with Apache License 2.0 5 votes vote down vote up
/**
 * Get custom tab view
 * @return custom tab view
 */
private View getView() {
    View view = LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
    TextView textView = (TextView) view.findViewById(R.id.title);
    textView.setText(SubscriptionListFragment.TAG);
    return view;
}
 
Example #18
Source File: PoemBuilderActivity.java    From cannonball-android with Apache License 2.0 5 votes vote down vote up
private void fillWordsList(FlowLayout view) {
    for (int i = 0; i < view.getChildCount(); i++) {
        final TextView word = (TextView) view.getChildAt(i);
        if (word.getTag() instanceof String)
            words.add(word);
    }
}
 
Example #19
Source File: FlavorPaletteListWrapper.java    From CameraColorPicker with Apache License 2.0 5 votes vote down vote up
public PaletteHolder(View view, PaletteListWrapperListener listener) {
    super(view);
    mUnderlyingView = view;
    mListener = listener;
    mPaletteRoundedThumbnail = (PaletteView) view.findViewById(R.id.row_color_palette_thumbnail);
    mPaletteName = (TextView) view.findViewById(R.id.row_color_palette_name);

    view.setOnClickListener(this);
}
 
Example #20
Source File: FragmentRegisterViewModel.java    From iGap-Android with GNU Affero General Public License v3.0 5 votes vote down vote up
private void counterTimer(TextView txtTimer, TextView btnResondCode) {

        long time = 0;
        if (BuildConfig.DEBUG) {
            time = 2 * DateUtils.SECOND_IN_MILLIS;
        } else if (FragmentRegister.smsPermission) {
            time = Config.COUNTER_TIMER;
        } else {
            time = 5 * DateUtils.SECOND_IN_MILLIS;
        }

        CountDownTimer countDownTimer = new CountDownTimer(time, Config.COUNTER_TIMER_DELAY) { // wait for verify sms
            public void onTick(long millisUntilFinished) {

                int seconds = (int) ((millisUntilFinished) / 1000);
                int minutes = seconds / 60;
                seconds = seconds % 60;

                txtTimer.setText("" + String.format("%02d", minutes) + ":" + String.format("%02d", seconds));

            }

            public void onFinish() {

                txtTimer.setVisibility(View.INVISIBLE);
                btnResondCode.setEnabled(true);
                btnResondCode.setTextColor(G.context.getResources().getColor(R.color.green));

            }
        };

        countDownTimer.start();
    }
 
Example #21
Source File: MainActivity.java    From IndicatorSeekBar with Apache License 2.0 5 votes vote down vote up
private void initViews() {
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);

    viewPager.setAdapter(new PagerAdapter(getSupportFragmentManager()));
    tabLayout.setupWithViewPager(viewPager);

    for (String s : sType) {
        TextView textView = new TextView(this);
        textView.setText(s);
        tabLayout.newTab().setCustomView(textView);
    }

}
 
Example #22
Source File: BubbleTextHolderLayouter.java    From actor-platform with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public AbsMessageViewHolder onCreateViewHolder(MessagesAdapter adapter, ViewGroup root, Peer peer) {
    TextView itemView = new TextView(root.getContext());
    itemView.setId(R.id.text);
    BubbleContainer container = new BubbleContainer(root.getContext());
    container.addView(itemView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    return new TextHolderEx(adapter, container);
}
 
Example #23
Source File: InfoRecActivity.java    From audio-analyzer-for-android with Apache License 2.0 5 votes vote down vote up
private void setTextData(final TextView tv, final String st) {
	runOnUiThread(new Runnable() {
		@Override
		public void run() {
			tv.setText(st);
		}
	});
}
 
Example #24
Source File: UI.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
public static void mapEnterToPositive(final Dialog dialog, final int editId) {
    final TextView edit = UI.find(dialog, editId);
    edit.setOnEditorActionListener(getListenerRunOnEnter(() -> {
        final MaterialDialog md = (MaterialDialog) dialog;
        md.onClick(md.getActionButton(DialogAction.POSITIVE));
    }));
}
 
Example #25
Source File: LabelsView.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
private void innerClearAllSelect() {
    int count = getChildCount();
    for (int i = 0; i < count; i++) {
        setLabelSelect((TextView) getChildAt(i), false);
    }
    mSelectLabels.clear();
}
 
Example #26
Source File: DeviceControlActivity.java    From freeiot-android with MIT License 5 votes vote down vote up
@Override
	protected void onCreate(Bundle savedInstances) {
		super.onCreate(savedInstances);
		setContentView(R.layout.activity_outlet_control);
		
		Bundle bundle = getIntent().getExtras();
		if (bundle != null) {
            mIdentifier = bundle.getString("identifier");
//			operateUrl = String.format(operateUrl, mIdentifier);
			mUrl = bundle.getString("app");
			if (BridgeUtil.hasAssetFile(this, "index.html")) {
				mUrl = "file:///android_asset/index.html";
			}
			LogUtils.e("url=> " + mUrl);
//			mUrl = "file:///android_asset/index.html";
//            mUrl = "file:///android_asset/failed/404.html";
            mTitleName = bundle.getString("name");
			((TextView)findViewById(R.id.title)).setText(mTitleName);
		}
		
		mSwipeRefreshLayout = (SwipeRefreshLayout)findViewById(R.id.swipe_container);
		mSwipeRefreshLayout.setColorScheme(R.color.main_red_color);
		mSwipeRefreshLayout.setOnRefreshListener(this);
		
		mProgressBar = (ProgressBar)findViewById(R.id.progressbar);
		mWebView = (XWalkView) findViewById(R.id.webview);
		findViewById(R.id.back).setOnClickListener(this);
		bridgeHelper = new BridgeHelper(this, mWebView);
		initVebView();
	}
 
Example #27
Source File: SkinMaterialTextInputLayout.java    From Android-skin-support with MIT License 5 votes vote down vote up
private void applyCounterTextColorResource() {
    mCounterTextColorResId = SkinCompatHelper.checkResourceId(mCounterTextColorResId);
    if (mCounterTextColorResId != INVALID_ID) {
        TextView counterView = getCounterView();
        if (counterView != null) {
            counterView.setTextColor(SkinCompatResources.getColor(getContext(), mCounterTextColorResId));
            updateEditTextBackgroundInternal();
        }
    }
}
 
Example #28
Source File: BaseFragment.java    From AndroidAll with Apache License 2.0 5 votes vote down vote up
protected void printLog(TextView textView, String prefix, String s) {
    String content = prefix + "'" + s + "'" + "\nMain Thread:" + (getActivity().getMainLooper() == Looper.myLooper()) +
            ", Thread Name:" + Thread.currentThread().getName();
    Log.d("OnSubscribe", content);
    //if (!TextUtils.isEmpty(s)) {
    appendText(textView, content);
    //}
}
 
Example #29
Source File: AddBuddyItemView.java    From imsdk-android with MIT License 5 votes vote down vote up
public AddBuddyItemView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    ctx = context;
    final LayoutInflater inflater = (LayoutInflater) context.getSystemService(
            Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.atom_ui_item_add_buddy_view,this,true);
    ll_personal_info = (LinearLayout) findViewById(R.id.ll_personal_info);
    view_gravatar_buddy = (com.facebook.drawee.view.SimpleDraweeView) findViewById(R.id.view_gravatar_buddy);
    m_name = (TextView) findViewById(R.id.m_name);
    btn_add = (Button) findViewById(R.id.btn_add);
}
 
Example #30
Source File: X8AiFollowConfirmUi.java    From FimiX8-RE with MIT License 5 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);
}