Commit 4f3c0ee8 authored by Emily Kager's avatar Emily Kager Committed by Jeff Boek
Browse files

Closes #378 - Creates Library Fragment UI and adds resources

parent 10495657
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -130,6 +130,9 @@ dependencies {
    implementation Deps.mozilla_feature_findinpage
    implementation Deps.mozilla_support_ktx

    implementation Deps.mozilla_ui_colors
    implementation Deps.mozilla_ui_icons

    implementation Deps.mozilla_lib_crash

    testImplementation Deps.junit
+23 −0
Original line number Diff line number Diff line
/* This Source Code Form is subject to the terms of the Mozilla Public
   License, v. 2.0. If a copy of the MPL was not distributed with this
   file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.fenix.library

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import org.mozilla.fenix.R

class LibraryFragment : Fragment() {

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return inflater.inflate(R.layout.fragment_library, container, false)
    }
}
+45 −0
Original line number Diff line number Diff line
/* This Source Code Form is subject to the terms of the Mozilla Public
   License, v. 2.0. If a copy of the MPL was not distributed with this
   file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.fenix.library

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import kotlinx.android.synthetic.main.library_list_item.view.*
import org.mozilla.fenix.R

class LibraryListItem @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
    init {
        LayoutInflater.from(context).inflate(R.layout.library_list_item, this, true)
        attrs.let {
            context.theme.obtainStyledAttributes(
                it,
                R.styleable.LibraryListItem,
                0, 0
            ).apply {
                try {
                    val id = getResourceId(
                        R.styleable.LibraryListItem_listItemIcon,
                        R.drawable.library_icon_logins_circle_background
                    )
                    libraryIcon?.background = resources.getDrawable(id, context.theme)
                    libraryItemTitle?.text = resources.getString(
                        getResourceId(
                            R.styleable.LibraryListItem_listItemTitle,
                            R.string.browser_menu_library
                        )
                    )
                } finally {
                    recycle()
                }
            }
        }
    }
}
+16 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
  <path
      android:pathData="M6.749,21.248C6.4234,21.2471 6.1142,21.1054 5.9008,20.8595C5.6875,20.6136 5.5909,20.2874 5.636,19.965L6.414,14.4L2.674,10.38C2.3928,10.0785 2.2991,9.6474 2.4296,9.2564C2.5601,8.8654 2.8941,8.5771 3.3,8.505L8.529,7.57L10.993,2.624C11.1833,2.242 11.5733,2.0006 12,2.0006C12.4267,2.0006 12.8167,2.242 13.007,2.624L15.471,7.57L20.7,8.5C21.1057,8.5724 21.4394,8.8608 21.5697,9.2518C21.7,9.6427 21.6062,10.0737 21.325,10.375L17.586,14.4L18.364,19.968C18.4229,20.3853 18.2434,20.8005 17.8991,21.0434C17.5547,21.2864 17.1034,21.3164 16.73,21.121L12,18.654L7.269,21.119C7.1087,21.2035 6.9302,21.2478 6.749,21.248Z"
      android:strokeWidth="1"
      android:fillColor="#202340"
      android:fillType="evenOdd"
      android:strokeColor="#00000000"/>
</vector>
+16 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
    <path
        android:fillColor="#202340"
        android:fillType="evenOdd"
        android:pathData="M11.293,17.707L5.293,11.707C4.914,11.3146 4.9194,10.6909 5.3052,10.3052C5.6909,9.9194 6.3146,9.914 6.707,10.293L11,14.586L11,3C11,2.4477 11.4477,2 12,2C12.5523,2 13,2.4477 13,3L13,14.586L17.293,10.293C17.6854,9.914 18.3091,9.9194 18.6948,10.3052C19.0806,10.6909 19.086,11.3146 18.707,11.707L12.707,17.707C12.3165,18.0974 11.6835,18.0974 11.293,17.707ZM18,20C18.5523,20 19,20.4477 19,21C19,21.5523 18.5523,22 18,22L6,22C5.4477,22 5,21.5523 5,21C5,20.4477 5.4477,20 6,20L18,20Z"
        android:strokeWidth="1"
        android:strokeColor="#00000000" />
</vector>
Loading