use of android.support.v7.widget.AppCompatTextView in project AndroidDevelop by 7449.
the class SingletonActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_singleton);
AppCompatTextView tv1 = (AppCompatTextView) findViewById(R.id.test1);
AppCompatTextView tv2 = (AppCompatTextView) findViewById(R.id.test2);
SingletonComponent build = DaggerSingletonComponent.builder().build();
build.register(this);
tv1.setText(test1.toString());
tv2.setText(test2.toString());
}
use of android.support.v7.widget.AppCompatTextView in project AndroidDevelop by 7449.
the class FilterAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RVHolder holder, @SuppressLint("RecyclerView") final int position) {
if (list == null) {
return;
}
final FilterBean filterBean = list.get(position);
switch(getItemViewType(position)) {
case TYPE_ITEM:
AppCompatTextView tv = holder.get(R.id.filter_tv_content);
tv.setText(filterBean.content);
tv.setSelected(TextUtils.equals(list.get(position).content, map.get(filterBean.titleType)));
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!v.isSelected()) {
map.put(filterBean.titleType, filterBean.content);
}
notifyDataSetChanged();
}
});
break;
case TYPE_TITLE:
holder.setTextView(R.id.filter_tv_title, filterBean.titleType);
break;
default:
break;
}
}
use of android.support.v7.widget.AppCompatTextView in project AndroidDevelop by 7449.
the class CheckAdapter method onBind.
@Override
protected void onBind(ViewHolder holder, int position, AppModel appModel) {
boolean isShowApp = AppUtils.isEquals(appModel.getPkgName());
AppCompatCheckBox checkBox = holder.getAppCompatCheckBox(R.id.check_cb_check);
AppCompatTextView textView = holder.getAppCompatTextView(R.id.check_tv_app_name);
textView.setText(appModel.getAppLabel());
TextDrawableUtils.setAppDrawable(textView, appModel.getAppIcon());
textView.setScaleX(isShowCheckBox ? 0.9f : 1);
textView.setScaleY(isShowCheckBox ? 0.9f : 1);
checkBox.setChecked(booleanArray.get(position));
checkBox.setVisibility(isShowCheckBox && !isShowApp ? View.VISIBLE : View.GONE);
holder.setBackgroundColor(holder.itemView, AppUtils.getColor(!isShowApp));
}
use of android.support.v7.widget.AppCompatTextView in project Rashr by DsLNeXuS.
the class FlashAsFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View fragment = inflater.inflate(R.layout.fragment_flash_as, container, false);
AppCompatTextView tvFlashAs = fragment.findViewById(R.id.tvFlashAs);
tvFlashAs.setText(String.format(getString(R.string.flash_as).replace("%", "%%"), mImg.getName()));
mOptAsRecovery = fragment.findViewById(R.id.optAsRecovery);
mOptAsKernel = fragment.findViewById(R.id.optAsKernel);
mButFlashAs = fragment.findViewById(R.id.bFlashAs);
final AppCompatButton ButCancel = fragment.findViewById(R.id.bCancel);
ButCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mActivity.finish();
}
});
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
if (view.getTag().toString().equals("recovery")) {
mOptAsKernel.setChecked(false);
} else {
mOptAsRecovery.setChecked(false);
}
mButFlashAs.setEnabled(true);
}
};
mButFlashAs.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mImg.exists()) {
int job = mOptAsRecovery.isChecked() ? FlashUtil.JOB_FLASH_RECOVERY : FlashUtil.JOB_FLASH_KERNEL;
final FlashUtil flashUtil = new FlashUtil(mActivity, mImg, job);
flashUtil.setOnFlashListener(new FlashUtil.OnFlashListener() {
@Override
public void onSuccess() {
flashUtil.showRebootDialog();
}
@Override
public void onFail(Exception e) {
App.ERRORS.add(e.toString());
AlertDialog.Builder d = new AlertDialog.Builder(mContext);
d.setTitle(R.string.flash_error);
d.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
if (e instanceof FlashUtil.ImageNotValidException) {
d.setMessage(getString(R.string.image_not_valid_message));
d.setNeutralButton(R.string.settings, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mActivity.switchTo(new SettingsFragment());
}
});
} else if (e instanceof FlashUtil.ImageToBigException) {
FlashUtil.ImageToBigException exception = (FlashUtil.ImageToBigException) e;
// Size in MB
int sizeOfImage = exception.getCustomSize() / (1024 * 1024);
int sizeOfPart = exception.getPartitionSize() / (1024 * 1024);
d.setMessage(String.format(getString(R.string.image_to_big_message), sizeOfImage, sizeOfPart));
d.setNeutralButton(R.string.settings, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mActivity.switchTo(new SettingsFragment());
}
});
} else {
d.setMessage(e.getMessage());
}
d.show();
}
});
flashUtil.execute();
} else {
mActivity.finish();
}
}
});
mOptAsRecovery.setOnClickListener(listener);
mOptAsKernel.setOnClickListener(listener);
ViewGroup parent;
if (!App.Device.isRecoverySupported()) {
if ((parent = (ViewGroup) mOptAsRecovery.getParent()) != null) {
parent.removeView(mOptAsRecovery);
mOptAsKernel.setChecked(true);
}
}
if (!App.Device.isKernelSupported()) {
if ((parent = (ViewGroup) mOptAsKernel.getParent()) != null) {
parent.removeView(mOptAsKernel);
}
}
return fragment;
}
use of android.support.v7.widget.AppCompatTextView in project material-components-android by material-components.
the class CoordinatorSnackbarWithFabTest method testBehaviorBasedSlidingFromClassAnnotation.
@Test
public void testBehaviorBasedSlidingFromClassAnnotation() {
// Use a layout in which a custom child view has Behavior object configured via
// annotation on the class that extends AppCompatTextView
onView(withId(R.id.coordinator_stub)).perform(inflateViewStub(R.layout.design_snackbar_behavior_annotation));
// Create and show a snackbar
mSnackbar = Snackbar.make(mCoordinatorLayout, MESSAGE_TEXT, Snackbar.LENGTH_INDEFINITE).setAction(ACTION_TEXT, mock(View.OnClickListener.class));
SnackbarUtils.showTransientBottomBarAndWaitUntilFullyShown(mSnackbar);
final AppCompatTextView textView = (AppCompatTextView) mCoordinatorLayout.findViewById(R.id.text);
verifySnackbarViewStacking(textView, 0);
}
Aggregations