List of usage examples for android.widget LinearLayout setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.android.together.BaseActivity.java
protected void initMenu() { menu = new SlidingMenu(this);//newgetSlidingMenu menu.setMode(SlidingMenu.LEFT);//from w ww. ja va 2 s .co m menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN); //menu.setShadowDrawable(R.drawable.shadow); //menu.setShadowWidthRes(R.dimen.shadow_width); //menu.setBehindOffsetRes(R.dimen.slidingmenu_offset); menu.setBehindWidth(mScreenWidth / 10 * 7);//SlidingMenu menu.setFadeDegree(0.5f); menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);// menu.setMenu(R.layout.menu_layout);//layout //menu.setSecondaryMenu(R.layout.menu_layout);//layout //menu.setBehindCanvasTransformer(mTransformer); menuItemClickListner = new MyMenuItemClickListner(); LinearLayout layout_item = (LinearLayout) menu.findViewById(R.id.layout_item); for (int i = 0; i < layout_item.getChildCount(); i++) { LinearLayout item = (LinearLayout) layout_item.getChildAt(i); item.setOnClickListener(menuItemClickListner); } }
From source file:de.enlightened.peris.ForumSettingsFragment.java
private void setupThemeButton() { //Theme button final LinearLayout forumSettingTheme = (LinearLayout) this.getActivity() .findViewById(R.id.forum_setting_theme); forumSettingTheme.setOnClickListener(new View.OnClickListener() { @Override/*from w ww . j a v a2s . co m*/ public void onClick(final View v) { final Intent themeIntent = new Intent(getActivity(), ThemeEditor.class); startActivity(themeIntent); } }); }
From source file:io.hypertrack.sendeta.view.Profile.java
private void initUIViews() { // Initialize UI Views before Attaching View Presenter mNameView = (EditText) findViewById(R.id.profile_name); mProfileImageView = (RoundedImageView) findViewById(R.id.profile_image_view); mProfileImageLoader = (ProgressBar) findViewById(R.id.profile_image_loader); register = (Button) findViewById(R.id.profile_register); phoneNumberView = (EditText) findViewById(R.id.register_phone_number); countryCodeTextView = (TextView) findViewById(R.id.register_country_code); countryCodeSpinner = (Spinner) findViewById(R.id.register_country_codes_spinner); LinearLayout countryCodeLayout = (LinearLayout) findViewById(R.id.register_country_code_layout); countryCodeLayout.setOnClickListener(new View.OnClickListener() { @Override/*from w w w.j a v a 2s . c o m*/ public void onClick(View v) { countryCodeSpinner.performClick(); } }); // Initialize UI Action Listeners mNameView.setOnEditorActionListener(mNameEditorActionListener); phoneNumberView.setOnEditorActionListener(mEditorActionListener); mNameView.addTextChangedListener(mTextWatcher); phoneNumberView.addTextChangedListener(mTextWatcher); register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onSignInButtonClicked(); } }); initCountryFlagSpinner(); }
From source file:org.ciasaboark.tacere.activity.fragment.AdvancedSettingsFragment.java
private void drawQuickSilenceWidget() { LinearLayout quicksilenceBox = (LinearLayout) rootView .findViewById(R.id.advanced_settings_quicksilence_box); quicksilenceBox.setOnClickListener(new View.OnClickListener() { @Override/*w w w . j av a 2 s . c om*/ public void onClick(View v) { LayoutInflater inflater = LayoutInflater.from(v.getContext()); View dialogView = inflater.inflate(R.layout.dialog_quicksilent, null); final AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(context, R.style.Dialog)); builder.setTitle(R.string.notification_quicksilence_title); builder.setView(dialogView); final NumberPicker hourP = (NumberPicker) dialogView.findViewById(R.id.hourPicker); final NumberPicker minP = (NumberPicker) dialogView.findViewById(R.id.minutePicker); String[] hours = new String[25]; String[] minutes = new String[59]; for (int i = 0; i < hours.length; i++) { hours[i] = Integer.toString(i); } int i = 0; while (i < minutes.length) { minutes[i] = Integer.toString(++i); } hourP.setMinValue(1); hourP.setMaxValue(hours.length - 1); hourP.setWrapSelectorWheel(false); hourP.setDisplayedValues(hours); hourP.setValue(prefs.getQuickSilenceHours() + 1); minP.setMinValue(1); minP.setMaxValue(minutes.length - 1); minP.setWrapSelectorWheel(false); minP.setDisplayedValues(minutes); minP.setValue(prefs.getQuicksilenceMinutes()); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { prefs.setQuickSilenceHours(hourP.getValue() - 1); prefs.setQuicksilenceMinutes(minP.getValue()); drawQuickSilenceWidget(); } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //do nothing } }); AlertDialog dialog = builder.show(); } }); //the quick silence button TextView quickTV = (TextView) rootView.findViewById(R.id.quickSilenceDescription); String quicksilenceText = getResources() .getString(R.string.advanced_settings_section_interval_quicksilence_duration); String hrs = ""; if (prefs.getQuickSilenceHours() > 0) { hrs = String.valueOf(prefs.getQuickSilenceHours()) + " " + getString(R.string.hours_lower) + " "; } quickTV.setText(String.format(quicksilenceText, hrs, prefs.getQuicksilenceMinutes())); }
From source file:de.enlightened.peris.ForumSettingsFragment.java
private void setupHomeButton(final SharedPreferences appPreferences) { //Home Page button final LinearLayout forumSettingHome = (LinearLayout) getActivity().findViewById(R.id.forum_setting_home); forumSettingHome.setOnClickListener(new View.OnClickListener() { @Override/*from w w w .j a va 2s . com*/ @SuppressWarnings("checkstyle:requirethis") public void onClick(final View v) { final PopupMenu popup = new PopupMenu(getActivity(), v); final MenuInflater inflater = popup.getMenuInflater(); inflater.inflate(R.menu.home_page_selection, popup.getMenu()); popup.setOnMenuItemClickListener(forumHomeSelectedListener); popup.show(); } }); //Home Page Display Text final String currentServerId = this.application.getSession().getServer().serverId; final String keyName = currentServerId + "_home_page"; String valueName = getString(R.string.subforum_id); String displayName = "Forum Index"; valueName = appPreferences.getString(keyName, getString(R.string.subforum_id)); if (valueName.contentEquals(getString(R.string.subforum_id))) { displayName = "Forum Index"; } if (valueName.contentEquals("forum_favs")) { displayName = "Favorites"; } if (valueName.contentEquals("timeline")) { displayName = "Timeline"; } if (valueName.contentEquals("participated")) { displayName = "Participated Topics"; } if (valueName.contentEquals("favs")) { displayName = "Subscribed Topics"; } if (valueName.contentEquals("unread")) { displayName = "Unread Topics"; } final TextView forumSettingHomeCurrent = (TextView) this.getActivity() .findViewById(R.id.forum_setting_home_current); forumSettingHomeCurrent.setText(displayName); }
From source file:com.example.dell.chihuobao.fragment.SettingFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { hashMap = user.getUser();/*from ww w . j a va2s. co m*/ View view = inflater.inflate(R.layout.setting, container, false); restaurant_icon = (ImageView) view.findViewById(R.id.restaurant_icon); tv_restaurant_name = (TextView) view.findViewById(R.id.tv_restaurant_name); tv_owner_phone = (TextView) view.findViewById(R.id.tv_owner_phone); tv_owner_cardnumber = (TextView) view.findViewById(R.id.tv_owner_cardnumber); shopmessage = (TextView) view.findViewById(R.id.shopmessage); if (MyApplication.getUser().getUser().get("name") != null) { tv_restaurant_name.setText(MyApplication.getUser().getUser().get("name").toString()); } if (MyApplication.getUser().getUser().get("phone") != null) { tv_owner_phone.setText(MyApplication.getUser().getUser().get("phone").toString()); } if (MyApplication.getUser().getUser().get("identify") != null) { tv_owner_cardnumber .setText(getDisplayStr(MyApplication.getUser().getUser().get("identify").toString())); } RelativeLayout about_us_layout = (RelativeLayout) view.findViewById(R.id.about_us_layout); about_us_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(getActivity(), FeedBackActivity.class); startActivity(intent); } }); RelativeLayout locationUpdate = (RelativeLayout) view.findViewById(R.id.location); locationUpdate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(getActivity(), LocationActivity.class); startActivity(intent); } }); RelativeLayout app_recommend_layout = (RelativeLayout) view.findViewById(R.id.app_recommend_layout); app_recommend_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(getActivity(), HelpActivity.class); startActivity(intent); } }); RelativeLayout app_password_layout = (RelativeLayout) view.findViewById(R.id.app_password_layout); app_password_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(getActivity(), PhoneVerifyActivity.class); startActivity(intent); } }); TextView settings_logout = (TextView) view.findViewById(R.id.settings_logout); settings_logout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new AlertDialog.Builder(getActivity()).setTitle("??").setMessage("") .setPositiveButton("", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { clearUser(); Intent intent = new Intent(getActivity(), LoginActivity.class); startActivity(intent); getActivity().finish(); } }).setNegativeButton("?", null).show(); } }); LinearLayout restaurant_info_container = (LinearLayout) view.findViewById(R.id.restaurant_info_container); restaurant_info_container.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /*startActivity(new Intent(getActivity(), UserModifyActivity.class));*/ startActivity(new Intent(getActivity(), UserUpdateActivity.class)); } }); if (hashMap.get("shopmessage") != null) { shopmessage.setText(hashMap.get("shopmessage").toString()); } LinearLayout shopmessage_layout = (LinearLayout) view.findViewById(R.id.shopmessage_layout); shopmessage_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final EditText editText = new EditText(getActivity()); editText.setText(hashMap.get("shopmessage").toString()); new AlertDialog.Builder(getActivity()).setTitle("?").setView(editText) .setPositiveButton("", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String text = editText.getText().toString().trim(); shopmessage.setText(text); hashMap.put("shopmessage", text); updateUser(hashMap); } }).setNegativeButton("?", null).show(); } }); Thread thread = new Thread(new Runnable() { @Override public void run() { downloadBitmap(UserModifyActivity.URL + MyApplication.getUser().getUser().get("shopphoto").toString().replaceAll("\\\\", "/")); } } ); thread.start(); /* SettingsItemView settings_connect_manager= (SettingsItemView) view.findViewById(R.id.settings_connect_manager); settings_connect_manager.setOnSettingClickListener(new SettingsItemView.settingClickListener() { @Override public void rightClick() { Toast.makeText(getActivity(), "a", Toast.LENGTH_SHORT).show(); } });*/ return view; }
From source file:com.insthub.O2OMobile.Activity.F9_SettingActivity.java
private void showDialog() { LayoutInflater inflater = LayoutInflater.from(this); View view = inflater.inflate(R.layout.photo_dialog, null); mDialog = new Dialog(this, R.style.dialog); mDialog.setContentView(view);/* www. j ava2s. c om*/ mDialog.setCanceledOnTouchOutside(true); mDialog.show(); LinearLayout requsetCameraLayout = (LinearLayout) view.findViewById(R.id.register_camera); LinearLayout requestPhotoLayout = (LinearLayout) view.findViewById(R.id.register_photo); requsetCameraLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub mDialog.dismiss(); if (mFileDir == null) { mFileDir = new File(O2OMobileAppConst.FILEPATH + "img/"); if (!mFileDir.exists()) { mFileDir.mkdirs(); } } mFileName = O2OMobileAppConst.FILEPATH + "img/" + "temp.jpg"; mFile = new File(mFileName); Uri imageuri = Uri.fromFile(mFile); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageuri); intent.putExtra("return-data", false); startActivityForResult(intent, REQUEST_CAMERA); } }); requestPhotoLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub mDialog.dismiss(); Intent picture = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(picture, REQUEST_PHOTO); } }); }
From source file:de.enlightened.peris.ForumSettingsFragment.java
private void setupSidebarSettings(final SharedPreferences appPreferences) { //Sidebar Setting final LinearLayout forumSettingSidebar = (LinearLayout) getActivity() .findViewById(R.id.forum_setting_sidebar); forumSettingSidebar.setOnClickListener(new View.OnClickListener() { @Override/*from w ww.j a v a 2 s .c o m*/ public void onClick(final View v) { final SharedPreferences appPreferences = getActivity().getSharedPreferences("prefs", 0); boolean currentSidebarSetting = appPreferences.getBoolean("show_sidebar", true); final TextView forumSettingSidebarSetting = (TextView) getActivity() .findViewById(R.id.forum_setting_sidebar_setting); if (currentSidebarSetting) { forumSettingSidebarSetting.setText("Off"); currentSidebarSetting = false; } else { forumSettingSidebarSetting.setText("On"); currentSidebarSetting = true; } final SharedPreferences.Editor editor = appPreferences.edit(); editor.putBoolean("show_sidebar", currentSidebarSetting); editor.commit(); } }); final boolean sidebarSetting = appPreferences.getBoolean("show_sidebar", true); final TextView forumSettingSidebarSetting = (TextView) getActivity() .findViewById(R.id.forum_setting_sidebar_setting); if (sidebarSetting) { forumSettingSidebarSetting.setText("On"); } else { forumSettingSidebarSetting.setText("Off"); } }
From source file:de.enlightened.peris.ForumSettingsFragment.java
private void setupQuickreplySettings(final SharedPreferences appPreferences) { //Quick Reply Setting final LinearLayout forumSettingQuickReply = (LinearLayout) getActivity() .findViewById(R.id.forum_setting_quick_reply); forumSettingQuickReply.setOnClickListener(new View.OnClickListener() { @Override/*w w w . j a v a2s . c o m*/ public void onClick(final View v) { final SharedPreferences appPreferences = getActivity().getSharedPreferences("prefs", 0); boolean quickReplySetting = appPreferences.getBoolean("show_quick_reply", true); final TextView forumSettingQuickReplySetting = (TextView) getActivity() .findViewById(R.id.forum_setting_quick_reply_setting); if (quickReplySetting) { forumSettingQuickReplySetting.setText("Off"); quickReplySetting = false; } else { forumSettingQuickReplySetting.setText("On"); quickReplySetting = true; } final SharedPreferences.Editor editor = appPreferences.edit(); editor.putBoolean("show_quick_reply", quickReplySetting); editor.commit(); } }); final boolean quickReplySetting = appPreferences.getBoolean("show_quick_reply", true); final TextView forumSettingQuickReplySetting = (TextView) getActivity() .findViewById(R.id.forum_setting_quick_reply_setting); if (quickReplySetting) { forumSettingQuickReplySetting.setText("On"); } else { forumSettingQuickReplySetting.setText("Off"); } }
From source file:jp.co.tweetmap.MainActivity.java
/** * Setup drawer toggle./* ww w .j a v a 2 s.c o m*/ */ private void initDrawer() { mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawer, R.string.drawer_open, R.string.drawer_close) { @Override public void onDrawerClosed(View drawerView) { } @Override public void onDrawerOpened(View drawerView) { } @Override public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, slideOffset); } @Override public void onDrawerStateChanged(int newState) { } }; mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawer.setDrawerListener(mDrawerToggle); // Set OnClickListener to the DrawerHeader LinearLayout drawerHeader = (LinearLayout) findViewById(R.id.drawer_header); drawerHeader.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (LogUtil.isDebug()) Log.e(TAG, "### onClick() drawer_header ###"); Intent intent = new Intent(getApplicationContext(), TwitterOAuthActivity.class); startActivity(intent); } }); ActionBar bar = getSupportActionBar(); if (null != bar) { bar.setDisplayHomeAsUpEnabled(true); bar.setDisplayShowHomeEnabled(true); } mDrawerToggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.main_drawer_view); navigationView.setNavigationItemSelectedListener(this); }