Giter VIP home page Giter VIP logo

basic-android-kotlin-compose-birthday-card-app's Introduction

Happy Birthday app - Solution Code

Solution code for the Android Basics with Compose: Add images to your Android app codelab.

Introduction

In this codelab, you will learn how to add images to your app using an Image Composable.

Pre-requisites

You need to know:

  • How to create and run a new app in Android Studio.

Getting Started

  1. Download and run the app.

basic-android-kotlin-compose-birthday-card-app's People

Contributors

android-dev-lxl avatar osuleymanova avatar owenscott-gds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

basic-android-kotlin-compose-birthday-card-app's Issues

Add images: Android Basics in Compose

URL of codelab

In which task and step of the codelab can this issue be found?
If you navigate to Practice problem - Task Manager

Describe the problem
Go to UI specification of Task Manager problem, in that point 2 asks to set the fontsize to 24sp, which clearly seems off. What we want to achieve based on screenshot is a bold text.

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Functions in Kotlin: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-functions?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-functions#5

In which task and step of the codelab can this issue be found?
named arguments

Describe the problem

function definition:
fun birthdayGreeting(name: String, age: Int): String {
val nameGreeting = "Happy Birthday, $name!"
val ageGreeting = "You are now 5 years old!"
return "$nameGreeting\n$ageGreeting"
}

statement in main:

println(birthdayGreeting(name = "Rex", age = 2))

output:

Happy Birthday, Rex! You are now 2 years old!

output should be:

Happy Birthday, Rex!
You are now 2 years old!

or you should eliminate \n in this stateement:

return "$nameGreeting\n$ageGreeting"

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Text composables: Android Basics with Compose (Preview Composable function name is inconsistent)

URL of codelab

In which task and step of the codelab can this issue be found?
5. Design pane in Android Studio

Describe the problem
It's confusing to the learner when the name of the Preview Composable function is inconsistent. By default, the name is DefaultPreview. That's what's show in the image used by the codelab. Yet in the code block, it keeps referring to BirthdayCardPreview(). Ideally, these two should match so it is consistent.

Additional information
Here's the screen shot of the inconsistencies (function name mismatch):

image

image

Add images: Android Basics in Compose

URL of codelab

In which task and step of the codelab can this issue be found?
5. Solution code

Describe the problem
Solution links don't work

Steps to reproduce?

  1. Just check the links.

Versions
N/A

Additional information
Include screenshots if they would be useful in clarifying the problem.

Add images: Android Basics with Compose

URL of codelab:
https://developer.android.com/codelabs/basic-android-kotlin-compose-add-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-add-images&authuser=1#3

In which task and step of the codelab can this issue be found?
Writing: Image(painter = image)

Describe the problem
Whenever I try to write Image(painter = image) it doesn't work.
It seems like android studio does not recognize the command painter.

The word painter turns red and there are 4 error codes.
Cannot access '': it is package-private in 'Image'
Cannot create an instance of an abstract class
Named arguments are not allowed for non-Kotlin functions
Cannot find a parameter with this name: painter

I am very new to coding and android studio and lost - I have searched the whole internet and didn't find a solution yet.

Steps to reproduce?

  1. Go to https://developer.android.com/codelabs/basic-android-kotlin-compose-add-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-add-images&authuser=1#3

  2. Follow the guidelines from the codelab, until you are asked to write the Image(painter=image) command.

  3. See the errors

Versions
_Android Studio version: Android Studio Chipmunk | 2021.2.1 Patch 2 (latest version)
Screenshot 2022-09-11 141723

Additional information
Include screenshots if they would be useful in clarifying the problem.

Practice problems: Android Basics with Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-add-images#9

In which task and step of the codelab can this issue be found?
ANDROID BASICS WITH COMPOSE
Unit 1: Your first Android app
Pathway 3: Build a basic layout
Step 10: Get the solution code

Describe the problem
Can't clone a repository on Windows.
I think the problem is in the file name:
"Unit 1 | Pathway 1 | Practice Problems.md"
=>
"Unit 1 - Pathway 1 - Practice Problems.md"

Steps to reproduce?
As described in step.

Versions
Android Studio Chipmunk | 2021.2.1
Build #AI-212.5712.43.2112.8512546, built on April 28, 2022
Runtime version: 11.0.12+7-b1504.28-7817840 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 4
Registry: external.system.auto.import.disabled=true

Additional information
clone_failed

Add images: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-add-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-add-images#8

In which task and step of the codelab can this issue be found?
9. Try this challenge

Describe the problem
We're being asked to do this:

Here's a challenge for you:
Arrange or align the two text composables so that they're both centered.

but the solution code below still has the start = 16.dp for the Happy Birthday text, which breaks its centering.

Versions
Android Studio version:
Android Studio Chipmunk | 2021.2.1
Build #AI-212.5712.43.2112.8512546, built on April 28, 2022
Runtime version: 11.0.12+0-b1504.28-7817840 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.17.15-gentoo-x86_64
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin (212-1.7.10-release-333-AS5457.46)
Current Desktop: LXQt

Additional information
Include screenshots if they would be useful in clarifying the problem.

@Composable
fun BirthdayGreetingWithText(message: String, from: String) {
   Column {
       Text(
           text = message,
           fontSize = 36.sp,
           modifier = Modifier
               .fillMaxWidth()
               .wrapContentWidth(Alignment.CenterHorizontally)
               .padding(start = 16.dp, top = 16.dp)

       )
       Text(
           text = from,
           fontSize = 24.sp,
           modifier = Modifier
               .fillMaxWidth()
               .wrapContentWidth(Alignment.CenterHorizontally)
               .padding(start = 16.dp, end = 16.dp)
       )
   }
}

vs truly centered:

@Composable
fun BirthdayGreetingWithText(message: String, from: String) {
   Column {
       Text(
           text = message,
           fontSize = 36.sp,
           modifier = Modifier
               .fillMaxWidth()
               .wrapContentWidth(Alignment.CenterHorizontally)
               .padding(start = 0.dp, top = 16.dp)

       )
       Text(
           text = from,
           fontSize = 24.sp,
           modifier = Modifier
               .fillMaxWidth()
               .wrapContentWidth(Alignment.CenterHorizontally)
               .padding(start = 16.dp, end = 16.dp)
       )
   }
}

(or just remove the argument start = 0.dp completely)

Practice problems: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-intro-kotlin-practice-problems?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-intro-kotlin-practice-problems#6

In which task and step of the codelab can this issue be found?
7 - Implement basic math operations.

Describe the problem

fun main() {
val firstNumber = 10
val secondNumber = 5
val thirdNumber = 8

val result = add(firstNumber, secondNumber)
val anotherResult = add(firstNumber, thirdNumber)

println("$firstNumber + $secondNumber = $result")
println("$firstNumber + $thirdNumber = $anotherResult")

}

// Define add() function below this line

"Can you define the add() function so that the program prints this output? "
10 + 5 = 15
10 + 8 = 18

The solution doesn't show how to print out the sum of firstNumber + thirdNumber , and when I add the third parameter thirdNumber it says value is not passed, can you please show a solution for the question?

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Parameters

URL of codelab

In which task and step of the codelab can this issue be found?

Default Parameters

Describe the problem

The default parameters must be mentioned at last in the argument list.

Screenshot_2022-09-05-17-58-42-288_com android chrome

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Add images: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-add-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-add-images#3

In which task and step of the codelab can this issue be found?
Step 4

Describe the problem

When creating:

Image(
     painter = image,
     contentDescription = null
)

the import context directs towards the (old android view?) package. The composable import is crossed out during import.

Steps to reproduce?

  1. Follow up to step 4
  2. Inside BirthdayGreetingWithImage, create val image, and create Image(painter=image)
  3. Follow context menu, import Image (android.media)
  4. variables within Image() are errors

Solution
Clear misunderstandings within the tutorial (no instance saying to import which one) or modify android studio context menu behavior. I think just adding to the tutorial would be much better. It would also clear up misunderstandings to anyone new to coding (they will get abstract object errors, and I think it would be hard for new coders to troubleshoot out of it)

Versions
Android Studio version: 2021.2.1 Patch 2

Additional information
Include screenshots if they would be useful in clarifying the problem.
image

Install Android Studio: Android Basics in Compose

https://developer.android.com/codelabs/basic-android-kotlin-compose-install-android-studio#3

In the section "macOS: Verify system requirements"

### Description
In the section "macOS: Verify system requirements" there's a subsection "Check system requirement" in that subsection a screenshot of system information showing macOS version 12.2.1 but in a piece text written just above that screenshot, the OS version written is 11.6.2.
I've underlined the mistakes in the attached screenshot (green underline).

Steps to reproduce?

  1. Go to- https://developer.android.com/codelabs/basic-android-kotlin-compose-install-android-studio#3
  2. Goto the subsection "Check system requirements"
  3. Compare the OS version in the screenshot and the text written as "For example in the screenshot below...." above that screenshot

Additional information

Web capture_12-7-2022_12117_developer android com
_

Add images: Android Basics in Compose

URL of codelab

Check your app for accessibility

contentDescription = null >> but always is red line and can'y preview

Steps to reproduce?

  1. Go to...
    001BB

  2. Click on...

  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Practice problems: Android Basics in Compose

URL of codelab
https://developer.android.google.cn/codelabs/basic-android-kotlin-compose-intro-kotlin-practice-problems?continue=https%3A%2F%2Fdeveloper.android.google.cn%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-intro-kotlin-practice-problems#11

In which task and step of the codelab can this issue be found?
in step 12

Describe the problem
The value in the description is incorrect. The correct value is 5000+1000
image

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Text composables: Android Basics with Compose

(https://developer.android.com/codelabs/basic-android-kotlin-compose-text-composables?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-text-composables#7)

8

message: String, from: String -> we have 2 variable but we use one variable , variable is "from", but output was merge of 2 variable

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Practice problems: Android Basics in Compose

URL of codelab

Task 12 Solution Code

There are some errors and some stuff missing
In the Message Formatting Section, the values in the exercise are 5000 and 1000 but in the Code Solution the values shows as 500 and 100.

In the Implement basic math operations section, in step 2 you ask several things

  1. Create an add() function that accepts a firstNumber parameter, secondNumber parameter and thirdNumber parameter, all of Int type, and returns an Int value.
  2. add the values of firstNumber and secondNumber
  3. add the values of firstNumber and thirdNumber
  4. return the result of both operations in the following format firstNumber + secondNumber = result and
    firstNumber + thirdNumber=result (ex. 10 + 5 = 15)
  5. add a subtract function using the add function as a template.

On the Code Solution section for this task on step 2 the solution is incomplete it only shows this:

fun add(firstNumber: Int, secondNumber: Int): Int {
    return firstNumber + secondNumber
} 

as a solution, it doesn't shows what code to add on the main function or how to return both addition operations that were asked (firstNumber + secondNumber and firstNumber + thirdNumber) in the format asked: 10+5=15. If I'm not mistaken the given solution will only print the result number. Also it doesn't show the subtract solution.

Text composables: Android Basics with Compose

URL of codelab
Every Codelab

In which task and step of the codelab can this issue be found?
Every Codelab has the issue

Describe the problem
Whenever you go to the next step of Codelab by pressing "Next" button the page is kept scrolled to the bottom, instead it should start from the top of the page. Every time you go to the end of one page and click "Next" button, the next page appears already to the bottom of the screen and one has to scroll back up to do the activity.

Steps to reproduce?

  1. Go to... Any Codelab tab
  2. Click on... Scroll down to the bottom and click on Next
  3. See error... The next page is scrolled to the bottom

Versions
Android Studio version: Nothing to do with Android Studio Version
API version of the emulator: Nothing to do with API version of the emulator

Additional information
Include screenshots if they would be useful in clarifying the problem.
I don't think it's necessary

Functions in Kotlin: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-functions?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-functions#4

In which task and step of the codelab can this issue be found?
Functions with multiple parameters

Describe the problem
function definition:

fun birthdayGreeting(name: String, age: Int): String {
val nameGreeting = "Happy Birthday, $name!"
val ageGreeting = "You are now $age years old!"
return "$nameGreeting\n$ageGreeting"
}

output:
Happy Birthday, Rover! You are now 5 years old!
Happy Birthday, Rex! You are now 2 years old!

in the return statement there is \n and output should be:

Happy Birthday, Rover!
You are now 5 years old!
Happy Birthday, Rex!
You are now 2 years old!

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Functions in Kotlin: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-functions?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-functions#6

In which task and step of the codelab can this issue be found?
in 7. Default arguments

Describe the problem
just search for this:

The second call to birthdayGreeting() still uses the Rex value, which you passed in for the name.

The expression "still uses" seems weird in that context, as if it's something that was already done from way before, it doesn't seem to be referring to the function call just written, but of course it can't refer to anything else, so by exclusion, it's eventually understood.
But maybe's just me that understands it this way.

Additional information
Untitled2

First Android app: Android Basics in Compose

URL of codelab

In which task and step of the codelab can this issue be found?

Describe the problem

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Functions in Kotlin: Android Basics in Compose

URL of codelab
https://developer.android.google.cn/codelabs/basic-android-kotlin-compose-functions?continue=https%3A%2F%2Fdeveloper.android.google.cn%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-functions#3

In which task and step of the codelab can this issue be found?
in step 4

Describe the problem
missing the colon
image

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

First Android app: Android Basics in Compose - Step 7 does not teach the learner how to import `dp`

URL of codelab

In which task and step of the codelab can this issue be found?
Step 7: Adding padding

Describe the problem
When adding the new code: modifier = Modifier.padding(24.dp), the codelab should instruct the learner that dp must be imported or else the code won't work. This is probably the first time the learner has to import something so it's crucial to teach how to do this.

import androidx.compose.ui.unit.dp

How to improve it
image

Here's an example:
"Notice that when you add a padding modifier to the text with a size of 24.dp, the dp text is red. This is happening because you need to import dp first in order for your code to compile. Fixing this error is simple thanks to Android Studio. Simply highlight the text and press Alt+Enter in PC/Linux or Option+Enter in Mac. Import should be highlighted by default so just press Enter.

image

If you don't do this and try Build & Refresh, you will get an "Unresolved reference: dp" error."

image

Variables in Kotlin: Android Basics with Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-variables?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-1%3Fhl%3Den%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-variables&hl=en#3

In which task and step of the codelab can this issue be found?
Part 4: Update Variables
subsection 5 - expected output box

Describe the problem
Typo:
value says: "cartTotal: 20"
should say: "Total : 20"

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

First Android app: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-first-app?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-first-app#4

In which task and step of the codelab can this issue be found?
5. Update the text

Describe the problem
The text The Greeting() function under the onCreate() function is a Composable function. Notice the @Composable annotation above it. gives me the impression that there's code above that should be there but it isn't! In fact, such code is below this text instead!

In other words, The Greeting() function isn't above at all, there's a function call, but it is inside, not under, the onCreate() function.
There's no @Composable annotation above! And there's no way to scroll down inside the above code(so, the code that's visible is all the code), see screenshot below.

So there's likely code missing above. Or maybe, I'm supposed to look only at my project contents and notice that code there?

Additional information
Include screenshots if they would be useful in clarifying the problem.
Untitled3

The missing code is duplicated below though:
Untitled4

First Android app: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-first-app?authuser=1&continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-2%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-first-app#6

In which task and step of the codelab can this issue be found?
Task: Create your first Android app
Step 7: Add padding

Describe the problem

Text(text = "Hi, my name is $name!", modifier = Modifier.padding(24.dp))

In this line, 24.dp was not working and gives the error: Unresolved reference: dp.
To resolve the error, I had to use, Dp(24.0f). This import was added automatically: import androidx.compose.ui.unit.Dp
The modified line looks like this:

Text(text = "Hello, my name is $name.", modifier = Modifier.padding(Dp(24.0f)))

My entire code for MainActivity.kt now looks like:

package com.example.greetingcard

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import com.example.greetingcard.ui.theme.GreetingCardTheme

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            GreetingCardTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colors.background
                ) {
                    Greeting("Android")
                }
            }
        }
    }
}

@Composable
fun Greeting(name: String) {
    Surface(color = Color.Cyan) {
        Text(text = "Hello, my name is $name.", modifier = Modifier.padding(Dp(24.0f)))
    }
}

@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
    GreetingCardTheme {
        Greeting("Jincy")
    }
}

Steps to reproduce?

  1. Go to Android Studio and create new project "Greeting Card" with empty compose activity.
  2. Modify function greeting, and add this modifier = Modifier.padding(24.dp) to the Text()
  3. See error: Unresolved reference: dp

Versions
Android Studio version: Android Studio Chipmunk | 2021.2.1 Patch 1
API version of the emulator: Not applicable.

Additional information
Include screenshots if they would be useful in clarifying the problem.

image

Text composables: Android Basics with Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-classes-and-objects?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-2-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-classes-and-objects#6

In which task and step of the codelab can this issue be found?
7 - Implement a relationship between classes

Describe the problem
fun nextChannel() {
channelNumber++
println("Channel number increased to $speakerVolume.")

println prints the $speakerVolume, it should print the $channelNumber

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Text composables: Android Basics in Compose (Readability Issue in the example image)

URL of codelab: https://developer.android.com/codelabs/basic-android-kotlin-compose-text-composables

Section: 4. What is Jetpack Compose

Issue: It's difficult to see the difference between annotation without parameters and annotation previewing background. There's not enough contrast to see what exactly is the difference (i.e., when using light theme for Android Studio, the showBackground = true doesn't seem to have had any effect due to light background).
android-compose-1

Suggested solution: I decided to mess with my color schemes to learn what showBackground was exactly referring to.

android-compose-2

android-compose-3

As you can see, it's super easy to understand in dark theme since there's no confusion at all for the learner.

Another solution is to actually darken the preview background to something less similar to white so that developers who prefer light theme will not run into this color issue.

Hope this helps. Thanks for creating these awesome tutorials by the way. You guys are the best.

Text composables: Android Basics with Compose

[email protected] URL of codelab

In which task and step of the codelab can this issue be found?

Describe the problem

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Add images: Android Basics in Compose

Variables in Kotlin: Android Basics with Compose

URL of codelab

In which task and step of the codelab can this issue be found?

Describe the problem
Eu terminei ,mas nao aparece como concluído

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Add images: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-add-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-add-images&authuser=1#4

In which task and step of the codelab can this issue be found?
4.

Describe the problem
Expected:
Your setContent block should look like this code snippet:

setContent {
   HappyBirthdayTheme {
       // A surface container using the 'background' color from the theme
       Box {
           BirthdayGreetingWithImage( "Happy Birthday Sam!", "- from Emma")
       }
   }
}

Actual:
Your setContent block should look like this code snippet:

setContent {
   HappyBirthdayTheme {
       // A surface container using the 'background' color from the theme
       Surface(color = MaterialTheme.colors.background) {
           BirthdayGreetingWithImage( "Happy Birthday Sam!", "- from Emma")
       }
   }
}

Practice problems: Android Basics with Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-add-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-add-images#9

In which task and step of the codelab can this issue be found?
10 Get solution code - step 9: click Clone

Describe the problem
The system showed the following error: invalid path '.github/ISSUE_TEMPLATE/Unit 1 | Pathway 1 | Practice Problems.md' unable to checkout working tree warning: Clone succeeded, but checkout failed.

Steps to reproduce?

  1. Go to https://developer.android.com/codelabs/basic-android-kotlin-compose-add-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-add-images#9
  2. Click on "Clone" in step 9
  3. See error: The system showed the following error: invalid path '.github/ISSUE_TEMPLATE/Unit 1 | Pathway 1 | Practice Problems.md' unable to checkout working tree warning: Clone succeeded, but checkout failed.

Versions
Android Studio version: Android Studio Chipmunk | 2021.2.1
Build #AI-212.5712.43.2112.8512546, built on April 28, 2022
Runtime version: 11.0.12+7-b1504.28-7817840 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Text composables: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-text-composables?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-text-composables#3

In which task and step of the codelab can this issue be found?
Notice the composable functions in code

Describe the problem
In codelab Its BirthdayCardTheme. In Android Studio its HappyBirthdayTheme

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.
image
image

image

Add images: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-add-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-add-images#2

In which task and step of the codelab can this issue be found?
3. Set up your app

Describe the problem
The text says:

If the image is imported successfully, Android Studio adds the image to the list under the Drawable tab. This list includes all your images and icons for the app. You can now use this image in your app.

but, the image only appears in the Drawable tab if, after import, I select: Build -> Run Generate Sources Gradle Tasks. Note that the Refresh previews button in Drawable tab, had no effect.

Versions
Android Studio version:

Android Studio Chipmunk | 2021.2.1
Build #AI-212.5712.43.2112.8512546, built on April 28, 2022
Runtime version: 11.0.12+0-b1504.28-7817840 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.17.15-gentoo-x86_64
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin (212-1.7.10-release-333-AS5457.46)
Current Desktop: LXQt

Additional information

Add images: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-add-images?authuser=1&continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-add-images#7

In which task and step of the codelab can this issue be found?
Step 8: Adopt good code practice

Describe the problem
In this step , one should adopt good code practices. Therefore, the Strings in the MainActivity are moved to the strings.xml file and replaced with a call to said file.

image

At the end of Step 8, the user should test if the App still looks the same by running it. The app indeed shows the same text in the preview, but one never changed the Strings in the preview. IMHO, one should also have to change the Strings in the BirthdayCardPreview with a call to the strings.xml file. Otherwise it does not make sense to extract them to the strings.xml file.

Text composables: Android Basics with Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-classes-and-objects?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-2-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-classes-and-objects#5

In which task and step of the codelab can this issue be found?
6. Define a constructor
Note: If the class doesn't have a default constructor and you attempt to instantiate the object without arguments, the compiler reports an error.

Describe the problem
The codelab states that "if the class doesn't have a default constructor and you attempt to instantiate the object without arguments, the compiler reports an error." I tried and the compiler did not report an error.

Steps to reproduce?

  1. Go to the Kotlin playground and create this:
    class SmartDevice {
    val name = "Android TV"
    val category = "Entertainment"
    var deviceStatus = "online"
    var speakerVolume = 2
    set(value) {
    if (value in 0..100) {
    field = value
    }
    }

    fun turnOn() {
    println("Smart device is turned on")
    }

    fun turnOff() {
    println("Smart device is turned off")
    }

}

fun main() {
val smartDevice = SmartDevice()

println("Device name is: ${smartDevice.name}")
smartDevice.turnOn()
smartDevice.turnOff()

}

  1. Click on Run
  2. See no error
    SSnoError

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Text composables: Android Basics with Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-classes-and-objects?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-2-pathway-1%3Fhl%3Den%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-classes-and-objects&hl=en#6

In which task and step of the codelab can this issue be found?
Implement a relationship between classes -> Override superclass methods from subclasses

Describe the problem

// FIX "...use the var keyword to define a SmartDevice variable of SmartDevice type that instantiates a SmartTvDevice object that..."

  1. In the main() function, use the var keyword to define a SmartDevice variable of SmartTvDevice type that instantiates a SmartTvDevice object that takes an "Android TV" argument and an "Entertainment" argument:

fun main(){
var smartDevice: SmartDevice = SmartTvDevice("Android TV", "Entertainment")
}
Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Add images: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-add-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-add-images#9

In which task and step of the codelab can this issue be found?
10. Get the solution code

Describe the problem
at step 13. In the Git Branches dialog under the Remote Branches section, select the branch name provided earlier and then click Checkout. we're expected to choose starter branch but the repository contains only the main branch! On github here, this is confirmed, no other branches exist. Maybe they existed in the past though.

Additional information
Include screenshots if they would be useful in clarifying the problem.
Untitled5
Untitled6

Add images: Android Basics in Compose

URL of codelab

In which task and step of the codelab can this issue be found?

Describe the problem

Снимок экрана 2022-07-21 в 12 22 46

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

help me please! don't work your instruction

Functions in Kotlin: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-functions?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-1%3Fhl%3Den%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-functions&hl=en#3

In which task and step of the codelab can this issue be found?
5 and 7

Describe the problem
output should also print (you are now 5 years old!)

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Text composables: Android Basics in Compose

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-text-composables?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-1-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-text-composables#4

In which task and step of the codelab can this issue be found?
Build a simple app with text composables
Step 5. Design pane in Android Studio

Describe the problem
The code generated by BumbleBee in ActivityMain.kt uses "Happy Birthday Theme" but the preview code snippet in Step 5 uses "BirthdayCardTheme". These should be consistent.

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version: Chipmunk 2021.2.1
API version of the emulator: N/A

Additional information
Include screenshots if they would be useful in clarifying the problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.