Skip to content

Commit

Permalink
WIP #80: UI created for Feedback screen. Existing not removed yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
bosankus committed Nov 15, 2021
1 parent b1502a8 commit 5c8407b
Show file tree
Hide file tree
Showing 14 changed files with 434 additions and 42 deletions.
40 changes: 34 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ android {
buildConfigField "String", "QUOTE_API_KEY", "\"API-KEY\""
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}

buildTypes {
Expand All @@ -32,6 +35,7 @@ android {
buildFeatures {
dataBinding true
viewBinding true
compose true
}

compileOptions {
Expand All @@ -40,17 +44,22 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion '1.0.5'
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion kotlin_version
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
jvmTarget = '1.8'
useIR = true
}


packagingOptions {
exclude 'META-INF/AL2.0'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/atomicfu.kotlin_module'
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}

Expand All @@ -75,6 +84,7 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "com.google.truth:truth:1.1"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"

// CanaryLeak
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
Expand Down Expand Up @@ -133,9 +143,6 @@ dependencies {
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

/*// Paging Library
implementation "androidx.paging:paging-runtime-ktx:2.1.2"*/

// DI - Hilt
implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hilt_jetpack_version"
implementation "com.google.dagger:hilt-android:$hilt_version"
Expand All @@ -148,6 +155,8 @@ dependencies {

// Lottie Animation
implementation "com.airbnb.android:lottie:$lottie_version"
// Lottie for compose
implementation "com.airbnb.android:lottie-compose:$lottie_version"

// Shimmer effect
implementation "com.facebook.shimmer:shimmer:$shimmer_version"
Expand All @@ -158,5 +167,24 @@ dependencies {
// Image Picker
implementation "com.github.dhaval2404:imagepicker:$picker_version"


/*JETPACK COMPOSE DEPENDENCIES*/
implementation "androidx.compose.ui:ui:$compose_version"
// Compose compiler
implementation "androidx.compose.compiler:compiler:1.1.0-beta02"
// Integration with activities
implementation 'androidx.activity:activity-compose:1.4.0'
// Compose Material Design
implementation 'androidx.compose.material:material:1.0.5'
// Animations
implementation 'androidx.compose.animation:animation:1.0.5'
// Tooling support (Previews, etc.)
implementation "androidx.compose.ui:ui-tooling-preview:1.0.5"
implementation 'androidx.compose.ui:ui-tooling:1.0.5'
// Integration with ViewModels
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0'
// When using a AppCompat theme - Reuse existing view theme
implementation "com.google.accompanist:accompanist-appcompat-theme:0.16.0"

}
apply plugin: 'com.google.gms.google-services'
18 changes: 10 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,29 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED " />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:protectionLevel="signature" />

<application
android:name=".TodoApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/MaterialTheme"
android:allowBackup="false"
android:windowSoftInputMode="adjustPan|stateHidden"
tools:ignore="AllowBackup,UnusedAttribute">

<activity android:name=".view.activity.MainActivity"
<activity
android:name=".view.feedback.FeedbackActivity"
android:exported="false"
android:label="@string/title_activity_feedback"
android:theme="@style/MaterialTheme.NoActionBar" />
<activity
android:name=".view.activity.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -47,7 +52,6 @@
<service
android:name=".service.TaskStatusUpdateService"
android:exported="false" />

<service
android:name=".service.FirebaseNotificationService"
android:exported="false">
Expand All @@ -59,9 +63,7 @@
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove">
</provider>

tools:node="remove"></provider>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package tech.androidplay.sonali.todo.view.common

import androidx.compose.ui.graphics.*

val WhiteOff = Color(0xFFFAFAFA)
val White100 = Color(0xFFFFFFFF)
val Black100 = Color(0XFF000000)
val GreyDark = Color(0xFF444444)
val GreyMedium = Color(0xFF9E9E9E)
val GreyLight = Color(0xEDE0E0E0)
val AppBlue = Color(0xFF3068DE)
val AppBlueDark = Color(0xFF3425D6)
val OrangeYellow1 = Color(0xfff0bd28)
val OrangeYellow2 = Color(0xfff1c746)
val OrangeYellow3 = Color(0xfff4cf65)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package tech.androidplay.sonali.todo.view.common

import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
import androidx.compose.ui.unit.dp

val Shapes = Shapes(
small = RoundedCornerShape(4.dp),
medium = RoundedCornerShape(4.dp),
large = RoundedCornerShape(0.dp)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package tech.androidplay.sonali.todo.view.common

import androidx.compose.foundation.*
import androidx.compose.material.*
import androidx.compose.runtime.*

private val DarkColorPalette = darkColors(
primary = AppBlue,
primaryVariant = Black100,
surface = Black100,
secondary = White100
)

private val LightColorPalette = lightColors(
primary = AppBlue,
primaryVariant = White100,
surface = White100,
secondary = GreyDark
)

@Composable
fun AheadTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable() () -> Unit
) {
val colors = if (darkTheme) DarkColorPalette
else LightColorPalette

MaterialTheme(
colors = colors,
typography = Typography,
content = content,
shapes = Shapes
)
}
15 changes: 15 additions & 0 deletions app/src/main/java/tech/androidplay/sonali/todo/view/common/Type.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package tech.androidplay.sonali.todo.view.common

import androidx.compose.material.Typography
import androidx.compose.ui.text.*
import androidx.compose.ui.text.font.*
import androidx.compose.ui.unit.*


val Typography = Typography(
body1 = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package tech.androidplay.sonali.todo.view.feedback

import android.os.*
import android.view.*
import androidx.compose.ui.platform.*
import androidx.fragment.app.*
import kotlinx.coroutines.*
import tech.androidplay.sonali.todo.view.common.*
import tech.androidplay.sonali.todo.viewmodel.*

@ExperimentalCoroutinesApi
class FeedbackComposableFragment() : Fragment() {

private val viewModel: FeedbackViewModel by viewModels()

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return ComposeView(requireContext()).apply {
setContent {
AheadTheme {
FeedbackComposeScreen()
}
}
}
}
}

Loading

0 comments on commit 5c8407b

Please sign in to comment.