setContentView(R.layout.clear_data);
setTitle(R.string.clear_pinned_apps);
- pba = U.findViewById(this, R.id.clear_pba);
+ pba = findViewById(R.id.clear_pba);
pba.setOnCheckedChangeListener(listener);
- hiddenApps = U.findViewById(this, R.id.clear_hidden_apps);
+ hiddenApps = findViewById(R.id.clear_hidden_apps);
hiddenApps.setOnCheckedChangeListener(listener);
- topApps = U.findViewById(this, R.id.clear_top_apps);
+ topApps = findViewById(R.id.clear_top_apps);
topApps.setOnCheckedChangeListener(listener);
- savedWindowSizes = U.findViewById(this, R.id.clear_window_sizes);
+ savedWindowSizes = findViewById(R.id.clear_window_sizes);
if(U.canEnableFreeform())
savedWindowSizes.setOnCheckedChangeListener(listener);
else
savedWindowSizes.setVisibility(View.GONE);
- button = U.findViewById(this, R.id.button);
+ button = findViewById(R.id.button);
button.setText(getResources().getString(R.string.action_close).toUpperCase());
button.setOnClickListener(view -> {
if(pba.isChecked())
setContentView(R.layout.incognito);
- LinearLayout layout = U.findViewById(this, R.id.incognitoLayout);
+ LinearLayout layout = findViewById(R.id.incognitoLayout);
layout.setLayoutParams(new FrameLayout.LayoutParams(display.width, display.height));
LocalBroadcastManager.getInstance(this).registerReceiver(addWidgetReceiver, new IntentFilter("com.farmerbb.taskbar.ADD_WIDGET_REQUESTED"));
setFinishOnTouchOutside(false);
setTitle(R.string.icon_pack);
- progressBar = U.findViewById(this, R.id.progress_bar);
- appList = U.findViewById(this, R.id.list);
+ progressBar = findViewById(R.id.progress_bar);
+ appList = findViewById(R.id.list);
appListGenerator = new AppListGenerator();
appListGenerator.execute();
final IconPack entry = getItem(position);
assert entry != null;
- TextView textView = U.findViewById(convertView, R.id.name);
+ TextView textView = convertView.findViewById(R.id.name);
textView.setText(entry.getName());
PackageManager pm = getPackageManager();
- ImageView imageView = U.findViewById(convertView, R.id.icon);
+ ImageView imageView = convertView.findViewById(R.id.icon);
if(entry.getPackageName().equals(BuildConfig.APPLICATION_ID)) {
imageView.setImageDrawable(null);
}
}
- LinearLayout layout = U.findViewById(convertView, R.id.entry);
+ LinearLayout layout = convertView.findViewById(R.id.entry);
layout.setOnClickListener(view -> {
SharedPreferences pref = U.getSharedPreferences(IconPackActivity.this);
pref.edit().putString("icon_pack", entry.getPackageName()).apply();
setContentView(R.layout.incognito);
- LinearLayout layout = U.findViewById(this, R.id.incognitoLayout);
+ LinearLayout layout = findViewById(R.id.incognitoLayout);
layout.setLayoutParams(new FrameLayout.LayoutParams(display.width, display.height));
if(!MenuHelper.getInstance().isStartMenuOpen() && !powerButtonWarning) finish();
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
}
- theSwitch = U.findViewById(this, R.id.the_switch);
+ theSwitch = findViewById(R.id.the_switch);
if(theSwitch != null) {
final SharedPreferences pref = U.getSharedPreferences(this);
theSwitch.setChecked(pref.getBoolean("taskbar_active", false));
getWindow().setElevation(0);
}
- progressBar = U.findViewById(this, R.id.progress_bar);
+ progressBar = findViewById(R.id.progress_bar);
appListGenerator = new AppListGenerator();
appListGenerator.execute();
} else {
topAppsAdapter = adapters[U.TOP_APPS];
SelectAppPagerAdapter pagerAdapter = new SelectAppPagerAdapter(getSupportFragmentManager());
- ViewPager viewPager = U.findViewById(SelectAppActivity.this, R.id.pager);
+ ViewPager viewPager = findViewById(R.id.pager);
viewPager.setAdapter(pagerAdapter);
- TabLayout tabLayout = U.findViewById(SelectAppActivity.this, R.id.sliding_tabs);
+ TabLayout tabLayout = findViewById(R.id.sliding_tabs);
tabLayout.setupWithViewPager(viewPager);
findViewById(R.id.configure_start_menu_layout).setVisibility(View.VISIBLE);
setContentView(R.layout.incognito);
DisplayInfo display = U.getDisplayInfo(this);
- LinearLayout layout = U.findViewById(this, R.id.incognitoLayout);
+ LinearLayout layout = findViewById(R.id.incognitoLayout);
layout.setLayoutParams(new FrameLayout.LayoutParams(display.width, display.height));
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
final String componentName = entry.getPackageName();
final String componentNameAlt = componentName.contains("/") ? componentName.split("/")[1] : componentName;
- TextView textView = U.findViewById(convertView, R.id.name);
+ TextView textView = convertView.findViewById(R.id.name);
textView.setText(entry.getLabel());
- final CheckBox checkBox = U.findViewById(convertView, R.id.checkbox);
+ final CheckBox checkBox = convertView.findViewById(R.id.checkbox);
checkBox.setChecked(blacklist.isBlocked(componentName) || blacklist.isBlocked(componentNameAlt));
- LinearLayout layout = U.findViewById(convertView, R.id.entry);
+ LinearLayout layout = convertView.findViewById(R.id.entry);
layout.setOnClickListener(view -> {
if(topApps.isTopApp(componentName) || topApps.isTopApp(componentNameAlt)) {
U.showToast(getContext(),
final String componentName = entry.getPackageName();
final String componentNameAlt = componentName.contains("/") ? componentName.split("/")[1] : componentName;
- TextView textView = U.findViewById(convertView, R.id.name);
+ TextView textView = convertView.findViewById(R.id.name);
textView.setText(entry.getLabel());
- final CheckBox checkBox = U.findViewById(convertView, R.id.checkbox);
+ final CheckBox checkBox = convertView.findViewById(R.id.checkbox);
checkBox.setChecked(topApps.isTopApp(componentName) || topApps.isTopApp(componentNameAlt));
- LinearLayout layout = U.findViewById(convertView, R.id.entry);
+ LinearLayout layout = convertView.findViewById(R.id.entry);
layout.setOnClickListener(view -> {
if(blacklist.isBlocked(componentName) || blacklist.isBlocked(componentNameAlt)) {
U.showToast(getContext(),
final SharedPreferences pref = U.getSharedPreferences(getContext());
- TextView textView = U.findViewById(convertView, R.id.name);
+ TextView textView = convertView.findViewById(R.id.name);
textView.setText(entry.getLabel());
textView.setTypeface(null, isTopApp(entry) ? Typeface.BOLD : Typeface.NORMAL);
break;
}
- ImageView imageView = U.findViewById(convertView, R.id.icon);
+ ImageView imageView = convertView.findViewById(R.id.icon);
imageView.setImageDrawable(entry.getIcon(getContext()));
- LinearLayout layout = U.findViewById(convertView, R.id.entry);
+ LinearLayout layout = convertView.findViewById(R.id.entry);
layout.setOnClickListener(view -> {
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(new Intent("com.farmerbb.taskbar.HIDE_START_MENU"));
U.launchApp(getContext(), entry.getPackageName(), entry.getComponentName(), entry.getUserId(getContext()), null, false, false);
editText2Id = R.id.fragmentEditText2;
}
- final EditText editText = U.findViewById(dialogLayout, editTextId);
- final EditText editText2 = U.findViewById(dialogLayout, editText2Id);
+ final EditText editText = dialogLayout.findViewById(editTextId);
+ final EditText editText2 = dialogLayout.findViewById(editText2Id);
builder.setView(dialogLayout)
.setTitle(R.string.dashboard_grid_size)
View colorPreview = dialogLayout.findViewById(R.id.color_preview);
colorPreview.setBackgroundColor(Color.argb(alpha, red, green, blue));
- TextView hexPreview = U.findViewById(dialogLayout, R.id.hex_preview);
+ TextView hexPreview = dialogLayout.findViewById(R.id.hex_preview);
hexPreview.setText("#" + String.format("%08x", Color.argb(alpha, red, green, blue)).toUpperCase());
- final TextView alphaValue = U.findViewById(dialogLayout, R.id.alpha_value);
+ final TextView alphaValue = dialogLayout.findViewById(R.id.alpha_value);
alphaValue.setText("0");
- final SeekBar alphaSeekBar = U.findViewById(dialogLayout, R.id.alpha_seekbar);
+ final SeekBar alphaSeekBar = dialogLayout.findViewById(R.id.alpha_seekbar);
alphaSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
alphaSeekBar.setProgress(Color.alpha(color));
- final TextView redValue = U.findViewById(dialogLayout, R.id.red_value);
+ final TextView redValue = dialogLayout.findViewById(R.id.red_value);
redValue.setText("0");
- final SeekBar redSeekBar = U.findViewById(dialogLayout, R.id.red_seekbar);
+ final SeekBar redSeekBar = dialogLayout.findViewById(R.id.red_seekbar);
redSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
redSeekBar.setProgress(Color.red(color));
- final TextView greenValue = U.findViewById(dialogLayout, R.id.green_value);
+ final TextView greenValue = dialogLayout.findViewById(R.id.green_value);
greenValue.setText("0");
- final SeekBar greenSeekBar = U.findViewById(dialogLayout, R.id.green_seekbar);
+ final SeekBar greenSeekBar = dialogLayout.findViewById(R.id.green_seekbar);
greenSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
greenSeekBar.setProgress(Color.green(color));
- final TextView blueValue = U.findViewById(dialogLayout, R.id.blue_value);
+ final TextView blueValue = dialogLayout.findViewById(R.id.blue_value);
blueValue.setText("0");
- final SeekBar blueSeekBar = U.findViewById(dialogLayout, R.id.blue_seekbar);
+ final SeekBar blueSeekBar = dialogLayout.findViewById(R.id.blue_seekbar);
blueSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
String value = pref.getString("max_num_of_recents", "10");
- final TextView textView = U.findViewById(dialogLayout, R.id.seekbar_value);
+ final TextView textView = dialogLayout.findViewById(R.id.seekbar_value);
textView.setText("0");
- final SeekBar seekBar = U.findViewById(dialogLayout, R.id.seekbar);
+ final SeekBar seekBar = dialogLayout.findViewById(R.id.seekbar);
seekBar.setMax(max);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
seekBar.setProgress(Integer.parseInt(value));
- TextView blurb = U.findViewById(dialogLayout, R.id.blurb);
+ TextView blurb = dialogLayout.findViewById(R.id.blurb);
blurb.setText(R.string.num_of_recents_blurb);
builder.setView(dialogLayout)
String value2 = pref.getString("refresh_frequency", "2");
- final TextView textView2 = U.findViewById(dialogLayout2, R.id.seekbar_value);
+ final TextView textView2 = dialogLayout2.findViewById(R.id.seekbar_value);
textView2.setText(R.string.infinity);
- final SeekBar seekBar2 = U.findViewById(dialogLayout2, R.id.seekbar);
+ final SeekBar seekBar2 = dialogLayout2.findViewById(R.id.seekbar);
seekBar2.setMax(max2);
seekBar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
seekBar2.setProgress((int) (Double.parseDouble(value2) * 2));
- TextView blurb2 = U.findViewById(dialogLayout2, R.id.blurb);
+ TextView blurb2 = dialogLayout2.findViewById(R.id.blurb);
blurb2.setText(R.string.refresh_frequency_blurb);
builder2.setView(dialogLayout2)
// Remove dividers
View rootView = getView();
if(rootView != null) {
- ListView list = U.findViewById(rootView, android.R.id.list);
+ ListView list = rootView.findViewById(android.R.id.list);
if(list != null) list.setDivider(null);
}
}
cellLayout.setOnClickListener(cellOcl);
cellLayout.setOnHoverListener(cellOhl);
- TextView empty = U.findViewById(cellLayout, R.id.empty);
+ TextView empty = cellLayout.findViewById(R.id.empty);
empty.setBackgroundColor(accentColorAlt);
empty.setTextColor(accentColor);
cellLayout.setOnGenericMotionListener(ogml);
cellLayout.setOnInterceptedLongPressListener(listener);
- LinearLayout linearLayout = U.findViewById(cellLayout, R.id.dashboard);
+ LinearLayout linearLayout = cellLayout.findViewById(R.id.dashboard);
linearLayout.addView(hostView);
Bundle bundle2 = (Bundle) cellLayout.getTag();
mAppWidgetHost.deleteAppWidgetId(bundle.getInt("appWidgetId"));
bundle.remove("appWidgetId");
- LinearLayout linearLayout = U.findViewById(cellLayout, R.id.dashboard);
+ LinearLayout linearLayout = cellLayout.findViewById(R.id.dashboard);
linearLayout.removeAllViews();
cellLayout.setTag(bundle);
}
private void addPlaceholder(int cellId) {
- FrameLayout placeholder = U.findViewById(cells.get(cellId), R.id.placeholder);
+ FrameLayout placeholder = cells.get(cellId).findViewById(R.id.placeholder);
SharedPreferences pref = U.getSharedPreferences(this);
String providerName = pref.getString("dashboard_widget_" + Integer.toString(cellId) + "_provider", "null");
if(!providerName.equals("null")) {
- ImageView imageView = U.findViewById(placeholder, R.id.placeholder_image);
+ ImageView imageView = placeholder.findViewById(R.id.placeholder_image);
ComponentName componentName = ComponentName.unflattenFromString(providerName);
List<AppWidgetProviderInfo> providerInfoList = mAppWidgetManager.getInstalledProvidersForProfile(Process.myUserHandle());
// Initialize views
layout = (StartMenuLayout) LayoutInflater.from(U.wrapContext(this)).inflate(layoutId, null);
- startMenu = U.findViewById(layout, R.id.start_menu);
+ startMenu = layout.findViewById(R.id.start_menu);
if((shouldShowSearchBox && !hasHardwareKeyboard) || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1)
layout.viewHandlesBackButton();
if(U.visualFeedbackEnabled(this))
startMenu.setRecyclerListener(view -> view.setBackgroundColor(0));
- searchView = U.findViewById(layout, R.id.search);
+ searchView = layout.findViewById(R.id.search);
int backgroundTint = U.getBackgroundTint(this);
- FrameLayout startMenuFrame = U.findViewById(layout, R.id.start_menu_frame);
- FrameLayout searchViewLayout = U.findViewById(layout, R.id.search_view_layout);
+ FrameLayout startMenuFrame = layout.findViewById(R.id.start_menu_frame);
+ FrameLayout searchViewLayout = layout.findViewById(R.id.search_view_layout);
startMenuFrame.setBackgroundColor(backgroundTint);
searchViewLayout.setBackgroundColor(backgroundTint);
if(adapter.getCount() > 0) {
View view = adapter.getView(0, null, startMenu);
- LinearLayout layout = U.findViewById(view, R.id.entry);
+ LinearLayout layout = view.findViewById(R.id.entry);
layout.performClick();
} else {
if(U.shouldCollapse(StartMenuService.this, true))
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
new Handler().postDelayed(() -> {
- EditText editText = U.findViewById(searchView, R.id.search_src_text);
+ EditText editText = searchView.findViewById(R.id.search_src_text);
if(editText != null) {
editText.requestFocus();
editText.setSelection(editText.getText().length());
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
- LinearLayout powerButton = U.findViewById(layout, R.id.power_button);
+ LinearLayout powerButton = layout.findViewById(R.id.power_button);
powerButton.setOnClickListener(view -> {
int[] location = new int[2];
view.getLocationOnScreen(location);
} else
searchViewLayout.setVisibility(View.GONE);
- textView = U.findViewById(layout, R.id.no_apps_found);
+ textView = layout.findViewById(R.id.no_apps_found);
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
boolean altButtonConfig = pref.getBoolean("alt_button_config", false);
layout = (LinearLayout) LayoutInflater.from(U.wrapContext(this)).inflate(layoutId, null);
- taskbar = U.findViewById(layout, R.id.taskbar);
- scrollView = U.findViewById(layout, R.id.taskbar_scrollview);
+ taskbar = layout.findViewById(R.id.taskbar);
+ scrollView = layout.findViewById(R.id.taskbar_scrollview);
int backgroundTint = U.getBackgroundTint(this);
int accentColor = U.getAccentColor(this);
if(altButtonConfig) {
- space = U.findViewById(layout, R.id.space_alt);
+ space = layout.findViewById(R.id.space_alt);
layout.findViewById(R.id.space).setVisibility(View.GONE);
} else {
- space = U.findViewById(layout, R.id.space);
+ space = layout.findViewById(R.id.space);
layout.findViewById(R.id.space_alt).setVisibility(View.GONE);
}
space.setOnClickListener(v -> toggleTaskbar(true));
- startButton = U.findViewById(layout, R.id.start_button);
+ startButton = layout.findViewById(R.id.start_button);
int padding;
if(pref.getBoolean("app_drawer_icon", false)) {
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
if(altButtonConfig) {
- button = U.findViewById(layout, R.id.hide_taskbar_button_alt);
+ button = layout.findViewById(R.id.hide_taskbar_button_alt);
layout.findViewById(R.id.hide_taskbar_button).setVisibility(View.GONE);
} else {
- button = U.findViewById(layout, R.id.hide_taskbar_button);
+ button = layout.findViewById(R.id.hide_taskbar_button);
layout.findViewById(R.id.hide_taskbar_button_alt).setVisibility(View.GONE);
}
updateButton(false);
button.setOnClickListener(v -> toggleTaskbar(true));
- LinearLayout buttonLayout = U.findViewById(layout, altButtonConfig
+ LinearLayout buttonLayout = layout.findViewById(altButtonConfig
? R.id.hide_taskbar_button_layout_alt
: R.id.hide_taskbar_button_layout);
if(buttonLayout != null) buttonLayout.setOnClickListener(v -> toggleTaskbar(true));
- LinearLayout buttonLayoutToHide = U.findViewById(layout, altButtonConfig
+ LinearLayout buttonLayoutToHide = layout.findViewById(altButtonConfig
? R.id.hide_taskbar_button_layout
: R.id.hide_taskbar_button_layout_alt);
if(buttonLayoutToHide != null) buttonLayoutToHide.setVisibility(View.GONE);
- dashboardButton = U.findViewById(layout, R.id.dashboard_button);
- navbarButtons = U.findViewById(layout, R.id.navbar_buttons);
+ dashboardButton = layout.findViewById(R.id.dashboard_button);
+ navbarButtons = layout.findViewById(R.id.navbar_buttons);
dashboardEnabled = pref.getBoolean("dashboard", false);
if(dashboardEnabled) {
if(pref.getBoolean("button_back", false)) {
navbarButtonsEnabled = true;
- ImageView backButton = U.findViewById(layout, R.id.button_back);
+ ImageView backButton = layout.findViewById(R.id.button_back);
backButton.setColorFilter(accentColor);
backButton.setVisibility(View.VISIBLE);
backButton.setOnClickListener(v -> {
if(pref.getBoolean("button_home", false)) {
navbarButtonsEnabled = true;
- ImageView homeButton = U.findViewById(layout, R.id.button_home);
+ ImageView homeButton = layout.findViewById(R.id.button_home);
homeButton.setColorFilter(accentColor);
homeButton.setVisibility(View.VISIBLE);
homeButton.setOnClickListener(v -> {
if(pref.getBoolean("button_recents", false)) {
navbarButtonsEnabled = true;
- ImageView recentsButton = U.findViewById(layout, R.id.button_recents);
+ ImageView recentsButton = layout.findViewById(R.id.button_recents);
recentsButton.setColorFilter(accentColor);
recentsButton.setVisibility(View.VISIBLE);
recentsButton.setOnClickListener(v -> {
if(fullLength && U.getTaskbarPosition(this).contains("bottom")) {
try {
- Space whitespace = U.findViewById(layout, R.id.whitespace);
+ Space whitespace = layout.findViewById(R.id.whitespace);
ViewGroup.LayoutParams params2 = whitespace.getLayoutParams();
params2.height = maxScreenSize - recentsSize;
whitespace.setLayoutParams(params2);
if(fullLength && U.getTaskbarPosition(this).contains("right")) {
try {
- Space whitespace = U.findViewById(layout, R.id.whitespace);
+ Space whitespace = layout.findViewById(R.id.whitespace);
ViewGroup.LayoutParams params2 = whitespace.getLayoutParams();
params2.width = maxScreenSize - recentsSize;
whitespace.setLayoutParams(params2);
final AppEntry entry = list.get(position);
final SharedPreferences pref = U.getSharedPreferences(this);
- ImageView imageView = U.findViewById(convertView, R.id.icon);
- ImageView imageView2 = U.findViewById(convertView, R.id.shortcut_icon);
+ ImageView imageView = convertView.findViewById(R.id.icon);
+ ImageView imageView2 = convertView.findViewById(R.id.shortcut_icon);
imageView.setImageDrawable(entry.getIcon(this));
imageView2.setBackgroundColor(pref.getInt("accent_color", getResources().getInteger(R.integer.translucent_white)));
imageView2.setRotationY(180);
}
- FrameLayout layout = U.findViewById(convertView, R.id.entry);
+ FrameLayout layout = convertView.findViewById(R.id.entry);
layout.setOnClickListener(view -> U.launchApp(this, entry.getPackageName(), entry.getComponentName(), entry.getUserId(this), null, true, false));
layout.setOnLongClickListener(view -> {
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
-import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.AlertDialog;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.Surface;
-import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;
|| (!isChromeOs(context) && getCurrentApiVersion() >= 28.0f));
}
- @SuppressWarnings("unchecked")
- public static <T extends View> T findViewById(Activity target, int id) {
- return (T) target.findViewById(id);
- }
-
- @SuppressWarnings("unchecked")
- public static <T extends View> T findViewById(View target, int id) {
- return (T) target.findViewById(id);
- }
-
public static boolean isPlayStoreInstalled(Context context) {
try {
context.getPackageManager().getPackageInfo("com.android.vending", 0);