use of android.support.v7.widget.AppCompatTextView in project material-components-android by material-components.
the class BottomSheetDialogTest method showDialog.
private void showDialog() {
Context context = activityTestRule.getActivity();
mDialog = new BottomSheetDialog(context);
AppCompatTextView text = new AppCompatTextView(context);
StringBuilder builder = new StringBuilder();
builder.append("It is fine today. ");
text.setText(builder);
mDialog.setContentView(text);
mDialog.show();
}
use of android.support.v7.widget.AppCompatTextView in project CircularReveal by ozodrukh.
the class SpringSettingsBottomDialog method createConfigurationView.
private SeekBar createConfigurationView(CharSequence label, int defaultVal, SeekBar.OnSeekBarChangeListener changeListener) {
final TextView labelView = new AppCompatTextView(getContext(), null, R.style.TextAppearance_AppCompat_Caption);
labelView.setText(label);
labelView.setLayoutParams(createMarginLayoutParams(MATCH_PARENT, WRAP_CONTENT, 0, 0, 0, dp(8)));
final SeekBar seekBar = new SeekBar(getContext());
seekBar.setProgress(defaultVal);
seekBar.setMax(100);
seekBar.setOnSeekBarChangeListener(changeListener);
seekBar.setLayoutParams(createMarginLayoutParams(MATCH_PARENT, WRAP_CONTENT, 0, 0, 0, dp(16)));
addView(labelView);
addView(seekBar);
return seekBar;
}
use of android.support.v7.widget.AppCompatTextView in project qksms by moezbhatti.
the class QKPopupActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
mRes = getResources();
setFinishOnTouchOutside(mPrefs.getBoolean(SettingsFragment.QUICKREPLY_TAP_DISMISS, true));
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
setContentView(getLayoutResource());
((QKLinearLayout) findViewById(R.id.popup)).setBackgroundTint(ThemeManager.getBackgroundColor());
View title = findViewById(R.id.title);
if (title != null && title instanceof AppCompatTextView) {
title.setVisibility(View.GONE);
}
}
use of android.support.v7.widget.AppCompatTextView in project Rashr by DsLNeXuS.
the class BackupRestoreFragment method showPopup.
public void showPopup(final View v) {
PopupMenu popup = new PopupMenu(mActivity, v);
popup.getMenuInflater().inflate(R.menu.bakmgr_menu, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(final MenuItem menuItem) {
final CharSequence text = ((AppCompatTextView) v).getText();
final String FileName = text.toString();
final AppCompatDialog dialog = new AppCompatDialog(mActivity);
dialog.setTitle(R.string.setname);
dialog.setContentView(R.layout.dialog_input);
final AppCompatButton bGo = (AppCompatButton) dialog.findViewById(R.id.bGoBackup);
final AppCompatEditText etFileName = (AppCompatEditText) dialog.findViewById(R.id.etFileName);
if (bGo == null || etFileName == null)
return false;
//If current item is 0 (first item) a recovery backup will be edited or created
final File path = mPager.getCurrentItem() == 0 ? Const.PathToRecoveryBackups : Const.PathToKernelBackups;
try {
switch(menuItem.getItemId()) {
case R.id.iRestore:
File backup = new File(path, FileName);
FlashUtil RestoreUtil = new FlashUtil(mActivity, backup, mPager.getCurrentItem() == 0 ? FlashUtil.JOB_RESTORE_RECOVERY : FlashUtil.JOB_RESTORE_KERNEL);
RestoreUtil.execute();
return true;
case R.id.iRename:
etFileName.setHint(FileName);
bGo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String Name;
if (etFileName.getText() != null && etFileName.isEnabled() && !etFileName.getText().toString().equals("")) {
//User has defined a name for the backup. Use it.
Name = etFileName.getText().toString();
} else {
//Use hint as backup name. Normally the correct version
//and Recovery System (if Rashr could read it out of
//"/cache/recovery/last_log"
Name = String.valueOf(etFileName.getHint());
}
if (!Name.endsWith(RashrApp.DEVICE.getRecoveryExt())) {
//Append extension
Name += RashrApp.DEVICE.getRecoveryExt();
}
File renamedBackup = new File(path, Name);
if (renamedBackup.exists()) {
Toast.makeText(mActivity, R.string.backupalready, Toast.LENGTH_SHORT).show();
// if backup already exists, let the user chose a new name
onMenuItemClick(menuItem);
} else {
File Backup = new File(path, FileName);
if (Backup.renameTo(renamedBackup)) {
mAdapter.reload();
} else {
Toast.makeText(mActivity, R.string.rename_failed, Toast.LENGTH_SHORT).show();
}
}
dialog.dismiss();
}
});
dialog.show();
return true;
case R.id.iDeleteBackup:
backup = new File(path, text.toString());
if (backup.delete()) {
Toast.makeText(mActivity, mContext.getString(R.string.bak_deleted), Toast.LENGTH_SHORT).show();
}
mAdapter.reload();
return true;
default:
return false;
}
} catch (Exception e) {
if (e.getMessage().contains("EINVAL") && text.toString().contains(":")) {
AlertDialog.Builder adialog = new AlertDialog.Builder(mContext);
adialog.setMessage(R.string.check_name);
adialog.setMessage(R.string.ok);
adialog.show();
}
RashrApp.ERRORS.add(Const.RASHR_TAG + " " + e);
return false;
}
}
});
popup.show();
}
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 = (AppCompatTextView) fragment.findViewById(R.id.tvFlashAs);
tvFlashAs.setText(String.format(getString(R.string.flash_as), mImg.getName()));
mOptAsRecovery = (RadioButton) fragment.findViewById(R.id.optAsRecovery);
mOptAsKernel = (RadioButton) fragment.findViewById(R.id.optAsKernel);
mButFlashAs = (AppCompatButton) fragment.findViewById(R.id.bFlashAs);
final AppCompatButton ButCancel = (AppCompatButton) fragment.findViewById(R.id.bCancel);
ButCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!mCloseApp) {
new AlertDialog.Builder(mContext).setTitle(R.string.exit_app).setPositiveButton(R.string.positive, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mActivity.finish();
}
}).setNegativeButton(R.string.negative, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mActivity.switchTo(FlashFragment.newInstance(mActivity));
}
}).setCancelable(false).show();
} else {
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.setOnTaskDoneListener(new FlashUtil.OnTaskDoneListener() {
@Override
public void onSuccess() {
flashUtil.showRebootDialog();
}
@Override
public void onFail(Exception e) {
}
});
flashUtil.execute();
} else {
mActivity.finish();
}
}
});
mOptAsRecovery.setOnClickListener(listener);
mOptAsKernel.setOnClickListener(listener);
ViewGroup parent;
if (!RashrApp.DEVICE.isRecoverySupported()) {
if ((parent = (ViewGroup) mOptAsRecovery.getParent()) != null) {
parent.removeView(mOptAsRecovery);
mOptAsKernel.setChecked(true);
}
}
if (!RashrApp.DEVICE.isKernelSupported()) {
if ((parent = (ViewGroup) mOptAsKernel.getParent()) != null) {
parent.removeView(mOptAsKernel);
}
}
return fragment;
}
Aggregations