26 |
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
JetPacker
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | JetPacker is an android application which implements various jetpack libraries created by the android team.
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | ## FEATURES - (Will be updated as more jetpack lib. gets used)
21 |
22 | * Navigation Component
23 | * Hilt
24 | * DataBinding
25 | * DataStore
26 | * Custom View
27 | * Constraint Layout
28 | * Test (Espresso, Junit etc)
29 | * ViewModel
30 |
31 | ## EXTERNAL LIBRARIES USED
32 | * Animation - https://github.com/daimajia/AndroidViewAnimations
33 | * Confetti - https://github.com/DanielMartinus/Konfetti
34 |
35 |
36 |
37 | 
38 |
39 |
40 | ## DOWNLOAD
41 | Navigate to Releases and download the latest apk
42 |
43 |
44 | # License
45 |
46 | ```xml
47 | Designed and developed by 2021 Inuwa Ibrahim (ibrajix)
48 |
49 | Licensed under the Apache License, Version 2.0 (the "License");
50 | you may not use this file except in compliance with the License.
51 | You may obtain a copy of the License at
52 |
53 | http://www.apache.org/licenses/LICENSE-2.0
54 |
55 | Unless required by applicable law or agreed to in writing, software
56 | distributed under the License is distributed on an "AS IS" BASIS,
57 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
58 | See the License for the specific language governing permissions and
59 | limitations under the License.
60 | ```
61 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | //application
3 | id 'com.android.application'
4 |
5 | //android
6 | id 'kotlin-android'
7 |
8 | //safe args for passing data across fragments
9 | id 'androidx.navigation.safeargs.kotlin'
10 |
11 | //kotlin kapt - mainly for hilt
12 | id 'kotlin-kapt'
13 |
14 | //kotlin android extensions
15 | id 'kotlin-android-extensions'
16 |
17 | //dagger hilt for dependency injection
18 | id 'dagger.hilt.android.plugin'
19 | }
20 |
21 | android {
22 | compileSdk 30
23 |
24 | defaultConfig {
25 | applicationId "com.ibrajix.jetpacker"
26 | minSdk 21
27 | targetSdk 30
28 | versionCode 1
29 | versionName "1.0"
30 |
31 | testInstrumentationRunner "com.ibrajix.jetpacker.HiltTestRunner"
32 | }
33 |
34 | buildTypes {
35 | release {
36 | minifyEnabled false
37 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
38 | }
39 | }
40 | compileOptions {
41 | sourceCompatibility JavaVersion.VERSION_1_8
42 | targetCompatibility JavaVersion.VERSION_1_8
43 | }
44 | kotlinOptions {
45 | jvmTarget = '1.8'
46 | }
47 | buildFeatures {
48 | viewBinding true
49 | }
50 | }
51 |
52 | dependencies {
53 |
54 | //variables
55 | def hilt_android_version = "2.39.1"
56 | def lifecycle_version = "2.3.1"
57 | def nav_version = "2.3.5"
58 | def mockito_version = "3.9.0"
59 |
60 | //default - core
61 | implementation 'androidx.core:core-ktx:1.6.0'
62 | implementation 'androidx.appcompat:appcompat:1.3.1'
63 | implementation 'com.google.android.material:material:1.4.0'
64 | implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
65 | implementation 'androidx.legacy:legacy-support-v4:1.0.0'
66 |
67 | //testing
68 | testImplementation 'junit:junit:4.13.2'
69 | testImplementation "com.google.truth:truth:1.1.3"
70 |
71 |
72 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
73 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
74 | androidTestImplementation "com.google.truth:truth:1.1.3"
75 | androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_android_version"
76 | kaptAndroidTest "com.google.dagger:hilt-android-compiler:$hilt_android_version"
77 | androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
78 | androidTestImplementation 'androidx.test:rules:1.4.0'
79 |
80 | //mockito
81 | androidTestImplementation "org.mockito:mockito-android:$mockito_version"
82 |
83 | def fragment_version = "1.3.6"
84 | debugImplementation "androidx.fragment:fragment-testing:$fragment_version"
85 | testImplementation "android.arch.core:core-testing:1.1.1"
86 |
87 | //animation
88 | implementation 'com.daimajia.androidanimations:library:2.4@aar'
89 |
90 | //lifeCycle
91 | implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
92 | implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
93 | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
94 | implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
95 |
96 | //navigation component
97 | implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
98 | implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
99 |
100 | //transformation
101 | implementation "com.github.skydoves:transformationlayout:1.1.0"
102 |
103 | //data store
104 | implementation "androidx.datastore:datastore-preferences:1.0.0"
105 |
106 | //hilt - dependency injection
107 | implementation "com.google.dagger:hilt-android:$hilt_android_version"
108 | kapt "com.google.dagger:hilt-compiler:$hilt_android_version"
109 |
110 | //confetti
111 | implementation 'nl.dionsegijn:konfetti:1.3.2'
112 |
113 | //easing
114 | implementation 'com.daimajia.easing:library:2.4@aar'
115 |
116 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/HiltTestRunner.kt:
--------------------------------------------------------------------------------
1 | package com.ibrajix.jetpacker
2 |
3 | import android.app.Application
4 | import android.content.Context
5 | import androidx.test.runner.AndroidJUnitRunner
6 | import dagger.hilt.android.testing.HiltTestApplication
7 |
8 | class HiltTestRunner : AndroidJUnitRunner() {
9 | override fun newApplication(cl: ClassLoader?, name: String?, context: Context?): Application {
10 | return super.newApplication(cl, HiltTestApplication::class.java.name, context)
11 | }
12 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/ibrajix/extension/DiExtension.kt:
--------------------------------------------------------------------------------
1 | package com.ibrajix.extension
2 |
3 | import android.content.ComponentName
4 | import android.content.Intent
5 | import android.os.Bundle
6 | import androidx.annotation.StyleRes
7 | import androidx.core.util.Preconditions
8 | import androidx.fragment.app.Fragment
9 | import androidx.test.core.app.ActivityScenario
10 | import androidx.test.core.app.ApplicationProvider
11 | import com.ibrajix.jetpacker.HiltTestActivity
12 | import com.ibrajix.jetpacker.R
13 |
14 | inline fun launchFragmentInHiltContainer(
15 | fragmentArgs: Bundle? = null,
16 | @StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme,
17 | crossinline action: Fragment.() -> Unit = {}
18 | ) {
19 | val startActivityIntent = Intent.makeMainActivity(
20 | ComponentName(
21 | ApplicationProvider.getApplicationContext(),
22 | HiltTestActivity::class.java
23 | )
24 | ).putExtra(
25 | "androidx.fragment.app.testing.FragmentScenario.EmptyFragmentActivity.THEME_EXTRAS_BUNDLE_KEY",
26 | themeResId
27 | )
28 |
29 | ActivityScenario.launch(startActivityIntent).onActivity { activity ->
30 | val fragment: Fragment = activity.supportFragmentManager.fragmentFactory.instantiate(
31 | Preconditions.checkNotNull(T::class.java.classLoader),
32 | T::class.java.name
33 | )
34 | fragment.arguments = fragmentArgs
35 | activity.supportFragmentManager
36 | .beginTransaction()
37 | .add(android.R.id.content, fragment, "")
38 | .commitNow()
39 |
40 | fragment.action()
41 |
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/ibrajix/jetpacker/ui/fragments/FundWalletFragmentTest.kt:
--------------------------------------------------------------------------------
1 | package com.ibrajix.jetpacker.ui.fragments
2 |
3 | import androidx.navigation.NavController
4 | import androidx.navigation.Navigation
5 | import androidx.test.espresso.Espresso
6 | import androidx.test.espresso.action.ViewActions
7 | import androidx.test.espresso.matcher.ViewMatchers
8 | import com.ibrajix.extension.launchFragmentInHiltContainer
9 | import com.ibrajix.jetpacker.R
10 | import dagger.hilt.android.testing.HiltAndroidRule
11 | import dagger.hilt.android.testing.HiltAndroidTest
12 | import junit.framework.TestCase
13 | import org.junit.Before
14 | import org.junit.Rule
15 | import org.junit.Test
16 | import org.mockito.Mockito
17 |
18 | @HiltAndroidTest
19 | class FundWalletFragmentTest{
20 |
21 | @get:Rule(order = 0)
22 | var hiltAndroidRule = HiltAndroidRule(this)
23 |
24 | @Before
25 | fun setUp(){
26 | hiltAndroidRule.inject()
27 | }
28 |
29 | @Test
30 | fun testThatOnClickBackButtonGoesBack(){
31 | val navController = Mockito.mock(NavController::class.java)
32 | launchFragmentInHiltContainer{
33 | Navigation.setViewNavController(requireView(), navController)
34 | }
35 | Espresso.onView(ViewMatchers.withId(R.id.ic_back)).perform(ViewActions.click())
36 | Mockito.verify(navController).popBackStack()
37 | }
38 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/ibrajix/jetpacker/ui/fragments/HomeFragmentTest.kt:
--------------------------------------------------------------------------------
1 | package com.ibrajix.jetpacker.ui.fragments
2 |
3 | import androidx.navigation.NavController
4 | import androidx.navigation.Navigation
5 | import androidx.test.espresso.Espresso.onView
6 | import androidx.test.espresso.action.ViewActions.click
7 | import androidx.test.espresso.matcher.ViewMatchers.withId
8 | import com.ibrajix.extension.launchFragmentInHiltContainer
9 | import com.ibrajix.jetpacker.R
10 | import dagger.hilt.android.testing.HiltAndroidRule
11 | import dagger.hilt.android.testing.HiltAndroidTest
12 | import org.junit.Before
13 | import org.junit.Rule
14 | import org.junit.Test
15 | import org.mockito.Mockito.mock
16 | import org.mockito.Mockito.verify
17 |
18 |
19 | @HiltAndroidTest
20 | class HomeFragmentTest{
21 |
22 | @get:Rule(order = 0)
23 | var hiltAndroidRule = HiltAndroidRule(this)
24 |
25 | @Before
26 | fun setUp(){
27 | hiltAndroidRule.inject()
28 | }
29 |
30 | @Test
31 | fun testThatOnClickFundWalletButtonNavigateToFundWalletFragment(){
32 | val navController = mock(NavController::class.java)
33 | launchFragmentInHiltContainer{
34 | Navigation.setViewNavController(requireView(), navController)
35 | }
36 | onView(withId(R.id.btn_fund_wallet)).perform(click())
37 | verify(navController).navigate(HomeFragmentDirections.actionHomeFragmentToFundWalletFragment())
38 | }
39 |
40 | @Test
41 | fun testThatOnClickStartYourJourneyNavigateToSelectSpaceCraftFragment(){
42 | val navController = mock(NavController::class.java)
43 | launchFragmentInHiltContainer {
44 | Navigation.setViewNavController(requireView(), navController)
45 | }
46 | onView(withId(R.id.lyt_start_journey)).perform(click())
47 | verify(navController).navigate(HomeFragmentDirections.actionHomeFragmentToSelectSpaceCraftFragment())
48 | }
49 |
50 | }
51 |
52 |
--------------------------------------------------------------------------------
/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/debug/java/com/ibrajix/jetpacker/HiltTestActivity.kt:
--------------------------------------------------------------------------------
1 | package com.ibrajix.jetpacker
2 |
3 | import androidx.appcompat.app.AppCompatActivity
4 | import dagger.hilt.android.AndroidEntryPoint
5 |
6 | @AndroidEntryPoint
7 | class HiltTestActivity : AppCompatActivity()
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/ic_logo-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/ic_logo-playstore.png
--------------------------------------------------------------------------------
/app/src/main/ic_main_logo-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/ic_main_logo-playstore.png
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/di/StorageModule.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.di
6 |
7 | import com.ibrajix.jetpacker.storage.DataStorage
8 | import com.ibrajix.jetpacker.storage.DataStorageImplementation
9 | import dagger.Binds
10 | import dagger.Module
11 | import dagger.hilt.InstallIn
12 | import dagger.hilt.components.SingletonComponent
13 |
14 | @Module
15 | @InstallIn(SingletonComponent::class)
16 | abstract class StorageModule {
17 |
18 | @Binds
19 | abstract fun bindDataStorage(dataStorageImplementation: DataStorageImplementation): DataStorage
20 |
21 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/global/MyApplication.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.global
6 |
7 | import android.app.Application
8 | import dagger.hilt.android.HiltAndroidApp
9 |
10 | @HiltAndroidApp
11 | class MyApplication : Application()
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/storage/DataStorage.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.storage
6 |
7 | import kotlinx.coroutines.flow.Flow
8 |
9 | interface DataStorage {
10 |
11 | fun getWalletBalance() : Flow
12 | suspend fun setWalletBalance(balance: String)
13 |
14 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/storage/DataStorageImplementation.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.storage
6 |
7 | import android.content.Context
8 | import androidx.datastore.core.DataStore
9 | import androidx.datastore.preferences.core.Preferences
10 | import androidx.datastore.preferences.core.edit
11 | import androidx.datastore.preferences.core.emptyPreferences
12 | import androidx.datastore.preferences.core.stringPreferencesKey
13 | import androidx.datastore.preferences.preferencesDataStore
14 | import dagger.hilt.android.qualifiers.ApplicationContext
15 | import kotlinx.coroutines.flow.catch
16 | import kotlinx.coroutines.flow.map
17 | import java.io.IOException
18 | import javax.inject.Inject
19 | import javax.inject.Singleton
20 |
21 | val Context.dataStore: DataStore by preferencesDataStore(name = "data_Storage")
22 |
23 | @Singleton
24 | class DataStorageImplementation @Inject constructor(@ApplicationContext context: Context) : DataStorage {
25 |
26 | private val dataStore = context.dataStore
27 |
28 | //keys
29 | private object PreferenceKeys{
30 | val WALLET_BALANCE = stringPreferencesKey("wallet_ballance")
31 | }
32 |
33 | override fun getWalletBalance() = dataStore.data.catch {
34 | if (it is IOException){
35 | emit(emptyPreferences())
36 | } else {
37 | throw it
38 | }
39 | }.map {
40 | it[PreferenceKeys.WALLET_BALANCE] ?: "0.0000"
41 | }
42 |
43 | override suspend fun setWalletBalance(balance: String) {
44 | dataStore.edit {
45 | it[PreferenceKeys.WALLET_BALANCE] = balance
46 | }
47 | }
48 |
49 |
50 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/activities/ContainerActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.activities
6 |
7 | import android.os.Bundle
8 | import androidx.appcompat.app.AppCompatActivity
9 | import com.ibrajix.jetpacker.R
10 | import com.ibrajix.jetpacker.utils.Utility.whiteStatusBar
11 | import dagger.hilt.android.AndroidEntryPoint
12 |
13 | /**
14 | * This activity hosts the entire fragments
15 | */
16 |
17 | @AndroidEntryPoint
18 | class ContainerActivity : AppCompatActivity() {
19 | override fun onCreate(savedInstanceState: Bundle?) {
20 | super.onCreate(savedInstanceState)
21 | whiteStatusBar()
22 | setContentView(R.layout.activity_container)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/activities/MainActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.activities
6 |
7 | import android.content.Intent
8 | import android.os.Bundle
9 | import android.os.Handler
10 | import android.os.Looper
11 | import androidx.appcompat.app.AppCompatActivity
12 | import com.daimajia.androidanimations.library.Techniques
13 | import com.daimajia.androidanimations.library.YoYo
14 | import com.ibrajix.jetpacker.databinding.ActivityMainBinding
15 | import com.ibrajix.jetpacker.utils.Constants.SPLASH_SCREEN_TIME
16 | import com.ibrajix.jetpacker.utils.Utility.whiteStatusBar
17 | import dagger.hilt.android.AndroidEntryPoint
18 |
19 | /**
20 | * This is the launcher activity which displays on first time visit
21 | */
22 |
23 |
24 | @AndroidEntryPoint
25 | class MainActivity : AppCompatActivity() {
26 |
27 | private lateinit var binding: ActivityMainBinding
28 |
29 | override fun onCreate(savedInstanceState: Bundle?) {
30 | super.onCreate(savedInstanceState)
31 |
32 | whiteStatusBar()
33 | binding = ActivityMainBinding.inflate(layoutInflater)
34 | setContentView(binding.root)
35 |
36 | //initialize view
37 | initView()
38 |
39 | }
40 |
41 | private fun initView(){
42 | startAnimation()
43 | goToNextActivity()
44 | }
45 |
46 | private fun startAnimation(){
47 |
48 | YoYo.with(Techniques.RotateInDownLeft)
49 | .duration(3000)
50 | .repeat(0)
51 | .playOn(binding.icLogo)
52 |
53 | YoYo.with(Techniques.RotateInDownRight)
54 | .duration(3000)
55 | .repeat(0)
56 | .playOn(binding.txtSpacex)
57 |
58 | YoYo.with(Techniques.RotateInDownRight)
59 | .duration(3000)
60 | .repeat(0)
61 | .playOn(binding.txtOdyssey)
62 |
63 | }
64 |
65 | /**
66 | * Normally, I don't use this splash screen implementation approach, I only use this to showcase the startup animation
67 | */
68 |
69 | private fun goToNextActivity(){
70 |
71 | //delay for 5 seconds and move to next activity
72 | Handler(Looper.getMainLooper()).postDelayed({
73 | val intent = Intent(this, ContainerActivity::class.java)
74 | startActivity(intent)
75 | finish()}, SPLASH_SCREEN_TIME)
76 |
77 | }
78 |
79 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/fragments/EnjoyRideFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.fragments
6 |
7 | import android.graphics.Color
8 | import android.os.Bundle
9 | import android.view.LayoutInflater
10 | import android.view.View
11 | import android.view.ViewGroup
12 | import androidx.fragment.app.Fragment
13 | import com.daimajia.androidanimations.library.Techniques
14 | import com.daimajia.androidanimations.library.YoYo
15 | import com.ibrajix.jetpacker.R
16 | import com.ibrajix.jetpacker.databinding.FragmentEnjoyRideBinding
17 | import com.ibrajix.jetpacker.utils.viewBinding
18 | import nl.dionsegijn.konfetti.models.Shape
19 | import nl.dionsegijn.konfetti.models.Size
20 |
21 | class EnjoyRideFragment : Fragment() {
22 |
23 | private val binding by viewBinding(FragmentEnjoyRideBinding::bind)
24 |
25 | override fun onCreate(savedInstanceState: Bundle?) {
26 | super.onCreate(savedInstanceState)
27 | }
28 |
29 | override fun onCreateView(
30 | inflater: LayoutInflater, container: ViewGroup?,
31 | savedInstanceState: Bundle?
32 | ): View? {
33 | // Inflate the layout for this fragment
34 | return inflater.inflate(R.layout.fragment_enjoy_ride, container, false)
35 | }
36 |
37 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
38 | super.onViewCreated(view, savedInstanceState)
39 | initView()
40 | }
41 |
42 | private fun initView(){
43 |
44 | /**
45 | * Do some animation and cofetti view with the aid of third party libraries
46 | */
47 |
48 |
49 | YoYo.with(Techniques.Swing)
50 | .duration(3000)
51 | .repeat(3)
52 | .playOn(binding.icLogo)
53 |
54 | binding.viewKonfetti.build()
55 | .addColors(Color.YELLOW, Color.GREEN, Color.MAGENTA)
56 | .setDirection(0.0, 359.0)
57 | .setSpeed(1f, 5f)
58 | .setFadeOutEnabled(true)
59 | .setTimeToLive(5000L)
60 | .addShapes(Shape.Square, Shape.Circle)
61 | .addSizes(Size(12))
62 | .setPosition(-50f, binding.viewKonfetti.width + 50f, -50f, -50f)
63 | .streamFor(300, 5000L)
64 |
65 | }
66 |
67 |
68 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/fragments/FundWalletFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.fragments
6 |
7 | import android.os.Bundle
8 | import android.view.LayoutInflater
9 | import android.view.View
10 | import android.view.ViewGroup
11 | import androidx.fragment.app.Fragment
12 | import androidx.fragment.app.viewModels
13 | import androidx.navigation.fragment.findNavController
14 | import com.ibrajix.jetpacker.R
15 | import com.ibrajix.jetpacker.databinding.FragmentFundWalletBinding
16 | import com.ibrajix.jetpacker.ui.viewmodel.StorageViewModel
17 | import com.ibrajix.jetpacker.utils.viewBinding
18 | import dagger.hilt.android.AndroidEntryPoint
19 |
20 |
21 | @AndroidEntryPoint
22 | class FundWalletFragment : Fragment() {
23 |
24 | private val viewModel: StorageViewModel by viewModels()
25 |
26 | private val binding by viewBinding(FragmentFundWalletBinding::bind)
27 |
28 | override fun onCreate(savedInstanceState: Bundle?) {
29 | super.onCreate(savedInstanceState)
30 |
31 | }
32 |
33 | override fun onCreateView(
34 | inflater: LayoutInflater, container: ViewGroup?,
35 | savedInstanceState: Bundle?
36 | ): View? {
37 | // Inflate the layout for this fragment
38 | return inflater.inflate(R.layout.fragment_fund_wallet, container, false)
39 | }
40 |
41 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
42 | super.onViewCreated(view, savedInstanceState)
43 | initView()
44 | }
45 |
46 | private fun initView(){
47 | handleClicks()
48 | }
49 |
50 | private fun handleClicks(){
51 |
52 | //on click back
53 | binding.icBack.setOnClickListener {
54 | findNavController().popBackStack()
55 | }
56 |
57 | //on click button fund wallet
58 | binding.btnFundWallet.setOnClickListener {
59 |
60 | //set balance
61 | viewModel.changeWalletBalance(binding.editText.text.toString())
62 |
63 | //navigate to success screen
64 | findNavController().navigate(FundWalletFragmentDirections.actionFundWalletFragmentToFundingSuccessFragment())
65 | }
66 |
67 | }
68 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/fragments/FundingSuccessFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.fragments
6 |
7 | import android.os.Bundle
8 | import android.view.LayoutInflater
9 | import android.view.View
10 | import android.view.ViewGroup
11 | import androidx.fragment.app.Fragment
12 | import androidx.navigation.fragment.findNavController
13 | import com.ibrajix.jetpacker.R
14 | import com.ibrajix.jetpacker.databinding.FragmentFundingSuccessBinding
15 | import com.ibrajix.jetpacker.utils.viewBinding
16 |
17 | class FundingSuccessFragment : Fragment() {
18 |
19 | private val binding by viewBinding(FragmentFundingSuccessBinding::bind)
20 |
21 | override fun onCreate(savedInstanceState: Bundle?) {
22 | super.onCreate(savedInstanceState)
23 | }
24 |
25 | override fun onCreateView(
26 | inflater: LayoutInflater, container: ViewGroup?,
27 | savedInstanceState: Bundle?
28 | ): View? {
29 | // Inflate the layout for this fragment
30 | return inflater.inflate(R.layout.fragment_funding_success, container, false)
31 | }
32 |
33 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
34 | super.onViewCreated(view, savedInstanceState)
35 | initView()
36 | }
37 |
38 | private fun initView(){
39 | handleClick()
40 | }
41 |
42 | private fun handleClick(){
43 |
44 | //on click back
45 | binding.btnOkay.setOnClickListener {
46 | findNavController().navigate(FundingSuccessFragmentDirections.actionFundingSuccessFragmentToHomeFragment())
47 | }
48 |
49 | }
50 |
51 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/fragments/HomeFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.fragments
6 |
7 | import android.os.Bundle
8 | import androidx.fragment.app.Fragment
9 | import android.view.LayoutInflater
10 | import android.view.View
11 | import android.view.ViewGroup
12 | import androidx.fragment.app.viewModels
13 | import androidx.navigation.fragment.findNavController
14 | import com.ibrajix.jetpacker.R
15 | import com.ibrajix.jetpacker.databinding.FragmentHomeBinding
16 | import com.ibrajix.jetpacker.ui.viewmodel.StorageViewModel
17 | import com.ibrajix.jetpacker.utils.viewBinding
18 | import dagger.hilt.android.AndroidEntryPoint
19 |
20 | @AndroidEntryPoint
21 | class HomeFragment : Fragment() {
22 |
23 | private val binding by viewBinding(FragmentHomeBinding::bind)
24 | private val viewModel: StorageViewModel by viewModels()
25 | private var walletBalance: String? = null
26 |
27 | override fun onCreate(savedInstanceState: Bundle?) {
28 | super.onCreate(savedInstanceState)
29 | }
30 |
31 | override fun onCreateView(
32 | inflater: LayoutInflater, container: ViewGroup?,
33 | savedInstanceState: Bundle?
34 | ): View? {
35 | // Inflate the layout for this fragment
36 | return inflater.inflate(R.layout.fragment_home, container, false)
37 | }
38 |
39 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
40 | super.onViewCreated(view, savedInstanceState)
41 | initView()
42 | }
43 |
44 | private fun initView(){
45 | observe()
46 | handleClicks()
47 | }
48 |
49 | /**
50 | * Observe changes to wallet balance - livedata
51 | */
52 |
53 | private fun observe(){
54 |
55 | viewModel.walletBalance.observe(viewLifecycleOwner){
56 | walletBalance = it
57 | binding.txtBtcAmount.text = walletBalance
58 | }
59 |
60 | }
61 |
62 |
63 | private fun handleClicks(){
64 |
65 | //on click btn fund wallet
66 | binding.btnFundWallet.setOnClickListener {
67 | findNavController().navigate(HomeFragmentDirections.actionHomeFragmentToFundWalletFragment())
68 | }
69 |
70 | //on click start journey
71 | binding.lytStartJourney.setOnClickListener {
72 | findNavController().navigate(HomeFragmentDirections.actionHomeFragmentToSelectSpaceCraftFragment())
73 | }
74 |
75 | }
76 |
77 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/fragments/SelectDestination2Fragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.fragments
6 |
7 | import android.os.Bundle
8 | import android.view.LayoutInflater
9 | import android.view.View
10 | import android.view.ViewGroup
11 | import androidx.fragment.app.Fragment
12 | import androidx.navigation.fragment.findNavController
13 | import com.ibrajix.jetpacker.R
14 | import com.ibrajix.jetpacker.databinding.FragmentSelectDestination2Binding
15 | import com.ibrajix.jetpacker.ui.model.TripDetails
16 | import com.ibrajix.jetpacker.utils.viewBinding
17 |
18 | class SelectDestination2Fragment : Fragment() {
19 |
20 | private val binding by viewBinding(FragmentSelectDestination2Binding::bind)
21 |
22 | override fun onCreate(savedInstanceState: Bundle?) {
23 | super.onCreate(savedInstanceState)
24 | }
25 |
26 | override fun onCreateView(
27 | inflater: LayoutInflater, container: ViewGroup?,
28 | savedInstanceState: Bundle?
29 | ): View? {
30 | // Inflate the layout for this fragment
31 | return inflater.inflate(R.layout.fragment_select_destination2, container, false)
32 | }
33 |
34 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
35 | super.onViewCreated(view, savedInstanceState)
36 | initView()
37 | }
38 |
39 | private fun initView(){
40 |
41 | //handle clicks
42 | handleClicks()
43 | }
44 |
45 | private fun handleClicks(){
46 |
47 |
48 | //on click back
49 | binding.icBack.setOnClickListener {
50 | findNavController().popBackStack()
51 | }
52 |
53 | val tripDetails1 = TripDetails(
54 | spaceCraft = requireContext().getString(R.string.falcon_9),
55 | station = requireContext().getString(R.string.abuja_to_moon),
56 | orbit = requireContext().getString(R.string.earth_earth),
57 | type = requireContext().getString(R.string.natural),
58 | fair_2 = requireContext().getString(R.string.royalty_landing),
59 | btc_2 = requireContext().getString(R.string.two_hundred_btc),
60 | )
61 |
62 | val tripDetails2 = TripDetails(
63 | spaceCraft = requireContext().getString(R.string.falcon_9),
64 | station = requireContext().getString(R.string.mars_to_space),
65 | orbit = requireContext().getString(R.string.mars_earth),
66 | type = requireContext().getString(R.string.manmade),
67 | fair_2 = requireContext().getString(R.string.royalty_landing),
68 | btc_2 = requireContext().getString(R.string.two_hundred_btc),
69 | )
70 |
71 | //on click destination
72 | binding.lytAbujaToMoon.setOnClickListener {
73 | findNavController().navigate(SelectDestination2FragmentDirections.actionSelectDestination2FragmentToTripDetailsFragment(tripDetails = tripDetails1))
74 | }
75 |
76 | //on click destination
77 | binding.lytMarsToInternationalSpace.setOnClickListener {
78 | findNavController().navigate(SelectDestination2FragmentDirections.actionSelectDestination2FragmentToTripDetailsFragment(tripDetails2))
79 | }
80 |
81 | }
82 |
83 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/fragments/SelectDestinationFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.fragments
6 |
7 | import android.os.Bundle
8 | import android.view.LayoutInflater
9 | import android.view.View
10 | import android.view.ViewGroup
11 | import androidx.fragment.app.Fragment
12 | import androidx.navigation.fragment.findNavController
13 | import com.ibrajix.jetpacker.R
14 | import com.ibrajix.jetpacker.databinding.FragmentSelectDestinationBinding
15 | import com.ibrajix.jetpacker.ui.model.TripDetails
16 | import com.ibrajix.jetpacker.utils.viewBinding
17 |
18 | class SelectDestinationFragment : Fragment() {
19 |
20 | private val binding by viewBinding(FragmentSelectDestinationBinding::bind)
21 |
22 | override fun onCreate(savedInstanceState: Bundle?) {
23 | super.onCreate(savedInstanceState)
24 |
25 | }
26 |
27 | override fun onCreateView(
28 | inflater: LayoutInflater, container: ViewGroup?,
29 | savedInstanceState: Bundle?
30 | ): View? {
31 | // Inflate the layout for this fragment
32 | return inflater.inflate(R.layout.fragment_select_destination, container, false)
33 | }
34 |
35 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
36 | super.onViewCreated(view, savedInstanceState)
37 | initView()
38 | }
39 |
40 | private fun initView(){
41 | handleClicks()
42 | }
43 |
44 | private fun handleClicks(){
45 |
46 | val tripDetails = TripDetails(
47 | spaceCraft = requireContext().getString(R.string.falcon_1),
48 | station = requireContext().getString(R.string.moon_to_spook_stations),
49 | orbit = requireContext().getString(R.string.earth_mass),
50 | type = requireContext().getString(R.string.natural),
51 | fair_1 = requireContext().getString(R.string.cross_orbit),
52 | fair_2 = requireContext().getString(R.string.royalty_landing),
53 | fair_3 = requireContext().getString(R.string.journey_2_points),
54 | btc_1 = requireContext().getString(R.string.two_fifty_btc),
55 | btc_2 = requireContext().getString(R.string.two_hundred_btc),
56 | btc_3 = requireContext().getString(R.string.fifty_btc),
57 | )
58 |
59 | //on click back
60 | binding.icBack.setOnClickListener {
61 | findNavController().popBackStack()
62 | }
63 |
64 | //on click destination
65 | binding.lytFalcon1.setOnClickListener {
66 | findNavController().navigate(SelectDestinationFragmentDirections.actionSelectDestinationFragmentToTripDetailsFragment(tripDetails = tripDetails))
67 | }
68 |
69 | }
70 |
71 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/fragments/SelectSpaceCraftFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.fragments
6 |
7 | import android.os.Bundle
8 | import androidx.fragment.app.Fragment
9 | import android.view.LayoutInflater
10 | import android.view.View
11 | import android.view.ViewGroup
12 | import android.widget.Toast
13 | import androidx.fragment.app.viewModels
14 | import androidx.navigation.fragment.findNavController
15 | import com.ibrajix.jetpacker.R
16 | import com.ibrajix.jetpacker.databinding.FragmentSelectSpaceCraftBinding
17 | import com.ibrajix.jetpacker.ui.viewmodel.StorageViewModel
18 | import com.ibrajix.jetpacker.utils.viewBinding
19 | import dagger.hilt.android.AndroidEntryPoint
20 |
21 |
22 | @AndroidEntryPoint
23 | class SelectSpaceCraftFragment : Fragment() {
24 |
25 | private val binding by viewBinding(FragmentSelectSpaceCraftBinding::bind)
26 | private val viewModel: StorageViewModel by viewModels()
27 |
28 | override fun onCreate(savedInstanceState: Bundle?) {
29 | super.onCreate(savedInstanceState)
30 | }
31 |
32 | override fun onCreateView(
33 | inflater: LayoutInflater, container: ViewGroup?,
34 | savedInstanceState: Bundle?
35 | ): View? {
36 | // Inflate the layout for this fragment
37 | return inflater.inflate(R.layout.fragment_select_space_craft, container, false)
38 | }
39 |
40 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
41 | super.onViewCreated(view, savedInstanceState)
42 | initView()
43 | }
44 |
45 | private fun initView(){
46 | observe()
47 | handleClicks()
48 | }
49 |
50 | private fun observe(){
51 | viewModel.walletBalance.observe(viewLifecycleOwner){
52 |
53 | //check if saved value in data store is equal to the default
54 | if (!it.equals(requireContext().getString(R.string.zero_btc))){
55 | binding.lytWalletFunded.visibility = View.VISIBLE
56 | binding.lytNoFunds.visibility = View.GONE
57 | }
58 |
59 | else{
60 | binding.lytWalletFunded.visibility = View.GONE
61 | binding.lytNoFunds.visibility = View.VISIBLE
62 | }
63 |
64 | }
65 | }
66 |
67 | private fun handleClicks(){
68 |
69 | //on click back
70 | binding.icBack.setOnClickListener {
71 | findNavController().popBackStack()
72 | }
73 |
74 |
75 | //on click falcon 1
76 | binding.lytFalcon1.setOnClickListener {
77 | findNavController().navigate(SelectSpaceCraftFragmentDirections.actionSelectSpaceCraftFragmentToSelectDestinationFragment())
78 | }
79 |
80 | //on click falcon 9
81 | binding.lytFalcon9.setOnClickListener {
82 | findNavController().navigate(SelectSpaceCraftFragmentDirections.actionSelectSpaceCraftFragmentToSelectDestination2Fragment())
83 | }
84 |
85 | //on click btn fund
86 | binding.btnFundWallet.setOnClickListener {
87 | findNavController().navigate(SelectSpaceCraftFragmentDirections.actionSelectSpaceCraftFragmentToFundWalletFragment())
88 | }
89 |
90 | }
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/fragments/TripDetailsFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.fragments
6 |
7 | import android.os.Bundle
8 | import android.view.LayoutInflater
9 | import android.view.View
10 | import android.view.ViewGroup
11 | import androidx.fragment.app.Fragment
12 | import androidx.navigation.fragment.findNavController
13 | import androidx.navigation.fragment.navArgs
14 | import com.ibrajix.jetpacker.R
15 | import com.ibrajix.jetpacker.databinding.FragmentTripDetailsBinding
16 | import com.ibrajix.jetpacker.utils.viewBinding
17 |
18 | class TripDetailsFragment : Fragment() {
19 |
20 | private val binding by viewBinding(FragmentTripDetailsBinding::bind)
21 | private val args: TripDetailsFragmentArgs by navArgs()
22 |
23 | override fun onCreate(savedInstanceState: Bundle?) {
24 | super.onCreate(savedInstanceState)
25 |
26 | }
27 |
28 | override fun onCreateView(
29 | inflater: LayoutInflater, container: ViewGroup?,
30 | savedInstanceState: Bundle?
31 | ): View? {
32 | // Inflate the layout for this fragment
33 | return inflater.inflate(R.layout.fragment_trip_details, container, false)
34 | }
35 |
36 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
37 | super.onViewCreated(view, savedInstanceState)
38 | initView()
39 | }
40 |
41 | private fun initView(){
42 |
43 | setView()
44 |
45 | handleClicks()
46 | }
47 |
48 | private fun setView(){
49 |
50 | binding.txtBtc1.text = args.tripDetails.btc_1
51 | binding.txtBtc2.text = args.tripDetails.btc_2
52 | binding.txtBtc3.text = args.tripDetails.btc_3
53 | binding.txtFair1.text = args.tripDetails.fair_1
54 | binding.txtFair2.text = args.tripDetails.fair_2
55 | binding.txtFair3.text = args.tripDetails.fair_3
56 | binding.txtOrbit.text = args.tripDetails.orbit
57 | binding.txtSpaceCraft.text = args.tripDetails.spaceCraft
58 | binding.txtStation.text = args.tripDetails.station
59 | binding.txtType.text = args.tripDetails.type
60 |
61 | }
62 |
63 | private fun handleClicks(){
64 |
65 | //on click back
66 | binding.icBack.setOnClickListener {
67 | findNavController().popBackStack()
68 | }
69 |
70 | //on click begin trip
71 | binding.btnBeginTrip.setOnClickListener {
72 | findNavController().navigate(TripDetailsFragmentDirections.actionTripDetailsFragmentToEnjoyRideFragment())
73 | }
74 |
75 | }
76 |
77 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/model/TripDetails.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.model
6 |
7 | import android.os.Parcelable
8 | import kotlinx.android.parcel.Parcelize
9 |
10 |
11 | @Parcelize
12 | data class TripDetails (
13 | val spaceCraft: String,
14 | val station: String,
15 | val orbit: String,
16 | val type: String,
17 | val fair_1: String = "-",
18 | val fair_2: String = "-",
19 | val fair_3: String = "-",
20 | val btc_1: String = "-",
21 | val btc_2: String = "-",
22 | val btc_3: String = "-"
23 | ) : Parcelable
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/ui/viewmodel/StorageViewModel.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.ui.viewmodel
6 |
7 | import androidx.lifecycle.ViewModel
8 | import androidx.lifecycle.asLiveData
9 | import androidx.lifecycle.viewModelScope
10 | import com.ibrajix.jetpacker.storage.DataStorage
11 | import dagger.hilt.android.lifecycle.HiltViewModel
12 | import kotlinx.coroutines.launch
13 | import javax.inject.Inject
14 |
15 | @HiltViewModel
16 | class StorageViewModel @Inject constructor(private val dataStorage: DataStorage) : ViewModel() {
17 |
18 | val walletBalance = dataStorage.getWalletBalance().asLiveData()
19 | fun changeWalletBalance(balance: String){
20 | viewModelScope.launch {
21 | dataStorage.setWalletBalance(balance)
22 | }
23 | }
24 |
25 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/utils/Constants.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.utils
6 |
7 | object Constants {
8 |
9 | const val SPLASH_SCREEN_TIME = 3500L
10 |
11 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/utils/FragmentViewBindingDelegate.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.utils
6 |
7 |
8 | import android.view.View
9 | import androidx.fragment.app.Fragment
10 | import androidx.lifecycle.DefaultLifecycleObserver
11 | import androidx.lifecycle.Lifecycle
12 | import androidx.lifecycle.LifecycleOwner
13 | import androidx.lifecycle.Observer
14 | import androidx.viewbinding.ViewBinding
15 | import kotlin.properties.ReadOnlyProperty
16 | import kotlin.reflect.KProperty
17 |
18 | /**
19 | * This class is used for simplifying viewBinding declarations in fragment, this way you don't have to call fragments onDestroy to nullify the binding every time
20 | */
21 |
22 | class FragmentViewBindingDelegate(
23 | val fragment: Fragment,
24 | val viewBindingFactory: (View) -> T
25 | ) : ReadOnlyProperty {
26 | private var binding: T? = null
27 |
28 | init {
29 | fragment.lifecycle.addObserver(object : DefaultLifecycleObserver {
30 | val viewLifecycleOwnerLiveDataObserver =
31 | Observer {
32 | val viewLifecycleOwner = it ?: return@Observer
33 |
34 | viewLifecycleOwner.lifecycle.addObserver(object : DefaultLifecycleObserver {
35 | override fun onDestroy(owner: LifecycleOwner) {
36 | binding = null
37 | }
38 | })
39 | }
40 |
41 | override fun onCreate(owner: LifecycleOwner) {
42 | fragment.viewLifecycleOwnerLiveData.observeForever(viewLifecycleOwnerLiveDataObserver)
43 | }
44 |
45 | override fun onDestroy(owner: LifecycleOwner) {
46 | fragment.viewLifecycleOwnerLiveData.removeObserver(viewLifecycleOwnerLiveDataObserver)
47 | }
48 | })
49 | }
50 |
51 | override fun getValue(thisRef: Fragment, property: KProperty<*>): T {
52 | val binding = binding
53 | if (binding != null) {
54 | return binding
55 | }
56 |
57 | val lifecycle = fragment.viewLifecycleOwner.lifecycle
58 | if (!lifecycle.currentState.isAtLeast(Lifecycle.State.INITIALIZED)) {
59 | throw IllegalStateException("Should not attempt to get bindings when Fragment views are destroyed.")
60 | }
61 |
62 | return viewBindingFactory(thisRef.requireView()).also { this.binding = it }
63 | }
64 |
65 | }
66 |
67 | fun Fragment.viewBinding(viewBindingFactory: (View) -> T) =
68 | FragmentViewBindingDelegate(this, viewBindingFactory)
--------------------------------------------------------------------------------
/app/src/main/java/com/ibrajix/jetpacker/utils/Utility.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Written and Developed by Inuwa Ibrahim - https://linktr.ee/Ibrajix
3 | */
4 |
5 | package com.ibrajix.jetpacker.utils
6 |
7 | import android.annotation.SuppressLint
8 | import android.app.Activity
9 | import android.graphics.Color
10 | import android.view.LayoutInflater
11 | import android.view.View
12 | import androidx.appcompat.app.AppCompatActivity
13 | import androidx.viewbinding.ViewBinding
14 |
15 |
16 | @Suppress("DEPRECATION")
17 | @SuppressLint("InlinedApi")
18 | object Utility {
19 |
20 | //faster view binding in activity
21 | inline fun AppCompatActivity.viewBinding(
22 | crossinline bindingInflater: (LayoutInflater) -> T
23 | ) = lazy(LazyThreadSafetyMode.NONE) {
24 | bindingInflater.invoke(layoutInflater)
25 | }
26 |
27 | //make status bar color white
28 | fun Activity.whiteStatusBar(){
29 | window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
30 | window.statusBarColor = Color.WHITE
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_solid_border.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/et_round_border.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
9 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_back.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_empty_wallet.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
15 |
18 |
21 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_location.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_logo.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_main_logo_foreground.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_mark_green.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_rocket_falcon.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
15 |
18 |
21 |
24 |
27 |
30 |
33 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_start_journey.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
9 |
12 |
15 |
18 |
21 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/lyt_with_border_and_stroke.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/lyt_with_solid_border_grey.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/lyt_with_solid_border_main_orange.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/lyt_with_solid_border_orange_opaque.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/font/avenir_black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/font/avenir_black.ttf
--------------------------------------------------------------------------------
/app/src/main/res/font/avenir_regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/font/avenir_regular.ttf
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_container.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
21 |
22 |
33 |
34 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_enjoy_ride.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
23 |
24 |
30 |
31 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_fund_wallet.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
30 |
31 |
41 |
42 |
53 |
54 |
63 |
64 |
78 |
79 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_funding_success.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
21 |
22 |
37 |
38 |
39 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
23 |
24 |
32 |
33 |
43 |
44 |
45 |
57 |
58 |
70 |
71 |
79 |
80 |
81 |
82 |
96 |
97 |
98 |
108 |
109 |
118 |
119 |
132 |
133 |
134 |
135 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_select_destination.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
30 |
31 |
41 |
42 |
51 |
52 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_select_destination2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
30 |
31 |
41 |
42 |
51 |
52 |
60 |
61 |
62 |
63 |
76 |
77 |
86 |
87 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_select_space_craft.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
30 |
31 |
32 |
44 |
45 |
54 |
55 |
56 |
63 |
64 |
79 |
80 |
90 |
91 |
92 |
93 |
106 |
107 |
108 |
115 |
116 |
131 |
132 |
142 |
143 |
144 |
145 |
146 |
147 |
159 |
160 |
168 |
169 |
181 |
182 |
193 |
194 |
208 |
209 |
210 |
211 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_trip_details.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
22 |
23 |
35 |
36 |
37 |
47 |
48 |
57 |
58 |
66 |
67 |
77 |
78 |
87 |
88 |
96 |
97 |
98 |
108 |
109 |
118 |
119 |
127 |
128 |
138 |
139 |
148 |
149 |
157 |
158 |
159 |
169 |
170 |
182 |
183 |
184 |
195 |
196 |
204 |
205 |
206 |
216 |
217 |
228 |
229 |
230 |
240 |
241 |
249 |
250 |
260 |
261 |
272 |
273 |
274 |
284 |
285 |
293 |
294 |
295 |
310 |
311 |
312 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_main_logo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_main_logo_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_main_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/mipmap-hdpi/ic_main_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_main_logo_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/mipmap-hdpi/ic_main_logo_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_main_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/mipmap-mdpi/ic_main_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_main_logo_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/mipmap-mdpi/ic_main_logo_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_main_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/mipmap-xhdpi/ic_main_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_main_logo_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/mipmap-xhdpi/ic_main_logo_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_main_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/mipmap-xxhdpi/ic_main_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_main_logo_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/mipmap-xxhdpi/ic_main_logo_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_main_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/mipmap-xxxhdpi/ic_main_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_main_logo_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/app/src/main/res/mipmap-xxxhdpi/ic_main_logo_round.png
--------------------------------------------------------------------------------
/app/src/main/res/navigation/nav_graph.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
20 |
27 |
28 |
33 |
36 |
37 |
42 |
45 |
46 |
51 |
54 |
57 |
60 |
61 |
66 |
69 |
70 |
75 |
78 |
79 |
84 |
87 |
90 |
91 |
96 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF000000
4 | #FFFFFFFF
5 |
6 | #FF8162
7 | #80FF8162
8 | #EAE9E9
9 | #C4C4C4
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_logo_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF8162
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_main_logo_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF8162
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | JetPacker
3 | JetPacker
4 | ➝
5 | Welcome,
6 | awesome
7 | Balance
8 | 0.0000
9 | BTC
10 | Fund Wallet
11 | Start your journey
12 | Amount (BTC)
13 | 10,000
14 | Enter the amount you want to fund
15 | Wallet funded successfully
16 | Okay
17 | Select Spacecraft
18 | Falcon 1
19 | Regular
20 | Falcon 9
21 | Premium
22 | Select Destination
23 | Moon to spook stations on mars
24 | Abuja station to moon
25 | Mars to international space station
26 | Trip Details
27 | Enjoy your ride!
28 | Space craft
29 | Station
30 | Orbit
31 | Type
32 | Fair 1
33 | Fair 2
34 | Fair 3
35 | Begin Trip
36 | Earth
37 | Natural
38 | Cross from one orbit to another
39 | Royalty when landing on man made satellite
40 | Journey between two points in an orbit
41 | BTC 250
42 | BTC 200
43 | BTC 50
44 | Earth - Earth
45 | Mars - Earth
46 | ManMade
47 | Earth - Mars
48 | 0.00000
49 | 3,000
50 | Empty Wallet
51 | You have to fund your wallet first
52 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/test/java/com/ibrajix/jetpacker/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.ibrajix.jetpacker
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 | dependencies {
8 | classpath "com.android.tools.build:gradle:7.0.3"
9 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
10 |
11 | //safe-args - to pass data between screens
12 | classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
13 |
14 | //hilt - dependency injection
15 | classpath "com.google.dagger:hilt-android-gradle-plugin:2.39.1"
16 | }
17 | }
18 |
19 | task clean(type: Delete) {
20 | delete rootProject.buildDir
21 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ibrajix/JetPacker/f4e01e506acb3d0fcae66c05e877b45e5216d405/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Dec 07 20:12:54 WAT 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | dependencyResolutionManagement {
2 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
3 | repositories {
4 | google()
5 | mavenCentral()
6 | jcenter() // Warning: this repository is going to shut down soon
7 | }
8 | }
9 | rootProject.name = "JetPacker"
10 | include ':app'
11 |
--------------------------------------------------------------------------------