Remove the tab slider, and go back to simply using a touchable title bar.

Remove the tab slider (TitleBarSet) from eclair.

In TitleBar, override onTouchEvent to handle touches as either presses
of the right button or the textfield.  Fix the press states on the
title bar to correctly reflect what will happen if you release your
finger.

Change-Id: I025b55e5ba546e8be4e9360e6f7db80fb6d9d3f9
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 4188fc7..0cecd85 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -90,7 +90,6 @@
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
-import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.Window;
@@ -332,7 +331,7 @@
         mCustomViewContainer = (FrameLayout) mBrowserFrameLayout
                 .findViewById(R.id.fullscreen_custom_content);
         frameLayout.addView(mBrowserFrameLayout, COVER_SCREEN_PARAMS);
-        mTitleBar = new TitleBarSet(this);
+        mTitleBar = new TitleBar(this);
 
         // Create the tab control and our initial tab
         mTabControl = new TabControl(this);
@@ -474,15 +473,6 @@
             attachTabToContentView(mTabControl.getCurrentTab());
         }
 
-        mTitleBar.init(this);
-        // Create title bars for all of the tabs that have been created
-        for (int i = 0; i < mTabControl.getTabCount(); i ++) {
-            WebView view = mTabControl.getTab(i).getWebView();
-            mTitleBar.addTab(view, false);
-        }
-
-        mTitleBar.setCurrentTab(mTabControl.getCurrentIndex());
-
         // Read JavaScript flags if it exists.
         String jsFlags = mSettings.getJsFlags();
         if (jsFlags.trim().length() != 0) {
@@ -503,7 +493,6 @@
                 return;
             }
             mTabControl.setCurrentTab(current);
-            mTitleBar.setCurrentTab(mTabControl.getTabIndex(current));
             attachTabToContentView(current);
             resetTitleAndIcon(current.getWebView());
         }
@@ -948,32 +937,11 @@
     private void showFakeTitleBar() {
         if (mFakeTitleBar == null || mActiveTabsPage != null) {
             final WebView webView = getTopWindow();
-            mFakeTitleBar = new TitleBar(this, webView);
+            mFakeTitleBar = new TitleBar(this);
             mFakeTitleBar.setTitleAndUrl(null, webView.getUrl());
             mFakeTitleBar.setProgress(webView.getProgress());
             mFakeTitleBar.setFavicon(webView.getFavicon());
             updateLockIconToLatest();
-            final View title = mFakeTitleBar.findViewById(R.id.title);
-            mFakeTitleBar.setOnTouchListener(new View.OnTouchListener() {
-                    public boolean onTouch(View v, MotionEvent event) {
-                        if (event.getAction() == MotionEvent.ACTION_UP) {
-                            if (event.getX() > title.getRight()) {
-                                if (webView != null
-                                        && webView.getProgress() < 100) {
-                                    if (webView != null) {
-                                        webView.stopLoading();
-                                    }
-                                } else {
-                                    bookmarksOrHistoryPicker(false);
-                                }
-                            } else {
-                                onSearchRequested();
-                            }
-                            closeOptionsMenu();
-                        }
-                        return true;
-                    }
-            });
 
             WindowManager manager
                     = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
@@ -1337,6 +1305,7 @@
      */
     @Override
     public boolean onSearchRequested() {
+        if (mOptionsMenuOpen) closeOptionsMenu();
         String url = (getTopWindow() == null) ? null : getTopWindow().getUrl();
         startSearch(mSettings.getHomePage().equals(url) ? null : url, true,
                 createGoogleSearchSourceBundle(GOOGLE_SEARCH_SOURCE_SEARCHKEY), false);
@@ -1375,7 +1344,6 @@
         removeTabFromContentView(tab);
         mTabControl.setCurrentTab(tab);
         attachTabToContentView(tab);
-        mTitleBar.setCurrentTab(index);
         resetTitle();
         return true;
     }
@@ -1852,7 +1820,6 @@
             final TabControl.Tab tab = mTabControl.createNewTab(
                     closeOnExit, appId, urlData.mUrl);
             WebView webview = tab.getWebView();
-            mTitleBar.addTab(webview, true);
             // If the last tab was removed from the active tabs page, currentTab
             // will be null.
             if (currentTab != null) {
@@ -1882,7 +1849,6 @@
             TabControl.Tab t = mTabControl.createNewTab();
             if (t != null) {
                 WebView view = t.getWebView();
-                mTitleBar.addTab(view, false);
                 view.loadUrl(url);
             }
             return t;
@@ -1967,10 +1933,10 @@
     private void resetTitleAndIcon(WebView view) {
         WebHistoryItem item = view.copyBackForwardList().getCurrentItem();
         if (item != null) {
-            setUrlTitle(item.getUrl(), item.getTitle(), view);
+            setUrlTitle(item.getUrl(), item.getTitle());
             setFavicon(item.getFavicon());
         } else {
-            setUrlTitle(null, null, view);
+            setUrlTitle(null, null);
             setFavicon(null);
         }
     }
@@ -1980,11 +1946,11 @@
      * @param url The URL of the site being loaded.
      * @param title The title of the site being loaded.
      */
-    private void setUrlTitle(String url, String title, WebView view) {
+    private void setUrlTitle(String url, String title) {
         mUrl = url;
         mTitle = title;
 
-        mTitleBar.setTitleAndUrl(title, url, view);
+        mTitleBar.setTitleAndUrl(title, url);
         if (mFakeTitleBar != null) {
             mFakeTitleBar.setTitleAndUrl(title, url);
         }
@@ -2029,7 +1995,7 @@
 
     // Set the favicon in the title bar.
     private void setFavicon(Bitmap icon) {
-        mTitleBar.setFavicon(icon, getTopWindow());
+        mTitleBar.setFavicon(icon);
         if (mFakeTitleBar != null) {
             mFakeTitleBar.setFavicon(icon);
         }
@@ -2067,7 +2033,6 @@
     /* package */ void closeTab(TabControl.Tab t) {
         int currentIndex = mTabControl.getCurrentIndex();
         int removeIndex = mTabControl.getTabIndex(t);
-        mTitleBar.removeTab(removeIndex);
         mTabControl.removeTab(t);
         if (currentIndex >= removeIndex && currentIndex != 0) {
             currentIndex--;
@@ -2122,7 +2087,6 @@
                     pauseWebViewTimers();
                     mActivityInPause = savedState;
                     removeTabFromContentView(current);
-                    mTitleBar.removeTab(mTabControl.getTabIndex(current));
                     mTabControl.removeTab(current);
                 }
                 /*
@@ -2213,7 +2177,7 @@
         return mKeyTracker.doKeyUp(keyCode, event) || super.onKeyUp(keyCode, event);
     }
 
-    private void stopLoading() {
+    /* package */ void stopLoading() {
         resetTitleAndRevertLockIcon();
         WebView w = getTopWindow();
         w.stopLoading();
@@ -2380,7 +2344,7 @@
         @Override
         public void onPageStarted(WebView view, String url, Bitmap favicon) {
             resetLockIcon(url);
-            setUrlTitle(url, null, view);
+            setUrlTitle(url, null);
 
             ErrorConsoleView errorConsole = mTabControl.getCurrentErrorConsole(false);
             if (errorConsole != null) {
@@ -3080,7 +3044,7 @@
 
         @Override
         public void onProgressChanged(WebView view, int newProgress) {
-            mTitleBar.setProgress(newProgress, view);
+            mTitleBar.setProgress(newProgress);
             if (mFakeTitleBar != null) {
                 mFakeTitleBar.setProgress(newProgress);
             }
@@ -3118,7 +3082,7 @@
             String url = view.getUrl();
 
             // here, if url is null, we want to reset the title
-            setUrlTitle(url, title, view);
+            setUrlTitle(url, title);
 
             if (url == null ||
                 url.length() >= SQLiteDatabase.SQLITE_MAX_LIKE_PATTERN_LENGTH) {
@@ -3498,7 +3462,7 @@
         } else if (lockIconType == LOCK_ICON_MIXED) {
             d = mMixLockIcon;
         }
-        mTitleBar.setLock(d, getTopWindow());
+        mTitleBar.setLock(d);
         if (mFakeTitleBar != null) {
             mFakeTitleBar.setLock(d);
         }
@@ -4329,7 +4293,7 @@
 
     private Toast mStopToast;
 
-    private TitleBarSet mTitleBar;
+    private TitleBar mTitleBar;
 
     private LinearLayout mErrorConsoleContainer = null;
     private boolean mShouldShowErrorConsole = false;
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index 857aa38..9c3e55a 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -28,8 +28,9 @@
 import android.graphics.drawable.PaintDrawable;
 import android.util.TypedValue;
 import android.view.LayoutInflater;
+import android.view.MotionEvent;
 import android.view.View;
-import android.webkit.WebView;
+import android.view.ViewConfiguration;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.ProgressBar;
@@ -50,12 +51,12 @@
     private Drawable        mStopDrawable;
     private Drawable        mBookmarkDrawable;
     private boolean         mInLoad;
-    private WebView         mWebView;
     private BrowserActivity mBrowserActivity;
     private Drawable        mGenericFavicon;
     private int             mIconDimension;
+    private View            mTitleBg;
 
-    public TitleBar(BrowserActivity context, WebView webview) {
+    public TitleBar(BrowserActivity context) {
         super(context, null);
         LayoutInflater factory = LayoutInflater.from(context);
         factory.inflate(R.layout.title_bar, this);
@@ -64,6 +65,7 @@
         mTitle = (TextView) findViewById(R.id.title);
         mTitle.setCompoundDrawablePadding(5);
 
+        mTitleBg = findViewById(R.id.title_bg);
         mLockIcon = (ImageView) findViewById(R.id.lock);
         mFavicon = (ImageView) findViewById(R.id.favicon);
 
@@ -77,16 +79,63 @@
         mCircularProgress.setBounds(0, 0, mIconDimension, mIconDimension);
         mHorizontalProgress = (ProgressBar) findViewById(
                 R.id.progress_horizontal);
-        mWebView = webview;
         mGenericFavicon = context.getResources().getDrawable(
                 R.drawable.app_web_browser_sm);
     }
 
-    /**
-     * Return the WebView associated with this TitleBar.
-     */
-    /* package */ WebView getWebView() {
-        return mWebView;
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        switch (event.getAction()) {
+            case MotionEvent.ACTION_DOWN:
+                // Make all touches hit either the textfield or the button,
+                // depending on which side of the right edge of the textfield
+                // they hit.
+                if ((int) event.getX() > mTitleBg.getRight()) {
+                    mRtButton.setPressed(true);
+                } else {
+                    mTitleBg.setPressed(true);
+                }
+                break;
+            case MotionEvent.ACTION_MOVE:
+                int slop = ViewConfiguration.get(mBrowserActivity)
+                        .getScaledTouchSlop();
+                if ((int) event.getY() > getHeight() + slop) {
+                    // We only trigger the actions in ACTION_UP if one or the
+                    // other is pressed.  Since the user moved off the title
+                    // bar, mark both as not pressed.
+                    mTitleBg.setPressed(false);
+                    mRtButton.setPressed(false);
+                    break;
+                }
+                int x = (int) event.getX();
+                int titleRight = mTitleBg.getRight();
+                if (mTitleBg.isPressed() && x > titleRight + slop) {
+                    mTitleBg.setPressed(false);
+                } else if (mRtButton.isPressed() && x < titleRight - slop) {
+                    mRtButton.setPressed(false);
+                }
+                break;
+            case MotionEvent.ACTION_CANCEL:
+                mRtButton.setPressed(false);
+                mTitleBg.setPressed(false);
+                break;
+            case MotionEvent.ACTION_UP:
+                if (mRtButton.isPressed()) {
+                    if (mInLoad) {
+                        mBrowserActivity.stopLoading();
+                    } else {
+                        mBrowserActivity.bookmarksOrHistoryPicker(false);
+                    }
+                    mRtButton.setPressed(false);
+                } else if (mTitleBg.isPressed()) {
+                    mBrowserActivity.onSearchRequested();
+                    mTitleBg.setPressed(false);
+                }
+                break;
+            default:
+                break;
+        }
+        return true;
     }
 
     /**
diff --git a/src/com/android/browser/TitleBarSet.java b/src/com/android/browser/TitleBarSet.java
deleted file mode 100644
index 316436b..0000000
--- a/src/com/android/browser/TitleBarSet.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.browser;
-
-import android.content.Context;
-import android.database.DataSetObserver;
-import android.graphics.Bitmap;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.webkit.WebView;
-import android.widget.AdapterView;
-import android.widget.Gallery;
-import android.widget.SpinnerAdapter;
-
-import java.util.Vector;
-
-/**
- * The TitleBarSet holds a TitleBar for each open "tab" in the browser.
- */
-public class TitleBarSet extends Gallery
-        implements AdapterView.OnItemSelectedListener {
-    private Vector<TitleBar>    mTitleBars;
-    private BrowserActivity     mBrowserActivity;
-    private int                 mCount;
-    private TitleAdapter        mTitleAdapter;
-    private boolean             mIgnoreSelectedListener;
-    private MotionEvent         mLastTouchUp;
-
-    public TitleBarSet(Context context) {
-        this(context, null);
-    }
-
-    public TitleBarSet(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        mTitleBars = new Vector<TitleBar>(TabControl.MAX_TABS);
-        mCount = 0;
-        mTitleAdapter = new TitleAdapter();
-        setAdapter(mTitleAdapter);
-        setCallbackDuringFling(false);
-        setCallbackOnUnselectedItemClick(true);
-        setSpacing(0);
-        setOnItemSelectedListener(this);
-        setBackgroundResource(R.drawable.tab_browser_unselected);
-        setPadding(0,0,0,0);
-    }
-
-    /**
-     * Add a tab/titlebar to our set.  Called when BrowserActivity adds a new
-     * Tab to its TabControl.
-     * @param view WebView associated with this tab.  Used to determine whether
-     *             updates are going to the correct place.
-     * @param selected Whether to set the new tab to be selected.
-     */
-    /* package */ void addTab(WebView view, boolean selected) {
-        if (TabControl.MAX_TABS == mCount) {
-            return;
-        }
-        int newSelection = mCount;
-        int oldSelection = getSelectedItemPosition();
-        TitleBar titleBar = new TitleBar(mBrowserActivity, view);
-        mTitleBars.add(titleBar);
-        mCount++;
-        // Need to refresh our list
-        setAdapter(mTitleAdapter);
-        setCurrentTab(selected ? newSelection : oldSelection);
-    }
-
-    /**
-     * Convenience method to get a particular title bar.
-     */
-    private TitleBar getTitleBarAt(int position) {
-        if (position < 0 || position >= mCount) {
-            return null;
-        }
-        return (TitleBar) mTitleBars.elementAt(position);
-    }
-
-    /**
-     * Implementation for OnItemSelectedListener
-     */
-    public void onItemSelected(AdapterView<?> parent, View view, int position,
-            long id) {
-        if (mIgnoreSelectedListener || !(view instanceof TitleBar)) {
-            return;
-        }
-        mBrowserActivity.switchToTab(position);
-        // In case the WebView finished loading while this TitleBar was out of
-        // focus, make sure all its data is up to date
-        TitleBar titleBar = getTitleBarAt(position);
-        WebView webview = titleBar.getWebView();
-        if (webview == null) {
-            // FIXME: Possible that the tab needs to be restored.
-            return;
-        }
-        if (webview.getProgress() == 100) {
-            titleBar.setProgress(100);
-            titleBar.setTitleAndUrl(webview.getTitle(), webview.getUrl());
-            // FIXME: BrowserActivity looks at the back forward list.  Is this
-            // better?
-            titleBar.setFavicon(webview.getFavicon());
-            mBrowserActivity.updateLockIconToLatest();
-        }
-    }
-
-    /**
-     * Implementation for OnItemSelectedListener
-     */
-    public void onNothingSelected(AdapterView<?> parent) {
-        // do nothing
-    }
-
-    /**
-     * Override from GestureDetector.OnGestureListener.  Store the MotionEvent
-     * so performItemClick can know how to handle the click.
-     */
-    public boolean onSingleTapUp(MotionEvent e) {
-        mLastTouchUp = e;
-        // super.onSingleTapUp will call performItemClick
-        boolean result = super.onSingleTapUp(e);
-        mLastTouchUp = null;
-        return result;
-    }
-
-    /**
-     * Override from View to ensure that the TitleBars get resized to match
-     * the new screen width
-     */
-    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
-        super.onSizeChanged(w, h, oldw, oldh);
-        int selection = getSelectedItemPosition();
-        // Need to make sure getView gets called again
-        setAdapter(mTitleAdapter);
-        // Stay on the same tab
-        setCurrentTab(selection);
-    }
-
-    /**
-     * Override from AdapterView.  Using simple OnClickListeners overrides
-     * the GestureDetector.OnGestureListener, so we handle it here.
-     */
-    public boolean performItemClick(View view, int position, long id) {
-        if (!(view instanceof TitleBar)) {
-            return super.performItemClick(view, position, id);
-        }
-        // If we have no mLastTouchUp, this was not called from onSingleTapUp,
-        // so ignore it.
-        if (null == mLastTouchUp) {
-            return false;
-        }
-        TitleBar titleBar = (TitleBar) view;
-        // If the user clicks on a view which is not selected, the Gallery will
-        // take care of making it selected.
-        if (titleBar != getTitleBarAt(position)) {
-            return false;
-        }
-        View textfield = titleBar.findViewById(R.id.title);
-        // Interpret all touches past the right edge of the search field as
-        // a touch on the icon on the right.
-        if ((int) mLastTouchUp.getX() > textfield.getRight()) {
-            WebView webView = titleBar.getWebView();
-            if (webView != null && webView.getProgress() < 100) {
-                webView.stopLoading();
-            } else {
-                mBrowserActivity.bookmarksOrHistoryPicker(false);
-            }
-            return true;
-        }
-        mBrowserActivity.onSearchRequested();
-        return true;
-    }
-
-    /**
-     * Remove the tab at the given position.
-     */
-    /* package */ void removeTab(int position) {
-        int selection = getSelectedItemPosition();
-        mTitleBars.remove(position);
-        mCount--;
-        // Need to refresh our list
-        setAdapter(mTitleAdapter);
-        setCurrentTab(selection);
-    }
-
-    /**
-     * Convenience method to get the currently selected title bar.
-     */
-    private TitleBar selectedTitleBar() {
-        return getTitleBarAt(getSelectedItemPosition());
-    }
-
-    /**
-     * Set the owning BrowserActivity.  Necessary so that we can call methods
-     * on it.  Only called once before adding any title bars.
-     */
-    /* package */ void init(final BrowserActivity ba) {
-        mBrowserActivity = ba;
-    }
-
-    /**
-     * Change to the tab at the new position.
-     */
-    /* package */ void setCurrentTab(int position) {
-        if (position < 0 || position >= mCount) return;
-        mIgnoreSelectedListener = true;
-        setSelection(position);
-        mIgnoreSelectedListener = false;
-    }
-
-    /**
-     * Update the Favicon of the currently selected tab.
-     * @param icon The new bitmap for the favicon
-     * @param topWindow The WebView which posted the update.  If it does not
-     *                  match the WebView of the currently selected tab, do
-     *                  nothing, since that tab is not being displayed.
-     */
-    /* package */ void setFavicon(Bitmap icon, WebView topWindow) {
-        TitleBar current = selectedTitleBar();
-        if (current != null && current.getWebView() == topWindow) {
-            current.setFavicon(icon);
-        }
-    }
-
-    /**
-     * Update the lock icon of the currently selected tab.
-     * @param d The new Drawable for the lock icon
-     * @param topWindow The WebView which posted the update.  If it does not
-     *                  match the WebView of the currently selected tab, do
-     *                  nothing, since that tab is not being displayed.
-     */
-    /* package */ void setLock(Drawable d, WebView topWindow) {
-        TitleBar current = selectedTitleBar();
-        if (current != null && current.getWebView() == topWindow) {
-            current.setLock(d);
-        }
-    }
-    /**
-     * Update the progress of the currently selected tab.
-     * @param newProgress The progress, between 0 and 100, of the current tab.
-     * @param topWindow The WebView which posted the update.  If it does not
-     *                  match the WebView of the currently selected tab, do
-     *                  nothing, since that tab is not being displayed.
-     */
-    /* package */ void setProgress(int newProgress, WebView topWindow) {
-        TitleBar current = selectedTitleBar();
-        if (current != null && current.getWebView() == topWindow) {
-            current.setProgress(newProgress);
-        }
-    }
-    /**
-     * Update the title and URL of the currently selected tab.
-     * @param title The title of the webpage
-     * @param url   The URL of the webpage
-     * @param topWindow The WebView which posted the update.  If it does not
-     *                  match the WebView of the currently selected tab, do
-     *                  nothing, since that tab is not being displayed.
-     */
-    /* package */ void setTitleAndUrl(CharSequence title, CharSequence url,
-            WebView topWindow) {
-        TitleBar current = selectedTitleBar();
-        if (current != null && current.getWebView() == topWindow) {
-            current.setTitleAndUrl(title, url);
-        }
-    }
-
-    // FIXME: Remove
-    /* package */ void setToTabPicker() {
-        TitleBar current = selectedTitleBar();
-        if (current != null) {
-            current.setToTabPicker();
-        }
-    }
-
-    /**
-     * Custom adapter which provides the TitleBars and the NewButton to the
-     * Gallery.
-     */
-    private class TitleAdapter implements SpinnerAdapter {
-        public View getDropDownView(int position, View convertView,
-                ViewGroup parent) {
-            return null;
-        }
-        public void registerDataSetObserver(DataSetObserver observer) {}
-        public void unregisterDataSetObserver(DataSetObserver observer) {}
-        public int getCount() {
-            return mCount;
-        }
-        public Object getItem(int position) {
-            return null;
-        }
-        public long getItemId(int position) {
-            return position;
-        }
-        public boolean hasStableIds() {
-            return true;
-        }
-        public View getView(int position, View convertView, ViewGroup parent) {
-            TitleBar titleBar = getTitleBarAt(position);
-            Gallery.LayoutParams lp;
-            int desiredWidth = TitleBarSet.this.getWidth();
-            ViewGroup.LayoutParams old = titleBar.getLayoutParams();
-            if (old == null || !(old instanceof Gallery.LayoutParams)) {
-                lp = new Gallery.LayoutParams(desiredWidth,
-                        ViewGroup.LayoutParams.WRAP_CONTENT);
-                titleBar.setLayoutParams(lp);
-            } else {
-                lp = (Gallery.LayoutParams) old;
-                if (lp.width != desiredWidth) {
-                    lp.width = desiredWidth;
-                    titleBar.setLayoutParams(lp);
-                    requestLayout();
-                }
-            }
-            return titleBar;
-        }
-        public int getItemViewType(int position) {
-            // We are managing our own views.
-            return AdapterView.ITEM_VIEW_TYPE_IGNORE;
-        }
-        public int getViewTypeCount() {
-            return 1;
-        }
-        public boolean isEmpty() {
-            // Will never be empty, because the NewButton is always there
-            // (though sometimes disabled).
-            return false;
-        }
-    }
-}