List of usage examples for android.widget LinearLayout getVisibility
@ViewDebug.ExportedProperty(mapping = { @ViewDebug.IntToString(from = VISIBLE, to = "VISIBLE"), @ViewDebug.IntToString(from = INVISIBLE, to = "INVISIBLE"), @ViewDebug.IntToString(from = GONE, to = "GONE") }) @Visibility public int getVisibility()
From source file:com.amrutpatil.makeanote.NotesActivity.java
private void edit(View view) { Intent intent = new Intent(NotesActivity.this, NoteDetailActivity.class); String id = ((TextView) view.findViewById(R.id.id_note_custom_home)).getText().toString(); intent.putExtra(AppConstant.ID, id); //If it is a custom note list LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.home_list); int isList = linearLayout.getVisibility(); if (isList == View.VISIBLE) { Intent intent1 = new Intent(NotesActivity.this, NoteCustomList.class); intent1.putExtra(AppConstant.LIST, AppConstant.TRUE); }/* w w w .j a va 2 s.c o m*/ ImageView tempImageView = (ImageView) view.findViewById(R.id.image_note_custom_home); if (tempImageView.getDrawable() != null) { mSendingImage = ((BitmapDrawable) tempImageView.getDrawable()).getBitmap(); } startActivity(intent); }
From source file:com.smc.jobs4smcyouth.Fragments.Print.PrintLayoutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View inflatedView = inflater.inflate(com.smc.jobs4smcyouth.R.layout.fragment_print_layout, container, false);// ww w .j av a 2 s . co m filePickerLayout = (RelativeLayout) inflatedView.findViewById(com.smc.jobs4smcyouth.R.id.filePickerLayout); RadioGroup layoutRadioGroup = (RadioGroup) inflatedView .findViewById(com.smc.jobs4smcyouth.R.id.layoutRadioGroup); layoutRadioGroup.setOnCheckedChangeListener(this); onCheckedChanged(layoutRadioGroup, layoutRadioGroup.getCheckedRadioButtonId()); RadioGroup layoutMarginRadioGroup = (RadioGroup) inflatedView .findViewById(com.smc.jobs4smcyouth.R.id.layoutMarginRadioGroup); layoutMarginRadioGroup.setOnCheckedChangeListener(this); onCheckedChanged(layoutMarginRadioGroup, layoutMarginRadioGroup.getCheckedRadioButtonId()); SwitchCompat metricsSwitch = (SwitchCompat) inflatedView .findViewById(com.smc.jobs4smcyouth.R.id.metricsRadioGroup); metricsSwitch.setOnCheckedChangeListener(this); onCheckedChanged(metricsSwitch, metricsSwitch.isChecked()); RadioGroup contentRadioGroup = (RadioGroup) inflatedView .findViewById(com.smc.jobs4smcyouth.R.id.contentRadioGroup); contentRadioGroup.setOnCheckedChangeListener(this); onCheckedChanged(contentRadioGroup, contentRadioGroup.getCheckedRadioButtonId()); RadioGroup deviceIdRadioGroup = (RadioGroup) inflatedView .findViewById(com.smc.jobs4smcyouth.R.id.deviceIdRadioGroup); deviceIdRadioGroup.setOnCheckedChangeListener(this); onCheckedChanged(deviceIdRadioGroup, deviceIdRadioGroup.getCheckedRadioButtonId()); tagText = (EditText) inflatedView.findViewById(com.smc.jobs4smcyouth.R.id.tagEditText); valueText = (EditText) inflatedView.findViewById(com.smc.jobs4smcyouth.R.id.valueEditText); LinearLayout customData = (LinearLayout) inflatedView.findViewById(com.smc.jobs4smcyouth.R.id.customData); showCustomData = customData.getVisibility() == View.VISIBLE; FloatingActionButton printButton = (FloatingActionButton) inflatedView .findViewById(com.smc.jobs4smcyouth.R.id.printBtn); printButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { continueButtonClicked(v); } }); Button buttonPick = (Button) inflatedView.findViewById(com.smc.jobs4smcyouth.R.id.buttonPick); buttonPick.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType(getContentMimeType()); startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICKFILE_RESULT_CODE); } }); mediaSize5x7 = new PrintAttributes.MediaSize("na_5x7_5x7in", "5 x 7", 5000, 7000); return inflatedView; }
From source file:com.amrutpatil.makeanote.NotesActivity.java
private void moveToArchive(View view, int position) { ContentValues contentValues = new ContentValues(); TextView title = (TextView) findViewById(R.id.title_note_custom_home); TextView description = (TextView) findViewById(R.id.description_note_custom_home); TextView dateTime = (TextView) findViewById(R.id.date_time_note_custom_home); LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.home_list); int isList = linearLayout.getVisibility(); String listDescription = ""; if (isList == View.VISIBLE) { //If a note contains list of items NoteCustomList noteCustomList = (NoteCustomList) linearLayout.getChildAt(0); listDescription = noteCustomList.getLists(); // for(int i = 0 ; i < noteCustomList.getChildCount(); i++){ // LinearLayout first = (LinearLayout) linearLayout.getChildAt(i); // CheckBox checkBox = (CheckBox) first.getChildAt(0); // TextView textView = (TextView) first.getChildAt(1); // listDescription = description + textView.toString() + checkBox.isChecked() + "%"; // } contentValues.put(ArchivesContract.ArchivesColumns.ARCHIVES_TYPE, AppConstant.LIST); } else {//from w w w. j a v a2s.c o m listDescription = description.getText().toString(); contentValues.put(ArchivesContract.ArchivesColumns.ARCHIVES_TYPE, AppConstant.NORMAL); } contentValues.put(ArchivesContract.ArchivesColumns.ARCHIVES_DESCRIPTION, listDescription); contentValues.put(ArchivesContract.ArchivesColumns.ARCHIVES_TITLE, title.getText().toString()); contentValues.put(ArchivesContract.ArchivesColumns.ARCHIVES_DATE_TIME, dateTime.getText().toString()); contentValues.put(ArchivesContract.ArchivesColumns.ARCHIVES_CATEGORY, mTitle); ContentResolver cr = this.getContentResolver(); Uri uri = ArchivesContract.URI_TABLE; cr.insert(uri, contentValues); delete(view, position); }
From source file:org.openaccessbutton.openaccessbutton.advocacy.AdvocacyFragment.java
License:asdf
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_advocacy, container, false); mResourceName = getArguments().getString("filename"); InputStream object;/*from w w w .j a v a 2s . c o m*/ // XML file containing content if (mResourceName.equals("diego.xml")) { object = this.getResources().openRawResource(R.raw.diego); } else if (mResourceName.equals("other_content.xml")) { object = this.getResources().openRawResource(R.raw.other_content); } else if (mResourceName.equals("take_action.xml")) { object = this.getResources().openRawResource(R.raw.take_action); } else { object = this.getResources().openRawResource(R.raw.advocacy); } // LinearLayout to append content to LinearLayout layout = (LinearLayout) view.findViewById(R.id.advocacy_content); try { XmlParser xmlParser = new XmlParser(); xmlParser.parseToView(object, layout, getActivity()); } catch (IOException e) { // TODO: Do something Log.e("openaccess", "exception", e); } catch (XmlPullParserException e) { // TODO: Do something Log.e("openaccess", "exception", e); } // Section for submitting an additional question final TextView askQuestion = (TextView) view.findViewById(R.id.askQuestion); final LinearLayout newQuestionWrapper = (LinearLayout) view.findViewById(R.id.newQuestionWrapper); final EditText newQuestion = (EditText) view.findViewById(R.id.newQuestion); final TextView questionSubmitted = (TextView) view.findViewById(R.id.questionSubmitted); final Button newQuestionSubmit = (Button) view.findViewById(R.id.newQuestionSubmit); askQuestion.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (newQuestionWrapper.getVisibility() == View.VISIBLE) { newQuestionWrapper.setVisibility(View.GONE); questionSubmitted.setVisibility(View.GONE); askQuestion.setText(getResources().getString(R.string.askQuestion)); } else { newQuestionWrapper.setVisibility(View.VISIBLE); questionSubmitted.setVisibility(View.GONE); newQuestion.setText(""); askQuestion.setText(getResources().getString(R.string.askQuestionClosed)); } } }); newQuestionSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (newQuestion.getText().length() > 0) { // Submit the question to the web service Thread thread = new Thread(new Runnable() { @Override public void run() { try { String user_id; ParseInstallation installation = ParseInstallation.getCurrentInstallation(); if (installation == null) { user_id = ""; } else { user_id = installation.getObjectId(); } Log.w("asdf", user_id); getActivity().runOnUiThread(new Runnable() { @Override public void run() { newQuestionSubmit.setVisibility(View.INVISIBLE); } }); Webb webb = Webb.create(); JSONObject response = webb .post("http://oabuttonquestions.herokuapp.com/questions/new") .param("user_id", user_id).param("question", newQuestion.getText()) .ensureSuccess().asJsonObject().getBody(); getActivity().runOnUiThread(new Runnable() { @Override public void run() { questionSubmitted.setVisibility(View.VISIBLE); newQuestion.setText(""); newQuestionSubmit.setVisibility(View.VISIBLE); } }); } catch (Exception e) { e.printStackTrace(); // TODO: Show error } } }); thread.start(); } else { Toast.makeText(getActivity(), getActivity().getResources().getString(R.string.blank_question_error), Toast.LENGTH_LONG).show(); } } }); return view; }
From source file:com.metinkale.prayerapp.vakit.fragments.NotificationPrefs.java
private void initCuma(int switchId, int textId, int expandId, final Vakit vakit) { final SwitchCompat sw = (SwitchCompat) mView.findViewById(switchId); final LinearLayout expand = (LinearLayout) mView.findViewById(expandId); sw.setChecked(mTimes.isCumaActive()); sw.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override//w w w. j a va 2 s . co m public void onCheckedChanged(CompoundButton compoundButton, boolean b) { mTimes.setCumaActive(b); if (!b && expand.getVisibility() == View.VISIBLE) { expand.setVisibility(View.GONE); } } }); View title = (View) mView.findViewById(textId).getParent(); title.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (!BuildConfig.DEBUG) { return false; } mTestAlarm = true; Times.Alarm a = new Times.Alarm(); a.time = System.currentTimeMillis() + (5 * 1000); a.city = mTimes.getID(); a.cuma = true; a.vakit = vakit; AlarmReceiver.setAlarm(getActivity(), a); Toast.makeText(App.getContext(), "Will play within 5 seconds", Toast.LENGTH_LONG).show(); return true; } }); title.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (sw.isChecked()) { expand.setVisibility((expand.getVisibility() == View.VISIBLE) ? View.GONE : View.VISIBLE); } else { Toast.makeText(getActivity(), R.string.activateForMorePrefs, Toast.LENGTH_LONG).show(); } } }); PrefsView sound = (PrefsView) expand.findViewById(R.id.sound); sound.setPrefType(PrefsView.Pref.Sela); sound.setVakit(vakit); sound.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.getCumaSound(); } @Override public void setValue(Object obj) { mTimes.setCumaSound((String) obj); } }); PrefsView vibr = (PrefsView) expand.findViewById(R.id.vibration); vibr.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.hasCumaVibration(); } @Override public void setValue(Object obj) { mTimes.setCumaVibration((boolean) obj); } }); PrefsView silenter = (PrefsView) expand.findViewById(R.id.silenter); silenter.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.getCumaSilenterDuration(); } @Override public void setValue(Object obj) { mTimes.setCumaSilenterDuration((int) obj); } }); PrefsView dua = (PrefsView) expand.findViewById(R.id.dua); dua.setVisibility(View.GONE); PrefsView time = (PrefsView) expand.findViewById(R.id.time); time.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.getCumaTime(); } @Override public void setValue(Object obj) { mTimes.setCumaTime((int) obj); } }); }
From source file:com.metinkale.prayerapp.vakit.fragments.NotificationPrefs.java
private void initEarly(int switchId, int textId, int expandId, final Vakit vakit) { final SwitchCompat sw = (SwitchCompat) mView.findViewById(switchId); final LinearLayout expand = (LinearLayout) mView.findViewById(expandId); sw.setChecked(mTimes.isEarlyNotificationActive(vakit)); sw.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override/*w w w . j a v a2 s .c o m*/ public void onCheckedChanged(CompoundButton compoundButton, boolean b) { mTimes.setEarlyNotificationActive(vakit, b); if (!b && expand.getVisibility() == View.VISIBLE) { expand.setVisibility(View.GONE); } } }); View title = (View) mView.findViewById(textId).getParent(); title.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (!BuildConfig.DEBUG) { return false; } mTestAlarm = true; Times.Alarm a = new Times.Alarm(); a.time = System.currentTimeMillis() + (5 * 1000); a.city = mTimes.getID(); a.early = true; a.vakit = vakit; AlarmReceiver.setAlarm(getActivity(), a); Toast.makeText(App.getContext(), "Will play within 5 seconds", Toast.LENGTH_LONG).show(); return true; } }); title.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (sw.isChecked()) { expand.setVisibility((expand.getVisibility() == View.VISIBLE) ? View.GONE : View.VISIBLE); } else { Toast.makeText(getActivity(), R.string.activateForMorePrefs, Toast.LENGTH_LONG).show(); } } }); PrefsView sound = (PrefsView) expand.findViewById(R.id.sound); sound.setVakit(vakit); sound.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.getEarlySound(vakit); } @Override public void setValue(Object obj) { mTimes.setEarlySound(vakit, (String) obj); } }); PrefsView vibr = (PrefsView) expand.findViewById(R.id.vibration); vibr.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.hasEarlyVibration(vakit); } @Override public void setValue(Object obj) { mTimes.setEarlyVibration(vakit, (boolean) obj); } }); PrefsView silenter = (PrefsView) expand.findViewById(R.id.silenter); silenter.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.getEarlySilenterDuration(vakit); } @Override public void setValue(Object obj) { mTimes.setEarlySilenterDuration(vakit, (int) obj); } }); PrefsView dua = (PrefsView) expand.findViewById(R.id.dua); dua.setVisibility(View.GONE); PrefsView time = (PrefsView) expand.findViewById(R.id.time); time.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.getEarlyTime(vakit); } @Override public void setValue(Object obj) { mTimes.setEarlyTime(vakit, (int) obj); } }); }
From source file:com.metinkale.prayerapp.vakit.fragments.NotificationPrefs.java
private void initMain(int switchId, int textId, int expandId, final Vakit vakit) { final SwitchCompat sw = (SwitchCompat) mView.findViewById(switchId); final LinearLayout expand = (LinearLayout) mView.findViewById(expandId); sw.setChecked(mTimes.isNotificationActive(vakit)); sw.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override//from ww w . j av a 2 s . c o m public void onCheckedChanged(CompoundButton compoundButton, boolean b) { mTimes.setNotificationActive(vakit, b); if (!b && expand.getVisibility() == View.VISIBLE) { expand.setVisibility(View.GONE); } } }); View title = (View) mView.findViewById(textId).getParent(); title.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (!BuildConfig.DEBUG) { return false; } mTestAlarm = true; Times.Alarm a = new Times.Alarm(); a.time = System.currentTimeMillis() + (5 * 1000); a.city = mTimes.getID(); a.vakit = vakit; AlarmReceiver.setAlarm(getActivity(), a); Toast.makeText(App.getContext(), "Will play within 5 seconds", Toast.LENGTH_LONG).show(); return true; } }); title.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (sw.isChecked()) { expand.setVisibility(expand.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); } else { Toast.makeText(getActivity(), R.string.activateForMorePrefs, Toast.LENGTH_LONG).show(); } } }); PrefsView sound = (PrefsView) expand.findViewById(R.id.sound); sound.setVakit(vakit); sound.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.getSound(vakit); } @Override public void setValue(Object obj) { mTimes.setSound(vakit, (String) obj); } }); PrefsView vibr = (PrefsView) expand.findViewById(R.id.vibration); vibr.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.hasVibration(vakit); } @Override public void setValue(Object obj) { mTimes.setVibration(vakit, (boolean) obj); } }); PrefsView silenter = (PrefsView) expand.findViewById(R.id.silenter); silenter.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.getSilenterDuration(vakit); } @Override public void setValue(Object obj) { mTimes.setSilenterDuration(vakit, (int) obj); } }); PrefsView dua = (PrefsView) expand.findViewById(R.id.dua); dua.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.getDua(vakit); } @Override public void setValue(Object obj) { mTimes.setDua(vakit, (String) obj); } }); PrefsView time = (PrefsView) expand.findViewById(R.id.time); if (vakit == Vakit.SABAH) { time.setTag("SabahTime"); time.setPrefFunctions(new PrefsView.PrefsFunctions() { @Override public Object getValue() { return mTimes.getSabahTime() * (mTimes.isAfterImsak() ? -1 : 1); } @Override public void setValue(Object obj) { int time = (int) obj; mTimes.setSabahTime(Math.abs(time)); mTimes.setAfterImsak(time < 0); } }); } else { time.setVisibility(View.GONE); } }
From source file:com.money.manager.ex.MainActivity.java
/** * this method call for classic method (show fragments) * /*from w w w . ja v a 2 s . c om*/ * @param savedInstanceState */ public void onCreateFragments(Bundle savedInstanceState) { Core core = new Core(this); setContentView(R.layout.main_fragments_activity); LinearLayout fragmentDetail = (LinearLayout) findViewById(R.id.fragmentDetail); setDualPanel(fragmentDetail != null && fragmentDetail.getVisibility() == View.VISIBLE); // show home fragment HomeFragment fragment = (HomeFragment) getSupportFragmentManager() .findFragmentByTag(HomeFragment.class.getSimpleName()); if (fragment == null) { // fragment create fragment = new HomeFragment(); // add to stack getSupportFragmentManager().beginTransaction() .replace(R.id.fragmentContent, fragment, HomeFragment.class.getSimpleName()).commit(); } else if (core.isTablet()) { getSupportFragmentManager().beginTransaction() .replace(R.id.fragmentContent, fragment, HomeFragment.class.getSimpleName()).commit(); } // manage fragment if (savedInstanceState != null && savedInstanceState.containsKey(KEY_CLASS_FRAGMENT_CONTENT)) { String className = savedInstanceState.getString(KEY_CLASS_FRAGMENT_CONTENT); if (className.contains(AccountFragment.class.getSimpleName())) { changeFragment(Integer.parseInt(className.substring(className.indexOf("_") + 1))); } else { try { showFragment(Class.forName(className)); } catch (ClassNotFoundException e) { Log.e(LOGCAT, e.getMessage()); } } } // navigation drawer mDrawer = (DrawerLayout) findViewById(R.id.drawerLayout); // set a custom shadow that overlays the main content when the drawer opens if (mDrawer != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { mDrawerToggle = new CustomActionBarDrawerToggle(this, mDrawer); mDrawer.setDrawerListener(mDrawerToggle); // create drawer menu createDrawerMenu(); // enable ActionBar app icon to behave as action to toggle nav drawer getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(true); } else { mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } } }
From source file:lewa.support.v7.app.ActionBarActivityDelegateBase.java
@Override boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_MENU: { // LEWA MODIFY BEGIN if (true && mActionBar != null && mActionMode != null) {// action mode mActionModeView.toggleActionModeOptionMenu(); } else if (true && mActionBar != null) { //refresh menu if (splitActionBarView != null && mActivity != null) { LinearLayout splitView = splitActionBarView.getActionOptionMenuBar(); if (splitView != null && splitView.getVisibility() != View.VISIBLE) { // mActivity.invalidateOptionsMenu(); if (!mInvalidateMenuPosted) { mInvalidateMenuPosted = true; final MenuBuilder menu = createMenu(); if (mActivity.superOnCreatePanelMenu(Window.FEATURE_OPTIONS_PANEL, menu) && mActivity.superOnPreparePanel(Window.FEATURE_OPTIONS_PANEL, null, menu)) { setMenu(menu); } else { setMenu(null); }/*from www . ja v a 2s . c om*/ // updateActionMenuCount(splitActionBarView, mMenu); mInvalidateMenuPosted = false; } else { return true; } // final MenuBuilder menu = createMenu(); // if (mMenu != null) { // if (mActivity.superOnPreparePanel(Window.FEATURE_OPTIONS_PANEL, null, mMenu)) { // // setMenu(mMenu); // } else { // // setMenu(null); // } // updateActionMenuCount(splitActionBarView, mMenu); // } } } mActionBarView.toggleActionOptionMenu(); } // LEWA MODIFY END return true; } } return false; }
From source file:com.gh4a.IssueLabelListActivity.java
private void fillData() { final Typeface condensed = getApplicationContext().condensed; LinearLayout ll = (LinearLayout) findViewById(R.id.main_content); ll.removeAllViews();/* ww w . j av a 2s. c o m*/ mAllLabelLayout = new ArrayList<Map<String, Object>>(); for (final Label label : mLabels) { Map<String, Object> selectedLabelItems = new HashMap<String, Object>(); selectedLabelItems.put("label", label); final View rowView = getLayoutInflater().inflate(R.layout.row_issue_label, null); final View viewColor = (View) rowView.findViewById(R.id.view_color); final LinearLayout llEdit = (LinearLayout) rowView.findViewById(R.id.ll_edit); selectedLabelItems.put("llEdit", llEdit); final EditText etLabel = (EditText) rowView.findViewById(R.id.et_label); selectedLabelItems.put("etLabel", etLabel); final TextView tvLabel = (TextView) rowView.findViewById(R.id.tv_title); selectedLabelItems.put("tvLabel", tvLabel); tvLabel.setTypeface(condensed); tvLabel.setText(label.getName()); viewColor.setBackgroundColor(Color.parseColor("#" + label.getColor())); selectedLabelItems.put("viewColor", viewColor); mAllLabelLayout.add(selectedLabelItems); viewColor.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (llEdit.getVisibility() == View.VISIBLE) { llEdit.setVisibility(View.GONE); unselectLabel(tvLabel, viewColor, label.getColor()); } else { llEdit.setVisibility(View.VISIBLE); selectLabel(tvLabel, viewColor, label.getColor(), true, etLabel); etLabel.setText(label.getName()); mActionMode = startActionMode(new EditActionMode(label.getName(), etLabel)); } } }); tvLabel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { LinearLayout llEdit = (LinearLayout) rowView.findViewById(R.id.ll_edit); if (llEdit.getVisibility() == View.VISIBLE) { llEdit.setVisibility(View.GONE); unselectLabel(tvLabel, viewColor, label.getColor()); } else { llEdit.setVisibility(View.VISIBLE); selectLabel(tvLabel, viewColor, label.getColor(), true, etLabel); etLabel.setText(label.getName()); mActionMode = startActionMode(new EditActionMode(label.getName(), etLabel)); } } }); if (!StringUtils.isBlank(mSelectedLabel) && mSelectedLabel.equals(label.getName())) { selectLabel(tvLabel, viewColor, label.getColor(), false, etLabel); llEdit.setVisibility(View.VISIBLE); etLabel.setText(label.getName()); } final View color1 = (View) rowView.findViewById(R.id.color_444444); color1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color1.getTag(), false, etLabel); } }); final View color2 = (View) rowView.findViewById(R.id.color_02d7e1); color2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color2.getTag(), false, etLabel); } }); final View color3 = (View) rowView.findViewById(R.id.color_02e10c); color3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color3.getTag(), false, etLabel); } }); final View color4 = (View) rowView.findViewById(R.id.color_0b02e1); color4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color4.getTag(), false, etLabel); } }); final View color5 = (View) rowView.findViewById(R.id.color_d7e102); color5.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color5.getTag(), false, etLabel); } }); final View color6 = (View) rowView.findViewById(R.id.color_DDDDDD); color6.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color6.getTag(), false, etLabel); } }); final View color7 = (View) rowView.findViewById(R.id.color_e102d8); color7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color7.getTag(), false, etLabel); } }); final View color8 = (View) rowView.findViewById(R.id.color_e10c02); color8.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color8.getTag(), false, etLabel); } }); ll.addView(rowView); } }