Skip to content

Commit

Permalink
Finish Version 1.0
Browse files Browse the repository at this point in the history
Signed-off-by: Jeevan Surendran <[email protected]>
  • Loading branch information
jeevansurendran committed May 2, 2021
1 parent 96025c0 commit be38470
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ val FALLBACK_DPS = arrayOf(
"https://storage.googleapis.com/instantaneous-e673e.appspot.com/fallbacks/yellow/05.png",
"https://storage.googleapis.com/instantaneous-e673e.appspot.com/fallbacks/yellow/06.png",
"https://storage.googleapis.com/instantaneous-e673e.appspot.com/fallbacks/yellow/07.png",
"https://storage.googleapis.com/instantaneous-e673e.appspot.com/fallbacks/yellow/08.png")
"https://storage.googleapis.com/instantaneous-e673e.appspot.com/fallbacks/yellow/08.png"
)

const val EASTER_EGG_CLICK_COUNT = 5
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.silverpants.instantaneous.ui.easter

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.silverpants.instantaneous.R

class MainEasterEggFragment : BottomSheetDialogFragment() {

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return inflater.inflate(R.layout.fragment_main_easter, container, false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.silverpants.instantaneous.R
import com.silverpants.instantaneous.databinding.FragmentMainRecentBinding
import com.silverpants.instantaneous.misc.EASTER_EGG_CLICK_COUNT
import com.silverpants.instantaneous.misc.Result
import com.silverpants.instantaneous.misc.hideKeyboard
import com.silverpants.instantaneous.misc.loadImageOrDefault
import com.xwray.groupie.GroupieAdapter
import dagger.hilt.android.AndroidEntryPoint
import java.util.concurrent.atomic.AtomicInteger

@AndroidEntryPoint
class MainRecentFragment : Fragment(R.layout.fragment_main_recent), RecentChatOnClickListener {

private val recentChatViewModel: RecentChatViewModel by viewModels()
private var buttonClick: AtomicInteger = AtomicInteger(1)

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val binding = FragmentMainRecentBinding.bind(view)
Expand Down Expand Up @@ -74,13 +77,24 @@ class MainRecentFragment : Fragment(R.layout.fragment_main_recent), RecentChatOn
binding.imRecentSearch.setOnClickListener {
openSearch()
}
binding.civRecentProfile.setOnClickListener {
if (buttonClick.getAndIncrement() == EASTER_EGG_CLICK_COUNT) {
openEaster()
}
}
}

fun openSearch() {
private fun openSearch() {
val action = MainRecentFragmentDirections.openSearch()
findNavController().navigate(action)
}

private fun openEaster() {
buttonClick.set(1)
val action = MainRecentFragmentDirections.openEaster()
findNavController().navigate(action)
}

// What happens when the chat is clicked
override fun onClick(chatId: String) {
val action = MainRecentFragmentDirections.openChat(chatId)
Expand Down
Binary file added app/src/main/res/drawable/ic_easter_sus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions app/src/main/res/layout/fragment_main_easter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"

android:layout_height="wrap_content"
tools:context=".ui.easter.MainEasterEggFragment">

<ImageView
android:id="@+id/im_easter_sus"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/size_i"
android:layout_marginTop="@dimen/size_m"
android:adjustViewBounds="true"
android:src="@drawable/ic_easter_sus"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_easter_sus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_l"
android:fontFamily="@font/dm_sans_bold"
android:text="That's kinda sus"
android:textColor="@color/grey_600"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/im_easter_sus" />

<TextView
android:id="@+id/tv_easter_idea"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/size_i"
android:layout_marginTop="@dimen/size_m"
android:text="Boop was a fun weekend project idea by Jeevan, Andrews, Dvija and Harshitha. Hope you are having fun with it."
android:textAlignment="center"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_easter_sus" />

<Button
android:id="@+id/btn_easter_invite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/size_m"
android:layout_marginTop="@dimen/size_m"
android:layout_marginBottom="@dimen/size_i"
android:backgroundTint="@color/blue"
android:fontFamily="@font/dm_sans_medium"
android:paddingStart="@dimen/size_el"
android:paddingTop="@dimen/size_s"
android:paddingEnd="@dimen/size_el"
android:paddingBottom="@dimen/size_s"
android:text="Let Us know on playstore"
app:cornerRadius="@dimen/rad_l"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_easter_idea" />

</androidx.constraintlayout.widget.ConstraintLayout>
8 changes: 8 additions & 0 deletions app/src/main/res/navigation/nav_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<action
android:id="@+id/open_search"
app:destination="@id/mainSearchFragment" />
<action
android:id="@+id/open_easter"
app:destination="@id/mainEasterEggFragment" />
</fragment>
<fragment
android:id="@+id/mainChatFragment"
Expand All @@ -38,4 +41,9 @@
app:destination="@id/mainChatFragment"
app:popUpTo="@id/mainRecentFragment" />
</fragment>
<dialog
android:id="@+id/mainEasterEggFragment"
android:name="com.silverpants.instantaneous.ui.easter.MainEasterEggFragment"
android:label="fragment_main_easter"
tools:layout="@layout/fragment_main_easter" />
</navigation>

0 comments on commit be38470

Please sign in to comment.