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 Rashr by DsLNeXuS.
the class RashrActivity method onRequestPermissionsResult.
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
// If request is cancelled, the result arrays are empty.
if (// 2 Permissions, Internet and Write storage
grantResults.length == 2 && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) {
final TextView tvLoading = findViewById(R.id.tvLoading);
final Thread StartThread = new Thread(new Runnable() {
@Override
public void run() {
/* Creating needed folder and unpacking files */
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
tvLoading.setText(R.string.loading_data);
}
});
if (App.PathToTmp.exists()) {
Common.deleteFolder(App.PathToTmp, true);
}
for (File i : Folder) {
if (!i.exists()) {
if (!i.mkdirs()) {
App.ERRORS.add(App.TAG + " " + i + " can't be created!");
}
}
}
if (!extractFiles()) {
App.ERRORS.add("Failed to extract files.");
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(mContext, R.string.failed_unpack_files, Toast.LENGTH_LONG).show();
}
});
}
try {
File LogCopy = new File(App.FilesDir, App.LastLog.getName() + ".txt");
App.Shell.execCommand(App.Busybox + " chmod 777 " + App.LastLog);
if (LogCopy.exists())
LogCopy.delete();
App.Shell.execCommand(App.Busybox + " cp " + App.LastLog + " " + LogCopy);
App.Shell.execCommand(App.Busybox + " chmod 777 " + LogCopy);
ApplicationInfo info = getApplicationInfo();
App.Shell.execCommand(App.Busybox + " chown " + info.uid + ":" + info.uid + " " + LogCopy);
App.Shell.execCommand(App.Busybox + " chmod 777 " + LogCopy);
LastLogExists = LogCopy.exists();
} catch (FailedExecuteCommand e) {
App.ERRORS.add(App.TAG + " LastLog not found: " + e);
}
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
checkAppUpdates();
tvLoading.setText(R.string.reading_device);
}
});
if (!App.Device.isSetup()) {
App.Device.setup();
}
/* If device is not supported, you can report it now or close the App */
if ((!App.Device.isRecoverySupported() && !App.Device.isKernelSupported()) && !BuildConfig.DEBUG) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
showDeviceNotSupportedDialog();
}
});
} else {
/* App is first time started so show usage warning */
if (App.Preferences.getBoolean(App.PREF_KEY_FIRST_RUN, true)) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (App.Device.isRecoverySupported() || App.Device.isKernelSupported()) {
// Show only if we can flash
showUsageWarning();
}
}
});
}
}
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
mRoot = (DrawerLayout) View.inflate(mContext, R.layout.activity_rashr, null);
setContentView(mRoot);
ButterKnife.bind(mActivity);
mRoot.startAnimation(AnimationUtils.loadAnimation(mContext, R.anim.abc_fade_in));
mToolbar = findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(mActivity, mRoot, mToolbar, R.string.app_name, R.string.app_name);
// Coloring drawertoggle
DrawerArrowDrawable coloredArrow = new DrawerArrowDrawable(mContext);
TypedValue typedValue = new TypedValue();
Resources.Theme theme = getTheme();
theme.resolveAttribute(R.attr.colorAccent, typedValue, true);
coloredArrow.setColor(typedValue.data);
toggle.setDrawerArrowDrawable(coloredArrow);
mRoot.addDrawerListener(toggle);
toggle.syncState();
mNavigationView.setNavigationItemSelectedListener(mActivity);
if (mAds != null) {
if (App.Preferences.getBoolean(App.PREF_KEY_ADS, true)) {
mAds.loadAd(new AdRequest.Builder().addTestDevice("BB1FFBF880370A581E6665C69C97D711").build());
} else {
mAds.setVisibility(View.GONE);
mRoot.removeView(mAds);
}
}
if (getIntent().getAction().equals(Intent.ACTION_VIEW)) {
/* Rashr is opened by other app to flash supported files (.zip) or (.img) */
File file = new File(getIntent().getData().getPath());
if (file.exists()) {
if (file.toString().endsWith(Device.EXT_ZIP)) {
/* If it is a zip file open the ScriptManager */
switchTo(ScriptManagerFragment.newInstance(file));
} else if (file.toString().endsWith(Device.EXT_IMG)) {
/* If it is a img file open FlashAs to choose mode (recovery or kernel) */
switchTo(FlashAsFragment.newInstance(mActivity, file));
}
}
} else {
onNavigationItemSelected(mNavigationView.getMenu().getItem(0));
}
} catch (NullPointerException e) {
setContentView(R.layout.err_layout);
App.ERRORS.add("Error while inflating layout:" + e);
AppCompatTextView tv = findViewById(R.id.tvErr);
try {
if (tv != null) {
tv.setText(R.string.failed_setup_layout);
}
} catch (RuntimeException ex) {
App.ERRORS.add(App.TAG + " " + e);
ReportDialog dialog = new ReportDialog(mActivity, e.toString());
dialog.show();
ex.printStackTrace();
}
ReportDialog dialog = new ReportDialog(mActivity, e.toString());
dialog.show();
e.printStackTrace();
}
}
});
}
});
StartThread.start();
} else {
// Permission not garanted
setContentView(R.layout.err_layout);
AppCompatTextView tverr = findViewById(R.id.tvErr);
tverr.setText(R.string.permissions_denied);
}
}
use of android.support.v7.widget.AppCompatTextView in project MaterialFBook by ZeeRooo.
the class CookingAToast method cooking.
@CheckResult
public static Toast cooking(Context context, CharSequence message_to_show, int text_color, int background, int icon_toast, boolean duration) {
View view = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.cooking_a_toast, null);
view.setBackgroundColor(background);
AppCompatImageView icon = (AppCompatImageView) view.findViewById(R.id.icon);
icon.setImageResource(icon_toast);
AppCompatTextView message = (AppCompatTextView) view.findViewById(R.id.message);
message.setText(message_to_show);
message.setTextColor(text_color);
Toast toast = new Toast(context);
toast.setView(view);
toast.setGravity(Gravity.FILL_HORIZONTAL | Gravity.BOTTOM, 0, 0);
if (duration) {
toast.setDuration(Toast.LENGTH_LONG);
} else {
toast.setDuration(Toast.LENGTH_SHORT);
}
return toast;
}
use of android.support.v7.widget.AppCompatTextView in project Stringlate by LonamiWebs.
the class ActivityUtils method showDialogWithHtmlTextView.
public void showDialogWithHtmlTextView(@StringRes int resTitleId, String text, boolean isHtml, DialogInterface.OnDismissListener dismissedListener) {
AppCompatTextView textView = new AppCompatTextView(_context);
int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, _context.getResources().getDisplayMetrics());
textView.setMovementMethod(new LinkMovementMethod());
textView.setPadding(padding, 0, padding, 0);
textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text);
AlertDialog.Builder dialog = new AlertDialog.Builder(_context).setPositiveButton(android.R.string.ok, null).setOnDismissListener(dismissedListener).setTitle(resTitleId).setView(textView);
dialog.show();
}
use of android.support.v7.widget.AppCompatTextView in project memetastic by gsantner.
the class ActivityUtils method showDialogWithHtmlTextView.
public void showDialogWithHtmlTextView(@StringRes int resTitleId, String text, boolean isHtml, DialogInterface.OnDismissListener dismissedListener) {
AppCompatTextView textView = new AppCompatTextView(_context);
int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, _context.getResources().getDisplayMetrics());
textView.setMovementMethod(new LinkMovementMethod());
textView.setPadding(padding, 0, padding, 0);
textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text);
AlertDialog.Builder dialog = new AlertDialog.Builder(_context).setPositiveButton(android.R.string.ok, null).setOnDismissListener(dismissedListener).setTitle(resTitleId).setView(textView);
dialog.show();
}
Aggregations