/* Copyright 2019 Google LLC
   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. */
LinearLayout(android:layout_width  = match_parent
             android:layout_height = match_parent
             android:orientation   = vertical
             xmlns:android         = http://schemas.android.com/apk/res/android
             xmlns:app             = http://schemas.android.com/apk/res-auto)
{
    android.support.v7.widget.Toolbar(android:id            = @+id/authenticator_toolbar
                                      android:layout_width  = match_parent
                                      android:layout_height = wrap_content
                                      android:background    = ?attr/colorPrimary
                                      android:minHeight     = @dimen/toolbar_height
                                      app:contentInsetLeft  = 24dp
                                      app:contentInsetStart = 24dp
                                      app:popupTheme        = @style/ThemeOverlay.AppCompat.Light
                                      app:theme             = @style/ThemeOverlay.AppCompat.Dark.ActionBar)
    // View displayed when there are no accounts/code generators configured in the app.
    include(layout = @layout/main_no_accounts)
    // View displayed when there is at least one account/code generator configured in the app.
    RelativeLayout(android:id            = @+id/content_accounts_present
                   style                 = ?attr/pinCodeListBackground
                   android:layout_width  = match_parent
                   android:layout_height = match_parent
                   android:orientation   = vertical)
    {
        LinearLayout(android:layout_width  = match_parent
                     android:layout_height = match_parent
                     android:orientation   = vertical)
        {
            TextView(android:id                  = @+id/first_account_message_header
                     style                       = ?attr/accountListWithFirstAccountHeader
                     android:layout_width        = match_parent
                     android:layout_height       = wrap_content
                     android:layout_marginTop    = 24dp
                     android:layout_marginBottom = 4dp
                     android:layout_marginStart  = 24dp
                     android:layout_marginEnd    = 24dp
                     android:layout_marginLeft   = 24dp
                     android:layout_marginRight  = 24dp
                     android:text                = @string/account_list_page_first_account_message_header
                     android:visibility          = gone)
            com.google.android.apps.authenticator.util.EmptySpaceClickableDragSortListView(android:id             = @+id/user_list
                                                                                           style                  = ?attr/accountListWithVerificationCodes
                                                                                           android:layout_width   = match_parent
                                                                                           android:layout_height  = match_parent
                                                                                           android:overScrollMode = never
                                                                                           app:float_alpha        = 1.0)
            TextView(android:id            = @+id/first_account_message_detail
                     style                 = ?attr/accountListWithFirstAccountDetail
                     android:layout_width  = match_parent
                     android:layout_height = wrap_content
                     android:text          = @string/account_list_page_first_account_message_detail
                     android:visibility    = gone)
            Button(android:id                 = @+id/first_account_message_button_done
                   style                      = ?attr/firstAccountMessageDoneButtonStyle
                   android:layout_width       = wrap_content
                   android:layout_height      = wrap_content
                   android:layout_marginTop   = 20dp
                   android:layout_marginStart = 24dp
                   android:layout_marginEnd   = 24dp
                   android:layout_marginLeft  = 24dp
                   android:layout_marginRight = 24dp
                   android:layout_gravity     = center_horizontal
                   android:text               = @string/account_list_page_first_account_button_done
                   android:visibility         = gone)
        }
        View(android:id            = @+id/toolbar_shadow
             android:layout_width  = match_parent
             android:layout_height = @dimen/toolbar_shadow_height
             android:background    = @drawable/toolbar_shadow)
        android.support.design.widget.FloatingActionButton(android:id                       = @+id/add_account_fab
                                                           style                            = ?attr/fabButtonAddAccount
                                                           android:layout_width             = wrap_content
                                                           android:layout_height            = wrap_content
                                                           android:layout_alignParentBottom = true
                                                           android:layout_alignParentEnd    = true
                                                           android:layout_alignParentRight  = true
                                                           android:clickable                = true
                                                           android:contentDescription       = @string/fab_add_account
                                                           android:src                      = @drawable/quantum_ic_add_white_24
                                                           app:elevation                    = 6dp)
    }
}