List of usage examples for android.widget LinearLayout findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:com.nadmm.airports.notams.NotamFragmentBase.java
protected void showNotams(File notamFile) { LinearLayout content = (LinearLayout) findViewById(R.id.notam_content_layout); HashMap<String, ArrayList<String>> notams = parseNotams(notamFile); if (notams == null) { // NOTAM cache file is missing. Must be an issue with fetching from FAA TextView title1 = (TextView) findViewById(R.id.notam_title1); title1.setText("Unable to show NOTAMs at this moment"); return;/*from w w w . j ava 2 s . c om*/ } int count = 0; // Get subjects in specific order String[] subjects = DataUtils.getNotamSubjects(); for (String subject : subjects) { if (!notams.containsKey(subject)) { continue; } LinearLayout item = (LinearLayout) inflate(R.layout.notam_detail_item); TextView tv = (TextView) item.findViewById(R.id.notam_subject); tv.setText(subject); LinearLayout details = (LinearLayout) item.findViewById(R.id.notam_details); ArrayList<String> list = notams.get(subject); count += list.size(); for (String notam : list) { addBulletedRow(details, notam); } content.addView(item, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); } TextView title1 = (TextView) findViewById(R.id.notam_title1); title1.setText(getResources().getQuantityString(R.plurals.notams_found, count, count)); TextView title2 = (TextView) findViewById(R.id.notam_title2); Date lastModified = new Date(notamFile.lastModified()); title2.setText("Updated " + TimeUtils.formatElapsedTime(lastModified.getTime())); setFragmentContentShown(true); }
From source file:com.draekko.traypreferencesapp.SampleAppPreferences.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ViewGroup root = (ViewGroup) findViewById(android.R.id.content); LinearLayout content = (LinearLayout) root.getChildAt(0); LinearLayout toolbarContainer = (LinearLayout) View.inflate(this, R.layout.toolbar, null); root.removeAllViews();//w ww .ja v a2s . c om toolbarContainer.addView(content); root.addView(toolbarContainer); mToolbar = (Toolbar) toolbarContainer.findViewById(R.id.toolbar); mToolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.white)); mToolbar.setSubtitleTextColor(ContextCompat.getColor(this, R.color.white)); mToolbar.setNavigationIcon(R.drawable.ic_back_material_light); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); }
From source file:com.thingsee.tracker.MainActivity.java
public static void refreshTrackerMarker(String serial) { TrackerModel trackerModel = trackers.get(serial); if (trackerModel != null) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout tv = (LinearLayout) inflater.inflate(R.layout.tracker_map_marker, null, false); ImageView image2 = (ImageView) tv.findViewById(R.id.tracker_marker_icon); TextView name = (TextView) tv.findViewById(R.id.tracker_name); name.setText(trackerModel.getName()); ImageView trackerBg = (ImageView) trackerModel.getView().findViewById(R.id.tracker_image_bg); if (trackerModel.isLocationTimeoutAlarmOn()) { image2.setColorFilter(mResources.getColor(R.color.red)); trackerBg.setColorFilter(mResources.getColor(R.color.red)); name.setTextColor(mResources.getColor(R.color.white_effect)); } else {/* www.j a va2 s . co m*/ image2.clearColorFilter(); trackerBg.setColorFilter(mResources.getColor(R.color.green)); name.setTextColor(mResources.getColor(R.color.black_effect)); } tv.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); tv.layout(0, 0, tv.getMeasuredWidth(), tv.getMeasuredHeight()); tv.setDrawingCacheEnabled(true); tv.buildDrawingCache(); Bitmap bm = tv.getDrawingCache(); tv = null; if (trackerModel.getMarker() != null) { trackerModel.getMarker().setIcon(BitmapDescriptorFactory.fromBitmap(bm)); } if (trackerModelWithMarker != null) { if (onChildOnMapView) { trackerModelWithMarker.getMarker().showInfoWindow(); } } } }
From source file:net.hyx.app.volumenotification.activity.ItemViewActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_buttons_item, menu); LinearLayout actionLayout = (LinearLayout) menu.findItem(R.id.item_btn_checked_layout).getActionView(); Switch statusInput = (Switch) actionLayout.findViewById(R.id.menu_item_switch); statusInput.setChecked((frag.item.status == 1)); statusInput.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override//from w w w .j ava2s.c o m public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { frag.item.status = (isChecked) ? 1 : 0; frag.model.saveItem(frag.item); } }); return super.onCreateOptionsMenu(menu); }
From source file:org.ewicom.pps.unitinfo.TabPhonesFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); phoneDataSource = new PhoneDataSource(getActivity()); phoneDataSource.open();/*from w w w. j av a 2 s . c o m*/ LinearLayout phonesLL = (LinearLayout) getView().findViewById(R.id.ll_phones); List<Phone> phones = new ArrayList<Phone>(); phones = phoneDataSource.getPhonesByUnitId(unitID); if (phones != null && !phones.isEmpty()) { Iterator<Phone> iterator = phones.iterator(); while (iterator.hasNext()) { Phone phone = iterator.next(); LinearLayout phoneLL = (LinearLayout) getActivity().getLayoutInflater().inflate(R.layout.phone_ll, null); TextView phoneTypeTV = (TextView) phoneLL.findViewById(R.id.text_phonetype); TextView phoneTV = (TextView) phoneLL.findViewById(R.id.text_phone); phoneTypeTV.setText(phone.getType()); phoneTV.setText(phone.getPhone()); Linkify.addLinks(phoneTV, Linkify.PHONE_NUMBERS); phonesLL.addView(phoneLL); } } }
From source file:com.mediatek.galleryfeature.stereo.segment.background.BackgroundThumbPanel.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LinearLayout main = (LinearLayout) inflater.inflate(R.layout.m_stereo_category_panel_new, container, false); if (savedInstanceState != null) { loadAdapter();/* w w w. j ava 2s.com*/ } View panelView = main.findViewById(R.id.listItems); if (panelView instanceof BackgroundThumbTrack) { BackgroundThumbTrack panel = (BackgroundThumbTrack) panelView; if (mAdapter != null) { mAdapter.setOrientation(BackgroundThumbView.HORIZONTAL); panel.setAdapter(mAdapter); mAdapter.setContainer(panel); } } else if (mAdapter != null) { ListView panel = (ListView) main.findViewById(R.id.listItems); panel.setAdapter(mAdapter); mAdapter.setContainer(panel); } mAddButton = (IconView) main.findViewById(R.id.addButton); if (mAddButton != null) { mAddButton.setVisibility(View.GONE); } return main; }
From source file:org.totschnig.myexpenses.dialog.VersionDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Bundle bundle = getArguments();/*from ww w. j av a2s . c o m*/ Activity ctx = (Activity) getActivity(); LayoutInflater li = LayoutInflater.from(ctx); int from = bundle.getInt("from"); Resources res = getResources(); int[] versionCodes = res.getIntArray(R.array.version_codes); String[] versionNames = res.getStringArray(R.array.version_names); final ArrayList<VersionInfo> versions = new ArrayList<VersionInfo>(); for (int i = 0; i < versionCodes.length; i++) { int code = versionCodes[i]; if (from >= code) break; int resId = res.getIdentifier("whats_new_" + code, "array", ctx.getPackageName()); if (resId == 0) { Log.e(MyApplication.TAG, "missing change log entry for version " + code); } else { String changes[] = res .getStringArray(res.getIdentifier("whats_new_" + code, "array", ctx.getPackageName())); versions.add(new VersionInfo(code, versionNames[i], changes)); } } View view = li.inflate(R.layout.versiondialog, null); final ListView lv = (ListView) view.findViewById(R.id.list); ArrayAdapter<VersionInfo> adapter = new ArrayAdapter<VersionInfo>(ctx, R.layout.version_row, R.id.versionInfoName, versions) { @Override public View getView(int position, View convertView, ViewGroup parent) { LinearLayout row = (LinearLayout) super.getView(position, convertView, parent); VersionInfo version = versions.get(position); ((TextView) row.findViewById(R.id.versionInfoName)).setText(version.name); ((TextView) row.findViewById(R.id.versionInfoChanges)) .setText("- " + TextUtils.join("\n- ", version.changes)); return row; } }; lv.setAdapter(adapter); if (MyApplication.getInstance().showImportantUpgradeInfo) { view.findViewById(R.id.ImportantUpgradeInfoHeading).setVisibility(View.VISIBLE); view.findViewById(R.id.ImportantUpgradeInfoBody).setVisibility(View.VISIBLE); } AlertDialog.Builder builder = new AlertDialog.Builder(ctx) .setTitle(getString(R.string.help_heading_whats_new)).setIcon(R.drawable.icon).setView(view) .setNegativeButton(android.R.string.ok, this); if (!MyApplication.getInstance().isContribEnabled) builder.setPositiveButton(R.string.menu_contrib, this); return builder.create(); }
From source file:com.balieiro.facebook.FriendItem.java
public View getPictureView(LayoutInflater inflater) { if (mPicView == null) { LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.picture_layout, null); mPicView = (ImageView) layout.findViewById(R.id.friend_image); mPictureLoader = new LoadPictureTask(); mPictureLoader.execute();//from w ww . j av a 2 s . com } return mPicView.getRootView(); }
From source file:pl.selvin.android.listsyncsample.ui.ListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // if (container == null) { // return null; // }/*from w w w.j a va 2 s . co m*/ View superroot = super.onCreateView(inflater, container, savedInstanceState); LinearLayout root = (LinearLayout) inflater.inflate(R.layout.list_activity, null); tName = (TextView) root.findViewById(R.id.tName); tDescription = (TextView) root.findViewById(R.id.tDescription); tCreatedDate = (TextView) root.findViewById(R.id.tCreatedDate); root.addView(superroot); if (!isDualPane()) root.findViewById(R.id.header).setVisibility(View.VISIBLE); return root; }
From source file:re.neutrino.kanji_assist.dictionary_popup.DictionaryBackgroundTask.java
private void addTextView(LinearLayout linearLayout, DictionaryParser.Entry i) { LinearLayout definitionLayout = (LinearLayout) View.inflate(context, R.layout.definition, null); TextView word = (TextView) definitionLayout.findViewById(R.id.word); TextView spelling = (TextView) definitionLayout.findViewById(R.id.spelling); String word_text = ""; String spelling_text = ""; for (DictionaryParser.Example j : i.examples) { if (j.getWord() == null) { Log.d(debugName, "null word, skipping"); } else {/* w w w . j av a 2 s .c o m*/ word_text += j.getWord() + "\n"; } if (j.getReading() == null) { Log.d(debugName, "null reading, skipping"); } else { spelling_text += j.getReading() + "\n"; } } word.setText(word_text); spelling.setText(spelling_text); TextView sense = (TextView) definitionLayout.findViewById(R.id.sense); String sense_text = ""; for (DictionaryParser.Sense j : i.senses) { for (String k : j.getDefinitions()) { sense_text += k + "\n"; } } sense.setText(sense_text); definitionLayout.setBackgroundColor(colorRotator.getNextColor()); linearLayout.addView(definitionLayout); }