Java Code Examples for android.widget.TextView

The following are top voted examples for showing how to use android.widget.TextView. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: GitHub   File: LoopViewPagerAdapter.java   View source code 8 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    if (convertView == null) {
        convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_viewpager, parent, false);
        holder = new ViewHolder();
        holder.ivBanner = (ImageView) convertView.findViewById(R.id.ivBanner);
        holder.tvName = (TextView) convertView.findViewById(R.id.tvName);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    int picSrcId = mHeroes.get(position).imageSrc;
    holder.tvName.setText(mHeroes.get(position).info);
    holder.ivBanner.setImageResource(picSrcId);
    return convertView;
}
 
Example 2
Project: VideoRecorder-master   File: FFmpegRecorderActivity.java   View source code 7 votes vote down vote up
@Override
protected void onPreExecute() {
    isFinalizing = true;
    recordFinish = true;
    runAudioThread = false;

    //创建处理进度条
    creatingProgress = new Dialog(FFmpegRecorderActivity.this, R.style.Dialog_loading_noDim);
    Window dialogWindow = creatingProgress.getWindow();
    WindowManager.LayoutParams lp = dialogWindow.getAttributes();
    lp.width = (int) (getResources().getDisplayMetrics().density * 240);
    lp.height = (int) (getResources().getDisplayMetrics().density * 80);
    lp.gravity = Gravity.CENTER;
    dialogWindow.setAttributes(lp);
    creatingProgress.setCanceledOnTouchOutside(false);
    creatingProgress.setContentView(R.layout.activity_recorder_progress);

    progress = (TextView) creatingProgress.findViewById(R.id.recorder_progress_progresstext);
    bar = (ProgressBar) creatingProgress.findViewById(R.id.recorder_progress_progressbar);
    creatingProgress.show();


    //txtTimer.setVisibility(View.INVISIBLE);
    //handler.removeCallbacks(mUpdateTimeTask);
    super.onPreExecute();
}
 
Example 3
Project: MDWechat   File: SlidingTabLayout.java   View source code 6 votes vote down vote up
private void updateTabStyles() {
        for (int i = 0; i < mTabCount; i++) {
            View v = mTabsContainer.getChildAt(i);
//            v.setPadding((int) mTabPadding, v.getPaddingTop(), (int) mTabPadding, v.getPaddingBottom());
            TextView tv_tab_title = (TextView) v.findViewById(R.id.tv_tab_title);
            if (tv_tab_title != null) {
                tv_tab_title.setTextColor(i == mCurrentTab ? mTextSelectColor : mTextUnselectColor);
                tv_tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextsize);
                tv_tab_title.setPadding((int) mTabPadding, 0, (int) mTabPadding, 0);
                if (mTextAllCaps) {
                    tv_tab_title.setText(tv_tab_title.getText().toString().toUpperCase());
                }

                if (mTextBold == TEXT_BOLD_BOTH) {
                    tv_tab_title.getPaint().setFakeBoldText(true);
                } else if (mTextBold == TEXT_BOLD_NONE) {
                    tv_tab_title.getPaint().setFakeBoldText(false);
                }
            }
        }
    }
 
Example 4
Project: LiuAGeAndroid   File: UserInfoActivity.java   View source code 6 votes vote down vote up
/**
 * 准备UI
 */
private void prepareUI() {
    mNavigationViewRed = (NavigationViewPush) findViewById(R.id.nav_user_info);
    mPortraitImageView = (SimpleDraweeView) findViewById(R.id.sdv_user_info_portrait);
    mUsernameTextView = (TextView) findViewById(R.id.tv_user_info_username);
    mGroupNameTextView = (TextView) findViewById(R.id.tv_user_info_groupname);
    mPointsTextView = (TextView) findViewById(R.id.tv_user_info_points);
    mModifyInfoLayout = findViewById(R.id.rl_user_info_modify_info_layout);
    mModifySafeInfoLayout = findViewById(R.id.rl_user_info_modify_safe_info_layout);
    mRegisterTimeTextView = (TextView) findViewById(R.id.tv_user_info_registertime);
    mMyPointsTextView = (TextView) findViewById(R.id.tv_user_info_mypoints);
    mMyGroupNameTextView = (TextView) findViewById(R.id.tv_user_info_mygroupname);
    mLogoutButton = (Button) findViewById(R.id.btn_user_info_logout);

    mNavigationViewRed.setupNavigationView(true, false, "我的资料", new NavigationViewPush.OnClickListener() {
        @Override
        public void onBackClick(View v) {
            finish();
        }
    });

    mModifyInfoLayout.setOnClickListener(this);
    mModifySafeInfoLayout.setOnClickListener(this);
    mLogoutButton.setOnClickListener(this);
}
 
Example 5
Project: wisebite_android   File: RestaurantAdapter.java   View source code 6 votes vote down vote up
OrderHolder(View itemView) {
    super(itemView);
    this.view = itemView;
    this.name = (TextView) itemView.findViewById(R.id.name);
    this.ratingBar = (RatingBar) itemView.findViewById(R.id.rating_bar);
    this.description = (TextView) itemView.findViewById(R.id.description);
    this.daysOpen = (TextView) itemView.findViewById(R.id.days_open);
    this.dishesCount = (TextView) itemView.findViewById(R.id.dishes_count);
    this.menusCount = (TextView) itemView.findViewById(R.id.menus_count);

    this.view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), GetRestaurantActivity.class);
            intent.putExtra(GetRestaurantActivity.RESTAURANT_ID, item.getId());
            v.getContext().startActivity(intent);
        }
    });
}
 
Example 6
Project: TableRecyclerView   File: TableAdapter.java   View source code 6 votes vote down vote up
private void initViews() {
    left_top_view.setBackgroundColor(parametersHolder.title_color);
    TextViewUtils.setTextView(left_top_view, dataAdapter.getTitleAt(0), parametersHolder.item_gravity,
            parametersHolder.item_width, parametersHolder.item_padding);

    leftViews.setAdapter(new LeftViewAdapter());

    SingleLineLinearLayout titleChild = ((SingleLineLinearLayout) titleView.getChildAt(0));

    for (int i = 0; i < dataAdapter.getTitleCount(); i++) {
        TextView textView = TextViewUtils.generateTextView(titleChild.getContext(),
                dataAdapter.getTitleAt(i),
                parametersHolder.item_gravity,
                parametersHolder.item_width,
                parametersHolder.item_padding);

        titleChild.addView(textView, i);
    }
    titleChild.setBackgroundColor(parametersHolder.title_color);
}
 
Example 7
Project: tuxguitar   File: TGToolbarPlayRateDialog.java   View source code 6 votes vote down vote up
@SuppressLint("InflateParams")
public Dialog onCreateDialog() {
    tgPlayRateList = generatePercent();

    final View view = getActivity().getLayoutInflater().inflate(R.layout.view_toolbar_playrate_dialog, null);
    this.seekBar = (SeekBar) view.findViewById(R.id.toolbar_percent_seekbar);
    this.textView = (TextView) view.findViewById(R.id.toolbar_percent_textview);

    this.seekBar.setMax(tgPlayRateList.size() - 1);
    this.initPlayRate();
    this.appendListeners(seekBar);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.toolbar_playrate_dlg_title);
    builder.setView(view);
    return builder.create();
}
 
Example 8
Project: do-road   File: RegisterActivity.java   View source code 6 votes vote down vote up
private void initViews()
{
    mEmailWrapper = (TextInputLayout) findViewById(R.id.user_email_wrapper_register);
    mPasswordWrapper = (TextInputLayout) findViewById(R.id.user_password_wrapper);
    mFirstNameWrapper = (TextInputLayout) findViewById(R.id.user_first_name_wrapper);
    mLastNameWrapper = (TextInputLayout) findViewById(R.id.user_last_name_wrapper);
    mConfirmWrapper = (TextInputLayout) findViewById(R.id.password_confirm_wrapper);

    mVehichleTypeSpinner = (Spinner) findViewById(R.id.SpinnerVehicleType);
    mRouteSpinner = (Spinner) findViewById(R.id.SpinnerRoute);


    mEmaiEdit = mEmailWrapper.getEditText();
    mPasswordEdit = mPasswordWrapper.getEditText();
    mConfirmEdit = mConfirmWrapper.getEditText();
    mFirstNameEdit = mFirstNameWrapper.getEditText();
    mLastNameEdit = mLastNameWrapper.getEditText();
    mRegisterBtn = (Button) findViewById(R.id.btn_signup);
    mLinkLogin = (TextView) findViewById(R.id.link_login);

    mRegisterBtn.setOnClickListener(this);
    mLinkLogin.setOnClickListener(this);
}
 
Example 9
Project: stynico   File: gifa.java   View source code 6 votes vote down vote up
public void ac_styTool()
   {
EditText et=(EditText) findViewById(R.id.mainEditText1);
String os =et.getText().toString();
char[] a = os.toCharArray();
StringBuffer b = new StringBuffer("");
String mo =getResources().getString(R.string.android_gifb); 
for (int i=0;i < a.length;i++)
{
    b.append(mo.replace('n', a[i])) ;
    ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    manager.setText(b);
}
TextView t=(TextView) findViewById(R.id.mainTextView1);
t.setText(b);
   }
 
Example 10
Project: SmartButler   File: SmsService.java   View source code 6 votes vote down vote up
private void initView()
{
    tv_sms_sender= (TextView) windowView.findViewById(R.id.tv_sms_sender);
    tv_sms_content= (TextView) windowView.findViewById(R.id.tv_sms_content);
    btn_sms_send= (Button) windowView.findViewById(R.id.btn_sms_send);
    //将发信人和短信内容显示在窗口中
    tv_sms_sender.setText("发件人——"+sender);
    tv_sms_content.setText(smsContent);
    //为短信发送按钮设置监听器
    btn_sms_send.setOnClickListener(new View.OnClickListener()
    {
        @Override
        public void onClick(View v)
        {
            if (v.getId()==R.id.btn_sms_send)
            {
                //发送短信
                sendSms();
                //关闭窗口
                windowManager.removeView(windowView);
            }
        }
    });
}
 
Example 11
Project: TYT   File: T_InvoiceInformationProductsActivity.java   View source code 6 votes vote down vote up
public ViewHolder(final View itemView) {
    super(itemView);
    tv_orderCommodityName = (TextView) itemView.findViewById(R.id.tv_orderCommodityName);
    tv_orderCommodityUnit = (TextView) itemView.findViewById(R.id.tv_orderCommodityUnit);
    tv_orderCommodityQuantity = (TextView) itemView.findViewById(R.id.tv_orderCommodityQuantity);
    tv_orderCommodityPriceWov = (TextView) itemView.findViewById(R.id.tv_orderCommodityPriceWov);
    tv_orderCommodityAmountWov = (TextView) itemView.findViewById(R.id.tv_orderCommodityAmountWov);
    tv_orderCommodityRebateRate = (TextView) itemView.findViewById(R.id.tv_orderCommodityRebateRate);
    tv_orderCommodityVatAmount = (TextView) itemView.findViewById(R.id.tv_orderCommodityVatAmount);
    // 整个条目点击事件
    itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
        }
    });
}
 
Example 12
Project: boohee_v5.6   File: StepSettingActivity$$ViewInjector.java   View source code 6 votes vote down vote up
public void inject(Finder finder, final T target, Object source) {
    target.tvStep = (TextView) finder.castView((View) finder.findRequiredView(source, R.id
            .tv_step, "field 'tvStep'"), R.id.tv_step, "field 'tvStep'");
    target.checkBoxStep = (AnimCheckBox) finder.castView((View) finder.findRequiredView
            (source, R.id.check_box_step, "field 'checkBoxStep'"), R.id.check_box_step,
            "field 'checkBoxStep'");
    target.checkBoxNotification = (AnimCheckBox) finder.castView((View) finder
            .findRequiredView(source, R.id.check_box_notification, "field " +
                    "'checkBoxNotification'"), R.id.check_box_notification, "field " +
            "'checkBoxNotification'");
    target.tvPermission = (TextView) finder.castView((View) finder.findRequiredView(source, R
            .id.tv_permission, "field 'tvPermission'"), R.id.tv_permission, "field " +
            "'tvPermission'");
    target.llContent = (LinearLayout) finder.castView((View) finder.findRequiredView(source,
            R.id.ll_content, "field 'llContent'"), R.id.ll_content, "field 'llContent'");
    target.checkBoxNotificationPermission = (AnimCheckBox) finder.castView((View) finder
            .findRequiredView(source, R.id.check_box_notification_permission, "field " +
                    "'checkBoxNotificationPermission'"), R.id
            .check_box_notification_permission, "field 'checkBoxNotificationPermission'");
    ((View) finder.findRequiredView(source, R.id.ll_notifi_permission, "method 'onClick'"))
            .setOnClickListener(new DebouncingOnClickListener() {
        public void doClick(View p0) {
            target.onClick(p0);
        }
    });
}
 
Example 13
Project: stynico   File: gifa.java   View source code 6 votes vote down vote up
public void bclick()
   {
EditText et=(EditText) findViewById(R.id.mainEditText1);
String os =et.getText().toString();
char[] a = os.toCharArray();
StringBuffer b = new StringBuffer("");
String mo ="爱҉";
for (int i=0;i < a.length;i++)
{
    b.append(mo.replace('爱', a[i])) ;
    ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    manager.setText(b);
}

TextView t=(TextView) findViewById(R.id.mainTextView1);
t.setText(b);
   }
 
Example 14
Project: Nearby   File: RecordVitalSignActivity.java   View source code 6 votes vote down vote up
private void createNewData(ArrayList<Double> list, String type){

        Random rand = new Random();
        Double temp = 0.0;
        if("pulse".equals(type)){
            temp = 80.0 + (int)Math.round(rand.nextDouble());
        }else if("temperature".equals(type)){
            temp = 36.0 + rand.nextDouble();
        }
//        int temp = 80 + (int)Math.round(rand.nextDouble());
        list.add(temp);

        TextView msg = new TextView(this);
        msg.setText(temp + "");
        msg.setTextColor(getColorId(R.color.dark_gray));
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        params.setMargins(0, 20, 0, 0);
        params.gravity = Gravity.CENTER;
        msg.setLayoutParams(params);
        msg.setGravity(Gravity.CENTER);
        li_result.addView(msg, 0);

        tv_time.setText("경과시간 : " + time + "s");

    }
 
Example 15
Project: Companion-For-PUBG-Android   File: NewsAdapter.java   View source code 5 votes vote down vote up
public NewsItemViewHolder(@NonNull final View itemView) {
    super(itemView);
    imgImageView = (ImageView) itemView.findViewById(R.id.row_item_image);
    titleTextView = (TextView) itemView.findViewById(R.id.row_item_title);
    typeTextView = (TextView) itemView.findViewById(R.id.row_item_type);
    dateTextView = (TextView) itemView.findViewById(R.id.row_item_date);
    descriptionTextView = (TextView) itemView.findViewById(R.id.row_item_description);
}
 
Example 16
Project: GitJourney   File: PersonalActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String userLogin = getIntent().getStringExtra("userSessionData");

    setContentView(R.layout.activity_personal);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(userLogin);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    recyclerView = (RecyclerView) findViewById(R.id.repo_details);
    recyclerView.setNestedScrollingEnabled(false);
    profilePoster = (ImageView) findViewById(R.id.profile_poster);
    repositories = (TextView) findViewById(R.id.repositories);
    following = (TextView) findViewById(R.id.following);
    followers = (TextView) findViewById(R.id.followers);

    Parser<GitHubUserProfileDataEntry> parser = new GitHubUserProfileDataParser();
    new UserProfileAsyncTask<GitHubUserProfileDataEntry>(this, this, parser).execute();

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setVisibility(View.GONE); //TODO: delete this line when edit functionality will be done
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //TODO: implement an edit activity
        }
    });
}
 
Example 17
Project: LQRWeChat-master   File: PRTHeader.java   View source code 5 votes vote down vote up
public PRTHeader(Context context) {
	super(context);
	int[] size = ResHelper.getScreenSize(context);
	float screenWidth = size[0] < size[1] ? size[0] : size[1];
	float ratio = screenWidth / DESIGN_SCREEN_WIDTH;

	setOrientation(VERTICAL);

	LinearLayout llInner = new LinearLayout(context);
	LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_HORIZONTAL;
	addView(llInner, lp);

	ivArrow = new RotateImageView(context);
	int resId = ResHelper.getBitmapRes(context, "ssdk_oks_ptr_ptr");
	if (resId > 0) {
		ivArrow.setImageResource(resId);
	}
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.topMargin = lp.bottomMargin = avataPadding;
	llInner.addView(ivArrow, lp);

	pbRefreshing = new ProgressBar(context);
	resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_progressbar");
	Drawable pbdrawable = context.getResources().getDrawable(resId);
	pbRefreshing.setIndeterminateDrawable(pbdrawable);
	llInner.addView(pbRefreshing, lp);
	pbRefreshing.setVisibility(View.GONE);

	tvHeader = new TextView(getContext());
	tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvHeader.setPadding(avataPadding, 0, avataPadding, 0);
	tvHeader.setTextColor(0xff09bb07);
	lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	llInner.addView(tvHeader, lp);
}
 
Example 18
Project: HeadlineNews   File: WebViewActivity.java   View source code 5 votes vote down vote up
@Override
protected void initViews() {
    StatusBarUtil.setPaddingSmart(this, findViewById(R.id.id_statusbar));
    StatusBarUtil.immersive(this, ResouceUtil.getColor(R.color.gray));
    
    mAutorTv = (TextView) findViewById(R.id.id_author_tv);
    mAvatarIv = (CircleImageView) findViewById(R.id.id_avatar_iv);
    mFollowTv = (TextView) findViewById(R.id.id_follow_tv);
    mWebView = (UIWebView) findViewById(R.id.id_webview);

    mAvatarIv.setVisibility(View.GONE);
    mFollowTv.setVisibility(View.VISIBLE);

    findViewById(R.id.id_back_iv).setOnClickListener(this);
    mFollowTv.setOnClickListener(this);
    mWebView.setOnKeyListener((v, keyCode, event) -> {
        if (event.getAction() == KeyEvent.ACTION_DOWN) {
            if (keyCode == KeyEvent.KEYCODE_BACK && mWebView.canGoBack()) {  //表示按返回键
                mWebView.goBack();
                return true;
            }
        }
        return false;
    });
}
 
Example 19
Project: TextReader   File: EasyRVHolder.java   View source code 5 votes vote down vote up
@Override
public EasyRVHolder setTypeface(Typeface typeface, int... viewIds) {
    for (int viewId : viewIds) {
        TextView view = getView(viewId);
        view.setTypeface(typeface);
        view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    }
    return this;
}
 
Example 20
Project: JKApp   File: CustomLoadDialog.java   View source code 5 votes vote down vote up
/**
	 * 弹出自定义ProgressDialog
	 * 
	 * @param context
	 *            上下文
	 * @param message
	 *            提示
	 * @param cancelable
	 *            是否按返回键取消
	 * @param cancelListener
	 *            按下返回键监听
	 * @return
	 */
	public static CustomLoadDialog show(Context context, CharSequence message, boolean cancelable, OnCancelListener cancelListener,int resId) {
		dialog = new CustomLoadDialog(context, R.style.Custom_Progress);
		dialog.setTitle("");
//		dialog.setContentView(R.layout.progress_custom);
		dialog.setContentView(resId);
		if (message == null || message.length() == 0) {
			dialog.findViewById(R.id.message).setVisibility(View.GONE);
		} else {
			TextView txt = (TextView) dialog.findViewById(R.id.message);
			txt.setText(message);
		}
		// 按返回键是否取消
		dialog.setCancelable(cancelable);
		// 监听返回键处理
		dialog.setOnCancelListener(cancelListener);
		// 设置居中
		dialog.getWindow().getAttributes().gravity = Gravity.CENTER;
		WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
		// 设置背景层透明度
		lp.dimAmount = 0.2f;
		dialog.getWindow().setAttributes(lp);
		// dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);

		if(!((Activity) context).isFinishing())
		{
			//show dialog
			dialog.show();
		}
		return dialog;
	}
 
Example 21
Project: pracler   File: MainActivity.java   View source code 5 votes vote down vote up
public void hideActionBarButton()
{
    TextView positive = (TextView) findViewById(R.id.action_positive);
    positive.setVisibility(View.GONE);
    TextView negative = (TextView) findViewById(R.id.action_negative);
    negative.setVisibility(View.GONE);
}
 
Example 22
Project: OverScrollableRecyclerView-Method1   File: RecyclerViewActivity.java   View source code 5 votes vote down vote up
public MyViewHolder(View itemView) {
    super(itemView);
    mTextView = (TextView) itemView.findViewById(R.id.tv);
    mTextView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
        }
    });
}
 
Example 23
Project: GitHub   File: FragmentLifecycleActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState == null) {
        //started for the first time, reset all counters
        fragmentLifecycleActivityInstanceCount = -1;
        TestFragment.testFragmentInstanceCount = -1;
    }

    fragmentLifecycleActivityInstanceCount++;
    setContentView(R.layout.activity_fragment_lifecycle);
    FragmentManager.enableDebugLogging(true);
    Log.v(TAG, "onCreate of " + this);

    mSwitchAddToBackStack = (SwitchCompat) findViewById(R.id.switch_add_back_stack);
    mSwitchRetainPresenterInstance = (SwitchCompat) findViewById(
            R.id.switch_retain_presenter_instance);
    final TextView textDontKeepActivities = (TextView) findViewById(
            R.id.text_dont_keep_activities);
    textDontKeepActivities.setText(
            isDontKeepActivities() ? R.string.dont_keep_activities_enabled
                    : R.string.dont_keep_activities_disabled);

    Log.v(TAG, "// A new Activity gets created by the Android Framework.");
    Log.v(TAG, "final HostingActivity hostingActivity" + fragmentLifecycleActivityInstanceCount
            + " = new HostingActivity();");
}
 
Example 24
Project: android-dev-challenge   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_forecast);

    // COMPLETED (2) Use findViewById to get a reference to the weather display TextView
    mWeatherTextView = (TextView) findViewById(R.id.tv_weather_data);

    // COMPLETED (3) Create an array of Strings that contain fake weather data
    String[] dummyWeatherData = {
            "Today, May 17 - Clear - 17°C / 15°C",
            "Tomorrow - Cloudy - 19°C / 15°C",
            "Thursday - Rainy- 30°C / 11°C",
            "Friday - Thunderstorms - 21°C / 9°C",
            "Saturday - Thunderstorms - 16°C / 7°C",
            "Sunday - Rainy - 16°C / 8°C",
            "Monday - Partly Cloudy - 15°C / 10°C",
            "Tue, May 24 - Meatballs - 16°C / 18°C",
            "Wed, May 25 - Cloudy - 19°C / 15°C",
            "Thu, May 26 - Stormy - 30°C / 11°C",
            "Fri, May 27 - Hurricane - 21°C / 9°C",
            "Sat, May 28 - Meteors - 16°C / 7°C",
            "Sun, May 29 - Apocalypse - 16°C / 8°C",
            "Mon, May 30 - Post Apocalypse - 15°C / 10°C",
    };

    // COMPLETED (4) Append each String from the fake weather data array to the TextView
    for (String dummyWeatherDay : dummyWeatherData) {
        mWeatherTextView.append(dummyWeatherDay + "\n\n\n");
    }
}
 
Example 25
Project: GitHub   File: ReplaceTransactionFragment.java   View source code 5 votes vote down vote up
@Nullable @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
    @Nullable Bundle savedInstanceState) {

  View view = inflater.inflate(R.layout.fragment_child, container, false);
  TextView tv = (TextView) view.findViewById(R.id.text);
  tv.setText(toString());

  return view;
}
 
Example 26
Project: Mobike   File: TabTitleView.java   View source code 5 votes vote down vote up
private void initView() {
    View view = mInflater.inflate(R.layout.tab_title, this, true);
    mTitleTextView = (TextView) view.findViewById(R.id.tv_tab_title);
    mLeftButton = (ImageView) view.findViewById(R.id.iv_tab_left);
    mRightTextView = (TextView) view.findViewById(R.id.tv_tab_ringht);
    mLRippleView = (RippleView) view.findViewById(R.id.more);
    mRRippleView = (RippleView) view.findViewById(R.id.more1);
}
 
Example 27
Project: nativead   File: AdLargeFragment.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	super.onCreateView(inflater, container, savedInstanceState);
	View view = inflater.inflate(R.layout.fragment_ad_large, container, false);
	mCardView = (CardView) view.findViewById(R.id.ad_large_cardview);
	mIconView = (ImageView) view.findViewById(R.id.ad_large_iv_icon);
	mTitleView = (TextView) view.findViewById(R.id.ad_large_tv_title);
	mSubTitleView = (TextView) view.findViewById(R.id.ad_large_tv_sub_title);
	mPicView = (ImageView) view.findViewById(R.id.ad_large_iv_large_pic);
	return view;
}
 
Example 28
Project: aos-Video   File: EpisodeInfo.java   View source code 5 votes vote down vote up
public void setDetailLineReleaseDate(TextView view, Resources res) {
    if (mAired == null) {
        view.setText(EMPTY);
    } else {
        view.setText(res.getString(R.string.scrap_aired_format, mAired));
    }
}
 
Example 29
Project: RNLearn_Project1   File: ReactTextTest.java   View source code 5 votes vote down vote up
@Test
public void testBackgroundColorStyleApplied() {
  UIManagerModule uiManager = getUIManagerModule();

  ReactRootView rootView = createText(
      uiManager,
      JavaOnlyMap.of(ViewProps.BACKGROUND_COLOR, Color.BLUE),
      JavaOnlyMap.of(ReactTextShadowNode.PROP_TEXT, "test text"));

  Drawable backgroundDrawable = ((TextView) rootView.getChildAt(0)).getBackground();
  assertThat(((ReactViewBackgroundDrawable) backgroundDrawable).getColor()).isEqualTo(Color.BLUE);
}
 
Example 30
Project: justintrain-client-android   File: FavouriteJourneysActivity.java   View source code 5 votes vote down vote up
@Override
public void showSnackbar(String message, ENUM_SNACKBAR_ACTIONS intent, int duration) {
    Log.w(message);
    Snackbar snackbar = Snackbar
            .make(this.rvFavouriteJourneys, message, Snackbar.LENGTH_LONG);
    ((TextView) snackbar.getView().findViewById(android.support.design.R.id.snackbar_text)).setTextColor(ContextCompat.getColor(this, R.color.txt_white));
    switch (intent) {
        case NONE:
            break;
    }
    snackbar.show();
}
 
Example 31
Project: HistoryProvider_Library   File: WordCursorAdapter.java   View source code 5 votes vote down vote up
@Override
public void bindView(View view, Context context, Cursor cursor) {

    TextView tv = (TextView) view.findViewById(R.id.word);
    int name = cursor.getColumnIndex(WordContract.WordEntry.COLUMN_WORD_NAME);
    String petName = cursor.getString(name);
    tv.setText(petName);

}
 
Example 32
Project: boohee_v5.6   File: OrderEditListAdapter.java   View source code 5 votes vote down vote up
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(this.ctx).inflate(R.layout.no, null);
    }
    Button decreseBtn = (Button) convertView.findViewById(R.id.decrease_btn);
    Button increaseBtn = (Button) convertView.findViewById(R.id.increase_btn);
    TextView quantity = (TextView) convertView.findViewById(R.id.quantity_value);
    TextView Title = (TextView) convertView.findViewById(R.id.title);
    TextView price = (TextView) convertView.findViewById(R.id.price_value);
    RelativeLayout intoGoodsDetails = (RelativeLayout) convertView.findViewById(R.id
            .into_goods_detail);
    CartGoods goods = (CartGoods) this.goodsList.get(position);
    quantity.setText(String.valueOf(goods.quantity));
    float priceVaule = goods.base_price;
    price.setText(this.ctx.getString(R.string.ae4) + TextUtil.m2(priceVaule));
    this.loader.displayImage(goods.thumb_photo_url, (ImageView) convertView.findViewById(R.id
            .default_photo), this.options);
    AddBtnClickListener buttonListener = new AddBtnClickListener(quantity, decreseBtn,
            position, priceVaule, goods.goods_id);
    intoGoodsDetails.setOnClickListener(buttonListener);
    decreseBtn.setVisibility(4);
    increaseBtn.setVisibility(4);
    decreseBtn.setOnClickListener(buttonListener);
    if (Integer.parseInt(String.valueOf(quantity.getText())) == 1) {
        decreseBtn.setClickable(false);
        decreseBtn.setEnabled(false);
    }
    increaseBtn.setOnClickListener(buttonListener);
    if (TextUtils.equals(goods_type.SpecGoods.name(), goods.type)) {
        Title.setText(goods.title);
    } else {
        Title.setText(goods.title + ShopUtils.getFormatInfo(goods.chosen_specs));
    }
    return convertView;
}
 
Example 33
Project: letv   File: ChannelListFootView.java   View source code 5 votes vote down vote up
protected void init(Context context) {
    View view = UIsUtils.inflate(context, R.layout.channel_listview_foot_playerlibs, null);
    view.setLayoutParams(new LayoutParams(-1, UIsUtils.dipToPx(40.0f)));
    this.loadingLayout = (LinearLayout) view.findViewById(R.id.loading_layout);
    this.refreshLayout = (LinearLayout) view.findViewById(R.id.refresh_layout);
    this.noMoreLayout = (RelativeLayout) view.findViewById(R.id.no_more_or_error_layout);
    this.finishNoReply = (RelativeLayout) view.findViewById(R.id.rl_no_more_reply_layout);
    this.noMoreInfo = (TextView) view.findViewById(R.id.tv_no_more_info);
    this.noMoreOrErrorView = (TextView) view.findViewById(R.id.no_more_or_error_text);
    addView(view);
}
 
Example 34
Project: ShoppingCartActivity   File: ShoppingCartActivity.java   View source code 5 votes vote down vote up
/**
 * 增加
 * @param position      组元素位置
 * @param showCountView 用于展示变化后数量的View
 * @param isChecked     子元素选中与否
 */
@Override
public void doIncrease(int position, View showCountView, boolean isChecked) {
    ShoppingCartBean shoppingCartBean = shoppingCartBeanList.get(position);
    int currentCount = shoppingCartBean.getCount();
    currentCount++;
    shoppingCartBean.setCount(currentCount);
    ((TextView) showCountView).setText(currentCount + "");
    shoppingCartAdapter.notifyDataSetChanged();
    statistics();
}
 
Example 35
Project: Mobike   File: EditPageLand.java   View source code 5 votes vote down vote up
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 36
Project: mobile-store   File: StartSwapView.java   View source code 5 votes vote down vote up
private void uiInitWifi() {

        viewWifiId = (TextView) findViewById(R.id.device_id_wifi);
        viewWifiNetwork = (TextView) findViewById(R.id.wifi_network);

        wifiSwitch = (SwitchCompat) findViewById(R.id.switch_wifi);
        wifiSwitch.setOnCheckedChangeListener(onWifiSwitchToggled);
        setWifiSwitchState(getManager().isBonjourDiscoverable(), true);

        textWifiVisible = (TextView) findViewById(R.id.wifi_visible);
        int textResource = getManager().isBonjourDiscoverable() ? R.string.swap_visible_wifi : R.string.swap_not_visible_wifi;
        textWifiVisible.setText(textResource);

        // Note that this is only listening for the WifiSwap, whereas we start both the WifiSwap
        // and the Bonjour service at the same time. Technically swap will work fine without
        // Bonjour, and that is more of a convenience. Thus, we should show feedback once wifi
        // is ready, even if Bonjour is not yet.
        LocalBroadcastManager.getInstance(getContext()).registerReceiver(onWifiSwapStateChanged, new IntentFilter(SwapService.WIFI_STATE_CHANGE));

        viewWifiNetwork.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().promptToSelectWifiNetwork();
            }
        });

        uiUpdateWifiNetwork();
    }
 
Example 37
Project: NeiHanDuanZiTV   File: CommonTabLayout.java   View source code 5 votes vote down vote up
/**
 * 设置提示红点偏移,注意
 * 1.控件为固定高度:参照点为tab内容的右上角
 * 2.控件高度不固定(WRAP_CONTENT):参照点为tab内容的右上角,此时高度已是红点的最高显示范围,所以这时bottomPadding其实就是topPadding
 */
public void setMsgMargin(int position, float leftPadding, float bottomPadding) {
    if (position >= mTabCount) {
        position = mTabCount - 1;
    }
    View tabView = mTabsContainer.getChildAt(position);
    MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip);
    if (tipView != null) {
        TextView tv_tab_title = (TextView) tabView.findViewById(R.id.tv_tab_title);
        mTextPaint.setTextSize(mTextsize);
        float textWidth = mTextPaint.measureText(tv_tab_title.getText().toString());
        float textHeight = mTextPaint.descent() - mTextPaint.ascent();
        MarginLayoutParams lp = (MarginLayoutParams) tipView.getLayoutParams();

        float iconH = mIconHeight;
        float margin = 0;
        if (mIconVisible) {
            if (iconH <= 0) {
                iconH = mContext.getResources().getDrawable(mTabEntitys.get(position).getTabSelectedIcon()).getIntrinsicHeight();
            }
            margin = mIconMargin;
        }

        if (mIconGravity == Gravity.TOP || mIconGravity == Gravity.BOTTOM) {
            lp.leftMargin = dp2px(leftPadding);
            lp.topMargin = mHeight > 0 ? (int) (mHeight - textHeight - iconH - margin) / 2 - dp2px(bottomPadding) : dp2px(bottomPadding);
        } else {
            lp.leftMargin = dp2px(leftPadding);
            lp.topMargin = mHeight > 0 ? (int) (mHeight - Math.max(textHeight, iconH)) / 2 - dp2px(bottomPadding) : dp2px(bottomPadding);
        }

        tipView.setLayoutParams(lp);
    }
}
 
Example 38
Project: RLibrary   File: RTitleCenterLayout.java   View source code 5 votes vote down vote up
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    //super.onLayout(changed, l, t, r, b);
    int width = getMeasuredWidth();
    int height = getMeasuredHeight();

    float offset = getResources().getDisplayMetrics().density * 4;
    int loadViewRight = -1;
    //有标题view的情况
    if (mTitleView != null && mTitleView.getVisibility() == VISIBLE) {
        if (mTitleView instanceof TextView) {
            if (!TextUtils.isEmpty(((TextView) mTitleView).getText())) {
                loadViewRight = (int) (layoutCenter(mTitleView, width, height) - offset);
            }
        } else {
            loadViewRight = (int) (layoutCenter(mTitleView, width, height) - offset);
        }
    }

    if (mLoadingView != null && mLoadingView.getVisibility() == VISIBLE) {
        int top = (height - mLoadingView.getMeasuredHeight()) / 2;

        if (loadViewRight == -1) {
            layoutCenter(mLoadingView, width, height);
        } else {
            mLoadingView.layout(loadViewRight - mLoadingView.getMeasuredWidth(), top,
                    loadViewRight, top + mLoadingView.getMeasuredHeight());
        }
    }

}
 
Example 39
Project: Mobike   File: PRTHeader.java   View source code 5 votes vote down vote up
public PRTHeader(Context context) {
	super(context);
	int[] size = R.getScreenSize(context);
	float screenWidth = size[0] < size[1] ? size[0] : size[1];
	float ratio = screenWidth / DESIGN_SCREEN_WIDTH;

	setOrientation(VERTICAL);

	LinearLayout llInner = new LinearLayout(context);
	LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_HORIZONTAL;
	addView(llInner, lp);

	ivArrow = new RotateImageView(context);
	int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr");
	if (resId > 0) {
		ivArrow.setImageResource(resId);
	}
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.topMargin = lp.bottomMargin = avataPadding;
	llInner.addView(ivArrow, lp);

	pbRefreshing = new ProgressBar(context);
	resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar");
	Drawable pbdrawable = context.getResources().getDrawable(resId);
	pbRefreshing.setIndeterminateDrawable(pbdrawable);
	llInner.addView(pbRefreshing, lp);
	pbRefreshing.setVisibility(View.GONE);

	tvHeader = new TextView(getContext());
	tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvHeader.setPadding(avataPadding, 0, avataPadding, 0);
	tvHeader.setTextColor(0xff09bb07);
	lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	llInner.addView(tvHeader, lp);
}
 
Example 40
Project: data-binding-validator   File: TypeRule.java   View source code 5 votes vote down vote up
public TypeRule instantiate(TextView view, String errorMessage) throws NoSuchMethodException, IllegalAccessException
        , InvocationTargetException, InstantiationException {
    if(this != None) {
        return mClass.getConstructor(TextView.class, String.class).newInstance(view, errorMessage);
    }
    throw new IllegalStateException("It's not possible to bind a none value type");
}