-
Notifications
You must be signed in to change notification settings - Fork 555
feat: Add welcome fragment for asking location first time #907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
app/src/main/java/org/fossasia/openevent/general/WelcomeFragment.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package org.fossasia.openevent.general | ||
|
|
||
| import android.os.Bundle | ||
| import android.view.LayoutInflater | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import androidx.appcompat.app.AppCompatActivity | ||
| import androidx.fragment.app.Fragment | ||
| import androidx.navigation.Navigation | ||
| import kotlinx.android.synthetic.main.fragment_welcome.view.pickCityButton | ||
| import org.fossasia.openevent.general.utils.Utils | ||
|
|
||
| const val LOCATION_SAVED = "LOCATION_SAVED" | ||
|
|
||
| class WelcomeFragment : Fragment() { | ||
| private lateinit var rootView: View | ||
|
|
||
| override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
| rootView = inflater.inflate(R.layout.fragment_welcome, container, false) | ||
| val thisActivity = activity | ||
| if (thisActivity is AppCompatActivity) | ||
| thisActivity.supportActionBar?.hide() | ||
| rootView.pickCityButton.setOnClickListener { | ||
| Navigation.findNavController(rootView).navigate(R.id.searchLocationFragment, null, Utils.getAnimSlide()) | ||
| } | ||
| return rootView | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
app/src/main/java/org/fossasia/openevent/general/search/SearchLocationViewModel.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,14 @@ | ||
| package org.fossasia.openevent.general.search | ||
|
|
||
| import androidx.lifecycle.ViewModel | ||
| import org.fossasia.openevent.general.LOCATION_SAVED | ||
| import org.fossasia.openevent.general.data.Preference | ||
|
|
||
| class SearchLocationViewModel(private val preference: Preference) : ViewModel() { | ||
| private val tokenKey = "LOCATION" | ||
|
|
||
| fun saveSearch(query: String) { | ||
| preference.putString(tokenKey, query) | ||
| preference.putBoolean(LOCATION_SAVED, true) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead, can't we save the location itself? |
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="512dp" | ||
| android:height="512dp" | ||
| android:viewportWidth="512" | ||
| android:viewportHeight="512"> | ||
|
|
||
| <path | ||
| android:fillColor="#000000" | ||
| android:pathData="M 176.748 182.811 L 176.748 182.811 L 176.735 182.783 Z" /> | ||
| <path | ||
| android:fillColor="#000000" | ||
| android:pathData="M 106.342 321.731 L 106.342 321.744 L 106.436 321.293 Z" /> | ||
| <path | ||
| android:fillColor="#000000" | ||
| android:pathData="M 209.806 231.019 L 209.82 230.958 L 209.907 230.541 Z" /> | ||
| <path | ||
| android:fillColor="#000000" | ||
| android:pathData="M 236.261 386.136 L 236.274 386.094 L 236.282 386.068 Z" /> | ||
| <path | ||
| android:fillColor="#000000" | ||
| android:pathData="M357.053,208.842c-22.333,0-40.421,18.095-40.421,40.421s18.089,40.421,40.421,40.421 c22.326,0,40.421-18.095,40.421-40.421C397.474,226.937,379.379,208.842,357.053,208.842z M357.053,269.474 c-11.143,0-20.211-9.068-20.211-20.211s9.068-20.211,20.211-20.211c11.143,0,20.211,9.068,20.211,20.211 S368.196,269.474,357.053,269.474z" /> | ||
| <path | ||
| android:fillColor="#000000" | ||
| android:pathData="M256,0c-38.589,0-75.102,8.656-107.911,23.956C132.352,9.155,111.051,0,87.58,0C39.289,0,0.001,38.535,0.001,85.895 c0,17.812,10.907,40.26,24.367,61.238C8.806,180.183,0.001,217.047,0.001,255.999C0.001,397.379,114.601,512,256,512 s255.999-114.621,255.999-255.999S397.4,0,256,0z M20.212,85.895c0-36.292,30.174-65.684,67.368-65.684 c37.201,0,67.368,29.393,67.368,65.684c0,36.271-67.368,109.474-67.368,109.474S20.212,122.166,20.212,85.895z M20.21,255.996 c0.001-31.592,6.3-61.732,17.631-89.293c14.801,20.13,29.527,36.547,34.87,42.348l14.868,16.162l14.868-16.162 c12.146-13.191,72.71-81.132,72.71-123.156c0-16.855-5.045-32.546-13.628-45.824c16.236-7.135,33.414-12.503,51.301-15.839 l-5.478,9.849c-2.647,4.796-3.632,9.943-3.658,15.023c0.055,6.393,1.549,12.84,5.524,18.513l-0.013-0.013l15.366,21.585 c0.842,1.145,1.967,3.509,2.702,6.137c0.754,2.627,1.179,5.558,1.172,7.842c0.007,1.037-0.087,1.947-0.202,2.594l0.007-0.021 l-3.989,21.733c-0.215,1.449-1.482,4.291-3.354,6.649c-1.819,2.398-4.257,4.331-5.605,4.904l-27.021,12.47 c-8.643,4.021-13.703,12.564-13.703,21.477c0,3.267,0.694,6.649,2.162,9.836l11.406,24.831c0.593,1.266,1.273,3.469,1.725,5.922 c0.458,2.453,0.707,5.174,0.707,7.619c0,2.162-0.209,4.136-0.499,5.389l-0.134,0.546l-3.106,13.488 c-0.33,1.623-1.786,4.675-3.793,7.249c-1.967,2.614-4.541,4.803-6.016,5.544l-19.962,10.591c-1.024,0.58-3.348,1.192-5.807,1.166 c-2.971,0.047-6.056-0.89-7.209-1.704l-16.33-10.516c-5.423-3.429-11.426-4.709-17.381-4.749 c-5.48,0.034-11.041,1.131-16.158,4.123l-16.354,9.679c-3.146,1.852-5.801,4.412-7.653,7.485 c-1.846,3.065-2.857,6.629-2.85,10.206c-0.027,5.376,2.264,10.665,6.09,14.599l-0.013-0.013l9.155,9.552 c0.829,0.835,2.054,2.768,2.87,5.039c0.829,2.256,1.287,4.837,1.273,6.77c0.007,0.815-0.074,1.529-0.182,2.075l-1.826,8.745 c-0.404,2.069-1.846,5.706-3.759,8.974c-1.867,3.288-4.299,6.36-5.881,7.747l-8.28,7.424 c-5.51,4.966-12.632,12.396-17.711,18.384C30.699,335.396,20.21,296.902,20.21,255.996z M189.616,442.408l-10.576,36.413 c-48.843-16.916-90.464-49.408-118.825-91.581c0.916-1.132,1.899-2.358,2.944-3.638c3.989-4.951,12.214-13.581,17.145-17.981 l8.273-7.424c3.928-3.557,7.141-7.95,9.903-12.698c2.721-4.769,4.911-9.754,6.03-14.929l1.839-8.839 c0.41-2.028,0.593-4.069,0.593-6.117c-0.007-4.709-0.922-9.331-2.513-13.716c-1.617-4.372-3.866-8.515-7.249-12.073l-9.155-9.56 l-0.021-0.013l-0.357-0.485l0.485-0.397l16.364-9.681l0.021-0.007c0.977-0.627,3.354-1.321,5.841-1.294 c2.695-0.034,5.383,0.788,6.447,1.536l16.317,10.51c5.646,3.564,11.918,4.877,18.155,4.924 c5.174-0.027,10.381-0.956,15.279-3.517l19.962-10.591c5.079-2.742,9.129-6.656,12.577-11.088 c3.396-4.48,6.13-9.412,7.458-15.023l3.261-14.174c0.701-3.186,0.977-6.44,0.984-9.782c-0.007-3.759-0.364-7.585-1.051-11.298 c-0.694-3.719-1.684-7.296-3.227-10.678l-11.419-24.859l-0.013-0.027l-0.289-1.34c0-1.307,0.761-2.6,1.96-3.126l27.029-12.47 c5.376-2.534,9.599-6.413,13.089-10.867c3.449-4.493,6.151-9.552,7.262-15.394l3.989-21.727l0.007-0.021 c0.378-2.069,0.525-4.136,0.533-6.198c-0.013-4.507-0.714-9.041-1.96-13.399c-1.266-4.359-3.012-8.529-5.673-12.295 l-15.36-21.578l-0.007-0.013c-0.843-1.064-1.812-3.961-1.765-6.763c-0.021-2.209,0.552-4.265,1.105-5.194l12.753-22.919 c6.036-0.485,12.099-0.809,18.244-0.809c117.208,0,214.683,85.975,232.751,198.17l-9.027-5.019 c-3.739-2.062-7.774-3.409-11.999-4.386c-4.224-0.956-8.569-1.489-12.827-1.495c-2.317,0-4.601,0.155-6.892,0.559l-1.867,0.33 c-17.055-31.763-50.577-53.422-89.085-53.422c-55.72,0-101.052,45.332-101.052,101.052c0,34.055,33.435,83.28,59.203,116.163 l-15.421,17.341c-0.922,1.092-3.274,2.802-5.962,3.921c-2.661,1.172-5.659,1.799-7.451,1.772l-0.64-0.021l-29.461-2.27 l-0.741-0.162l-0.034-0.013v-0.101l0.094-0.606l0.027-0.074l5.255-17.509c0.741-2.486,1.058-4.979,1.058-7.398 c-0.013-4.796-1.219-9.384-3.354-13.528c-2.143-4.123-5.276-7.882-9.573-10.597l-11.816-7.383 c-4.049-2.526-8.577-3.679-12.982-3.672c-7.505,0.013-15.017,3.274-19.975,9.822l-35.819,47.758 c-3.167,4.21-4.703,9.223-4.703,14.114c-0.007,7.12,3.241,14.255,9.418,18.896l13.103,9.822c0.72,0.519,1.765,1.738,2.479,3.335 c0.741,1.576,1.152,3.469,1.139,4.924C189.852,441.303,189.744,441.951,189.616,442.408z M437.896,256.007 c0,44.632-80.842,134.73-80.842,134.73s-80.842-90.099-80.842-134.73c0-44.665,36.19-80.843,80.842-80.843 C401.699,175.164,437.896,211.341,437.896,256.007z M256,491.789c-19.86,0-39.154-2.5-57.593-7.148l10.624-36.615 c0.72-2.513,1.03-5.026,1.03-7.492c-0.013-4.696-1.077-9.216-2.999-13.393c-1.933-4.157-4.722-8.031-8.711-11.041l-13.097-9.822 c-0.862-0.64-1.321-1.631-1.327-2.721c0.007-0.735,0.202-1.387,0.654-1.988l35.827-47.764c0.66-0.95,2.224-1.752,3.8-1.731 c0.909,0,1.684,0.236,2.27,0.599l11.81,7.383c0.694,0.418,1.657,1.408,2.351,2.762c0.701,1.34,1.098,2.971,1.085,4.224 c0,0.66-0.094,1.2-0.209,1.589l-5.234,17.462c-0.674,2.183-0.99,4.393-0.99,6.534c-0.021,5.2,1.98,10.348,5.571,14.06 c3.571,3.753,8.596,5.988,13.871,6.373l29.461,2.27c0.735,0.055,1.462,0.081,2.19,0.081c5.416-0.027,10.584-1.347,15.455-3.422 c4.851-2.115,9.371-4.951,13.063-9.047l13.191-14.848c6.164,7.398,11.136,13.036,13.925,16.141l15.037,16.761l15.037-16.768 c14.37-16.007,86.016-98.378,86.016-148.224c0-9.822-1.476-19.295-4.102-28.281c0.303-0.007,0.573-0.034,0.896-0.034 c2.5-0.007,5.557,0.35,8.341,0.984c2.776,0.62,5.308,1.57,6.67,2.345l21.498,11.944c0.242,4.325,0.384,8.664,0.384,13.036 C491.79,386.013,386.014,491.789,256,491.789z" /> | ||
| <path | ||
| android:fillColor="#000000" | ||
| android:pathData="M 94.172 252.312 L 94.183 252.306 L 94.185 252.305 Z" /> | ||
| <path | ||
| android:fillColor="#000000" | ||
| android:pathData="M89.256,47.151c-18.614,0-33.677,15.07-33.677,33.684c0,18.607,15.064,33.684,33.678,33.684s33.69-15.077,33.69-33.684 C122.948,62.228,107.87,47.151,89.256,47.151z M89.257,94.308c-7.431,0.007-13.467-6.043-13.467-13.473 c0-7.43,6.036-13.473,13.467-13.473c7.438,0,13.48,6.043,13.48,13.473C102.738,88.265,96.695,94.308,89.257,94.308z" /> | ||
| </vector> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| <RelativeLayout 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="match_parent" | ||
| tools:context="org.fossasia.openevent.general.WelcomeFragment"> | ||
|
|
||
| <LinearLayout | ||
| android:id="@+id/textLinearLayout" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:orientation="vertical"> | ||
|
|
||
| <TextView | ||
| style="@style/WelcomeFragmentTextStyle" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:text="@string/start_text_1" /> | ||
|
|
||
| <TextView | ||
| style="@style/WelcomeFragmentTextStyle" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:text="@string/start_text_2" /> | ||
|
|
||
| <TextView | ||
| style="@style/WelcomeFragmentTextStyle" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:text="@string/start_text_3" /> | ||
|
|
||
| <TextView | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginLeft="@dimen/layout_margin_large" | ||
| android:layout_marginTop="@dimen/layout_margin_large" | ||
| android:text="@string/start_text_4" | ||
| android:textColor="@color/black" | ||
| android:textSize="@dimen/text_size_medium" /> | ||
| </LinearLayout> | ||
|
|
||
| <ImageView | ||
| android:layout_width="@dimen/avatar_medium" | ||
| android:layout_height="@dimen/avatar_medium" | ||
| android:layout_above="@+id/pickCityButton" | ||
| android:layout_below="@id/textLinearLayout" | ||
| android:layout_centerHorizontal="true" | ||
| app:srcCompat="@drawable/ic_location_world" | ||
| app:tint="@color/colorPrimary" /> | ||
|
|
||
| <androidx.appcompat.widget.AppCompatButton | ||
| android:id="@+id/pickCityButton" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_alignParentBottom="true" | ||
| android:layout_marginLeft="@dimen/layout_margin_large" | ||
| android:layout_marginRight="@dimen/layout_margin_large" | ||
| android:layout_marginBottom="@dimen/layout_margin_large" | ||
| android:padding="@dimen/padding_medium" | ||
| android:text="@string/pick_a_city" | ||
| android:textColor="@android:color/white" | ||
| app:backgroundTint="@color/colorPrimary" /> | ||
| </RelativeLayout> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make this a contraint layout |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't done this lately, but all logic goes in ViewModel so that it is testable.