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

The following are Jave code examples for showing how to use setTextAppearance() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: showroom-android   File: CardSliderActivity.java   View Source Code Vote up 6 votes
@SuppressWarnings("deprecation")
@Override
public View makeView() {
    final TextView textView = new TextView(CardSliderActivity.this);

    if (center) {
        textView.setGravity(Gravity.CENTER);
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
        textView.setTextAppearance(CardSliderActivity.this, styleId);
    } else {
        textView.setTextAppearance(styleId);
    }

    return textView;
}
 
Example 2
Project: showroom-android   File: ItemsCountView.java   View Source Code Vote up 6 votes
private void init(Context context) {
    textSwitcher = new TextSwitcher(context);
    textSwitcher.addView(createViewForTextSwitcher(context));
    textSwitcher.addView(createViewForTextSwitcher(context));

    addView(textSwitcher, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    textView = new TextView(context);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        textView.setTextAppearance(R.style.EcPositionIndicator);
    } else {
        textView.setTextAppearance(context, R.style.EcPositionIndicator);
    }

    addView(textView, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
 
Example 3
Project: MyCalendar   File: FloatingActionsMenu.java   View Source Code Vote up 6 votes
private void createLabels() {
  Context context = new ContextThemeWrapper(getContext(), mLabelsStyle);

  for (int i = 0; i < mButtonsCount; i++) {
    FloatingActionButtonLibrary button = (FloatingActionButtonLibrary) getChildAt(i);
    String title = button.getTitle();

    if (button == mAddButton || title == null ||
        button.getTag(R.id.fab_label) != null) continue;

    TextView label = new TextView(context);
    label.setTextAppearance(getContext(), mLabelsStyle);
    label.setText(button.getTitle());
    addView(label);

    button.setTag(R.id.fab_label, label);
  }
}
 
Example 4
Project: YCCustomText   File: LabeledEditText.java   View Source Code Vote up 5 votes
private void setAttributes(AttributeSet attrs) {
    mHintTextView = new TextView(mContext);

    final TypedArray a = mContext.obtainStyledAttributes(attrs, R.styleable.LabeledEditText);
    final int padding = a.getDimensionPixelSize(R.styleable.LabeledEditText_etPadding, 0);
    final int defaultPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            DEFAULT_PADDING_LEFT, getResources().getDisplayMetrics());
    final int paddingLeft = a.getDimensionPixelSize(R.styleable.LabeledEditText_etPaddingLeft, defaultPadding);
    final int paddingTop = a.getDimensionPixelSize(R.styleable.LabeledEditText_etPaddingTop, 0);
    final int paddingRight = a.getDimensionPixelSize(R.styleable.LabeledEditText_etPaddingRight, 0);
    final int paddingBottom = a.getDimensionPixelSize(R.styleable.LabeledEditText_etPaddingBottom, 0);
    Drawable background = a.getDrawable(R.styleable.LabeledEditText_etBackground);

    if (padding != 0) {
        mHintTextView.setPadding(padding, padding, padding, padding);
    } else {
        mHintTextView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
    }

    if (background != null) {
        setHintBackground(background);
    }
    mHintTextView.setTextAppearance(mContext, a.getResourceId(R.styleable.LabeledEditText_etTextAppearance,
            android.R.style.TextAppearance_Small));
    //Start hidden
    mHintTextView.setVisibility(INVISIBLE);
    //AnimatorProxy.wrap(mHintTextView).setAlpha(0);
    addView(mHintTextView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    a.recycle();
}
 
Example 5
Project: MenuSet   File: Utils.java   View Source Code Vote up 5 votes
public static TextView getItemTextView(Context context, MenuObject menuItem, int menuItemSize,
                                       View.OnClickListener onCLick, View.OnLongClickListener onLongClick) {
    TextView itemTextView = new TextView(context);
    RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, menuItemSize);
    itemTextView.setLayoutParams(textLayoutParams);
    itemTextView.setOnClickListener(onCLick);
    itemTextView.setOnLongClickListener(onLongClick);
    itemTextView.setText(menuItem.getTitle());
    itemTextView.setPadding(0, 0, (int) context.getResources().getDimension(R.dimen.text_right_padding), 0);
    itemTextView.setGravity(Gravity.CENTER_VERTICAL);
    int textColor = menuItem.getTextColor() == 0 ?
            android.R.color.white :
            menuItem.getTextColor();

    itemTextView.setTextColor(ContextCompat.getColor(context, textColor));

    int styleResId = menuItem.getMenuTextAppearanceStyle() > 0
            ? menuItem.getMenuTextAppearanceStyle()
            : R.style.TextView_DefaultStyle;

    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.M) {
        itemTextView.setTextAppearance(context, styleResId);
    } else {
        itemTextView.setTextAppearance(styleResId);
    }

    return itemTextView;
}
 
Example 6
Project: SimpleNotes   File: NoteAdapter.java   View Source Code Vote up 5 votes
@SuppressWarnings("deprecation")
private void setTextAppearance(Context context, TextView textView, int resId) {
    if (Build.VERSION.SDK_INT < 23) {
        textView.setTextAppearance(context, resId);
    }
    else {
        textView.setTextAppearance(resId);
    }
}
 
Example 7
Project: MyCalendar   File: MainActivity.java   View Source Code Vote up 5 votes
private TextView createTextView(Context context, String s, int minHeight, int marginTop, int marginBottom, int marginLeftRight) {
    TextView tv = new TextView(context);
    LinearLayout.LayoutParams params =
            new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.setMargins(marginLeftRight, marginTop, marginLeftRight, marginBottom);
    tv.setLayoutParams(params);
    tv.setText(s);
    tv.setGravity(Gravity.CENTER);
    tv.setMinHeight(minHeight);
    tv.setTextAppearance(mContext, R.style.TextAppearance_AppCompat_Caption);
    return tv;

}
 
Example 8
Project: UiLib   File: EasySwitcher.java   View Source Code Vote up 5 votes
private View getItemView(int position){
    TextView textView = new TextView(mContext);
    textView.setTextAppearance(mContext, R.style.switcher_item_text_style);
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
            DensityUtil.dip2px(mContext, 35));
    textView.setLayoutParams(layoutParams);
    textView.setSelected(position == mDefaultSelection);
    textView.setGravity(Gravity.CENTER);
    textView.setText(mAllItemArray.get(position));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12.0f);
    textView.setOnClickListener(mItemOnClickListener);
    textView.setTag(position);
    return textView;
}
 
Example 9
Project: B4A_ViewsEx   File: FloatLabeledEditText.java   View Source Code Vote up 5 votes
private void setAttributes(AttributeSet attrs) {
    mHintTextView = new TextView(mContext);


    final int padding =  0;
    final int defaultPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, DEFAULT_PADDING_LEFT, getResources().getDisplayMetrics());
    final int paddingLeft = defaultPadding;
    final int paddingTop =  0;
    final int paddingRight = 0;
    final int paddingBottom =  0;
    Drawable background = null;

    if (padding != 0) {
        mHintTextView.setPadding(padding, padding, padding, padding);
    } else {
        mHintTextView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
    }

    if (background != null) {
        setHintBackground(background);
    }

    mHintTextView.setTextAppearance(mContext,  android.R.style.TextAppearance_Small);

    //Start hidden
    mHintTextView.setVisibility(INVISIBLE);

    addView(mHintTextView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
}
 
Example 10
Project: Guanajoven   File: ExtendedCalendarView.java   View Source Code Vote up 5 votes
private void init(){
	cal = Calendar.getInstance();
	base = new RelativeLayout(context);
	base.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
	base.setMinimumHeight(50);
	
	base.setId(4);
	
	LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
	params.leftMargin = 16;
	params.topMargin = 50;
	params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
	params.addRule(RelativeLayout.CENTER_VERTICAL);
	prev = new ImageView(context);
	prev.setId(1);
	prev.setLayoutParams(params);
	prev.setImageResource(R.drawable.navigation_previous_item);
	prev.setOnClickListener(this);
	base.addView(prev);
	
	params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
	params.addRule(RelativeLayout.CENTER_HORIZONTAL);
	params.addRule(RelativeLayout.CENTER_VERTICAL);
	month = new TextView(context);
	month.setId(2);
	month.setLayoutParams(params);
	month.setTextAppearance(context, android.R.attr.textAppearanceLarge);
	month.setText(cal.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault())+" "+cal.get(Calendar.YEAR));
	month.setTextSize(25);
	
	base.addView(month);
	
	params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
	params.rightMargin = 16;
	params.topMargin = 50;
	params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	params.addRule(RelativeLayout.CENTER_VERTICAL);
	next = new ImageView(context);
	next.setImageResource(R.drawable.navigation_next_item);
	next.setLayoutParams(params);
	next.setId(3);
	next.setOnClickListener(this);
	
	base.addView(next);
	
	addView(base);
	
	params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
	params.bottomMargin = 20;
	params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
	params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
	params.addRule(RelativeLayout.BELOW, base.getId());
	
	calendar = new GridView(context);
	calendar.setLayoutParams(params);
	calendar.setVerticalSpacing(4);
	calendar.setHorizontalSpacing(4);
	calendar.setNumColumns(7);
	calendar.setChoiceMode(GridView.CHOICE_MODE_SINGLE);
	calendar.setDrawSelectorOnTop(true);
	calendar.setFocusable(false);

	mAdapter = new CalendarAdapter(context,cal);
	calendar.setAdapter(mAdapter);
	calendar.setOnTouchListener(new OnTouchListener() {
		
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return calendarGesture.onTouchEvent(event);
        }
    });

	addView(calendar);
}
 
Example 11
Project: QiangHongBao   File: MiscUtils.java   View Source Code Vote up 5 votes
/**
 * A convenience method for setting text appearance.
 *
 * @param textView a TextView which textAppearance to modify.
 * @param resId    a style resource for the text appearance.
 */
@SuppressWarnings("deprecation")
protected static void setTextAppearance(TextView textView, int resId) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        textView.setTextAppearance(resId);
    } else {
        textView.setTextAppearance(textView.getContext(), resId);
    }
}
 
Example 12
Project: RecyclerViewPreferences   File: Util.java   View Source Code Vote up 5 votes
public static void setTextAppearance(TextView tv, int textAppearance) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        tv.setTextAppearance(textAppearance);
    } else {
        //noinspection deprecation
        tv.setTextAppearance(tv.getContext(), textAppearance);
    }
}
 
Example 13
Project: buildAPKsApps   File: ItemPropertiesAdapter.java   View Source Code Vote up 4 votes
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
    //Log.v(L.TAG, "ItemPropertiesAdapter.getView() called");
    
    View rv = null;
    
    try
    {
        if(convertView == null)
        {
            rv = View.inflate(context, R.layout.item_entry, null);
        }
        else
        {
            rv = convertView;
        }
        
        ItemDesc it = dataViewer.getItemData().get(position);
        TextView t1 = (TextView)rv.findViewById(R.id.text1);
        t1.setText(it.getLabel());
        t1.setTextAppearance(context, it.isActive()?R.style.ActiveText:R.style.InactiveText);
        if(it.isActive())
        {
            t1.setPaintFlags(t1.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);                
        }
        else
        {
            t1.setPaintFlags(t1.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
        }
        
        ImageSwitcher starSwitch = (ImageSwitcher)rv.findViewById(R.id.StarSwitcher);
        starSwitch.setVisibility(it.isStar()?View.VISIBLE:View.INVISIBLE);
        starSwitch.setDisplayedChild(it.isActive()?0:1);
        
        View sortedMarker = (View)rv.findViewById(R.id.SortedMarker);
        if(it.isSorted())
        {
            sortedMarker.setVisibility(View.INVISIBLE);
        }
        else
        {
            sortedMarker.setVisibility(View.VISIBLE);
        }

    }
    catch(Exception e)
    {
        Log.e(L.TAG, "Error in getView()", e);
    }

    return rv;
}
 
Example 14
Project: boohee_v5.6   File: TextViewCompatDonut.java   View Source Code Vote up 4 votes
static void setTextAppearance(TextView textView, int resId) {
    textView.setTextAppearance(textView.getContext(), resId);
}
 
Example 15
Project: TIIEHenry-Android-SDK   File: TabLayout.java   View Source Code Vote up 4 votes
final void update() {
  final Tab tab = mTab;
  final View custom = tab.getCustomView();
  if (custom != null) {
	final ViewParent customParent = custom.getParent();
	if (customParent != this) {
	  if (customParent != null) {
		((ViewGroup) customParent).removeView(custom);
	  }
	  addView(custom);
	}
	mCustomView = custom;
	if (mTextView != null) {
	  mTextView.setVisibility(GONE);
	}
	if (mIconView != null) {
	  mIconView.setVisibility(GONE);
	  mIconView.setImageDrawable(null);
	}
  } else {
	if (mCustomView != null) {
	  removeView(mCustomView);
	  mCustomView = null;
	}

	final Drawable icon = tab.getIcon();
	final CharSequence text = tab.getText();

	if (icon != null) {
	  if (mIconView == null) {
		ImageView iconView = new ImageView(getContext());
		LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,
										   LayoutParams.WRAP_CONTENT);
		lp.gravity = Gravity.CENTER_VERTICAL;
		iconView.setLayoutParams(lp);
		addView(iconView, 0);
		mIconView = iconView;
	  }
	  mIconView.setImageDrawable(icon);
	  mIconView.setVisibility(VISIBLE);
	} else if (mIconView != null) {
	  mIconView.setVisibility(GONE);
	  mIconView.setImageDrawable(null);
	}

	final boolean hasText = !TextUtils.isEmpty(text);
	if (hasText) {
	  if (mTextView == null) {
		TextView textView = new TextView(getContext());
		textView.setTextAppearance(getContext(), mTabTextAppearance);
		textView.setMaxLines(MAX_TAB_TEXT_LINES);
		textView.setEllipsize(TextUtils.TruncateAt.END);
		textView.setGravity(Gravity.CENTER);
		if (mTabSelectedTextColorSet) {
		  textView.setTextColor(createColorStateList(
								  textView.getCurrentTextColor(), mTabSelectedTextColor));
		}

		addView(textView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		mTextView = textView;
	  }
	  mTextView.setText(text);
	  mTextView.setVisibility(VISIBLE);
	} else if (mTextView != null) {
	  mTextView.setVisibility(GONE);
	  mTextView.setText(null);
	}

	if (mIconView != null) {
	  mIconView.setContentDescription(tab.getContentDescription());
	}

	if (!hasText && !TextUtils.isEmpty(tab.getContentDescription())) {
	  setOnLongClickListener(this);
	} else {
	  setOnLongClickListener(null);
	  setLongClickable(false);
	}
  }
}
 
Example 16
Project: RestaurantApp   File: DeskBasketActivity.java   View Source Code Vote up 4 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.AppThemeStaffLogin);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_desk_basket);

    lvBasket= (ListView) findViewById(R.id.lvBasket);
    lvBasket.setOnItemLongClickListener(this);
    lvBasket.setOnItemClickListener(this);
    productList = new ArrayList<>();

    btnOrderVerify = (FlatButton) findViewById(R.id.btnOrderVerify);
    btnOrderVerify.setOnClickListener(this);

    getSupportActionBar().setDisplayOptions(android.support.v7.app.ActionBar.DISPLAY_SHOW_CUSTOM);
    getSupportActionBar().setCustomView(R.layout.custom_actionbar);
    tvActionBar = (TextView)getSupportActionBar().getCustomView().findViewById(R.id.tvActionBar);
    tvActionBar.setText(getResources().getString(R.string.staffDeskBasketHeader));
    tvActionBar.setTextAppearance(this, android.R.style.TextAppearance_Large);
    tvActionBar.setTextColor(Color.WHITE);

    orderId = getIntent().getIntExtra("orderId",-1);
    status = getIntent().getIntExtra("status",-1);
    url+=orderId;

    if (status == 0){
        btnOrderVerify.setBackgroundColor(getResources().getColor(R.color.status0));
        btnOrderVerify.setText("SİPARİŞ YOK");
        btnOrderVerify.setClickable(false);
    }else if (status == 1){
        btnOrderVerify.setBackgroundColor(getResources().getColor(R.color.status1));
        btnOrderVerify.setText("SİPARİŞİ ONAYLA");
        btnOrderVerify.setClickable(true);
    }else{
        btnOrderVerify.setBackgroundColor(getResources().getColor(R.color.status2));
        btnOrderVerify.setText("SİPARİŞ ONAYLANMIŞ");
        btnOrderVerify.setClickable(false);
    }

    Request request = new Request(this, url, com.android.volley.Request.Method.GET);
    request.requestVolleyDeskList(this);

}
 
Example 17
Project: Quran   File: InlineTranslationView.java   View Source Code Vote up 4 votes
private void addTextForAyah(String[] translations, QuranAyahInfo ayah) {
  LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
      LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
  params.setMargins(leftRightMargin, topBottomMargin, leftRightMargin, topBottomMargin);

  final int suraNumber = ayah.sura;
  final int ayahNumber = ayah.ayah;
  TextView ayahHeader = new TextView(context);
  ayahHeader.setTextColor(Color.WHITE);
  ayahHeader.setTextSize(fontSize);
  ayahHeader.setTypeface(null, Typeface.BOLD);
  ayahHeader.setText(resources.getString(R.string.sura_ayah, suraNumber, ayahNumber));
  linearLayout.addView(ayahHeader, params);

  TextView ayahView = new TextView(context);
  ayahView.setTextAppearance(context, textStyle);
  ayahView.setTextColor(Color.WHITE);
  ayahView.setTextSize(fontSize);

  // translation
  boolean showHeader = translations.length > 1;
  SpannableStringBuilder builder = new SpannableStringBuilder();
  for (int i = 0; i < translations.length; i++) {
    String translationText = ayah.texts.get(i);
    if (!TextUtils.isEmpty(translationText)) {
      if (showHeader) {
        if (i > 0) {
          builder.append("\n\n");
        }
        int start = builder.length();
        builder.append(translations[i]);
        builder.setSpan(new StyleSpan(Typeface.BOLD),
            start, builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        builder.append("\n\n");
      }
      builder.append(translationText);
    }
  }
  ayahView.append(builder);

  params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
  params.setMargins(leftRightMargin, topBottomMargin, leftRightMargin, topBottomMargin);
  ayahView.setTextIsSelectable(true);
  linearLayout.addView(ayahView, params);
}
 
Example 18
Project: HutHelper   File: SyllabusFragment.java   View Source Code Vote up 4 votes
/**
 * 初始化添加课程点击事件
 */
private void initTwentyFourHourViews() {
    initViewParams();
    for (int i = 1; i < 11; i++) {
        for (int j = 1; j <= 8; j++) {
            if (j == 1) {
                addTimeView(i);
            } else if (i % 2 == 0) {
                //i 节数 j  周数
                addDotView(i, j - 1);
                //可以点击的TextView 用来添加课程
                TextView tx = new TextView(context);
                tx.setId((i - 1) * 7 + j);
                //相对布局参数
                RelativeLayout.LayoutParams rp = new RelativeLayout.LayoutParams(aveWidth, gridHeight * 2);
                //设置他们的相对位置
                if (j == 2) {
                    if (i > 1) {
                        rp.addRule(RelativeLayout.BELOW, (i - 3) * 7 + j);
                    }
                } else {
                    //字体样式
                    tx.setTextAppearance(context, R.style.courseTableText);
                    rp.addRule(RelativeLayout.RIGHT_OF, (i - 1) * 7 + j - 1);
                    rp.addRule(RelativeLayout.ALIGN_TOP, (i - 1) * 7 + j - 1);
                    tx.setText("");
                }

                tx.setLayoutParams(rp);
                tx.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        //莫忘了计算点击的时间时 加上开始时间
                        if (curClickView != null) {
                            curClickView.setBackground(null);
                            if (curClickView.getId() == v.getId()) {
                                curClickView = null;
                                Bundle bundle = new Bundle();
                                bundle.putInt("type", SyllabusItemActivity.ADD_COURSE);
                                bundle.putLong("lessonId", -3);
                                //跳转到添加课程界面
                                startActivityForResult(SyllabusItemActivity.class, bundle, Constants.REQUEST);
                                return;
                            }
                        }
                        curClickView = v;
                        //TODO 修改添加课表背景
                        curClickView.setBackground(getResources().getDrawable(R.drawable.add_course_bg));
                        curClickView.setAlpha((float) 0.5);
                    }
                });
                if (courseLayout != null) {
                    courseLayout.addView(tx);
                }
            }
        }
    }
}
 
Example 19
Project: aos-Video   File: BrowserBySFTP.java   View Source Code Vote up 4 votes
@Override
public void handleMessage(Message msg) {
    switch(msg.what){

        case LONG_CONNECTION:
            // Hide content, show message
            mHandler.removeMessages(LONG_CONNECTION);
            if(mArchosGridView!=null && mRootView!=null){
                mArchosGridView.setVisibility(View.GONE);
                View emptyView = mRootView.findViewById(R.id.empty_view);
                if (emptyView instanceof ViewStub) {
                    final ViewStub stub = (ViewStub) emptyView;
                    emptyView = stub.inflate();
                }
                if (emptyView != null) {
                    emptyView.setVisibility(View.VISIBLE);
                    // Update the text of the empty view
                    TextView emptyViewText = (TextView)emptyView.findViewById(R.id.empty_view_text);
                    emptyViewText.setTextAppearance(getActivity(), android.R.style.TextAppearance_Medium);
                    emptyViewText.setText(R.string.connection_abnormally_long);
                    // Check if a button is needed in the empty view
                    Button emptyViewButton = (Button)emptyView.findViewById(R.id.empty_view_button);
                    if (emptyViewButton != null) {
                        emptyViewButton.setVisibility(View.VISIBLE);
                        emptyViewButton.setOnClickListener(new OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                SFTPSession.getInstance().removeSession(mCurrentDirectory);
                                Session.getInstance().removeFTPClient(mCurrentDirectory);
                                if(mListingEngine!=null)
                                    mListingEngine.abort();
                                listFiles(false);
                            }
                        });
                    }
                    emptyViewButton.setText(R.string.connection_reset);
                    View loading = mRootView.findViewById(R.id.loading);
                    if (loading != null){
                        loading.setVisibility(View.VISIBLE);
                    }
                }
            }
            break;
    }
}
 
Example 20
Project: boohee_v5.6   File: TextViewCompatApi23.java   View Source Code Vote up 4 votes
public static void setTextAppearance(@NonNull TextView textView, @StyleRes int resId) {
    textView.setTextAppearance(resId);
}