List of usage examples for android.widget LinearLayout findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:com.einzig.ipst2.activities.PSDetailsActivity.java
/** * Add additional UI components for an accepted portal submission * * @param portal Portal being viewed cast to a PortalAccepted for convenience *///from w w w . j a v a2s . c o m private void buildAcceptedUI(PortalAccepted portal) { buildRespondedUI(portal); portalStatusImage.setBackgroundColor(ContextCompat.getColor(this, R.color.accepted)); portalStatusImage.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_check)); LinearLayout acceptedLayout = (LinearLayout) LayoutInflater.from(this) .inflate(R.layout.row_psdetails_accepted, extraLayout, false); ThemeHelper.styleView(acceptedLayout.findViewById(R.id.liveaddresslayout_acceptedrow), this); ThemeHelper.styleButton((Button) acceptedLayout.findViewById(R.id.viewonintelmapbutton_acceptedrow), this); ((TextView) acceptedLayout.findViewById(R.id.liveaddress_acceptedrow)).setText(portal.getLiveAddress()); acceptedLayout.findViewById(R.id.viewonintelmapbutton_acceptedrow) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { goToIntel(); } }); extraLayout.addView(acceptedLayout); }
From source file:com.androguide.honamicontrol.soundcontrol.SoundFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true);//from www.ja v a 2 s . c o m LinearLayout ll = (LinearLayout) inflater.inflate(R.layout.cardsui, container, false); fa = (ActionBarActivity) super.getActivity(); fa.getSupportActionBar().setDisplayHomeAsUpEnabled(true); fa.getSupportActionBar().setHomeButtonEnabled(true); bootPrefs = fa.getSharedPreferences("BOOT_PREFS", 0); assert ll != null; mCardUI = (CardUI) (ll.findViewById(R.id.cardsui)); createCards(); return ll; }
From source file:com.chalmers.feedlr.activity.FeedActivity.java
private void updateOverlay() { if (feedAdapter.getCount() > 0) { LinearLayout overlayLayout = (LinearLayout) mainViewFlipper.findViewById(R.id.main_layout); ImageView overlay = (ImageView) overlayLayout.findViewById(R.id.no_feed_image); overlay.setVisibility(View.INVISIBLE); }/*from w ww . j a v a 2 s . c om*/ }
From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.swipe.TimeLineActivity.java
/** * Recording time ASYNCHRONOUSLY/*from w ww. ja va 2s .c o m*/ * * @param v */ public void onClickRecord(View v) { LinearLayout llTimePicker = (LinearLayout) v.getParent(); LinearLayout lllFrag = (LinearLayout) llTimePicker.getParent(); LinearLayout llTime = (LinearLayout) llTimePicker.findViewById(R.id.llTimePicker); TimePicker tp = (TimePicker) llTime.findViewById(R.id.tpTask); Integer oiHour = tp.getCurrentHour(); Integer oiMin = tp.getCurrentMinute(); DateUtils du = new DateUtils(); long lmills = du.toMills(oiHour, oiMin); ActivitySession as = Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()); String sSubjectId = as.getId_subject(); double dLat = as.getLocation_latitude(); double dLong = as.getLocation_longitude(); long lCheckIn = new Date().getTime(); long lCheckOut = lCheckIn + lmills; // Save data into both databases Log.i(CLASSNAME, "Recording activity into both databasees:" + as.getId_subject() + " / " + du.duration(lCheckIn, lCheckOut)); // TODO make some control here to make this transactional recordActivityBackend(sSubjectId, lCheckIn, lCheckOut, dLat, dLong, ActivityDO.ACTIVITY_RECORD_MODE_ASYNCHRONOUS); recordActivitySQLite(sSubjectId, lCheckIn, lCheckOut, dLat, dLong); TextView tvDuration = (TextView) lllFrag.findViewById(R.id.tvDuration); tvDuration.setText( du.duration(Session.getSingleInstance().getDatabaseHandler().getAccumulatedTime(sSubjectId))); // // Update history layout // LayoutInflater inflater = LayoutInflater.from(this); LinearLayout llParent = (LinearLayout) inflater.inflate(R.layout.check_item, null); LinearLayout liContent = (LinearLayout) llParent.getChildAt(0); 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); Toast.makeText(getApplicationContext(), "Recorded " + du.duration(lCheckIn, lCheckOut), Toast.LENGTH_SHORT) .show(); }
From source file:com.nadmm.airports.FragmentBase.java
protected void addBulletedRow(LinearLayout layout, String text) { LinearLayout row = (LinearLayout) inflate(R.layout.detail_row_bullet); TextView tv = (TextView) row.findViewById(R.id.item_value); tv.setText(text);/*from ww w . j ava2s . c o m*/ layout.addView(row, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); }
From source file:com.nadmm.airports.FragmentBase.java
protected View addProgressRow(LinearLayout layout, String label) { if (layout.getChildCount() > 0) { addSeparator(layout);//from w w w . j a v a2s . com } LinearLayout row = (LinearLayout) inflate(R.layout.list_item_text1); TextView tv = (TextView) row.findViewById(R.id.text); tv.setText(label); layout.addView(row, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); return row; }
From source file:mx.klozz.xperience.tweaker.fragments.CPUSettings.java
private void setCpuOnOff(int i) { final LinearLayout l = (LinearLayout) lCurrentCPU.getChildAt(i); final View vc = (View) l.findViewById(R.id.vcpu); if (MainActivity.mCPUOn.get(i).equals("0")) { vc.setBackgroundColor(getResources().getColor(R.color.light_gray)); } else {/*w ww .j a va 2 s . c o m*/ vc.setBackgroundColor(getResources().getColor(android.R.color.holo_blue_light)); } }
From source file:com.nadmm.airports.FragmentBase.java
protected View addRow(LinearLayout layout, String label, String value) { if (layout.getChildCount() > 0) { addSeparator(layout);//from www . j a v a2 s .com } LinearLayout row = (LinearLayout) inflate(R.layout.detail_row_item2); TextView tv = (TextView) row.findViewById(R.id.item_label); tv.setText(label); tv = (TextView) row.findViewById(R.id.item_value); if (value != null && value.length() > 0) { tv.setText(value); } else { tv.setVisibility(View.GONE); } layout.addView(row, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); return row; }
From source file:mx.klozz.xperience.tweaker.fragments.CPUSettings.java
private void setCpuNo(int i, int k) { final LinearLayout l = (LinearLayout) lCurrentCPU.getChildAt(i); final TextView nc = (TextView) l.findViewById(R.id.ncpu); if (i == k) { nc.setText(Integer.toString(i + 1)); } else {/*from w ww . ja v a 2 s. co m*/ nc.setText(" "); } }
From source file:com.androguide.honamicontrol.kernel.KernelFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true);// w w w .java 2 s .com 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(""), true); String sectionColor = fa.getString(R.string.kernel_color); CardImageLocal cpuControl = new CardImageLocal(fa.getString(R.string.kernel_cpu_control), fa.getString(R.string.kernel_cpu_control_desc), sectionColor, R.drawable.ic_tools_cpu_control, fa); cpuControl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fa.startActivity(new Intent(fa, CPUActivity.class)); } }); CardImageLocal voltageControl = new CardImageLocal(fa.getString(R.string.voltage_control), fa.getString(R.string.voltage_control_text), sectionColor, R.drawable.ic_tools_voltage_control, fa); voltageControl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fa.startActivity(new Intent(fa, VoltageActivity.class)); } }); CardImageLocal gpuControl = new CardImageLocal(fa.getString(R.string.kernel_gpu_control), fa.getString(R.string.kernel_gpu_control_desc), sectionColor, R.drawable.ic_tools_gpu_control, fa); gpuControl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fa.startActivity(new Intent(fa, GPUActivity.class)); } }); CardImageLocal gammaControl = new CardImageLocal(fa.getString(R.string.color_calibration), fa.getString(R.string.gamma_control_desc), sectionColor, R.drawable.ic_tools_color_calibration, fa); gammaControl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fa.startActivity(new Intent(fa, ColorControlActivity.class)); } }); CardImageLocal powerManagement = new CardImageLocal(fa.getString(R.string.kernel_power_management), fa.getString(R.string.kernel_power_management_desc), sectionColor, R.drawable.ic_tools_power_management, fa); powerManagement.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fa.startActivity(new Intent(fa, PowerManagementActivity.class)); } }); CardImageLocal ioTweaks = new CardImageLocal(fa.getString(R.string.kernel_io_tweaks), fa.getString(R.string.kernel_io_tweaks_desc), sectionColor, R.drawable.ic_tools_io_tweaks, fa); ioTweaks.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fa.startActivity(new Intent(fa, IOTweaksActivity.class)); } }); CardImageLocal mm = new CardImageLocal(fa.getString(R.string.memory_management), fa.getString(R.string.memory_management_text), sectionColor, R.drawable.ic_tools_mm, fa); mm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fa.startActivity(new Intent(fa, MemoryManagementActivity.class)); } }); CardImageLocal misc = new CardImageLocal(fa.getString(R.string.kernel_misc), fa.getString(R.string.kernel_misc_desc), sectionColor, R.drawable.ic_tools_misc, fa); misc.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fa.startActivity(new Intent(fa, MiscActivity.class)); } }); mCardUI.addCard(cpuControl); if (Helpers.doesFileExist(VoltageInterface.UV_MV_TABLE)) mCardUI.addCard(voltageControl); mCardUI.addCard(gpuControl); if (Helpers.doesFileExist(ColorControlInterface.GAMMA_KCAL)) mCardUI.addCard(gammaControl); mCardUI.addCard(powerManagement); mCardUI.addCard(ioTweaks); mCardUI.addCard(mm); mCardUI.addCard(misc); mCardUI.refresh(); return ll; }