List of usage examples for android.widget LinearLayout findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:org.tomahawk.tomahawk_android.dialogs.ResolverRedirectConfigDialog.java
/** * Called when this {@link android.support.v4.app.DialogFragment} is being created */// ww w. j av a 2 s . co m @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (getArguments() != null && getArguments().containsKey(TomahawkFragment.PREFERENCEID)) { String id = getArguments().getString(TomahawkFragment.PREFERENCEID); mScriptResolver = (ScriptResolver) PipeLine.get().getResolver(id); } TextView headerTextView = (TextView) addScrollingViewToFrame(R.layout.config_textview); headerTextView.setText(mScriptResolver.getDescription()); int buttonBackgroundResId = R.drawable.selectable_background_tomahawk_rectangle_gray; int buttonTextColor = getResources().getColor(R.color.primary_textcolor); View.OnClickListener onClickListener = new RedirectButtonListener(); View buttonLayout = addScrollingViewToFrame(R.layout.config_redirect_button); LinearLayout button = ((LinearLayout) buttonLayout.findViewById(R.id.config_redirect_button)); button.setBackgroundResource(buttonBackgroundResId); ImageView buttonImage = (ImageView) buttonLayout.findViewById(R.id.config_redirect_button_image); mScriptResolver.loadIcon(buttonImage, false); mRedirectButtonTextView = (TextView) button.findViewById(R.id.config_redirect_button_text); mRedirectButtonTextView.setTextColor(buttonTextColor); if (isPluginInstalled()) { mRedirectButtonTextView.setText(mScriptResolver.isEnabled() ? getString(R.string.resolver_config_redirect_button_text_log_out_of) : getString(R.string.resolver_config_redirect_button_text_log_into)); } else { mRedirectButtonTextView .setText(getString(R.string.resolver_config_redirect_button_text_download_plugin)); } button.setOnClickListener(onClickListener); setDialogTitle(mScriptResolver.getName()); hideNegativeButton(); setStatus(mScriptResolver); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(getDialogView()); return builder.create(); }
From source file:com.mobicage.rogerthat.plugins.friends.ServiceSearchActivity.java
private TextView setCatorySelected(LinearLayout label, final boolean selected) { final View labelIndicatorView = label.findViewById(R.id.indicator); final TextView labelTextView = (TextView) label.findViewById(R.id.category); if (selected) { labelIndicatorView.setVisibility(View.VISIBLE); labelTextView.setTypeface(Typeface.create(labelTextView.getTypeface(), Typeface.BOLD)); labelTextView.setTextColor(getResources().getColor(R.color.mc_blue2)); } else {/*from www.j a va 2 s . c om*/ labelIndicatorView.setVisibility(View.INVISIBLE); labelTextView.setTypeface(Typeface.create(labelTextView.getTypeface(), Typeface.NORMAL)); labelTextView.setTextColor(getResources().getColor(android.R.color.secondary_text_light)); } return labelTextView; }
From source file:com.androguide.honamicontrol.touchscreen.TouchScreenFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LinearLayout ll = (LinearLayout) inflater.inflate(R.layout.cardsui, container, false); final ActionBarActivity fa = (ActionBarActivity) super.getActivity(); fa.getSupportActionBar().setDisplayHomeAsUpEnabled(true); fa.getSupportActionBar().setHomeButtonEnabled(true); assert ll != null; CardUI mCardUI = (CardUI) (ll.findViewById(R.id.cardsui)); mCardUI.addStack(new CardStack("")); final SharedPreferences bootPrefs = fa.getSharedPreferences("BOOT_PREFS", 0); String sectionColor = fa.getString(R.string.touch_screen_color); if (Helpers.doesFileExist(PEN_MODE)) { mCardUI.addCard(// ww w . j a v a 2 s . c o m new CardSwitchPlugin(fa.getString(R.string.pen_mode), fa.getString(R.string.pen_mode_desc), sectionColor, PEN_MODE, fa, new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isOn) { bootPrefs.edit().putBoolean("PEN_MODE", isOn).commit(); if (isOn) Helpers.CMDProcessorWrapper.runSuCommand("chown system:system " + PEN_MODE + " && busybox echo 1 > " + PEN_MODE); else Helpers.CMDProcessorWrapper.runSuCommand("chown system:system " + PEN_MODE + " && busybox echo 0 > " + PEN_MODE); } })); } else { mCardUI.addCard(new CardSwitchDisabled(fa.getString(R.string.pen_mode), "Sorry, your kernel does not seem to support Pen Mode", "#c74b46", "", fa, null)); } if (Helpers.doesFileExist(GLOVE_MODE)) { mCardUI.addCard( new CardSwitchPlugin(fa.getString(R.string.glove_mode), fa.getString(R.string.glove_mode_desc), sectionColor, GLOVE_MODE, fa, new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isOn) { bootPrefs.edit().putBoolean("GLOVE_MODE", isOn).commit(); if (isOn) Helpers.CMDProcessorWrapper.runSuCommand("chown system:system " + GLOVE_MODE + " && busybox echo 1 > " + GLOVE_MODE); else Helpers.CMDProcessorWrapper.runSuCommand("chown system:system " + GLOVE_MODE + " && busybox echo 0 > " + GLOVE_MODE); } })); } else { mCardUI.addCard(new CardSwitchDisabled(fa.getString(R.string.glove_mode), "Sorry, your kernel does not seem to support Glove Mode", "#c74b46", "", fa, null)); } if (Helpers.doesFileExist(DT2WAKE)) { mCardUI.addCard( new CardSwitchPlugin(fa.getString(R.string.dt2wake), fa.getString(R.string.dt2wake_text), sectionColor, DT2WAKE, fa, new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isOn) { bootPrefs.edit().putBoolean("DT2WAKE", isOn).commit(); if (isOn) Helpers.CMDProcessorWrapper.runSuCommand("busybox echo 1 > " + DT2WAKE); else Helpers.CMDProcessorWrapper.runSuCommand("busybox echo 0 > " + DT2WAKE); } })); } else { mCardUI.addCard(new CardSwitchDisabled(fa.getString(R.string.dt2wake), "Sorry, your kernel does not seem to support Double Tap 2 Wake", "#c74b46", "", fa, null)); } // bash command to grab the nth line (where NUM is the line number): // sed 'NUMq;d' path/to/file // mCardUI.addCard(new CardSeekBar("Touch Pressure Scale", // "This defines the amount of pressure required for a touch to be detected by the touchscreen. Setting a low value can make hovers be recognized as touch events.", // sectionColor, // "", // CLEARPAD, // 0, // 1000, // 74, // fa, // new ActionMode.Callback() { // @Override // public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { // return false; // } // // @Override // public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) { // return false; // } // // @Override // public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) { // return false; // } // // @Override // public void onDestroyActionMode(ActionMode actionMode) { // // } // } // )); mCardUI.addStack(new CardStack()); mCardUI.refresh(); return ll; }
From source file:org.fdroid.fdroid.privileged.views.AppSecurityPermissions.java
public View getPermissionsView(int which) { LinearLayout permsView = (LinearLayout) inflater.inflate(R.layout.app_perms_summary, null); LinearLayout displayList = (LinearLayout) permsView.findViewById(R.id.perms_list); View noPermsView = permsView.findViewById(R.id.no_permissions); displayPermissions(permGroupsList, displayList, which); if (displayList.getChildCount() <= 0) { noPermsView.setVisibility(View.VISIBLE); }//from w ww.j a va2 s . c om return permsView; }
From source file:com.thelastcrusade.soundstream.components.NetworkFragment.java
private void setButtonToSearchingState(LinearLayout button) { button.setEnabled(false);/*w w w . j a v a 2s . c o m*/ //TODO: add a better indicator while discovering //...seconds until discovery is finished, number of clients found, etc button.findViewById(R.id.searching).setVisibility(View.VISIBLE); button.findViewById(R.id.image_background) .setBackgroundColor(getActivity().getResources().getColor(R.color.gray)); }
From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.swipe.TimeLineActivity.java
/** * On click image view to start stop recording * // w w w . j a v a 2 s .co m * Records time SYNCHRONOUSLY * * @param v */ public void onClickSwitchAction(View v) { Drawable drwStart = getResources().getDrawable(R.drawable.play); Drawable drwStop = getResources().getDrawable(R.drawable.stop); LinearLayout lllFrag = (LinearLayout) v.getParent(); LinearLayout llTimePicker = (LinearLayout) lllFrag.findViewById(R.id.llTimePicker); LinearLayout llStatus = (LinearLayout) lllFrag.findViewById(R.id.llStatus); TextView tvRecording = (TextView) llStatus.findViewById(R.id.tvRecording); ImageView ivRecording = (ImageView) llStatus.findViewById(R.id.ivRecording); Animation anim = new AlphaAnimation(0.0f, 1.0f); Log.d(CLASSNAME, "BEFORE: " + Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).toString()); ImageView iv = (ImageView) v; int currentStatus = Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).getStatus(); if (currentStatus == ActivitySession.STATUS_STOPPED) { Log.d(CLASSNAME, "Status is STOPPED. Shift to STARTED"); iv.setImageDrawable(drwStop); llTimePicker.setVisibility(View.INVISIBLE); anim.setDuration(500); anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).doCheckIn(); } else { Log.d(CLASSNAME, "Status is STARTED. Shift to STOPPED"); iv.setImageDrawable(drwStart); llTimePicker.setVisibility(View.VISIBLE); anim.setRepeatCount(0); ActivitySession as = Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()); String sSubjectId = as.getId_subject(); double dLat = as.getLocation_latitude(); double dLong = as.getLocation_longitude(); long lCheckOut = new Date().getTime(); long lCheckIn = Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).doCheckOut(); // Save data into both databases DateUtils du = new DateUtils(); Log.i(CLASSNAME, "Recording activity into both databasees:" + as.getId_subject() + " / " + du.duration(lCheckIn, lCheckOut)); // TODO make some control here to make this transactional // Save in backend recordActivityBackend(sSubjectId, lCheckIn, lCheckOut, dLat, dLong, ActivityDO.ACTIVITY_RECORD_MODE_SYNCHRONOUS); // Save in local database recordActivitySQLite(sSubjectId, lCheckIn, lCheckOut, dLat, dLong); TextView tvDuration = (TextView) lllFrag.findViewById(R.id.tvDuration); tvDuration.setText( du.duration(Session.getSingleInstance().getDatabaseHandler().getAccumulatedTime(sSubjectId))); Toast.makeText(getApplicationContext(), "Recorded " + du.duration(lCheckIn, lCheckOut), Toast.LENGTH_SHORT).show(); // // Update history layout // LayoutInflater inflater = LayoutInflater.from(this); LinearLayout llParent = (LinearLayout) inflater.inflate(R.layout.check_item, null); LinearLayout liContent = (LinearLayout) llParent.getChildAt(0); // ImageView ivParent = (ImageView) liContent.findViewById(R.id.imageViewStart); // ivParent.setImageResource(R.drawable.rec_50x); //TextView tvTimeStamp = (TextView) liContent.getChildAt(1); TextView tvTimeStamp = (TextView) liContent.findViewById(R.id.textViewTimeStamp); tvTimeStamp.setText(Constants.TIME_FORMAT.format(lCheckIn)); tvTimeStamp.setTag(Long.valueOf(lCheckIn)); TextView tvDurRecord = (TextView) liContent.findViewById(R.id.textViewDuration); tvDurRecord.setText(" [" + du.duration(lCheckIn, lCheckOut) + "]"); // Passing subject id as parameter tvDurRecord.setTag(sSubjectId); LinearLayout llHistory = (LinearLayout) lllFrag.findViewById(R.id.llHistory); // Set index number so that the record can be removed int iTag = (llHistory.getChildCount() - 1) / 2; llParent.setTag(iTag); llHistory.addView(inflater.inflate(R.layout.tag_divider, llHistory, false), 1); llHistory.addView(llParent, 2); } tvRecording.startAnimation(anim); ivRecording.startAnimation(anim); Log.d(CLASSNAME, "AFTER: " + Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).toString()); }
From source file:com.meetingninja.csse.agenda.AgendaItemAdapter.java
@Override public LinearLayout updateView(final View view, final TreeNodeInfo<Topic> treeNodeInfo) { final LinearLayout rowView = (LinearLayout) view; final Topic rowTopic = treeNodeInfo.getId(); // System.out.println("Echo: Checked" + rowTopic + " " + counter + " " // + Comparison.size() + " " + checked); final EditText mTitle = (EditText) rowView.findViewById(R.id.agenda_edit_topic); final TextView mTime = (TextView) rowView.findViewById(R.id.agenda_topic_time); if (textHandlers.containsKey(mTitle)) { mTitle.removeTextChangedListener(textHandlers.get(mTitle)); }/* w w w . j a v a 2 s . co m*/ mTitle.setText(rowTopic.getTitle()); // System.out.println("Echo: Here" + rowTopic.getTitle() + " " + // rowView); TextWatcher c = new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { String text = s.toString(); // rowTopic.setTitle(text); mTitle.setTag(text); rowTopic.setTitle(text); Log.d(TAG, "Text changed" + treeNodeInfo.getLevel() + " " + treeNodeInfo.getId()); manager.getChildren(treeNodeInfo.getId()); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }; mTitle.addTextChangedListener(c); textHandlers.put(mTitle, c); final Button mAddTopicBtn = (Button) rowView.findViewById(R.id.agenda_subtopicAddBtn); final Button mTimeBtn = (Button) rowView.findViewById(R.id.agenda_topicTimeBtn); System.out.println(); // Add SubTopic Button // mAddTopicBtn.setTag(rowTopic); mAddTopicBtn.setOnClickListener(new SubTopicListener(rowTopic)); // Set Time Button mTimeBtn.setTag(rowTopic); mTimeBtn.setOnClickListener(new OnTimeBtnClick(rowTopic, mTime)); Map<String, String> info = getDescription(rowTopic); String time = info.containsKey("time") ? info.get("time") : ""; time = "(" + rowTopic.getTime() + "m)"; mTime.setText(time); // If a topic has subTopics, then its time is determined by the sum of // the subTopics if (getManager().getChildren(rowTopic).size() != 0) { // mTimeBtn.setVisibility(View.GONE); mTime.setVisibility(View.GONE); mTimeBtn.setVisibility(View.GONE); } else { mTime.setVisibility(View.VISIBLE); mTimeBtn.setVisibility(View.VISIBLE); // timeBtn.setChecked(selected.contains(treeNodeInfo.getId())); } getManager().notifyDataSetChanged(); return rowView; }
From source file:com.battery.materialdesigndemo.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { //supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set explode animation when enter and exit the activity //Utils.configureWindowEnterExitTransition(getWindow()); // Handle Toolbar Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);//from w w w . j a va 2 s .com getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Handle DrawerLayout DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer); // Handle ActionBarDrawerToggle ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close); actionBarDrawerToggle.syncState(); // Handle different Drawer States :D mDrawerLayout.setDrawerListener(actionBarDrawerToggle); // Handle DrawerList LinearLayout mDrawerList = (LinearLayout) findViewById(R.id.drawerList); // Handle ProgressBar mProgressBar = (ProgressBar) findViewById(R.id.progressBar); // Init DrawerElems NOTE Just don't do this in a live app :D final SharedPreferences pref = getSharedPreferences("com.mikepenz.applicationreader", 0); ((Switch) mDrawerList.findViewById(R.id.drawer_autoupload)) .setChecked(pref.getBoolean("autouploadenabled", false)); ((Switch) mDrawerList.findViewById(R.id.drawer_autoupload)) .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { SharedPreferences.Editor editor = pref.edit(); editor.putBoolean("autouploadenabled", isChecked); editor.apply(); } }); mDrawerList.findViewById(R.id.drawer_opensource).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new Libs.Builder().withFields(R.string.class.getFields()).withVersionShown(true) .withLicenseShown(true).withActivityTitle(getString(R.string.drawer_opensource)) .withActivityTheme(R.style.AboutTheme).start(MainActivity.this); } }); ((ImageView) mDrawerList.findViewById(R.id.drawer_opensource_icon)).setImageDrawable( new IconicsDrawable(this, FontAwesome.Icon.faw_github).colorRes(R.color.secondary).actionBarSize()); // Fab Button mFabButton = (ImageButton) findViewById(R.id.fab_button); mFabButton.setImageDrawable( new IconicsDrawable(this, FontAwesome.Icon.faw_upload).color(Color.WHITE).actionBarSize()); mFabButton.setOnClickListener(fabClickListener); Utils.configureFab(mFabButton); mRecyclerView = (RecyclerView) findViewById(R.id.list); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.setItemAnimator(new CustomItemAnimator()); //mRecyclerView.setItemAnimator(new ReboundItemAnimator()); mAdapter = new ApplicationAdapter(new ArrayList<AppInfo>(), R.layout.row_application, MainActivity.this); mRecyclerView.setAdapter(mAdapter); mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container); mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.theme_accent)); mSwipeRefreshLayout.setRefreshing(true); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { new InitializeApplicationsTask().execute(); } }); new InitializeApplicationsTask().execute(); if (savedInstanceState != null) { if (uploadComponentInfoTask != null) { if (uploadComponentInfoTask.isRunning) { uploadComponentInfoTask.showProgress(this); } } } //show progress mRecyclerView.setVisibility(View.GONE); mProgressBar.setVisibility(View.VISIBLE); }
From source file:com.einzig.ipst2.activities.PSDetailsActivity.java
/** * Add additional UI components for a portal submission that is no longer pending * * @param portal Portal being viewed cast to a PortalResponded for convenience *//*from w w w .j av a 2 s .c o m*/ private void buildRespondedUI(PortalResponded portal) { daysInQueueLabel.setText(String.valueOf(portal.getResponseTime())); LinearLayout respondedLayout = (LinearLayout) LayoutInflater.from(this) .inflate(R.layout.row_psdetails_responded, extraLayout, false); ThemeHelper.styleView(respondedLayout.findViewById(R.id.daterespondedlayout_respondedrow), this); ((TextView) respondedLayout.findViewById(R.id.dateresponded_respondedrow)) .setText(uiFormatter.print(portal.getDateResponded())); extraLayout.addView(respondedLayout); }
From source file:com.einzig.ipst2.activities.PSDetailsActivity.java
/** * Add additional UI components for a rejected portal submission * * @param portal Portal being viewed cast to a PortalRejected for convenience */// ww w . j a v a 2 s .c om private void buildRejectedUI(PortalRejected portal) { buildRespondedUI(portal); portalStatusImage.setBackgroundColor(ContextCompat.getColor(this, R.color.rejected)); portalStatusImage.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_rejected)); LinearLayout rejectedLayout = (LinearLayout) LayoutInflater.from(this) .inflate(R.layout.row_psdetails_rejected, extraLayout, false); ThemeHelper.styleView(rejectedLayout.findViewById(R.id.rejectionreasonlayout_rejectedrow), this); ((TextView) rejectedLayout.findViewById(R.id.rejectionreason_rejectedrow)) .setText(portal.getRejectionReason()); extraLayout.addView(rejectedLayout); }