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.pouyadr.ui.LocationActivity.java
@Override public void onTransitionAnimationEnd(boolean isOpen, boolean backward) { if (isOpen) { try {// ww w .j a va2 s . c o m if (mapView.getParent() instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) mapView.getParent(); viewGroup.removeView(mapView); } } catch (Exception e) { FileLog.e("tmessages", e); } if (mapViewClip != null) { mapViewClip.addView(mapView, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, overScrollHeight + AndroidUtilities.dp(10), Gravity.TOP | Gravity.LEFT)); updateClipView(listView.getFirstVisiblePosition()); } else { ((FrameLayout) fragmentView).addView(mapView, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT)); } } }
From source file:com.momock.binder.container.ViewPagerBinder.java
public void onBind(final ViewPager view, final IDataList<?> dataSource) { if (view != null) { if (refIndicator != null && refIndicator.get() != null) { refIndicator.get().setCount(dataSource.getItemCount()); }//w w w.ja v a 2 s . com view.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { position = adapter instanceof IRoundAdapter ? ((IRoundAdapter) adapter).getRealPosition(position) : position; Object item = dataSource.getItem(position); ItemEventArgs args = new ItemEventArgs(view, position, item); itemSelectedEvent.fireEvent(view, args); if (refIndicator != null && refIndicator.get() != null) { refIndicator.get().setCurrentIndex(position); } } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageScrollStateChanged(int state) { viewPagerState = state; } }); view.setOnTouchListener(new View.OnTouchListener() { GestureDetector detector = null; @Override public boolean onTouch(View v, MotionEvent event) { view.getParent().requestDisallowInterceptTouchEvent(true); if (detector == null) { detector = new GestureDetector(v.getContext(), new GestureDetector.SimpleOnGestureListener() { @Override public boolean onSingleTapConfirmed(MotionEvent e) { Object item = dataSource.getItem(adapter instanceof IRoundAdapter ? ((IRoundAdapter) adapter).getRealPosition(view.getCurrentItem()) : view.getCurrentItem()); ItemEventArgs args = new ItemEventArgs(view, view.getCurrentItem(), item); itemClickedEvent.fireEvent(view, args); return true; } }); } return detector.onTouchEvent(event); } }); adapter = new PagerAdapter() { BlockingQueue<View> savedViews = new LinkedBlockingQueue<View>(); @Override public int getCount() { return dataSource.getItemCount(); } @Override public boolean isViewFromObject(View view, Object object) { return view == ((View) object); } @Override public Object instantiateItem(ViewGroup container, int position) { View convertView = null; if (savedViews.size() > 0) { convertView = savedViews.poll(); } Object item = dataSource.getItem(position); if (convertView != null) convertView.setTag(null); convertView = itemBinder.onCreateItemView(convertView, item, ViewPagerBinder.this); convertView.setTag(item); container.addView(convertView, 0); return convertView; } @Override public void destroyItem(ViewGroup container, int position, Object object) { savedViews.add((View) object); container.removeView((View) object); } long lastDataSetChangedTick = 0; @Override public void notifyDataSetChanged() { lastDataSetChangedTick = System.nanoTime(); getDataChangedEvent().fireEvent(this, new EventArgs()); if (refIndicator != null && refIndicator.get() != null) { refIndicator.get().setCount(dataSource.getItemCount()); } super.notifyDataSetChanged(); Logger.debug("ViewPagerBinder.PagerAdapter.notifyDataSetChanged"); } long updateTick = 0; @Override public void startUpdate(ViewGroup container) { updateTick = System.nanoTime(); super.startUpdate(container); } @Override public void setPrimaryItem(ViewGroup container, int position, Object object) { super.setPrimaryItem(container, position, object); } @Override public void finishUpdate(ViewGroup container) { super.finishUpdate(container); if (lastDataSetChangedTick < updateTick) lastDataSetChangedTick = 0; } @Override public int getItemPosition(Object object) { return lastDataSetChangedTick == 0 ? PagerAdapter.POSITION_UNCHANGED : PagerAdapter.POSITION_NONE; } }; if (round) adapter = new RoundPagerAdapter(adapter); view.setAdapter(adapter); dataSource.addDataChangedHandler(new IEventHandler<DataChangedEventArgs>() { @Override public void process(Object sender, DataChangedEventArgs args) { adapter.notifyDataSetChanged(); } }); if (round) view.setCurrentItem(Math.max(100, dataSource.getItemCount() * 100), false); } }
From source file:org.telegram.ui.ContactsActivity.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (fragmentView == null) { fragmentView = inflater.inflate(R.layout.contacts_layout, container, false); epmtyTextView = (TextView) fragmentView.findViewById(R.id.searchEmptyView); searchListViewAdapter = new SearchAdapter(parentActivity); listView = (PinnedHeaderListView) fragmentView.findViewById(R.id.listView); listView.setEmptyView(epmtyTextView); listView.setVerticalScrollBarEnabled(false); listView.setAdapter(listViewAdapter = new ListAdapter(parentActivity)); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/*w ww .j av a 2s . co m*/ public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { if (searching && searchWas) { TLRPC.User user = searchResult.get(i); if (user.id == UserConfig.clientUserId) { return; } if (returnAsResult) { if (ignoreUsers != null && ignoreUsers.containsKey(user.id)) { return; } didSelectResult(user, true); } else { if (createSecretChat) { creatingChat = true; MessagesController.Instance.startSecretChat(parentActivity, user); } else { ChatActivity fragment = new ChatActivity(); Bundle bundle = new Bundle(); bundle.putInt("user_id", user.id); fragment.setArguments(bundle); ((ApplicationActivity) parentActivity).presentFragment(fragment, "chat" + Math.random(), destroyAfterSelect, false); } } } else { int section = listViewAdapter.getSectionForPosition(i); int row = listViewAdapter.getPositionInSectionForPosition(i); if (row < 0 || section < 0) { return; } TLRPC.User user = null; if (usersAsSections) { if (section < ContactsController.Instance.sortedUsersSectionsArray.size()) { ArrayList<TLRPC.TL_contact> arr = ContactsController.Instance.usersSectionsDict .get(ContactsController.Instance.sortedUsersSectionsArray.get(section)); if (row < arr.size()) { TLRPC.TL_contact contact = arr.get(row); user = MessagesController.Instance.users.get(contact.user_id); } else { return; } } } else { if (section == 0) { if (row == 0) { try { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, inviteText != null ? inviteText : getStringEntry(R.string.InviteText)); startActivity(intent); } catch (Exception e) { FileLog.e("tmessages", e); } return; } else { if (row - 1 < ContactsController.Instance.contacts.size()) { user = MessagesController.Instance.users .get(ContactsController.Instance.contacts.get(row - 1).user_id); } else { return; } } } } if (user != null) { if (user.id == UserConfig.clientUserId) { return; } if (returnAsResult) { if (ignoreUsers != null && ignoreUsers.containsKey(user.id)) { return; } didSelectResult(user, true); } else { if (createSecretChat) { creatingChat = true; MessagesController.Instance.startSecretChat(parentActivity, user); } else { ChatActivity fragment = new ChatActivity(); Bundle bundle = new Bundle(); bundle.putInt("user_id", user.id); fragment.setArguments(bundle); ((ApplicationActivity) parentActivity).presentFragment(fragment, "chat" + Math.random(), destroyAfterSelect, false); } } } else { ArrayList<ContactsController.Contact> arr = ContactsController.Instance.contactsSectionsDict .get(ContactsController.Instance.sortedContactsSectionsArray.get(section - 1)); ContactsController.Contact contact = arr.get(row); String usePhone = null; if (!contact.phones.isEmpty()) { usePhone = contact.phones.get(0); } if (usePhone == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); builder.setMessage(getStringEntry(R.string.InviteUser)); builder.setTitle(getStringEntry(R.string.AppName)); final String arg1 = usePhone; builder.setPositiveButton(getStringEntry(R.string.OK), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", arg1, null)); intent.putExtra("sms_body", getStringEntry(R.string.InviteText)); startActivity(intent); } catch (Exception e) { FileLog.e("tmessages", e); } } }); builder.setNegativeButton(getStringEntry(R.string.Cancel), null); builder.show().setCanceledOnTouchOutside(true); } } } }); listView.setOnTouchListener(new OnSwipeTouchListener() { public void onSwipeRight() { finishFragment(true); if (searchItem != null) { if (searchItem.isActionViewExpanded()) { searchItem.collapseActionView(); } } } }); epmtyTextView.setOnTouchListener(new OnSwipeTouchListener() { public void onSwipeRight() { finishFragment(true); if (searchItem != null) { if (searchItem.isActionViewExpanded()) { searchItem.collapseActionView(); } } } }); } else { ViewGroup parent = (ViewGroup) fragmentView.getParent(); if (parent != null) { parent.removeView(fragmentView); } } return fragmentView; }
From source file:net.quduo.pixel.interfaces.android.activity.GuideActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_guide); // ?????DisplayMetrics? DisplayMetrics DM = new DisplayMetrics(); // ???,???,getDefaultDisplay()???DM,?getMetrics(DM)? getWindowManager().getDefaultDisplay().getMetrics(DM); int wdip = px2dip(getApplicationContext(), getApplicationContext().getResources().getDisplayMetrics().widthPixels); int hdip = px2dip(getApplicationContext(), getApplicationContext().getResources().getDisplayMetrics().heightPixels); LayoutInflater inflater = getLayoutInflater(); views = new ArrayList<View>(); views.add(inflater.inflate(R.layout.layout_guide_item_01, null)); views.add(inflater.inflate(R.layout.layout_guide_item_02, null)); views.add(inflater.inflate(R.layout.layout_guide_item_03, null)); views.add(inflater.inflate(R.layout.layout_guide_item_04, null)); views.add(inflater.inflate(R.layout.layout_guide_item_05, null)); indicators = new ImageView[views.size()]; mViewGroup = (ViewGroup) findViewById(R.id.viewGroup); mViewPager = (ViewPager) findViewById(R.id.view_pager); for (int i = 0; i < views.size(); i++) { mImageView = new ImageView(this); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(20, 20); layoutParams.setMargins(8, 0, 8, 20); mImageView.setLayoutParams(layoutParams); indicators[i] = mImageView;//ww w. jav a 2s . c om mImageView.setBackgroundResource(R.drawable.selector_indicator_view); mImageView.setEnabled(false); if (i == 0) { mImageView.setEnabled(true); } mViewGroup.addView(mImageView); } mViewPager.setAdapter(new PagerAdapter() { @Override public int getCount() { return Integer.MAX_VALUE; } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public int getItemPosition(Object object) { return super.getItemPosition(object); } @Override public Object instantiateItem(ViewGroup container, int position) { ((ViewPager) container).addView(views.get(position % views.size()), 0); return views.get(position % views.size()); } @Override public void restoreState(Parcelable arg0, ClassLoader arg1) { } @Override public Parcelable saveState() { return null; } @Override public void startUpdate(ViewGroup container) { super.startUpdate(container); } @Override public void finishUpdate(ViewGroup container) { super.finishUpdate(container); } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView(views.get(position % views.size())); } }); mViewPager.setOnPageChangeListener(this); mViewPager.setCurrentItem(0); mLoginButton = (Button) findViewById(R.id.login_button); mRegisterButton = (Button) findViewById(R.id.register_button); mLoginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(GuideActivity.this, LoginActivity.class); GuideActivity.this.startActivity(intent); // ? overridePendingTransition(R.anim.activity_open_enter, R.anim.activity_close_exit); GuideActivity.this.finish(); } }); mRegisterButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(GuideActivity.this, RegisterActivity.class); GuideActivity.this.startActivity(intent); // ? overridePendingTransition(R.anim.activity_open_enter, R.anim.activity_close_exit); GuideActivity.this.finish(); } }); }
From source file:$.GooglePlayServicesExtension.java
public void GoogleMobileAds_AddBannerAt(String _bannerId, double _sizeType, double _x, double _y) { final String bannerId = _bannerId; BannerXPos = (int) _x; BannerYPos = (int) _y; int type = (int) (_sizeType + 0.5); switch (type) { case 1://from w ww . j av a 2 s . co m BannerSize = AdSize.BANNER; break; case 2: BannerSize = AdSize.MEDIUM_RECTANGLE; break; case 3: BannerSize = AdSize.FULL_BANNER; break; case 4: BannerSize = AdSize.LEADERBOARD; break; case 5: BannerSize = AdSize.WIDE_SKYSCRAPER; break; default: Log.i("yoyo", "AddBanner illegal banner size type:" + _sizeType); return; } RunnerActivity.ViewHandler.post(new Runnable() { public void run() { AbsoluteLayout layout = (AbsoluteLayout) RunnerActivity.CurrentActivity.findViewById(R.id.ad); ViewGroup vg = (ViewGroup) layout; //remove existing banner if (adView != null) { if (vg != null) { vg.removeView(adView); } adView.destroy(); adView = null; } //create new banner adView = new AdView(RunnerActivity.CurrentActivity); //adView.setAdListener(GoogleMobileAdsExt.this); adView.setAdListener(new AdListener() { /** Called when an ad is loaded. */ @Override public void onAdLoaded() { Log.i("yoyo", "Banner Ad onAdLoaded"); sendBannerLoadedEvent(true); } @Override public void onAdFailedToLoad(int errorCode) { Log.i("yoyo", "Banner Ad onAdFailedToLoad"); sendBannerLoadedEvent(false); } }); SetLayerType(); //adView.setAdSize(AdSize.BANNER); adView.setAdSize(BannerSize); adView.setAdUnitId(bannerId); if (vg != null) { vg.addView((View) adView); AdRequest.Builder builder = new AdRequest.Builder(); builder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR); if (bUseTestAds) builder.addTestDevice(TestDeviceId); AdRequest adRequest = builder.build(); // Start loading the ad in the background. adView.setVisibility(View.INVISIBLE); adView.loadAd(adRequest); } } }); }
From source file:org.catnut.fragment.TweetFragment.java
/** * ??/*from w w w .j av a2s .c o m*/ * * @param thumb url * @param originalUrl url */ private void loadThumbs(String thumb, final String originalUrl, final ImageView thumbs, final JSONArray jsonArray, View overflow) { if (!TextUtils.isEmpty(thumb)) { if (mStayInLatest) { int screenWidth = CatnutUtils.getScreenWidth(getActivity()); Picasso.with(getActivity()).load(thumb).into(thumbs); thumbs.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return CatnutUtils.imageOverlay(v, event); } }); thumbs.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { thumbs.getDrawable().clearColorFilter(); mText.invalidate(); Intent intent = SingleFragmentActivity.getIntent(getActivity(), SingleFragmentActivity.PHOTO_VIEWER); intent.putExtra(Constants.PIC, originalUrl); startActivity(intent); } }); } else { thumbs.setImageResource(R.drawable.error); } thumbs.setVisibility(View.VISIBLE); } else { thumbs.setVisibility(View.GONE); overflow.setVisibility(View.GONE); } if (jsonArray != null && jsonArray.length() > 1) { overflow.setVisibility(View.VISIBLE); overflow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { View view = LayoutInflater.from(getActivity()).inflate(R.layout.tweet_pics, null); LinePageIndicator indicator = (LinePageIndicator) view.findViewById(R.id.indicator); final ViewPager pager = (ViewPager) view.findViewById(R.id.pager); pager.setPageTransformer(true, new PageTransformer.DepthPageTransformer()); pager.setAdapter(new PagerAdapter() { @Override public int getCount() { return jsonArray.length(); } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } @Override public Object instantiateItem(ViewGroup container, int position) { View v = LayoutInflater.from(getActivity()).inflate(R.layout.photo, null); TouchImageView iv = (TouchImageView) v.findViewById(R.id.image); String url = jsonArray.optJSONObject(position).optString(Status.thumbnail_pic); String replace = url.replace(Constants.THUMBNAIL, Status.MEDIUM_THUMBNAIL); Picasso.with(getActivity()).load(replace).into(iv); container.addView(v); return v; } }); indicator.setViewPager(pager); new AlertDialog.Builder( new ContextThemeWrapper(getActivity(), android.R.style.Theme_Holo_Dialog)).setView(view) .setPositiveButton(getString(R.string.original_pics), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ArrayList<Uri> urls = new ArrayList<Uri>(jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { String s = jsonArray.optJSONObject(i) .optString(Status.thumbnail_pic) .replace(Constants.THUMBNAIL, Status.LARGE_THUMBNAIL); urls.add(Uri.parse(s)); } Intent intent = SingleFragmentActivity.getIntent(getActivity(), SingleFragmentActivity.GALLERY); intent.putExtra(GalleryPagerFragment.CUR_INDEX, pager.getCurrentItem()); intent.putExtra(GalleryPagerFragment.URLS, urls); intent.putExtra(GalleryPagerFragment.TITLE, getString(R.string.tweet_pics)); startActivity(intent); } }) .setNegativeButton(getString(R.string.close), null).show(); } }); } else { overflow.setVisibility(View.GONE); } }
From source file:com.yahala.ui.LaunchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); XMPPManager.foreground = false;/*from w w w .j a va 2 s . c o m*/ ApplicationLoader.postInitApplication(); this.setTheme(R.style.Theme_TMessages); try { openAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_in); closeAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_out); } catch (Exception e) { FileLog.e("yahala", e); } // getWindow().setBackgroundDrawableResource(R.drawable.transparent); getWindow().setFormat(PixelFormat.RGB_888); if (!UserConfig.clientActivated) { Intent intent = getIntent(); if (intent != null && intent.getAction() != null && (Intent.ACTION_SEND.equals(intent.getAction()) || intent.getAction().equals(Intent.ACTION_SEND_MULTIPLE))) { finish(); return; } Intent intent2 = new Intent(this, IntroActivity.class); startActivity(intent2); finish(); return; } else { SecurePreferences preferences = new SecurePreferences(this, "preferences", "Blacktow@111", true); String locked = preferences.getString("locked", "false"); String lockedAuthenticated = preferences.getString("clientAuthenticated", "false"); if (locked.equals("true") && lockedAuthenticated.equals("false") && !getIntent().getAction().startsWith("com.yahala.openchat")) { Intent intent = getIntent(); if (intent != null && intent.getAction() != null && (Intent.ACTION_SEND.equals(intent.getAction()) || intent.getAction().equals(Intent.ACTION_SEND_MULTIPLE))) { finish(); return; } Intent intent2 = new Intent(this, UnlockActivity.class); startActivity(intent2); finish(); return; } preferences.put("clientAuthenticated", "false"); //String user = preferences.getString("userId"); } int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { OSUtilities.statusBarHeight = getResources().getDimensionPixelSize(resourceId); } NotificationCenter.getInstance().postNotificationName(702, this); // currentConnectionState = ConnectionsManager.getInstance().connectionState; for (BaseFragment fragment : ApplicationLoader.fragmentsStack) { if (fragment.fragmentView != null) { ViewGroup parent = (ViewGroup) fragment.fragmentView.getParent(); if (parent != null) { parent.removeView(fragment.fragmentView); } fragment.fragmentView = null; } fragment.parentActivity = this; } setContentView(R.layout.application_layout); NotificationCenter.getInstance().addObserver(this, 1234); NotificationCenter.getInstance().addObserver(this, XMPPManager.connectionStateDidChanged); NotificationCenter.getInstance().addObserver(this, XMPPManager.currentUserPresenceDidChanged); //NotificationCenter.getInstance().addObserver(this, 701); NotificationCenter.getInstance().addObserver(this, 702); /* NotificationCenter.getInstance().addObserver(this, 703);*/ // NotificationCenter.getInstance().addObserver(this, XmppManager.connectionSuccessful); // NotificationCenter.getInstance().addObserver(this, 1003); // NotificationCenter.getInstance().addObserver(this, GalleryImageViewer.needShowAllMedia); ////getSupportActionBar().setLogo(R.drawable.ab_icon_fixed2); /* statusView = getLayoutInflater().inflate(R.layout.updating_state_layout, null); statusBackground = statusView.findViewById(R.id.back_button_background); backStatusButton = statusView.findViewById(R.id.back_button); containerView = findViewById(R.id.container); statusText = (TextView)statusView.findViewById(R.id.status_text);*/ connectionStatusLayout = (LinearLayout) findViewById(R.id.connection_status_layout); connectionStatus = (TextView) findViewById(R.id.connection_status); /* statusBackground.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (ApplicationLoader.fragmentsStack.size() > 1) { onBackPressed(); } } });*/ if (XMPPManager.getInstance().connectionState == ConnectionState.ONLINE) { connectionStatusLayout.setVisibility(View.GONE); } if (ApplicationLoader.fragmentsStack.isEmpty()) { MainActivity fragment = new MainActivity(); fragment.onFragmentCreate(); ApplicationLoader.fragmentsStack.add(fragment); } // savedInstanceState != null ===>>> possible orientation change /* if (savedInstanceState != null && savedInstanceState.containsKey("StatusLayoutIsShowing")) { connectionStatusLayout.setVisibility(View.VISIBLE); } else { connectionStatusLayout.setVisibility(View.GONE); }*/ handleIntent(getIntent(), false, savedInstanceState != null); }
From source file:com.juce.JuceAppActivity.java
public final void deleteView (ComponentPeerView view) { ViewGroup group = (ViewGroup) (view.getParent()); if (group != null) group.removeView (view); }
From source file:com.juce.JuceAppActivity.java
public final void deleteNativeSurfaceView (NativeSurfaceView view) { ViewGroup group = (ViewGroup) (view.getParent()); if (group != null) group.removeView (view); }
From source file:im.neon.fragments.VectorRecentsListFragment.java
/** * The drag ends./* ww w .j a v a 2 s.c om*/ */ public void onDrop() { // check if the list wad in drag & drop mode if (null != mDraggedView) { // remove the overlay child view ViewGroup viewParent = (ViewGroup) mDraggedView.getParent(); viewParent.removeView(mDraggedView); mDraggedView = null; // hide the overlay layout mSelectedCellLayout.setVisibility(View.GONE); // same place, nothing to do if ((mOriginGroupPosition == mDestGroupPosition) && (mOriginChildPosition == mDestChildPosition)) { stopDragAndDropMode(); } // move in no tag sections else if (mAdapter.isNoTagRoomPosition(mOriginGroupPosition) && mAdapter.isNoTagRoomPosition(mDestGroupPosition)) { // nothing to do, there is no other stopDragAndDropMode(); } else if (!groupIsMovable(mDestGroupPosition)) { // cannot move in the expected group stopDragAndDropMode(); } else { // retrieve the moved summary RoomSummary roomSummary = mAdapter.getRoomSummaryAt(mDestGroupPosition, mDestChildPosition); // its tag String dstRoomTag = roomTagAt(mDestGroupPosition); // compute the new tag order int oldPos = (mOriginGroupPosition == mDestGroupPosition) ? mOriginChildPosition : Integer.MAX_VALUE; Double tagOrder = mSession.tagOrderToBeAtIndex(mDestChildPosition, oldPos, dstRoomTag); updateRoomTag(mSession, roomSummary.getRoomId(), tagOrder, dstRoomTag); } } }