Java Code Examples for android.widget.TextView.setVisibility()

The following are Jave code examples for showing how to use setVisibility() of the android.widget.TextView 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: Nearby   File: InquiryPhotoActivity.java   View Source Code Vote up 6 votes
private void init(){

        findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        tv_msg = (TextView)findViewById(R.id.tv_msg);
        tv_msg.setVisibility(View.GONE);

        mGridLayoutManager = new GridLayoutManager(this, 2);//new LinearLayoutManager(getApplicationContext());
//        mLinearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        rv = (RecyclerView) findViewById(R.id.rv);
        rv.setHasFixedSize(true);
        rv.setLayoutManager(mGridLayoutManager);
//        rv.addItemDecoration(new DividerItemDecoration(getApplicationContext(), DividerItemDecoration.VERTICAL_LIST));

        loading = (AVLoadingIndicatorView)findViewById(R.id.loading);

    }
 
Example 2
Project: SunmiUI   File: WheelActivity.java   View Source Code Vote up 6 votes
@Override
        protected View bindView(int position, View convertView, ViewGroup parent) {
            if (convertView == null) {
                WheelItemLayout view = (WheelItemLayout) View.inflate(getApplicationContext(), R.layout.item_wheel, null);
                view.setParentHeight(parent.getHeight());
                convertView = view;
            }
            Log.d(TAG, "bindView position:"+position);
            WheelData wheelData = mList.get(position);
            ImageView imageView = (ImageView) convertView.findViewById(R.id.iv);
            TextView tv = (TextView) convertView.findViewById(R.id.text);
            if(position == mCurrentPositon){
                imageView.setImageResource(wheelData.getId_s());
            }else {
                imageView.setImageResource(wheelData.getId());
            }
            tv.setVisibility(View.GONE);
//            tv.setText(wheelData.getName());

            return convertView;
        }
 
Example 3
Project: letv   File: FirstPageCustomAdapter.java   View Source Code Vote up 6 votes
public void onBindViewHolder(ViewHolder holder, int position) {
    boolean isFirstUnLock;
    int i = 0;
    if (position == this.mLockSize + this.mHeadSize) {
        isFirstUnLock = true;
    } else {
        isFirstUnLock = false;
    }
    if (holder instanceof LockBlockViewHolder) {
        LockBlockViewHolder.access$700((LockBlockViewHolder) holder).setText(((HomeBlock) this.mList.get(position - 1)).blockname);
    } else if (holder instanceof UnLockBlockViewHolder) {
        LogInfo.log("zhaoxiang", "isFirstUnLock" + isFirstUnLock + "-------" + position);
        UnLockBlockViewHolder.access$500((UnLockBlockViewHolder) holder).setText(((HomeBlock) this.mList.get(position - this.mHeadSize)).blockname);
        TextView access$300 = UnLockBlockViewHolder.access$300((UnLockBlockViewHolder) holder);
        if (isFirstUnLock) {
            i = 8;
        }
        access$300.setVisibility(i);
    }
}
 
Example 4
Project: postixdroid   File: MainActivity.java   View Source Code Vote up 6 votes
private void resetView() {
    TextView tvScanResult = (TextView) findViewById(R.id.tvScanResult);
    timeoutHandler.removeCallbacksAndMessages(null);
    tvScanResult.setVisibility(View.VISIBLE);
    ((TextView) findViewById(R.id.tvScanResult)).setText("");
    findViewById(R.id.rlScanStatus).setBackgroundColor(
            ContextCompat.getColor(this, R.color.scan_result_unknown));

    if (!config.getCamera()) {
        qrView.setVisibility(View.GONE);
    } else {
        qrView.setVisibility(View.VISIBLE);
    }

    if (config.isConfigured()) {
        tvScanResult.setText(R.string.hint_scan);
    } else {
        tvScanResult.setText(R.string.hint_config);
    }
}
 
Example 5
Project: Mchat   File: MessageAdapter.java   View Source Code Vote up 5 votes
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = ((Activity) getContext()).getLayoutInflater().inflate(R.layout.item_message, parent, false);
    }

    ImageView photoImageView = (ImageView) convertView.findViewById(R.id.photoImageView);
    TextView messageTextView = (TextView) convertView.findViewById(R.id.messageTextView);
    TextView authorTextView = (TextView) convertView.findViewById(R.id.nameTextView);

    Message message = getItem(position);

    boolean isPhoto = message.getPhotoUrl() != null;
    if (isPhoto) {
        messageTextView.setVisibility(View.GONE);
        photoImageView.setVisibility(View.VISIBLE);
        Glide.with(photoImageView.getContext())
                .load(message.getPhotoUrl())
                .into(photoImageView);
    } else {
        messageTextView.setVisibility(View.VISIBLE);
        photoImageView.setVisibility(View.GONE);
        messageTextView.setText(message.getText());
    }
    authorTextView.setText(message.getName());

    return convertView;
}
 
Example 6
Project: LiuAGeAndroid   File: EditPageLand.java   View Source Code Vote up 5 votes
private void initBottom(LinearLayout llBottom, float ratio) {
	LinearLayout llAt = new LinearLayout(activity);
	llAt.setPadding(0, 0, 0, 5);
	llAt.setBackgroundColor(0xffffffff);
	int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight);
	llBottom.addView(llAt, lp);

	tvAt = new TextView(activity);
	tvAt.setTextColor(0xff3b3b3b);
	tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
	tvAt.setGravity(Gravity.BOTTOM);
	tvAt.setText("@");
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	tvAt.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	llAt.addView(tvAt, lp);
	tvAt.setOnClickListener(this);
	if (isShowAtUserLayout(platform.getName())) {
		tvAt.setVisibility(View.VISIBLE);
	} else {
		tvAt.setVisibility(View.INVISIBLE);
	}

	tvTextCouter = new TextView(activity);
	tvTextCouter.setTextColor(0xff3b3b3b);
	tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
	onTextChanged(etContent.getText(), 0, 0, 0);
	tvTextCouter.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.weight = 1;
	llAt.addView(tvTextCouter, lp);

	View v = new View(activity);
	v.setBackgroundColor(0xffcccccc);
	int px_1 = ratio > 1 ? ((int) ratio) : 1;
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px_1);
	llBottom.addView(v, lp);
}
 
Example 7
Project: firebase-android-udacity   File: MessageAdapter.java   View Source Code Vote up 5 votes
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = ((Activity) getContext()).getLayoutInflater().inflate(R.layout.item_message, parent, false);
    }

    ImageView photoImageView = (ImageView) convertView.findViewById(R.id.photoImageView);
    TextView messageTextView = (TextView) convertView.findViewById(R.id.messageTextView);
    TextView authorTextView = (TextView) convertView.findViewById(R.id.nameTextView);

    FriendlyMessage message = getItem(position);

    boolean isPhoto = message.getPhotoUrl() != null;
    if (isPhoto) {
        messageTextView.setVisibility(View.GONE);
        photoImageView.setVisibility(View.VISIBLE);
        Glide.with(photoImageView.getContext())
                .load(message.getPhotoUrl())
                .into(photoImageView);
    } else {
        messageTextView.setVisibility(View.VISIBLE);
        photoImageView.setVisibility(View.GONE);
        messageTextView.setText(message.getText());
    }
    authorTextView.setText(message.getName());

    return convertView;
}
 
Example 8
Project: boohee_v5.6   File: SocialPopupDialog.java   View Source Code Vote up 5 votes
public a a(String str) {
    TextView textView = (TextView) this.b.findViewById(ResContainer.getResourceId(this.a,
            ResType.ID, "umeng_socialize_first_area_title"));
    if (TextUtils.isEmpty(str)) {
        textView.setVisibility(8);
    } else {
        textView.setText(str);
    }
    return this;
}
 
Example 9
Project: OpenAPK   File: ButtonView.java   View Source Code Vote up 5 votes
public ButtonView(Context context, String title, String summary, OnClickListener onClickListener) {
    super(context);
    this.setOnClickListener(onClickListener);

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.view_button, null);
    addView(view);

    TextView titleView = (TextView) view.findViewById(R.id.title);
    TextView summaryView = (TextView) view.findViewById(R.id.summary);
    titleView.setText(title);
    if (summary == null) {
        summaryView.setVisibility(GONE);
    } else {
        summaryView.setText(summary);
    }

    View dividerTop = findViewById(R.id.divider_top);
    View dividerBottom = findViewById(R.id.divider_bottom);
    if (App.getAppPreferences().getTheme().equals("0")) {
        dividerTop.setBackgroundColor(getResources().getColor(R.color.grey_one));
        dividerBottom.setBackgroundColor(getResources().getColor(R.color.grey_one));
    } else {
        dividerTop.setBackgroundColor(getResources().getColor(R.color.grey_three));
        dividerBottom.setBackgroundColor(getResources().getColor(R.color.grey_three));
    }
}
 
Example 10
Project: Hotspot-master-devp   File: CustomAlertPPtDialog.java   View Source Code Vote up 5 votes
public CustomAlertPPtDialog builder() {
    view = LayoutInflater.from(context).inflate(R.layout.view_alertdialog, null);

    lLayout_bg = (LinearLayout) view.findViewById(R.id.layout_bg);
    txt_title = (TextView) view.findViewById(R.id.txt_title);
    txt_title.setVisibility(View.GONE);
    txt_msg = (TextView) view.findViewById(R.id.txt_msg);
    txt_msg.setVisibility(View.GONE);
    et_input = (EditText) view.findViewById(R.id.et_input);
    et_input.setVisibility(View.GONE);
    btn_neg = (Button) view.findViewById(R.id.btn_neg);
    btn_neg.setVisibility(View.GONE);
    btn_pos = (Button) view.findViewById(R.id.btn_pos);
    btn_pos.setVisibility(View.GONE);
    btn_mid = (Button) view.findViewById(R.id.btn_mid);
    btn_mid.setVisibility(View.GONE);
    line1 = (ImageView) view.findViewById(R.id.line1);
    line1.setVisibility(View.GONE);
    line2 = (ImageView) view.findViewById(R.id.line2);
    line2.setVisibility(View.GONE);

    dialog = new Dialog(context, R.style.AlertDialogStyle);
    dialog.setContentView(view);

    lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (
            display.getWidth() * 0.85), LayoutParams.WRAP_CONTENT));

    return this;
}
 
Example 11
Project: Croprotector   File: UAVControllerActivity.java   View Source Code Vote up 5 votes
private void initUI() {
    // init mVideoSurface
    mVideoSurface = (TextureView)findViewById(R.id.video_previewer_surface);

    recordingTime = (TextView) findViewById(R.id.timer);
    mCaptureBtn = (Button) findViewById(R.id.btn_capture);
    mRecordBtn = (ToggleButton) findViewById(R.id.btn_record);
    mShootPhotoModeBtn = (Button) findViewById(R.id.btn_shoot_photo_mode);
    mRecordVideoModeBtn = (Button) findViewById(R.id.btn_record_video_mode);
    mWayPointBtn=(Button)findViewById(R.id.btn_wayPoint);

    if (null != mVideoSurface) {
        mVideoSurface.setSurfaceTextureListener(this);
    }

    mCaptureBtn.setOnClickListener(this);
    mRecordBtn.setOnClickListener(this);
    mShootPhotoModeBtn.setOnClickListener(this);
    mRecordVideoModeBtn.setOnClickListener(this);
    mWayPointBtn.setOnClickListener(this);

    recordingTime.setVisibility(View.INVISIBLE);

    mRecordBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                startRecord();
            } else {
                stopRecord();
            }
        }
    });
}
 
Example 12
Project: rongyunDemo   File: ContactsFragment.java   View Source Code Vote up 5 votes
private void initView(View view) {
    mSearchEditText = (EditText) view.findViewById(R.id.search);
    mListView = (ListView) view.findViewById(R.id.listview);
    mNoFriends = (TextView) view.findViewById(R.id.show_no_friend);
    mSidBar = (SideBar) view.findViewById(R.id.sidrbar);
    mDialogTextView = (TextView) view.findViewById(R.id.group_dialog);
    mSidBar.setTextView(mDialogTextView);
    LayoutInflater mLayoutInflater = LayoutInflater.from(getActivity());
    mHeadView = mLayoutInflater.inflate(R.layout.item_contact_list_header,
                                        null);
    mUnreadTextView = (TextView) mHeadView.findViewById(R.id.tv_unread);
    RelativeLayout newFriendsLayout = (RelativeLayout) mHeadView.findViewById(R.id.re_newfriends);
    RelativeLayout groupLayout = (RelativeLayout) mHeadView.findViewById(R.id.re_chatroom);
    RelativeLayout publicServiceLayout = (RelativeLayout) mHeadView.findViewById(R.id.publicservice);
    RelativeLayout selfLayout = (RelativeLayout) mHeadView.findViewById(R.id.contact_me_item);
    mSelectableRoundedImageView = (SelectableRoundedImageView) mHeadView.findViewById(R.id.contact_me_img);
    mNameTextView = (TextView) mHeadView.findViewById(R.id.contact_me_name);
    updatePersonalUI();
    mListView.addHeaderView(mHeadView);
    mNoFriends.setVisibility(View.VISIBLE);

    selfLayout.setOnClickListener(this);
    groupLayout.setOnClickListener(this);
    newFriendsLayout.setOnClickListener(this);
    publicServiceLayout.setOnClickListener(this);
    //设置右侧触摸监听
    mSidBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {

        @Override
        public void onTouchingLetterChanged(String s) {
            //该字母首次出现的位置
            int position = mFriendListAdapter.getPositionForSection(s.charAt(0));
            if (position != -1) {
                mListView.setSelection(position);
            }

        }
    });
}
 
Example 13
Project: buildAPKsSamples   File: MainActivity.java   View Source Code Vote up 5 votes
private void showAlreadyAuthenticated() {
    TextView textView = (TextView) findViewById(
            R.id.already_has_valid_device_credential_message);
    textView.setVisibility(View.VISIBLE);
    textView.setText(getString(
            R.string.already_confirmed_device_credentials_within_last_x_seconds,
            AUTHENTICATION_DURATION_SECONDS));
    findViewById(R.id.purchase_button).setEnabled(false);
}
 
Example 14
Project: crossword   File: Main.java   View Source Code Vote up 5 votes
@Override
public void onItemSelected(AdapterView<?> parent, View view,
                           int pos, long id)
{
    // An item was selected. You can retrieve the selected item
    // using parent.getItemAtPosition(pos)
    // Check id
    switch (parent.getId())
    {
    case R.id.spinner:
        String item = (String)parent.getItemAtPosition(pos);

        // Get length
        length = Integer.parseInt(item);

        // Remove the unused slots
        if (letters != null)
        {
            for (int i = 0; i < letters.getChildCount(); i++)
            {
                TextView text = (TextView)letters.getChildAt(i);
                if (i < length)
                    text.setVisibility(View.VISIBLE);

                // Temporarily remove the text change listener to
                // stop unexpected consequences
                else
                {
                    text.setVisibility(View.GONE);
                    text.removeTextChangedListener(this);
                    text.setText("");
                    text.addTextChangedListener(this);
                }
            }
        }
    }
}
 
Example 15
Project: GitHub   File: AlertDialog.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {  
	super.onCreate(savedInstanceState);  
	setContentView(R.layout.alert_dialog); 
	setCanceledOnTouchOutside(true);

	tvTitle = (TextView) findViewById(R.id.tvAlertDialogTitle);
	tvMessage = (TextView) findViewById(R.id.tvAlertDialogMessage);
	btnPositive = (Button) findViewById(R.id.btnAlertDialogPositive);
	btnNegative = (Button) findViewById(R.id.btnAlertDialogNegative);

	tvTitle.setVisibility(StringUtil.isNotEmpty(title, true) ? View.VISIBLE : View.GONE);
	tvTitle.setText("" + StringUtil.getCurrentString());

	if (StringUtil.isNotEmpty(strPositive, true)) {
		btnPositive.setText(StringUtil.getCurrentString());
	}
	btnPositive.setOnClickListener(this);

	if (showNegativeButton) {
		if (StringUtil.isNotEmpty(strNegative, true)) {
			btnNegative.setText(StringUtil.getCurrentString());
		}
		btnNegative.setOnClickListener(this);
	} else {
		btnNegative.setVisibility(View.GONE);
	}

	tvMessage.setText(StringUtil.getTrimedString(message));
}
 
Example 16
Project: xlight_android_native   File: BindDeviceSuccessActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    setContentView(R.layout.activity_bind_device_success);

    AndroidBug54971Workaround.assistActivity(findViewById(android.R.id.content));
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= 20) {
        getWindow().setStatusBarColor(getResources().getColor(R.color.bar_color));
    }

    llBack = (LinearLayout) findViewById(R.id.ll_back);
    llBack.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    TextView btnSure = (TextView) findViewById(R.id.tvEditSure);
    btnSure.setVisibility(View.INVISIBLE);

    TextView tvTitle = (TextView) findViewById(R.id.tvTitle);
    tvTitle.setText(R.string.find_devices);
    coreID = getIntent().getStringExtra("coreID");
    Log.d("XLight", "coreID:" + coreID);
    EditText et = (EditText) findViewById(R.id.etControllerName);
    et.setSelection(et.getText().length());
}
 
Example 17
Project: OSchina_resources_android   File: ViewHolder.java   View Source Code Vote up 4 votes
public void setText(int viewId, Spanned text) {
    if (text == null) return;
    TextView tv = getView(viewId);
    tv.setText(text);
    tv.setVisibility(View.VISIBLE);
}
 
Example 18
Project: MySelfDemo   File: MyBaseTextView.java   View Source Code Vote up 4 votes
private void setTextString(TextView textView, String textString) {
    if (!TextUtils.isEmpty(textString)) {
        textView.setText(textString);
        textView.setVisibility(VISIBLE);
    }
}
 
Example 19
Project: SunmiUI   File: DialogCreater.java   View Source Code Vote up 4 votes
public static HintDialog createHintDialog(Context context, int iconId, String textLeft, String textRight, String message, View.OnClickListener left, View.OnClickListener right,boolean isSystem) {
    HintDialog dialogProxy = HintDialog.getInstance();
    if (dialogProxy.hasDialog()) {
        return dialogProxy;
    }
    Dialog dialog = setHintDialogContentView(context);
    ImageView img = (ImageView) dialog.findViewById(R.id.img);
    img.setImageResource(iconId);
    TextView tvMsg = (TextView) dialog.findViewById(R.id.content);
    TextView btnLeft = (TextView) dialog.findViewById(R.id.left);
    TextView btnRight = (TextView) dialog.findViewById(R.id.right);
    tvMsg.setText(message);
    btnLeft.setText(textLeft);
    btnLeft.setOnClickListener(left);
    if(isSystem){
        dialogProxy.setSystemDialog(dialog);
    }else {
        dialogProxy.setDialog(dialog);
    }
    View line = dialog.findViewById(R.id.line2);

    if (TextUtils.isEmpty(textRight)) {
        btnRight.setVisibility(View.GONE);
        line.setVisibility(View.GONE);
        if (Adaptation.proportion == Adaptation.SCREEN_9_16) {
            btnLeft.setBackgroundResource(R.drawable.ripple_bg_bottom);
        } else if (Adaptation.proportion == Adaptation.SCREEN_16_9) {
            btnLeft.setBackgroundResource(R.drawable.ripple_bg_bottom_t1);
        }

        btnLeft.setLayoutParams(new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 2));
    } else {
        btnRight.setVisibility(View.VISIBLE);
        line.setVisibility(View.VISIBLE);
        if (Adaptation.proportion == Adaptation.SCREEN_9_16) {
            btnLeft.setBackgroundResource(R.drawable.ripple_bg_left_bottom);
        } else if (Adaptation.proportion == Adaptation.SCREEN_16_9) {
            btnLeft.setBackgroundResource(R.drawable.ripple_bg_left_bottom_t1);
        }
        btnRight.setText(textRight);
        btnRight.setOnClickListener(right);
    }
    return dialogProxy;
}
 
Example 20
Project: cniao5   File: UIHelper.java   View Source Code Vote up 2 votes
/**
 * 显示提示文本框
 *
 * @param toast 需要显示的提示语句
 */
public static void setMyCustomToastVisibility(TextView view, String toast) {
    view.setText(toast);
    view.setVisibility(View.VISIBLE);
}