List of usage examples for android.view ViewGroup removeView
@Override public void removeView(View view)
Note: do not invoke this method from #draw(android.graphics.Canvas) , #onDraw(android.graphics.Canvas) , #dispatchDraw(android.graphics.Canvas) or any related method.
From source file:org.apache.cordova.engine.crosswalk.XWalkCordovaWebView.java
@Override public void hideCustomView() { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 Log.d(TAG, "Hidding Custom View"); if (mCustomView == null) return;//w ww.j a va 2 s. c o m // Hide the custom view. mCustomView.setVisibility(View.GONE); // Remove the custom view from its container. ViewGroup parent = (ViewGroup) webview.getParent(); parent.removeView(mCustomView); mCustomView = null; mCustomViewCallback.onCustomViewHidden(); // Show the content view. webview.setVisibility(View.VISIBLE); }
From source file:org.apache.cordova.CordovaWebViewImpl.java
@Override @Deprecated/*from w w w .java 2 s .c o m*/ public void hideCustomView() { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 if (mCustomView == null) return; Log.d(TAG, "Hiding Custom View"); // Hide the custom view. mCustomView.setVisibility(View.GONE); // Remove the custom view from its container. ViewGroup parent = (ViewGroup) engine.getView().getParent(); parent.removeView(mCustomView); mCustomView = null; mCustomViewCallback.onCustomViewHidden(); // Show the content view. engine.getView().setVisibility(View.VISIBLE); }
From source file:com.mirasense.scanditsdk.plugin.ScanditSDK.java
private void removeSubviewPicker() { cordova.getActivity().runOnUiThread(new Runnable() { public void run() { mBarcodePicker.stopScanning(); ViewGroup viewGroup = getViewGroupToAddTo(); if (viewGroup != null) { viewGroup.removeView(mLayout); }//w w w . jav a 2 s. com mLayout = null; mBarcodePicker = null; } }); }
From source file:org.apache.cordova.X5CordovaWebViewImpl.java
@Override @Deprecated/*from ww w . j ava 2 s . c o m*/ public void hideCustomView() { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 if (mCustomView == null) return; LOG.d(TAG, "Hiding Custom View"); // Hide the custom view. mCustomView.setVisibility(View.GONE); // Remove the custom view from its container. ViewGroup parent = (ViewGroup) engine.getView().getParent(); parent.removeView(mCustomView); mCustomView = null; mCustomViewCallback.onCustomViewHidden(); // Show the content view. engine.getView().setVisibility(View.VISIBLE); }
From source file:widgets.QuizWidget.java
public void showResults() { // log the activity as complete isOnResultsPage = true;//from w w w.ja v a 2s. c o m this.saveTracker(); // save results ready to send back to the quiz server String data = quiz.getResultObject().toString(); DbHelper db = new DbHelper(super.getActivity()); db.insertQuizResult(data, course.getModId()); db.close(); Log.d(TAG, data); // load new layout View C = getView().findViewById(R.id.quiz_progress); ViewGroup parent = (ViewGroup) C.getParent(); int index = parent.indexOfChild(C); parent.removeView(C); C = super.getActivity().getLayoutInflater().inflate(R.layout.widget_quiz_results, parent, false); parent.addView(C, index); TextView title = (TextView) getView().findViewById(R.id.quiz_results_score); title.setText(super.getActivity().getString(R.string.widget_quiz_results_score, this.getPercent())); if (this.isBaseline) { TextView baselineExtro = (TextView) getView().findViewById(R.id.quiz_results_baseline); baselineExtro.setVisibility(View.VISIBLE); baselineExtro.setText(super.getActivity().getString(R.string.widget_quiz_baseline_completed)); } // TODO add TextView here to give overall feedback if it's in the quiz // Show the detail of which questions were right/wrong ListView questionFeedbackLV = (ListView) getView().findViewById(R.id.quiz_results_feedback); ArrayList<QuizFeedback> quizFeedback = new ArrayList<QuizFeedback>(); List<QuizQuestion> questions = this.quiz.getQuestions(); for (QuizQuestion q : questions) { if (!(q instanceof Description)) { QuizFeedback qf = new QuizFeedback(); qf.setScore(q.getScoreAsPercent()); qf.setQuestionText(q.getTitle()); qf.setUserResponse(q.getUserResponses()); qf.setFeedbackText(q.getFeedback()); quizFeedback.add(qf); } } QuizFeedbackAdapter qfa = new QuizFeedbackAdapter(super.getActivity(), quizFeedback); questionFeedbackLV.setAdapter(qfa); // Show restart or continue button Button restartBtn = (Button) getView().findViewById(R.id.quiz_results_button); if (this.isBaseline) { restartBtn.setText(super.getActivity().getString(R.string.widget_quiz_baseline_goto_course)); restartBtn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { QuizWidget.this.getActivity().finish(); } }); } else { restartBtn.setText(super.getActivity().getString(R.string.widget_quiz_results_restart)); restartBtn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { QuizWidget.this.restart(); } }); } }
From source file:com.yahala.ui.LanguageSelectActivity.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (fragmentView == null) { fragmentView = inflater.inflate(R.layout.language_select_layout, container, false); listAdapter = new ListAdapter(parentActivity); listView = (ListView) fragmentView.findViewById(R.id.listView); listView.setAdapter(listAdapter); emptyTextView = (TextView) fragmentView.findViewById(R.id.searchEmptyView); listView.setEmptyView(emptyTextView); searchListViewAdapter = new SearchAdapter(parentActivity); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/* w w w.j a v a2 s .co m*/ public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { if (parentActivity == null) { return; } LocaleController.LocaleInfo localeInfo = null; if (searching && searchWas) { if (i >= 0 && i < searchResult.size()) { localeInfo = searchResult.get(i); } } else { if (i >= 0 && i < LocaleController.getInstance().sortedLanguages.size()) { localeInfo = LocaleController.getInstance().sortedLanguages.get(i); } } if (localeInfo != null) { boolean isRTL = LocaleController.isRTL; LocaleController.getInstance().applyLanguage(localeInfo, true); if (isRTL != LocaleController.isRTL) { for (BaseFragment fragment : ApplicationLoader.fragmentsStack) { if (fragment == LanguageSelectActivity.this) { continue; } if (fragment.fragmentView != null) { ViewGroup parent = (ViewGroup) fragment.fragmentView.getParent(); if (parent != null) { parent.removeView(fragment.fragmentView); } fragment.fragmentView = null; } fragment.parentActivity = parentActivity; } } } ((LaunchActivity) parentActivity).finishFragment(false); finishFragment(); getFragmentManager().popBackStack(); // ((LaunchActivity) parentActivity).updateActionBar(); } }); searching = false; searchWas = false; } else { ViewGroup parent = (ViewGroup) fragmentView.getParent(); if (parent != null) { parent.removeView(fragmentView); } } return fragmentView; }
From source file:com.mk4droid.IMC_Activities.Fragment_NewIssueB.java
/** * on Create View of this fragment/*from w ww. ja va 2 s. com*/ */ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); ctx = this.getActivity(); if (vframeLayout_nib != null) { ViewGroup parent = (ViewGroup) vframeLayout_nib.getParent(); parent.removeView(vframeLayout_nib); } else vframeLayout_nib = inflater.inflate(R.layout.framelayout_newissue_b, container, false); mfrag_nIssueB = this; resources = SetResources(); //-------------------------- if (fmap == null) { fmap = SupportMapFragment.newInstance(); getChildFragmentManager().beginTransaction().add(R.id.flmapnewissue, fmap).commit(); } etAddress = (EditText) vframeLayout_nib.findViewById(R.id.etAddress); etAddress.setCompoundDrawablesWithIntrinsicBounds(resources.getDrawable(R.drawable.ic_location), null, null, null); scr_NIB = (ScrollView) vframeLayout_nib.findViewById(R.id.scrNIB); imv_transparent = (ImageView) vframeLayout_nib.findViewById(R.id.imv_overlaymap_NIB); imv_transparent.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int action = event.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: // Disallow ScrollView to intercept touch events. scr_NIB.requestDisallowInterceptTouchEvent(true); // Disable touch on transparent view return false; case MotionEvent.ACTION_UP: // Allow ScrollView to intercept touch events. scr_NIB.requestDisallowInterceptTouchEvent(false); return true; case MotionEvent.ACTION_MOVE: scr_NIB.requestDisallowInterceptTouchEvent(true); return false; default: return true; } } }); //----- Handler for setting address string ------------ handlerAddresUPD = new Handler() { public void handleMessage(Message msg) { if (msg.arg1 == 2) { // Location not found, get from predefined pos = new LatLng(Constants_API.locUserPred_Lat, Constants_API.locUserPred_Long); gmap.moveCamera(CameraUpdateFactory.newLatLngZoom(pos, 14)); // Cannot zoom to bounds until the map has a size. mMarker = gmap.addMarker( new MarkerOptions().position(pos).title(resources.getString(R.string.Issueposition)) .snippet(resources.getString(R.string.Dragndrop)).draggable(true)); } Lat_D = mMarker.getPosition().latitude; Long_D = mMarker.getPosition().longitude; LatLng pt = new LatLng(Lat_D, Long_D); Address_STR = GEO.ConvertGeoPointToAddress(pt, ctx); if (Address_STR != "") etAddress.setText(Address_STR); progressLoc.dismiss(); super.handleMessage(msg); } }; //-------- Broadcast new Issue was send through a handler --------- handlerBroadcastNewIssue = new Handler() { public void handleMessage(Message msg) { if (msg.arg1 == 1) // Refresh Button ctx.sendBroadcast(new Intent("android.intent.action.MAIN").putExtra("NewIssueAdded", "ok")); super.handleMessage(msg); } }; return vframeLayout_nib; }
From source file:com.example.fansonlib.widget.calendar.MonthSelectLayout.java
void init(int year) { if (isInit) { setCurrentItem(year - mMinYear); return;/*from ww w. jav a2 s. co m*/ } setAdapter(new PagerAdapter() { @Override public int getCount() { return mMaxYear - mMinYear; } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public Object instantiateItem(ViewGroup container, int position) { MonthRecyclerView view = new MonthRecyclerView(getContext()); container.addView(view); view.setOnMonthSelectedListener(mListener); view.setSchemeColor(mSchemeColor); view.init(position + mMinYear); view.setSchemes(mSchemes); return view; } @Override public void destroyItem(ViewGroup container, int position, Object object) { if (object instanceof MonthRecyclerView) container.removeView((MonthRecyclerView) object); } }); isInit = true; setCurrentItem(year - mMinYear); }
From source file:com.ameron32.apps.tapnotes._trial._demo.fragment.FlippableStackViewTestFragment.java
private void initAdapter() { mAdapter = new PagerAdapter() { @Override//w w w.j a v a 2 s . c om public int getCount() { return colors.length; } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public Object instantiateItem(ViewGroup container, int position) { // Object o = super.instantiateItem(container, position); final FrameLayout l = new FrameLayout(container.getContext()); l.setBackgroundColor(getColorFrom(position)); container.addView(l); return l; } private int getColorFrom(int position) { return colors[(getCount() - 1) - position]; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } }; }
From source file:com.dabay6.libraries.androidshared.ui.fragments.LoadingFragment.java
/** * @param view/* ww w .ja v a2s .co m*/ */ public void setContentView(final View view) { afterViews(); if (view == null) { throw new IllegalArgumentException("Content view can't be null"); } if (contentContainer instanceof ViewGroup) { final ViewGroup container = (ViewGroup) contentContainer; if (content == null) { container.addView(view); } else { final int index = container.indexOfChild(content); // replace content view container.removeView(content); container.addView(view, index); } content = view; } else { throw new IllegalStateException("Can't be used with a custom content view"); } }