List of usage examples for android.widget RelativeLayout setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.odoo.core.utils.OAppBarUtils.java
public static void bindShopMenu(final AppCompatActivity activity, int[] hideMenuIds, Menu menu) { final ShopCart shopCart = new ShopCart(activity); MenuItem cart = menu.findItem(R.id.menu_show_cart); for (int menuId : hideMenuIds) { Log.v("", "Hiding menu " + menu.findItem(menuId).getTitle()); menu.findItem(menuId).setVisible(false); }/*w w w. jav a2 s. co m*/ // menu.findItem(R.id.menu_search_product).setVisible(!isHome); // Binding cart and its badge final RelativeLayout cartBadge = (RelativeLayout) cart.getActionView(); int counter = shopCart.counter(); setCounter(counter, cartBadge); cart.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { OAppBarUtils.onShopMenuItemClick(activity, null, item); return true; } }); cartBadge.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { OFragmentUtils.get(activity, null).startFragment(new CartFragment(), true, null); } }); }
From source file:com.hp.mss.printsdksample.fragment.TabFragmentPrintHelp.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View inflatedView = inflater.inflate(R.layout.tab_fragment_print_help, container, false); RelativeLayout printPluginManager = (RelativeLayout) inflatedView.findViewById(R.id.print_plugin_manager); printPluginManager.setOnClickListener(new View.OnClickListener() { @Override/* ww w . j a v a 2 s. c o m*/ public void onClick(View v) { pluginStatusButtonClicked(v); } }); RelativeLayout printHelpMenu = (RelativeLayout) inflatedView.findViewById(R.id.print_help_menu); printHelpMenu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { printHelpClicked(v); } }); return inflatedView; }
From source file:kz.qobyzbook.I_Settings.FragmentSettings.java
private void setupInitialViews(View rootview) { // sharedPreferences = getActivity().getSharedPreferences("VALUES", Context.MODE_PRIVATE); // editor = sharedPreferences.edit(); // ((RelativeLayout) rootview.findViewById(kz.qobyzbook.R.id.relativeLayoutChooseTheme)).setOnClickListener(this); RelativeLayout rl_language = (RelativeLayout) rootview.findViewById(R.id.language); rl_language.setOnClickListener(this); }
From source file:com.slensky.focussis.fragments.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_about, container, false); // ImageView logo = (ImageView) view.findViewById(R.id.image_logo); // ConstraintLayout.LayoutParams lp = (ConstraintLayout.LayoutParams) logo.getLayoutParams(); // lp.setMargins(lp.leftMargin, ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getHeight() / 10, lp.rightMargin, lp.bottomMargin); // logo.setLayoutParams(lp); TextView version = (TextView) view.findViewById(R.id.text_version); version.setText("Version " + this.version); //TextView copyright = (TextView) view.findViewById(R.id.text_copyright); //copyright.setText(String.format(getString(R.string.copyright), Calendar.getInstance().get(Calendar.YEAR))); //TextView license = (TextView) view.findViewById(R.id.text_license); ImageView mailIcon = (ImageView) view.findViewById(R.id.email_icon); mailIcon.setColorFilter(Color.argb(132, 0, 0, 0), PorterDuff.Mode.MULTIPLY); ImageView githubIcon = (ImageView) view.findViewById(R.id.github_icon); githubIcon.setColorFilter(Color.argb(132, 0, 0, 0), PorterDuff.Mode.MULTIPLY); ImageView licenseIcon = (ImageView) view.findViewById(R.id.version_icon); licenseIcon.setColorFilter(Color.argb(132, 0, 0, 0), PorterDuff.Mode.MULTIPLY); /*license.setOnClickListener(new View.OnClickListener() { @Override//from ww w . j av a2s . c o m public void onClick(View v) { Uri uri = Uri.parseRequirements(getString(R.string.about_license_link)); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } });*/ RelativeLayout emailLayout = (RelativeLayout) view.findViewById(R.id.email_layout); emailLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", getString(R.string.about_email), null)); startActivity(Intent.createChooser(intent, "Send Email")); } }); RelativeLayout githubLayout = (RelativeLayout) view.findViewById(R.id.github_layout); githubLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri uri = Uri.parse(getString(R.string.about_github_link)); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } }); return view; }
From source file:fm.krui.kruifm.StationSelectionFragment.java
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Determine if welcome window should be displayed or hidden final PreferenceManager pm = new PreferenceManager(getActivity()); // If preference key indicates user has hidden the welcome window, do not display it. if (!pm.getWelcomePreference()) { setWelcomeMessage(false);//from w w w . j a va2 s .co m } else { // If we are displaying the welcome message, we must build a listener for the "hide" button setWelcomeMessage(true); Button hideButton = (Button) rootView.findViewById(R.id.hide_welcome_message_button); hideButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // When hide button is clicked, hide the window and set pref key to never display again. pm.setWelcomePreference(false); setWelcomeMessage(false); rootView.invalidate(); } }); } // Assign button listeners RelativeLayout mainStudio = (RelativeLayout) rootView.findViewById(R.id.main_studio_stream_button); mainStudio.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Start streaming 89.7 Intent intent = new Intent(getActivity(), StreamActivity.class); intent.putExtra(StreamActivity.KEY_STATION_TAG, StreamActivity.MAIN_STUDIO); startActivity(intent); } }); RelativeLayout labButton = (RelativeLayout) rootView.findViewById(R.id.the_lab_stream_button); labButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Start streaming The Lab Intent intent = new Intent(getActivity(), StreamActivity.class); intent.putExtra(StreamActivity.KEY_STATION_TAG, StreamActivity.THE_LAB); startActivity(intent); } }); }
From source file:org.ciasaboark.tacere.activity.SettingsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); prefs = new Prefs(this); if (savedInstanceState == null) { context = this; // Show the Up button in the action bar. setupActionBar();//from w w w . jav a2 s . c om RelativeLayout serviceToggleBox = (RelativeLayout) findViewById(id.settings_serviceBox); serviceToggleBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onClickToggleService(view); } }); drawAllWidgets(); } }
From source file:com.frostwire.android.gui.activities.internal.NavigationMenu.java
private AdMenuItemView initAdMenuItemListener(final Activity activity) { AdMenuItemView adMenuItemView = activity.findViewById(R.id.slidermenu_ad_menuitem); RelativeLayout menuAd = activity.findViewById(R.id.view_ad_menu_item_ad); menuAd.setOnClickListener(v -> { Intent intent = new Intent(activity, BuyActivity.class); activity.startActivity(intent);/*from w ww .j a va2 s .com*/ }); return adMenuItemView; }
From source file:org.ciasaboark.tacere.activity.fragment.MainSettingsFragment.java
private void drawAlarmWidgets() { RelativeLayout alarmBox = (RelativeLayout) rootView.findViewById(R.id.settings_alarmBox); alarmBox.setOnClickListener(new View.OnClickListener() { @Override/*from w ww .j a v a 2 s . c o m*/ public void onClick(View v) { prefs.setAlarmVolumeShouldSilence(!prefs.shouldAlarmVolumeBeSilenced()); drawAlarmWidgets(); } }); //the alarm volumes toggle SwitchCompat alarmSwitch = (SwitchCompat) rootView.findViewById(R.id.adjustAlarmCheckBox); alarmSwitch.setChecked(prefs.shouldAlarmVolumeBeSilenced()); }
From source file:org.montanafoodhub.app.producer.ProducerDetailFragment.java
private void loadCertifications(View view) { LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.certificationLayout); linearLayout.removeAllViews();/* w ww . j av a2 s . c o m*/ ImageCache imageCache = ((HubApplication) getActivity().getApplication()).getImageCache(); for (Certification cert : _producer.getCertifications()) { RelativeLayout relativeLayout = (RelativeLayout) LayoutInflater.from(getActivity()) .inflate(R.layout.certification, null); relativeLayout.setOnClickListener(this); relativeLayout.setTag(cert); ImageView imageView = (ImageView) relativeLayout.findViewById(R.id.certificationImageview); imageCache.loadImage(imageView, cert.getIconUrl(), R.drawable.default_certification); TextView textView = (TextView) relativeLayout.findViewById(R.id.certificationText); textView.setText(cert.getDisplayName()); linearLayout.addView(relativeLayout); } }
From source file:com.cypress.cysmart.GATTDBFragments.GattServicesFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_gatt_list, container, false); mApplication = (CySmartApplication) getActivity().getApplication(); mGattListView = (ListView) rootView.findViewById(R.id.ListView_gatt_services); mBackButton = (ImageView) rootView.findViewById(R.id.imgback); mBackButton.setVisibility(View.GONE); RelativeLayout parent = (RelativeLayout) rootView.findViewById(R.id.parent); parent.setOnClickListener(new OnClickListener() { @Override/* w w w. j a v a 2 s .c o m*/ public void onClick(View v) { } }); // Getting the service data from the application mGattServiceData = mApplication.getGattServiceMasterData(); // Preparing list data mModifiedServiceData = new ArrayList<HashMap<String, BluetoothGattService>>(); for (int i = 0; i < mGattServiceData.size(); i++) { if (!(mGattServiceData.get(i).get("UUID").getUuid().toString() .equalsIgnoreCase(GattAttributes.GENERIC_ATTRIBUTE_SERVICE) || mGattServiceData.get(i).get("UUID").getUuid().toString() .equalsIgnoreCase(GattAttributes.GENERIC_ACCESS_SERVICE))) { mModifiedServiceData.add(mGattServiceData.get(i)); } } // Setting adapter GattServiceListAdapter adapter = new GattServiceListAdapter(getActivity(), mModifiedServiceData); mGattListView.setAdapter(adapter); // List listener mGattListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) { mService = mModifiedServiceData.get(pos).get("UUID"); mGattCharacteristics = mService.getCharacteristics(); String selected_service_name = GattAttributes.lookup(mService.getUuid().toString(), getResources().getString(R.string.profile_control_unknown_service)); mApplication.setGattCharacteristics(mGattCharacteristics); // Passing service details to GattCharacteristicsFragment and // adding that fragment to the current view Bundle bundle = new Bundle(); bundle.putString(Constants.GATTDB_SELECTED_SERVICE, selected_service_name); FragmentManager fragmentManager = getFragmentManager(); GattCharacteristicsFragment gattcharacteristicsfragment = new GattCharacteristicsFragment() .create(); gattcharacteristicsfragment.setArguments(bundle); fragmentManager.beginTransaction().add(R.id.container, gattcharacteristicsfragment) .addToBackStack(null).commit(); } }); setHasOptionsMenu(true); return rootView; }