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: VideoRecorder-master   File: FFmpegRecorderActivity.java   Source Code and License 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 2
Project: GitHub   File: LoopViewPagerAdapter.java   Source Code and License 6 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 3
Project: MDWechat   File: SlidingTabLayout.java   Source Code and License 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   Source Code and License 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: android-dev-challenge   File: MainActivity.java   Source Code and License 6 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 6
Project: wisebite_android   File: RestaurantAdapter.java   Source Code and License 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 7
Project: TableRecyclerView   File: TableAdapter.java   Source Code and License 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 8
Project: tuxguitar   File: TGToolbarPlayRateDialog.java   Source Code and License 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 9
Project: do-road   File: RegisterActivity.java   Source Code and License 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 10
Project: stynico   File: gifa.java   Source Code and License 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 11
Project: SmartButler   File: SmsService.java   Source Code and License 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 12
Project: TYT   File: T_InvoiceInformationProductsActivity.java   Source Code and License 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 13
Project: boohee_v5.6   File: StepSettingActivity$$ViewInjector.java   Source Code and License 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 14
Project: stynico   File: gifa.java   Source Code and License 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 15
Project: Nearby   File: RecordVitalSignActivity.java   Source Code and License 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 16
Project: Companion-For-PUBG-Android   File: NewsAdapter.java   Source Code and License 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 17
Project: GitJourney   File: PersonalActivity.java   Source Code and License 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 18
Project: LQRWeChat-master   File: PRTHeader.java   Source Code and License 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 19
Project: HeadlineNews   File: WebViewActivity.java   Source Code and License 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 20
Project: TextReader   File: EasyRVHolder.java   Source Code and License 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 21
Project: JKApp   File: CustomLoadDialog.java   Source Code and License 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 22
Project: pracler   File: MainActivity.java   Source Code and License 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 23
Project: OverScrollableRecyclerView-Method1   File: RecyclerViewActivity.java   Source Code and License 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 24
Project: GitHub   File: FragmentLifecycleActivity.java   Source Code and License 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 25
Project: GitHub   File: ReplaceTransactionFragment.java   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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");
}
 
Example 41
Project: CustomizableCalendar   File: SubView.java   Source Code and License 5 votes vote down vote up
private void init(Context context, AttributeSet attrs) {
    this.context = context;
    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CustomizableCalendar);
    if (typedArray != null) {
        layoutResId = typedArray.getResourceId(R.styleable.CustomizableCalendar_layout, R.layout.sub_view);
        typedArray.recycle();
    }

    LayoutInflater.from(context).inflate(layoutResId, this);
    monthTxt = (TextView) findViewById(android.R.id.message);
}
 
Example 42
Project: Epilepsy_quiz   File: SummaryActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_summary);
    // Submit score method
    Bundle b = getIntent().getExtras();
    String score = b.getString("score");

    TextView correctAnswersTextView = (TextView) findViewById(R.id.answers_correct);
    TextView totalAnswersTextView = (TextView) findViewById(R.id.answers_total);

    correctAnswersTextView.setText(score);
    totalAnswersTextView.setText("5");

    Button playAgainButton = (Button) findViewById(R.id.button_play_again);

    switch (Integer.parseInt(score)) {
        case 3:
            Toast.makeText(SummaryActivity.this, getResources().getString(R.string.not_so_bad) + score, Toast.LENGTH_LONG).show();
            break;
        case 4:
            Toast.makeText(SummaryActivity.this, getResources().getString(R.string.nice_score) + score, Toast.LENGTH_LONG).show();
            break;
        case 5:
            Toast.makeText(SummaryActivity.this, getResources().getString(R.string.great_score) + score, Toast.LENGTH_LONG).show();
            break;
        default:
            Toast.makeText(SummaryActivity.this, getResources().getString(R.string.could_be_better), Toast.LENGTH_LONG).show();
            break;
    }

    playAgainButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(SummaryActivity.this, MainActivity.class);
            startActivity(intent);
        }
    });
}
 
Example 43
Project: file_scanner   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    btScan = (Button) findViewById(R.id.scan);
    progressBar = (ProgressBar) findViewById(R.id.progressBar1);
    resultContainer = (LinearLayout) findViewById(R.id.result);
    tvFilePath = (TextView) findViewById(R.id.tvFilePath);
    presenter = new MainViewPresenterImpl(this);
    btScan.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (((Button) v).getText().equals(getString(R.string.start))) {
                if (ContextCompat.checkSelfPermission(MainActivity.this,
                        Manifest.permission.READ_CONTACTS)
                        != PackageManager.PERMISSION_GRANTED) {
                    ActivityCompat.requestPermissions(MainActivity.this,
                            new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
                            PERMISSION_REQUEST_CODE_READ_EXTERNAL_STORAGE);
                }else {
                    startScan();
                }
            } else {
                stopScan();
            }
        }
    });
}
 
Example 44
Project: KokoWalk   File: NaginataMayActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    int layout = getIntent().getIntExtra("layout",R.layout.activity_naginata_may);
    mWaitTime = getIntent().getIntExtra("waitTime",400);
    if (layout == R.layout.activity_naginata_koko_hard) {
        //mAutoMode = false;
        mHard = true;
        mDiffLimit = 1980;
        mPointBase *= 2;
    }
    if (layout == R.layout.activity_naginata_doitsujin) {
        //mAutoMode = false;
        mDoitsu = true;
        mDiffLimit = 1999;
        mPointBase *= 4;
    }
    setContentView(layout);
    backGround = (FrameLayout)findViewById(R.id.backGround);
    mTimerText = (TextView)findViewById(R.id.clockView);
    setScore();

    mCharaUp = new ImageView[2];
    mCharaMiddle = new ImageView[2];
    mCharaNormal = new ImageView[2];

    mCharaUp[0] = (ImageView) findViewById(R.id.upper);
    mCharaUp[1] = (ImageView) findViewById(R.id.upper_r);

    mCharaMiddle[0] = (ImageView) findViewById(R.id.middle);
    mCharaMiddle[1] = (ImageView) findViewById(R.id.middle_r);

    mCharaNormal[0] = (ImageView) findViewById(R.id.def);
    mCharaNormal[1] = (ImageView) findViewById(R.id.def_r);

    mCharaDamage[1] = (ImageView)findViewById(R.id.damage);
    mCharaDamage[0] = (ImageView)findViewById(R.id.damage_r);
}
 
Example 45
Project: kognitivo   File: RectangleFragment.java   Source Code and License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_rectangle, container, false);

    adViewRectangleContainer = (RelativeLayout)view.findViewById(R.id.adViewContainerRectangle);
    adRectangleStatusLabel = (TextView)view.findViewById(R.id.adRectangleStatusLabel);
    setLabel(statusLabel);

    // Reposition the ad and add it to the view hierarchy.
    adViewRectangleContainer.addView(adViewRectangle);

    return view;
}
 
Example 46
Project: FiveMinsMore   File: CustomRenderer.java   Source Code and License 5 votes vote down vote up
@Override
protected void onBeforeClusterItemRendered(CustomMarker item, MarkerOptions markerOptions) {
    // Set the info window to show their name.
    TextView tv = (TextView) mActivity.getLayoutInflater().inflate(R.layout.view_cluster_item, null);
    tv.setText(item.getTitle());
    mIconGenerator.setContentView(tv);
    Bitmap icon = mIconGenerator.makeIcon();
    markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
}
 
Example 47
Project: GCSApp   File: SystemCircleMsgAdapter.java   Source Code and License 5 votes vote down vote up
public AnchorHotViewHolder(final View itemView) {
    super(itemView);
    this.item = itemView;
    lin_action = (LinearLayout) itemView.findViewById(R.id.lin_action);
    pic = (ImageView) itemView.findViewById(R.id.avatar);
    tvName = (TextView) itemView.findViewById(R.id.name);
    tvMsg = (TextView) itemView.findViewById(R.id.message);
    tvTime = (TextView) itemView.findViewById(R.id.time);
    tv_refuse = (TextView) itemView.findViewById(R.id.tv_refuse);
    tv_msg_from = (TextView) itemView.findViewById(R.id.tv_msg_from);
    tv_accept = (TextView) itemView.findViewById(R.id.tv_accept);
}
 
Example 48
Project: BizareChat   File: UserInfoFragment.java   Source Code and License 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_user_info, container, false);
    arguments = getArguments();
    email = arguments.getString(EMAIL_BUNDLE_KEY);
    phone = arguments.getString(PHONE_BUNDLE_KEY);
    website = arguments.getString(WEBSITE_BUNDLE_KEY);
    fullName = arguments.getString(FULL_NAME_BUNDLE_KEY);
    presenter.setUserId(arguments.getLong(ID_BUNDLE_KEY));

    Toolbar toolbar = (Toolbar) view.findViewById(R.id.user_toolbar);
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(toolbar.getContext(),
            null, android.support.v7.appcompat.R.styleable.ActionBar, android.support.v7.appcompat.R.attr.actionBarStyle, 0);
    toolbar.setNavigationIcon(a.getDrawable(android.support.v7.appcompat.R.styleable.ActionBar_homeAsUpIndicator));
    toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed());

    toolbarLayout = (CollapsingToolbarLayout) view.findViewById(R.id.user_collapsing_toolbar_layout);
    emailTextView = (TextView) view.findViewById(R.id.user_info_email_value);
    phoneTextView = (TextView) view.findViewById(R.id.user_info_phone_value);
    websiteTextView = (TextView) view.findViewById(R.id.user_info_website_value);
    userInfoFab = (FloatingActionButton) view.findViewById(R.id.user_info_fab);
    toolbarLayout.setTitleEnabled(true);
    toolbarLayout.setTitle(fullName);

    view.findViewById(R.id.user_info_email_layout).setOnClickListener(this);
    view.findViewById(R.id.user_info_phone_layout).setOnClickListener(this);
    view.findViewById(R.id.user_info_website_layout).setOnClickListener(this);
    userInfoFab.setOnClickListener(this);

    if (presenter.isCurrentUser()) {
        userInfoFab.setVisibility(View.GONE);
    }

    packageManager = getActivity().getPackageManager();

    return view;
}
 
Example 49
Project: RNLearn_Project1   File: ReactTextTest.java   Source Code and License 5 votes vote down vote up
/**
 * Make sure TextView has exactly one span and that span has given type.
 */
private static <TSPAN> TSPAN getSingleSpan(TextView textView, Class<TSPAN> spanClass) {
  Spanned text = (Spanned) textView.getText();
  TSPAN[] spans = text.getSpans(0, text.length(), spanClass);
  assertThat(spans).hasSize(1);
  return spans[0];
}
 
Example 50
Project: GitHub   File: SampleParentActivity.java   Source Code and License 5 votes vote down vote up
protected View getColoredView(int bgColor, String msg) {
    TextView tv = new TextView(this);
    tv.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    tv.setText(msg);
    tv.setBackgroundColor(bgColor);
    tv.setPadding(10, 10, 10, 10);
    tv.setTextColor(getContrastColor(bgColor));
    return tv;
}
 
Example 51
Project: Daejeon-People   File: MapView.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_mapview);
    select = (TextView)findViewById(R.id.select);

    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}
 
Example 52
Project: UiLib   File: SimpleViewHolder.java   Source Code and License 5 votes vote down vote up
public SimpleViewHolder(View itemView) {
    super(itemView);
    tvContent = (TextView) itemView.findViewById(R.id.simple_content);
    if (tvContent == null) {
        throw new IllegalArgumentException("use simple_viewholder,never change it's id");
    }
    itemView.setOnClickListener(this);
}
 
Example 53
Project: KernelAdiutor-Mod   File: FrequencyTableView.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateView(View view) {
    mFrequency = (TextView) view.findViewById(R.id.frequency);
    mPercentage = (TextView) view.findViewById(R.id.percentage);
    mDuration = (TextView) view.findViewById(R.id.duration);
    mProgress = (ProgressBar) view.findViewById(R.id.progress);

    super.onCreateView(view);
}
 
Example 54
Project: scab   File: FeedbackActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_feedback);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    CommonLib commonLib = CommonLib.getInstance();
    this.feedbackInfo = commonLib.getFeedbackInfo();

    this.checkBoxDevice = (CheckBox) findViewById(R.id.checkboxDeviceInfo);
    this.checkBoxUser = (CheckBox) findViewById(R.id.checkboxUserInfo);
    this.checkBoxLog = (CheckBox) findViewById(R.id.checkboxLog);
    this.editTextFeedback = (EditText) findViewById(R.id.editTextFeedback);

    this.editTextFeedback.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_SEND) {
                sendMessage();
                handled = true;
            }
            return handled;
        }
    });

    Button buttonSend = (Button) findViewById(R.id.buttonSend);
    buttonSend.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            sendMessage();
        }
    });
}
 
Example 55
Project: deepenlib-android-sample   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(mContext).inflate(
                R.layout.list_view_item_classifier_result,
                parent, false);
    }
    final ClassifierResultEntry classifierResult = getItem(position);
    ((TextView) convertView.findViewById(R.id.list_item_classifier_result_class)).setText(classifierResult.mClass);
    ((TextView) convertView.findViewById(R.id.list_item_classifier_result_score)).setText("" + classifierResult.mScore);

    return convertView;
}
 
Example 56
Project: BookReader-master   File: BaseViewHolder.java   Source Code and License 5 votes vote down vote up
public BaseViewHolder 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 57
Project: Orin   File: IndexLayoutManager.java   Source Code and License 5 votes vote down vote up
private Boolean isHeader(TextView prev, TextView act) {
    if (isSameChar(prev.getText().charAt(0), act.getText().charAt(0))) {
        return Boolean.FALSE;
    } else {
        return Boolean.TRUE;
    }
}
 
Example 58
Project: terminal-seekbar   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    terminalSeekBar = (TerminalSeekBar) findViewById(R.id.terminalSeekBar);
    textViewTerminalChanged = (TextView) findViewById(R.id.textView);
    textViewSeekChanged = (TextView) findViewById(R.id.positionSeekTextView);

    ArrayList<Terminal> terminals = new ArrayList<>();

    //Note that an exception is thrown if TerminalPosition is greater than the setMaxValue of TerminalSeekBar
    terminals.add(new Terminal(10, Color.GREEN, "...this..." , Terminal.DEFAULT_PRIORITY_NORMAL));
    terminals.add(new Terminal(100, Color.RED, "...HIGH...", Terminal.DEFAULT_PRIORITY_HIGH));
    terminals.add(new Terminal(25, Color.BLUE, "...is...", Terminal.DEFAULT_PRIORITY_NORMAL));
    terminals.add(new Terminal(70, Color.YELLOW, "...gettING...", Terminal.DEFAULT_PRIORITY_MEDIATE));
    terminals.add(new Terminal(50, Color.GRAY, "...check...", Terminal.DEFAULT_PRIORITY_HIGH));

    terminalSeekBar.setTerminals(terminals);

    terminalSeekBar.enablePriorityBlinking(TerminalAnimationType.BLINK_ACTIVE);

    //Or
    //terminalSeekBar.enablePriorityBlinking(TerminalAnimationType.BLINK_STILL);

    terminalSeekBar.setTerminalChangedListener(this);
    terminalSeekBar.setSeekBarValueChangedListener(this); //Optional

}
 
Example 59
Project: Hotspot-master-devp   File: AlignTextView.java   Source Code and License 5 votes vote down vote up
/**
 * 获取文本实际所占高度,辅助用于计算行高,行数
 *
 * @param text        文本
 * @param textSize    字体大小
 * @param deviceWidth 屏幕宽度
 */
private void measureTextViewHeight(String text, float textSize, int deviceWidth) {
    TextView textView = new TextView(getContext());
    textView.setText(text);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    int widthMeasureSpec = MeasureSpec.makeMeasureSpec(deviceWidth, MeasureSpec.EXACTLY);
    int heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    textView.measure(widthMeasureSpec, heightMeasureSpec);
    originalLineCount = textView.getLineCount();
    originalHeight = textView.getMeasuredHeight();
}
 
Example 60
Project: Hotspot-master-devp   File: SpecialListAdapter.java   Source Code and License 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if(convertView == null) {
        convertView = View.inflate(mContext, R.layout.item_special_list,null);
        holder = new ViewHolder();
        holder.tv_little_title = (TextView) convertView.findViewById(R.id.tv_little_title);
        holder.tv_special_desc = (TextView) convertView.findViewById(R.id.tv_special_desc);
        holder.tv_special_title = (TextView) convertView.findViewById(R.id.tv_special_title);
        holder.iv_image = (ImageView) convertView.findViewById(R.id.iv_image);
        convertView.setTag(holder);
    }else {
        holder = (ViewHolder) convertView.getTag();
    }

    ViewGroup.LayoutParams layoutParams = holder.iv_image.getLayoutParams();
    int width = DensityUtil.getScreenWidth(mContext) - DensityUtil.dip2px(mContext, 20);
    layoutParams.width = width;
    layoutParams.height = (int) (width*IMAGE_SCALE);

    SpecialList.SpecialListItem item = (SpecialList.SpecialListItem) getItem(position);
    Glide.with(mContext).load(item.getImg_url()).placeholder(R.drawable.kong_mrjz).dontAnimate().into(holder.iv_image);

    holder.tv_special_title.setText(item.getName());

    holder.tv_little_title.setText(item.getTitle());

    holder.tv_special_desc.setText(item.getDesc());
    return convertView;
}