diff --git a/app/build.gradle b/app/build.gradle
index 85611f4107df..4d7bd22def46 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -71,11 +71,12 @@ dependencies {
implementation Deps.mozilla_browser_awesomebar
implementation Deps.mozilla_browser_toolbar
-
testImplementation Deps.junit
androidTestImplementation Deps.tools_test_runner
androidTestImplementation Deps.tools_espresso_core
armImplementation Deps.geckoview_nightly_arm
x86Implementation Deps.geckoview_nightly_x86
+ implementation Deps.androidx_legacy
+ implementation Deps.android_arch_navigation
}
diff --git a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
index e02d5f94a931..e17d005c4041 100644
--- a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
+++ b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
@@ -6,16 +6,10 @@ package org.mozilla.fenix
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
-import org.mozilla.fenix.home.HomeFragment
class HomeActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_home)
-
- supportFragmentManager?.beginTransaction()?.apply {
- replace(R.id.container, HomeFragment.create())
- commit()
- }
}
}
diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt
new file mode 100644
index 000000000000..70319c8a65a9
--- /dev/null
+++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt
@@ -0,0 +1,21 @@
+/* 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.browser
+
+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 BrowserFragment : Fragment() {
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ return inflater.inflate(R.layout.fragment_browser, container, false)
+ }
+}
diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
index 3835cdf8fc38..74c50f3792b4 100644
--- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
+++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
@@ -5,23 +5,24 @@
package org.mozilla.fenix.home
import android.content.Context
+import android.graphics.Color
import android.os.Build
import android.os.Bundle
-import androidx.fragment.app.Fragment
+import android.transition.TransitionInflater
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.RelativeLayout
import android.widget.TextView
import androidx.annotation.RequiresApi
-import androidx.core.content.ContextCompat
+import androidx.core.view.ViewCompat
+import androidx.fragment.app.Fragment
+import androidx.navigation.Navigation
+import androidx.navigation.fragment.FragmentNavigator
+import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.fragment_home.*
-
import org.mozilla.fenix.R
-import android.widget.RelativeLayout
-import android.graphics.Color
-import androidx.recyclerview.widget.LinearLayoutManager
-
class HomeFragment : Fragment() {
override fun onCreateView(
@@ -39,11 +40,11 @@ class HomeFragment : Fragment() {
sessionsAdapter = SessionsAdapter(requireContext())
toolbar_wrapper.clipToOutline = false
- toolbar.apply {
- textColor = ContextCompat.getColor(context, R.color.searchText)
- textSize = 14f
- hint = context.getString(R.string.search_hint)
- hintColor = ContextCompat.getColor(context, R.color.searchText)
+ toolbar.setOnClickListener { it ->
+ val extras = FragmentNavigator.Extras.Builder().addSharedElement(
+ toolbar_wrapper, ViewCompat.getTransitionName(toolbar_wrapper)!!
+ ).build()
+ Navigation.findNavController(it).navigate(R.id.action_homeFragment_to_searchFragment, null, null, extras)
}
session_list.apply {
@@ -53,9 +54,10 @@ class HomeFragment : Fragment() {
}
}
-
- companion object {
- fun create() = HomeFragment()
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ enterTransition = TransitionInflater.from(context).inflateTransition(android.R.transition.fade)
+ exitTransition = TransitionInflater.from(context).inflateTransition(android.R.transition.fade)
}
}
diff --git a/app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt b/app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt
new file mode 100644
index 000000000000..7efa899d671f
--- /dev/null
+++ b/app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt
@@ -0,0 +1,44 @@
+/* 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.search
+
+import android.os.Bundle
+import android.transition.TransitionInflater
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.core.content.ContextCompat
+import androidx.fragment.app.Fragment
+import kotlinx.android.synthetic.main.fragment_search.*
+import org.mozilla.fenix.R
+
+class SearchFragment : Fragment() {
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ return inflater.inflate(R.layout.fragment_search, container, false)
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ sharedElementEnterTransition = TransitionInflater.from(context).inflateTransition(android.R.transition.move)
+ }
+
+ override fun onResume() {
+ super.onResume()
+ toolbar.editMode()
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ toolbar_wrapper.clipToOutline = false
+ toolbar.apply {
+ textColor = ContextCompat.getColor(context, R.color.searchText)
+ textSize = 14f
+ hint = context.getString(R.string.search_hint)
+ hintColor = ContextCompat.getColor(context, R.color.searchText)
+ }
+ }
+}
diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml
index 4a0116b3f175..c3e7eb5e8d6e 100644
--- a/app/src/main/res/layout/activity_home.xml
+++ b/app/src/main/res/layout/activity_home.xml
@@ -1,10 +1,20 @@
-
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_browser.xml b/app/src/main/res/layout/fragment_browser.xml
new file mode 100644
index 000000000000..eeb937c9512c
--- /dev/null
+++ b/app/src/main/res/layout/fragment_browser.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
index 2f4cf43399a5..9dbf4da38aaf 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -2,79 +2,84 @@
-
+
+ android:id="@+id/menuButton"
+ android:layout_width="@dimen/glyph_button_height"
+ android:layout_height="@dimen/glyph_button_height"
+ android:layout_marginTop="16dp"
+ android:background="?android:attr/selectableItemBackgroundBorderless"
+ android:src="@drawable/ic_menu"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+ android:id="@+id/privateBrowsingButton"
+ android:layout_width="@dimen/glyph_button_height"
+ android:layout_height="@dimen/glyph_button_height"
+ android:background="?android:attr/selectableItemBackgroundBorderless"
+ android:src="@drawable/ic_private_browsing"
+ app:layout_constraintEnd_toStartOf="@id/menuButton"
+ app:layout_constraintTop_toTopOf="@id/menuButton" />
+ android:id="@+id/wordmark"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="16dp"
+ android:layout_marginTop="42dp"
+ android:src="@drawable/ic_logo_wordmark"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/menuButton" />
-
-
+ android:id="@+id/toolbar_wrapper"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="16dp"
+ android:layout_marginTop="64dp"
+ android:layout_marginRight="16dp"
+ android:background="@drawable/home_search_background"
+ android:clipToPadding="false"
+ android:elevation="5dp"
+ android:outlineProvider="paddedBounds"
+ android:transitionName="firstTransitionName"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/wordmark">
+
+ android:id="@+id/session_list"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_margin="16dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/toolbar_wrapper" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml
new file mode 100644
index 000000000000..7760b8c45648
--- /dev/null
+++ b/app/src/main/res/layout/fragment_search.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml
new file mode 100644
index 000000000000..196796d7536c
--- /dev/null
+++ b/app/src/main/res/navigation/nav_graph.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt
index 8bb8627100e1..acd1742027da 100644
--- a/buildSrc/src/main/java/Dependencies.kt
+++ b/buildSrc/src/main/java/Dependencies.kt
@@ -15,6 +15,9 @@ private object Versions {
const val junit = "4.12"
const val test_tools = "1.0.2"
const val espresso_core = "2.2.2"
+
+ const val androidx_legacy = "1.0.0"
+ const val android_arch_navigation = "1.0.0-alpha09"
}
@Suppress("unused")
@@ -35,4 +38,7 @@ object Deps {
const val junit = "junit:junit:${Versions.junit}"
const val tools_test_runner = "com.android.support.test:runner:${Versions.test_tools}"
const val tools_espresso_core = "com.android.support.test.espresso:espresso-core:${Versions.espresso_core}"
+
+ const val androidx_legacy = "androidx.legacy:legacy-support-v4:${Versions.androidx_legacy}"
+ const val android_arch_navigation = "android.arch.navigation:navigation-fragment:${Versions.android_arch_navigation}"
}
\ No newline at end of file