List of usage examples for android.view ViewGroup findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:gr.sepals.eshop.info.gui.SyncSlidePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_info_sync, container, false); if (getResources().getBoolean(R.bool.isTablet)) { title = (TextView) rootView.findViewById(R.id.info_sync_title_textview); Typeface titleFont = Typeface.createFromAsset(getActivity().getAssets(), "fonts/GFS_Pyrsos.otf"); title.setTypeface(titleFont, Typeface.BOLD); }/* w ww .ja v a 2 s .c om*/ desc = (TextView) rootView.findViewById(R.id.info_sync_description_textview); Typeface descFont = Typeface.createFromAsset(getActivity().getAssets(), "fonts/GFS_Goschen-Italic.otf"); desc.setTypeface(descFont); memoryOption = (RadioGroup) rootView.findViewById(R.id.memory_radioGroup); internal = (RadioButton) rootView.findViewById(R.id.internal_memory_radiobutton); internal.setTypeface(descFont); internal.setOnClickListener(this); embedded = (RadioButton) rootView.findViewById(R.id.embedded_memory_radiobutton); embedded.setTypeface(descFont); embedded.setOnClickListener(this); removable = (RadioButton) rootView.findViewById(R.id.removable_memory_radiobutton); //check if there is sdcard port at device if (DeviceOptionsHandler.checkAvailableExternalMemory(getActivity()) == -1) { memoryOption.removeView(removable); } else { removable.setTypeface(descFont); removable.setOnClickListener(this); } sync = (Button) rootView.findViewById(R.id.sync_button); sync.setOnClickListener(this); exit = (Button) rootView.findViewById(R.id.exit_button); exit.setOnClickListener(this); // update the fragment content String selectedStorage = Settings.getString(getActivity(), InternalDatabaseKeys.PRODUCTS_DB_STORAGE_OPTION, InternalDatabasePredefinedValues.PRODUCTS_DB_NONE_STORAGE); if (selectedStorage.equals(InternalDatabasePredefinedValues.PRODUCTS_DB_INTERNAL_STORAGE)) { memoryOption.check(R.id.internal_memory_radiobutton); sync.setEnabled(true); } else if (selectedStorage.equals(InternalDatabasePredefinedValues.PRODUCTS_DB_EMBEDDED_STORAGE)) { memoryOption.check(R.id.embedded_memory_radiobutton); sync.setEnabled(true); } else if (selectedStorage.equals(InternalDatabasePredefinedValues.PRODUCTS_DB_REMOVABLE_STORAGE)) { memoryOption.check(R.id.removable_memory_radiobutton); sync.setEnabled(true); } else { sync.setEnabled(false); } return rootView; }
From source file:com.ijunes.transitions.StoryDetailActivity.java
/** * Given a view group, then populate with the content from the node which has been loaded * into mItem/*from www . j ava 2s . co m*/ * @param viewGroup The ViewGroup to populate with the content */ private void addContentToViewGroup(ViewGroup viewGroup) { if (mItem != null) { TextView contentTextView = (TextView) viewGroup.findViewById(R.id.item1); if (contentTextView != null) { contentTextView.setText(getResources().getText(mItem.contentResourceId)); } ListView contentListView = (ListView) findViewById(R.id.story_detail_list); if (contentListView instanceof ParallaxListView) { View galleryLayout = null; if (tabPosition == 1) { galleryLayout = getLayoutInflater().inflate(R.layout.header_layout, null); } else if (tabPosition == 0) { galleryLayout = getLayoutInflater().inflate(R.layout.header_layout_small, null); } if (galleryLayout != null) { ImageView imageView = (ImageView) galleryLayout.findViewById(R.id.story_image); imageView.setOnClickListener(this); ((ParallaxListView) contentListView).addParallaxedHeaderView(galleryLayout); } } TextView titleTextView = (TextView) viewGroup.findViewById(R.id.item2); if (titleTextView != null) { titleTextView.setText(mItem.title); } } }
From source file:behsaman.storytellerandroid.ScreenSlidePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container, false); // Set the title view to show the page number. ((TextView) rootView.findViewById(android.R.id.text1)).setText( //getString(R.string.title_template_step, mPageNumber + 1)); "Piece " + dataModel.getIndex()); ((TextView) rootView.findViewById(R.id.textview_fragment_textviewer)).setText(this.dataModel.getText_val()); final ImageView imgView = (ImageView) rootView.findViewById(R.id.imageViewComic); //Comics has picture as well if (storyType == STORY_TYPE.TEXT_ONLY) imgView.setVisibility(View.INVISIBLE); else {//from w w w. j a v a 2 s .c o m //Load picture //dataModel.get // Start downloading piece one and show progress bar ServerIO.getInstance().download(dataModel.getPicture_file_addr(), new MyBinaryHttpResponseHandler() { @Override public void onFailure(int statusCode, Header[] headers, byte[] binaryData, Throwable error) { Log.e(TAG, "FAILLLEEEDDD:" + error.getMessage() + "\tStatusCode:" + statusCode + "\tBinaryData:" + binaryData); ServerIO.getInstance().connectionError(parentContext); } @Override public void onSuccess(int statusCode, Header[] headers, byte[] binaryData) { String dir = Utils.getCacheDir(parentContext).getAbsolutePath(); File f = new File( dir + "/" + dataModel.getStory_id().toString() + dataModel.getId().toString()); try { FileOutputStream writer = new FileOutputStream(f); writer.write(binaryData); writer.close(); FileInputStream inStream = new FileInputStream(f); Bitmap bitmap_skip = BitmapFactory.decodeStream(inStream); imgView.setImageBitmap(bitmap_skip); } catch (Exception e) { Log.e(TAG, e.getMessage()); } } }); } return rootView; }
From source file:com.collabora.xwperf.notxw_contacts.fragments.MainFragment.java
private TabHost.TabSpec newTab(String tabId, String tabCaption, int imgResId) { TabHost.TabSpec tabSpec = tabHost.newTabSpec(tabId); ViewGroup tab = (ViewGroup) getLayoutInflater(Bundle.EMPTY).inflate(R.layout.view_tabwidget_tab, null); TextView tabTextView = ((TextView) tab.findViewById(R.id.tab_text)); tabTextView.setText(tabCaption);//from w w w.j av a2 s . com tabTextView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(imgResId), null, null, null); tabSpec.setIndicator(tab); tabSpec.setContent(getContainerViewId(tabId)); return tabSpec; }
From source file:gov.wa.wsdot.android.wsdot.ui.camera.CameraListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Bundle args = getActivity().getIntent().getExtras(); cameraIds = args.getIntArray("cameraIds"); cameraUrls = args.getStringArray("cameraUrls"); ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_recycler_with_spinner, null); mRecyclerView = (RecyclerView) root.findViewById(R.id.my_recycler_view); mRecyclerView.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(getActivity()); mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); mRecyclerView.setLayoutManager(mLayoutManager); mAdapter = new CameraGroupImageAdapter(getActivity(), null); mRecyclerView.setAdapter(mAdapter);/*from w w w . ja va2s.com*/ mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(getActivity())); // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity. root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mLoadingSpinner = root.findViewById(R.id.loading_spinner); mEmptyView = root.findViewById(R.id.empty_list_view); return root; }
From source file:gov.wa.wsdot.android.wsdot.ui.ferries.bulletins.FerriesRouteAlertsBulletinDetailsFragment.java
@SuppressLint("SetJavaScriptEnabled") @Override/*from ww w .j a v a 2s. c o m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview_with_spinner, null); mLoadingSpinner = root.findViewById(R.id.loading_spinner); mLoadingSpinner.setVisibility(View.VISIBLE); webview = root.findViewById(R.id.webview); webview.setWebViewClient(new myWebViewClient()); webview.getSettings().setJavaScriptEnabled(true); disableAds(root); viewModel = ViewModelProviders.of(this, viewModelFactory).get(FerriesBulletinsViewModel.class); viewModel.init(mRouteId, mAlertId); viewModel.getResourceStatus().observe(this, resourceStatus -> { if (resourceStatus != null) { switch (resourceStatus.status) { case LOADING: mLoadingSpinner.setVisibility(View.VISIBLE); break; case SUCCESS: if (mAlertFullText == null) { mContent = "<p>Sorry, this bulletin has expired.</p>"; webview.loadDataWithBaseURL(null, mContent, "text/html", "utf-8", null); } break; case ERROR: if (mAlertFullText == null) { mLoadingSpinner.setVisibility(View.GONE); mContent = "<p>Connection error, failed to load bulletin.</p>"; webview.loadDataWithBaseURL(null, mContent, "text/html", "utf-8", null); } else { Toast.makeText(getContext(), "Connection error", Toast.LENGTH_LONG).show(); } } } }); viewModel.getAlert().observe(this, alert -> { if (alert != null) { Date date = new Date(Long.parseLong(alert.getPublishDate())); mAlertPublishDate = displayDateFormat.format(date); mAlertDescription = alert.getAlertDescription(); mAlertFullText = alert.getAlertFullText(); mAlertFullTitle = alert.getAlertFullTitle(); mContent = formatText(mAlertPublishDate, mAlertDescription, mAlertFullText); webview.loadDataWithBaseURL(null, mContent, "text/html", "utf-8", null); } }); return root; }
From source file:de.devmil.common.ui.color.HistorySelectorView.java
private void makeColorList() { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout colorlist = (LinearLayout) findViewById(R.id.colorlist); if (colors == null || colors.length() <= 0) { View nocolors = findViewById(R.id.nocolors); nocolors.setVisibility(View.VISIBLE); colorlist.setVisibility(View.GONE); findViewById(R.id.colorlistscroll).setVisibility(View.GONE); //have to remove it's parent container too return;//from www . j a v a2s .c o m } try { for (int i = colors.length() - 1; i >= 0; i--) { final int color = colors.getInt(i); ViewGroup boxgroup = (ViewGroup) inflater.inflate(R.layout.color_historyview_item, colorlist, false); TextView box = (TextView) boxgroup.findViewById(R.id.colorbox); box.setBackgroundColor(color); //box.setText("#"+Integer.toHexString(color)); colorlist.addView(boxgroup); box.setOnClickListener(new OnClickListener() { public void onClick(View v) { setColor(color); onColorChanged(); } }); } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.jeremy.tripcord.main.TripcordFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_tripcord, container, false); listViewTripHistory = (ListView) rootView.findViewById(R.id.list); listViewTripHistory.setOverScrollMode(ListView.OVER_SCROLL_NEVER); slidingUpPanelLayout = (SlidingUpPanelLayout) rootView.findViewById(R.id.slidingLayout); slidingUpPanelLayout.setEnableDragViewTouchEvents(true); int mapHeight = getResources().getDimensionPixelSize(R.dimen.map_height); slidingUpPanelLayout.setPanelHeight(mapHeight); // you can use different height here slidingUpPanelLayout.setScrollableView(listViewTripHistory, mapHeight); slidingUpPanelLayout.setPanelSlideListener(this); // transparent view at the top of ListView transparentView = rootView.findViewById(R.id.transparentView); // init header view for ListView transparentHeaderView = LayoutInflater.from(getActivity()).inflate(R.layout.transparent_header_view, null, false);// w ww. j a va 2 s .co m spaceView = transparentHeaderView.findViewById(R.id.space); ArrayList<String> testData = new ArrayList<String>(100); for (int i = 0; i < 100; i++) { testData.add("Item " + i); } listViewTripHistory.addHeaderView(transparentHeaderView); listViewTripHistory .setAdapter(new ArrayAdapter<String>(getActivity(), R.layout.simple_list_item, testData)); listViewTripHistory.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { slidingUpPanelLayout.collapsePane(); } }); collapseMap(); mapFragment = MapFragment.newInstance(); FragmentTransaction fragmentTransaction = getActivity().getFragmentManager().beginTransaction(); fragmentTransaction.add(R.id.mapContainer, mapFragment, "map"); fragmentTransaction.commit(); setUpMapIfNeeded(); return rootView; }
From source file:com.jaspersoft.android.jaspermobile.dialog.PageDialogFragment.java
@NonNull @Override//from w w w .j a va 2s.c o m public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); ViewGroup customView = (ViewGroup) layoutInflater.inflate(R.layout.page_dialog_layout, (ViewGroup) getActivity().getWindow().getDecorView(), false); final EditText numberEditText = (EditText) customView.findViewById(R.id.customNumber); builder.setTitle(R.string.rv_select_page); builder.setView(customView); builder.setNegativeButton(android.R.string.cancel, null); builder.setPositiveButton(android.R.string.ok, null); final AlertDialog dialog = builder.create(); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialogInterface) { numberEditText.requestFocus(); inputMethodManager.showSoftInput(numberEditText, 0); dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (numberEditText.length() == 0) { numberEditText.setError(getString(R.string.sp_error_field_required)); } else { int page; try { page = Integer.valueOf(numberEditText.getText().toString()); } catch (NumberFormatException ex) { page = Integer.MAX_VALUE; numberEditText.setText(String.valueOf(page)); } if (onPageSelectedListener != null) { onPageSelectedListener.onPageSelected(page); dismiss(); } } } }); } }); return dialog; }
From source file:com.zerobyte.lifesync.ScreenSlidePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.event_page, container, false); // Set the title view to show the page number. TextView pageNumber = (TextView) rootView.findViewById(R.id.pageNumber); int pos = mPageNumber + 1; pageNumber.setText("Event " + pos + " of " + schedule_id_list.size()); ScheduleEvent se = schedule_data.get(schedule_id_list.get(mPageNumber)); TextView eventName = (TextView) rootView.findViewById(R.id.eventName); TextView eventLocation = (TextView) rootView.findViewById(R.id.eventLocation); TextView eventDescription = (TextView) rootView.findViewById(R.id.eventDescription); TextView eventOwner = (TextView) rootView.findViewById(R.id.eventOwner); eventName.setText(se.getEvent_name()); eventLocation.setText(se.getEvent_location()); eventDescription.setText(se.getEvent_description()); if (se.getEvent_owner() == user.getUserid()) { eventOwner.setText("Self"); } else {// w w w . j a v a 2 s. c o m for (User u : lfapp.getFriendlist()) { if (u.getUserid() == se.getEvent_owner()) { eventOwner.setText(u.getFirst_name() + " " + u.getLast_name()); break; } } // eventOwner.setText("Other"); // eventOwner.setText(se.getEvent_owner()); } String event_start_time_str[] = se.getEvent_start_time().split("-"); String event_end_time_str[] = se.getEvent_end_time().split("-"); int[] event_start_time = new int[2]; int[] event_end_time = new int[2]; event_start_time[0] = Integer.parseInt(event_start_time_str[0]); event_start_time[1] = Integer.parseInt(event_start_time_str[1]); event_end_time[0] = Integer.parseInt(event_end_time_str[0]); event_end_time[1] = Integer.parseInt(event_end_time_str[1]); String[] day_of_week = getResources().getStringArray(R.array.day_of_week); String[] time_of_day = getResources().getStringArray(R.array.time_of_day); TextView eventStart = (TextView) rootView.findViewById(R.id.eventStart); TextView eventEnd = (TextView) rootView.findViewById(R.id.eventEnd); eventStart.setText(day_of_week[event_start_time[0]] + " " + time_of_day[event_start_time[1]]); eventEnd.setText(day_of_week[event_end_time[0]] + " " + time_of_day[event_end_time[1]]); return rootView; }