Shorr 2024-25 Android Development-Per 2 Assignments
- Instructor
- Mr. Garrett Shorr
- Term
- 2024-2025 School Year
- Department
- Mathematics
- Description
-
Upcoming Assignments
No upcoming assignments.
Past Assignments
Due:
1. A link to the github repository with the final project. (Make sure it is PUBLIC or if private, you have invited gshorrSPHS).
2. A gif or movie made using GIPHY capture or QuickTime Screen Recorder showing the basic functionality of the app.
3. If in a group, a brief breakdown of what each member did to contribute.
2. A gif or movie made using GIPHY capture or QuickTime Screen Recorder showing the basic functionality of the app.
3. If in a group, a brief breakdown of what each member did to contribute.
Due:
Again, before you write a single line of code:
Finish the prior project planning assignment
Have one person create a github repository (by creating a new project in Android Studio and doing Share on Github)
Add access to all group members
Other group members when opening the project for the first time should click get from vcs, select github, and choose the repository to clone. After it's been opened once on a computer, you just use the recent project menu to open it in the future.
Create a project planning board "from scratch" while selecting board in that repository
Come up with a few user stories to help drive your work for the next 2 weeks
Add labels for spike, user story, and task
Break up a user story into smaller tasks that you can start with and assign to group members
Share a screenshot of your planning board. Note who your group members are. One per group should submit.
User Stories Video: https://www.youtube.com/watch?v=Fw98L-kcRpc
Finish the prior project planning assignment
Have one person create a github repository (by creating a new project in Android Studio and doing Share on Github)
Add access to all group members
Other group members when opening the project for the first time should click get from vcs, select github, and choose the repository to clone. After it's been opened once on a computer, you just use the recent project menu to open it in the future.
Create a project planning board "from scratch" while selecting board in that repository
Come up with a few user stories to help drive your work for the next 2 weeks
Add labels for spike, user story, and task
Break up a user story into smaller tasks that you can start with and assign to group members
Share a screenshot of your planning board. Note who your group members are. One per group should submit.
User Stories Video: https://www.youtube.com/watch?v=Fw98L-kcRpc
Due:
Requirements:
Logging in and registering new users both work.
All CRUD operations work.
Part A: The video
Using Quicktime Screen Capture, make an mp4 showing all 4 CRUD functions in your app.
1. Start the recording
2. Log into backendless in your browser and navigate to the User table
3. Register a new user in your app. Show that the User table has updated. You might need to refresh the browser.
4. Put your emulator over that window so that the ownerId column of the GameEntry table is visible along with one of the values you can change in the GameDetailActivity (I was able to see the name of the game, but your order may differ).
5. Login to your app using a credential that has existing rows in the GameEntry table so that you have the GameListActivity showing. This demonstrates the Read functionality.
6. Demo Create: click the floating action button to bring up the detail activity with a new object. Save immediately. The backendless table in the background should update with the new item.
7. Demo Delete: Long click the item you just created in your list activity and click the delete option. The backendless table in the background should update removing that item.
8. Demo Update: click any GameEntry item that already exists. Change the value that is visible near the ownerId (mine was name). Click the save button. The backendless table in the background should update changing that value.
9. Stop the recording.
10. Save the recording as an MP4. You can do this by selecting the recording in the bottom left area below the green recording area, then click save as and change the type from gif to mp4. Name it CRUD_{YourName}.mp4.
11. Upload your video here.
A demo video is attached.
Part B: The code
Using the same settings as prior submissions, save the following files into a pdf by using the print menu item in Android Studio:
GameListActivity
GameAdapter
GameDetailActivity
Logging in and registering new users both work.
All CRUD operations work.
Part A: The video
Using Quicktime Screen Capture, make an mp4 showing all 4 CRUD functions in your app.
1. Start the recording
2. Log into backendless in your browser and navigate to the User table
3. Register a new user in your app. Show that the User table has updated. You might need to refresh the browser.
4. Put your emulator over that window so that the ownerId column of the GameEntry table is visible along with one of the values you can change in the GameDetailActivity (I was able to see the name of the game, but your order may differ).
5. Login to your app using a credential that has existing rows in the GameEntry table so that you have the GameListActivity showing. This demonstrates the Read functionality.
6. Demo Create: click the floating action button to bring up the detail activity with a new object. Save immediately. The backendless table in the background should update with the new item.
7. Demo Delete: Long click the item you just created in your list activity and click the delete option. The backendless table in the background should update removing that item.
8. Demo Update: click any GameEntry item that already exists. Change the value that is visible near the ownerId (mine was name). Click the save button. The backendless table in the background should update changing that value.
9. Stop the recording.
10. Save the recording as an MP4. You can do this by selecting the recording in the bottom left area below the green recording area, then click save as and change the type from gif to mp4. Name it CRUD_{YourName}.mp4.
11. Upload your video here.
A demo video is attached.
Part B: The code
Using the same settings as prior submissions, save the following files into a pdf by using the print menu item in Android Studio:
GameListActivity
GameAdapter
GameDetailActivity
Due:
Due Thu 3/27
1. Print the following files to a pdf:
Your Activities
Your Model/Data Classes
Your Adapter(s) if you have any
Your Layouts (activity layouts and any recyclerview item layouts)
Your menus (if you have any)
Print using the following settings:
JetBrains Mono font size 8
Margins of 0.25 all around
Color Printing
Save as a pdf (you can open in preview first to see that the settings were correct, but then you'll have to open the print dialog again from within preview and save as pdf from there)
2. Record a movie of your app working using Quicktime's screen record funciton. Submit that as well.
1. Print the following files to a pdf:
Your Activities
Your Model/Data Classes
Your Adapter(s) if you have any
Your Layouts (activity layouts and any recyclerview item layouts)
Your menus (if you have any)
Print using the following settings:
JetBrains Mono font size 8
Margins of 0.25 all around
Color Printing
Save as a pdf (you can open in preview first to see that the settings were correct, but then you'll have to open the print dialog again from within preview and save as pdf from there)
2. Record a movie of your app working using Quicktime's screen record funciton. Submit that as well.
Due:
1. Browse the lists of apis:
Big list: https://github.com/public-apis/public-apis
Another list with some repeats: See attached file
Yet another list with some repeats: https://mixedanalytics.com/blog/list-actually-free-open-no-auth-needed-apis/
2. Test your desired api endpoint and make sure you can actually retrieve a JSON file with the desired data. If you can't get that to work, go back to step 1.
(For more complex APIs that require a key in the header for instance, we can use postman. Talk to me and we can set it up: https://www.postman.com/)
3. Come up with a data class for your API. Use any method you have learned to do that.
4. Submit the following in a google doc:
a a brief plan of what you want to do with the project (how you plan to present/display the data)
b. the URL of your API documentation
c. the URL of the API endpoint you are using
d. a sample of the JSON that endpoint returns
e. your kotlin data class(es)
DO NOT START WORK ON OTHER ASPECTS OF THE PROJECT UNTIL YOU HAVE THIS DONE
Big list: https://github.com/public-apis/public-apis
Another list with some repeats: See attached file
Yet another list with some repeats: https://mixedanalytics.com/blog/list-actually-free-open-no-auth-needed-apis/
2. Test your desired api endpoint and make sure you can actually retrieve a JSON file with the desired data. If you can't get that to work, go back to step 1.
(For more complex APIs that require a key in the header for instance, we can use postman. Talk to me and we can set it up: https://www.postman.com/)
3. Come up with a data class for your API. Use any method you have learned to do that.
4. Submit the following in a google doc:
a a brief plan of what you want to do with the project (how you plan to present/display the data)
b. the URL of your API documentation
c. the URL of the API endpoint you are using
d. a sample of the JSON that endpoint returns
e. your kotlin data class(es)
DO NOT START WORK ON OTHER ASPECTS OF THE PROJECT UNTIL YOU HAVE THIS DONE
Due:
Checklist:
* API call works and the list of and you can access the count, title, and status of the request along with the magnitude, title, place, time, url, and coordinates of each earthquake.
* The recyclerView works and displays the magnitude, place, and time for each earthquake
* The recyclerView filters out all earthquakes below 1.0. (recall dogs.filter { it.breed == "golden" } would return a list where only the breed of an individual dog object matches "golden")
* The recyclerView has changed the colors of magnitude to match the severity of the earthquake.
* The recyclerView has added the appropriately colored warning icon attached to the magnitude textview for earthquakes that are large or significant.
* the menu has options to sort by recent and sort by magnitude level descending (then by recent) in the options 3 vertical dots section.
* magnitude should only display 1 decimal point (Use any method you want to accomplish this. Some options include something like DecimalFormat, NumberFormatter (google it), but there are some workarounds using things you learned in AP Comp Sci)
* There is also a clickable item in the menu to show the dialog giving a brief legend of what the different colors mean.
* clicking on an item will take you to the EarthquakeMapActivity, transferring the the entire parcelable Earthquake object through with the intent (you may have called the object Feature. That's fine.).
* the map has a marker placed at the location of the earthquake. the map should be centered on the marker and zoomed out enough to see roughly where in the world it is.
* clicking on the marker brings up additional earthquake details in the marker's popup
* the earthquake magnitude level colors are added as constants to the colors.xml file in the res/values folder
1. Take a screenshot of the list in default most recent order.
2. Take a screenshot of the list sorted by magnitude level first, then most recent second.
3. Take a screenshot of the marker popup.
4. Print the following files to PDF:
EarthquakeAdapter
EarthquakeListActivity
EarthquakeMapActivity
EarthquakeService
RetrofitHelper
All your model classes
colors.xml
menu_earthquake_data.xml (or whatever you called the menu in the EarthquakeListActivity)
activity_earthquake_list.xml
activity_earthquake_map.xml
item_earthquake.xml (or whatever you called the layout that the recyclerview uses)
4. Add the screenshots to the pdf using preview.
* API call works and the list of and you can access the count, title, and status of the request along with the magnitude, title, place, time, url, and coordinates of each earthquake.
* The recyclerView works and displays the magnitude, place, and time for each earthquake
* The recyclerView filters out all earthquakes below 1.0. (recall dogs.filter { it.breed == "golden" } would return a list where only the breed of an individual dog object matches "golden")
* The recyclerView has changed the colors of magnitude to match the severity of the earthquake.
* The recyclerView has added the appropriately colored warning icon attached to the magnitude textview for earthquakes that are large or significant.
* the menu has options to sort by recent and sort by magnitude level descending (then by recent) in the options 3 vertical dots section.
* magnitude should only display 1 decimal point (Use any method you want to accomplish this. Some options include something like DecimalFormat, NumberFormatter (google it), but there are some workarounds using things you learned in AP Comp Sci)
* There is also a clickable item in the menu to show the dialog giving a brief legend of what the different colors mean.
* clicking on an item will take you to the EarthquakeMapActivity, transferring the the entire parcelable Earthquake object through with the intent (you may have called the object Feature. That's fine.).
* the map has a marker placed at the location of the earthquake. the map should be centered on the marker and zoomed out enough to see roughly where in the world it is.
* clicking on the marker brings up additional earthquake details in the marker's popup
* the earthquake magnitude level colors are added as constants to the colors.xml file in the res/values folder
1. Take a screenshot of the list in default most recent order.
2. Take a screenshot of the list sorted by magnitude level first, then most recent second.
3. Take a screenshot of the marker popup.
4. Print the following files to PDF:
EarthquakeAdapter
EarthquakeListActivity
EarthquakeMapActivity
EarthquakeService
RetrofitHelper
All your model classes
colors.xml
menu_earthquake_data.xml (or whatever you called the menu in the EarthquakeListActivity)
activity_earthquake_list.xml
activity_earthquake_map.xml
item_earthquake.xml (or whatever you called the layout that the recyclerview uses)
4. Add the screenshots to the pdf using preview.
Due:
Write your answers in a textedit window and then post them as responses to this question thread.
################ REFERENCES #####################
As references, here are two github examples on the retrofit documentation website rewritten in Kotlin.
Given the following endpoint: https://api.github.com/users/gshorrSPHS/repos
The base url is: https://api.github.com
interface GitHubService {
@GET("users/{user}/repos")
fun listRepos(@Path("user") user: String) : Call
- >
}
(how it would be used in an activity: githubCall.listRepos("gshorrSPHS"))
Given the following endpoint: https:api.github.com/group/1234/users?sort=ascending
The base url is: https://api.github.com
interface GithubService {
@GET("group/{id}/users")
Call
- > groupList(@Path("id") int groupId, @Query("sort") String sort);
}
githubCall.groupList(1234, "descending")
####################################################
Get all teams: https://www.balldontlie.io/api/v1/teams
Get a specific team: https://www.balldontlie.io/api/v1/teams/
Due:
(reviewed how to work with drawable by resource name in video)
1. Add one more menu item to sort by description length (shortest description to longest)
2. Take a screenshot of the list activity with the options menu open
(click on the options menu, then cmd+shift+4 to screenshot)
3. Take a screenshot of the detail activity (pick any hero you want)
4. Print the Hero, HeroAdapter, HeroDetailActivity, HeroListActivity, activity_hero_detail.xml, activity_hero_list.xml, item_hero.xml,
herolist_menu.xml and save as pdf. Remember to make the font size 8 and the margins 0.25inches.
5. Upload all those things to the submission assignment
Checklist before submitting:
Recyclerview and detail activity both work
Hero class is made parcelable and comparable
Adapter is refactored to pass the single Hero object rather than each field individually
Menu works with 3 sort options (rank, name, description length)
1. Add one more menu item to sort by description length (shortest description to longest)
2. Take a screenshot of the list activity with the options menu open
(click on the options menu, then cmd+shift+4 to screenshot)
3. Take a screenshot of the detail activity (pick any hero you want)
4. Print the Hero, HeroAdapter, HeroDetailActivity, HeroListActivity, activity_hero_detail.xml, activity_hero_list.xml, item_hero.xml,
herolist_menu.xml and save as pdf. Remember to make the font size 8 and the margins 0.25inches.
5. Upload all those things to the submission assignment
Checklist before submitting:
Recyclerview and detail activity both work
Hero class is made parcelable and comparable
Adapter is refactored to pass the single Hero object rather than each field individually
Menu works with 3 sort options (rank, name, description length)
Due:
Google meet link: https://meet.google.com/fvf-owap-juy
Submit the doc you work on during class. I'll explain as we go what needs to be on it.
Join the google meet link above
Get your headphones connected
(if you don't have any, there are headphones in the back. the headphones jack is on the bottom right side of the back of the iMac)
Create a google doc
You will take notes on it as well as record your participation there (answer prompts, code, etc)
Being on your phone, playing games on the computer, or otherwise being distracted will negatively impact your grade.
Keep your cameras on please.
Submit the doc you work on during class. I'll explain as we go what needs to be on it.
Join the google meet link above
Get your headphones connected
(if you don't have any, there are headphones in the back. the headphones jack is on the bottom right side of the back of the iMac)
Create a google doc
You will take notes on it as well as record your participation there (answer prompts, code, etc)
Being on your phone, playing games on the computer, or otherwise being distracted will negatively impact your grade.
Keep your cameras on please.
Due:
Print the following files:
RegistrationUtil.kt
RegistrationUtilTest.kt
Make sure that you have in your Unit Test Class:
// Make tests for failures of
// min length of 8 chars
// at least one digit (make sure it's at least 8 and has a capital letter)
// at least on capital letter
// Make a test for good matching passwords working
// Make the tests for the other functions in the Util class with
// the common failures and 1 success for each
Submit those as a pdf. Remember to use the font size 8 and 0.25" margins. See attached images.
RegistrationUtil.kt
RegistrationUtilTest.kt
Make sure that you have in your Unit Test Class:
// Make tests for failures of
// min length of 8 chars
// at least one digit (make sure it's at least 8 and has a capital letter)
// at least on capital letter
// Make a test for good matching passwords working
// Make the tests for the other functions in the Util class with
// the common failures and 1 success for each
Submit those as a pdf. Remember to use the font size 8 and 0.25" margins. See attached images.
Due:
Requirements:
View Binding is enabled and you are using the binding notation when referencing widgets. Example:
binding.buttonMainSong.setOnClicklistener { }
noteMap is implemented
playSong is a suspend function
a coroutine is used to launch the playSong function
Submit the following:
A pdf of your MainActivity done through the print menu item.
View Binding is enabled and you are using the binding notation when referencing widgets. Example:
binding.buttonMainSong.setOnClicklistener { }
noteMap is implemented
playSong is a suspend function
a coroutine is used to launch the playSong function
Submit the following:
A pdf of your MainActivity done through the print menu item.
Due:
For your tutorial topic, you will explain the following:
Definition and description of the topic
Where/when it is used and why
Step by step implementation of an example of your creation with relevant screenshots you took for each step
Show both the Design & Code views
Acknowledgement section citing all sources used (Rebecca Franks video, Android docs, stackoverflow, other online tutorials, etc)
Use the Pageless format in Google Docs
Example of a good written tutorial. Yours doesn't have to be this long but it shows all the elements I discussed above.
https://developer.android.com/codelabs/android-room-with-a-view-kotlin?hl=en#4
You may work with a partner and collaborate on writing this.
Topics:
Barriers (including explanations of the following: vertical & horizontal orientation, barrier direction)
Guidelines (include the 3 types and how to toggle among them visually and via xml)
Chains (include horizontal & vertical along with the different chain types and weight)
Dimensional Constraints (aspect ratio triangle. give examples for filling an image at the top of the screen like the beauty & the beast banner and also one for filling the whole left side of the screen for a skinny vertical image)
Importing svgs and icons (from the clipart library) and using them in a layout
Post your name and topic below as a class comment (and if you are working with a partner, one per group).
Definition and description of the topic
Where/when it is used and why
Step by step implementation of an example of your creation with relevant screenshots you took for each step
Show both the Design & Code views
Acknowledgement section citing all sources used (Rebecca Franks video, Android docs, stackoverflow, other online tutorials, etc)
Use the Pageless format in Google Docs
Example of a good written tutorial. Yours doesn't have to be this long but it shows all the elements I discussed above.
https://developer.android.com/codelabs/android-room-with-a-view-kotlin?hl=en#4
You may work with a partner and collaborate on writing this.
Topics:
Barriers (including explanations of the following: vertical & horizontal orientation, barrier direction)
Guidelines (include the 3 types and how to toggle among them visually and via xml)
Chains (include horizontal & vertical along with the different chain types and weight)
Dimensional Constraints (aspect ratio triangle. give examples for filling an image at the top of the screen like the beauty & the beast banner and also one for filling the whole left side of the screen for a skinny vertical image)
Importing svgs and icons (from the clipart library) and using them in a layout
Post your name and topic below as a class comment (and if you are working with a partner, one per group).
Due:
Due Monday end of class.
1. Screenshot of the activity_main.xml layout (with special instructions, see below & video)
Design & Blueprint turned on
Show all constraints turned on
2. print to pdf the activity_main.xml
1. Screenshot of the activity_main.xml layout (with special instructions, see below & video)
Design & Blueprint turned on
Show all constraints turned on
2. print to pdf the activity_main.xml
Due:
Tentatively Due End of Class Tuesday.
Submission Checklist:
Quiz works and completes without crashing
Score is calculated correctly
Changing the phone language to your chosen second language fully translates the entire app to that language
No hardcoded strings--all strings are in strings.xml
All quiz logic is handled by the Quiz class (i.e. things like score variables are stored in the Quiz class and not the MainActivity)
Quiz & Question classes have no knowledge of Android-specific functions
Print the following files to a pdf:
MainActivity.kt
Quiz.kt
Question.kt
activity_main.xml
both question.json files
both strings.xml files
Print using the following settings:
JetBrains Mono font size 8
Margins of 0.25 all around
Color Printing
Save as a pdf. Open the pdf and verify it has all the files in it before submitting.
Submission Checklist:
Quiz works and completes without crashing
Score is calculated correctly
Changing the phone language to your chosen second language fully translates the entire app to that language
No hardcoded strings--all strings are in strings.xml
All quiz logic is handled by the Quiz class (i.e. things like score variables are stored in the Quiz class and not the MainActivity)
Quiz & Question classes have no knowledge of Android-specific functions
Print the following files to a pdf:
MainActivity.kt
Quiz.kt
Question.kt
activity_main.xml
both question.json files
both strings.xml files
Print using the following settings:
JetBrains Mono font size 8
Margins of 0.25 all around
Color Printing
Save as a pdf. Open the pdf and verify it has all the files in it before submitting.
Due:
Open the textedit app on your computers and make the font size at least 64. Write your answers to these questions there.
REVIEW
This is how you make a string template in your strings.xml. %1$s means 1st parameter (%1), string datatype ($s). %2$d means 2nd parameter (%2), decimal (integer. decimal as in base 10) datatype ($d)
Hello, %1$s! You have %2$d new messages.
This creates a string that looks like: Hello, name! You have 5 new message.
This is how you would retrieve the template in your Activity. You provide variables for each parameter you described in the string template.
var text = getString(R.string.welcome_messages, username, mailCount)
QUESTIONS
1a:Make a string formatting template (that would be in the strings.xml file) for a 2 player score in the following format:
P1: 10 -- P2: 5
1b: How would you access and use that string template using the variables score1 and score2?
2a: Make a string template & getString call for a chapter and chapter title text in the following format (specific example and general format below):
Chapter 2: Revenge of Chapter 1
Chapter [number]: [title]
2b: How would you access and use that string template using the variables chNum and chTitle?
ANSWERS
1a.P1: %1$d -- P2: %2$d 1b. getString(R.string.scores, score1, score2)
2a.Chapter %1$d: %2$s
2b. getString(R.string.chapter, chNum, chTitle)
REVIEW
This is how you make a string template in your strings.xml. %1$s means 1st parameter (%1), string datatype ($s). %2$d means 2nd parameter (%2), decimal (integer. decimal as in base 10) datatype ($d)
This creates a string that looks like: Hello, name! You have 5 new message.
This is how you would retrieve the template in your Activity. You provide variables for each parameter you described in the string template.
var text = getString(R.string.welcome_messages, username, mailCount)
QUESTIONS
1a:Make a string formatting template (that would be in the strings.xml file) for a 2 player score in the following format:
P1: 10 -- P2: 5
1b: How would you access and use that string template using the variables score1 and score2?
2a: Make a string template & getString call for a chapter and chapter title text in the following format (specific example and general format below):
Chapter 2: Revenge of Chapter 1
Chapter [number]: [title]
2b: How would you access and use that string template using the variables chNum and chTitle?
ANSWERS
1a.
2a.
2b. getString(R.string.chapter, chNum, chTitle)
Due:
https://pl.kotl.in/uTRNb2q91
fun main() {
// Using windowed and count (and optionally all), how many times are there 3 of the same number in a row? Note: [5, 5, 5, 5] would be 2, because
// [<<<5, 5, 5>>>, 5] and [5, <<<5, 5, 5>>>] each count as 3 in a row.
// reminder: windowed(n) makes a list of lists containing the adjacent n elements.
// example: with a list having [1, 2, 3, 4, 5, 6], windowed(2) will give [[1,2], [2,3], [3,4], [4,5], [5,6]]
// windowed(5) would give [[1,2,3,4,5], [2,3,4,5,6]]
// count is a lambda that is similar to filter, but instead of returning a list of matches, it just gives the number of matches
val nums = listOf(1, 5, 2, 5, 5, 5, 5, 5, 3, 5, 3, 3, 3, 5, 1, 1, 1, 1, 1)
// val triplets =
// print(triplets) // answer should be 7
}
fun main() {
// Using windowed and count (and optionally all), how many times are there 3 of the same number in a row? Note: [5, 5, 5, 5] would be 2, because
// [<<<5, 5, 5>>>, 5] and [5, <<<5, 5, 5>>>] each count as 3 in a row.
// reminder: windowed(n) makes a list of lists containing the adjacent n elements.
// example: with a list having [1, 2, 3, 4, 5, 6], windowed(2) will give [[1,2], [2,3], [3,4], [4,5], [5,6]]
// windowed(5) would give [[1,2,3,4,5], [2,3,4,5,6]]
// count is a lambda that is similar to filter, but instead of returning a list of matches, it just gives the number of matches
val nums = listOf(1, 5, 2, 5, 5, 5, 5, 5, 3, 5, 3, 3, 3, 5, 1, 1, 1, 1, 1)
// val triplets =
// print(triplets) // answer should be 7
}
Due:
Do the 3 problems on this link below:
https://pl.kotl.in/4QnIgtYbl
code here:
fun main() {
//1. use map to take a list of integer values and create a list of their squares
val nums = listOf(0, 1, 2, 3, 4, 5, 6, 7)
//val squares =
// print(squares)
//2. use filter to take a list of string values and create a list of strings that end in y
val days = listOf("Monday", "Tuesday", "Wednesday", "Florb", "Thursday", "Blurym", "Friday", "Saturday", "Sunday", "Mrrrrrr")
// val endsInY =
// print(endsInY)
//3. use map and filter to give a list of string lengths of words that contain "cat"
val words = listOf("cat", "dog", "catastrophe", "doggedness", "concatenation", "hotdog", "catdog")
// val catWords =
// print(catWords)
}
https://pl.kotl.in/4QnIgtYbl
code here:
fun main() {
//1. use map to take a list of integer values and create a list of their squares
val nums = listOf(0, 1, 2, 3, 4, 5, 6, 7)
//val squares =
// print(squares)
//2. use filter to take a list of string values and create a list of strings that end in y
val days = listOf("Monday", "Tuesday", "Wednesday", "Florb", "Thursday", "Blurym", "Friday", "Saturday", "Sunday", "Mrrrrrr")
// val endsInY =
// print(endsInY)
//3. use map and filter to give a list of string lengths of words that contain "cat"
val words = listOf("cat", "dog", "catastrophe", "doggedness", "concatenation", "hotdog", "catdog")
// val catWords =
// print(catWords)
}
Due:
One thing programmers often do is learn by reading through tutorials. Use the various resources provided in the document to find the answers to the questions and use a different color when answering.
You can work in groups but each turn in an individual document.
You can work in groups but each turn in an individual document.
Due:
Due Monday end of class
1. Start/Stop works & doesn't skip time
2. Maintain state through orientation change
*if it were running, stay running & not skip time
*if it were stopped, stay stopped & not skip time
having a rounding error of 1 second is okay.
To turn this in, we'll use Quicktime screen record to record a movie of the following:
Start
Wait 3 seconds
Stop
Wait 3 seconds
Start
Wait 3 seconds
Stop
Rotate
Wait 3 seconds
Start
Rotate
Wait 3 seconds
Stop
Reset
Start
Wait 3 seconds
Reset
1. Start/Stop works & doesn't skip time
2. Maintain state through orientation change
*if it were running, stay running & not skip time
*if it were stopped, stay stopped & not skip time
having a rounding error of 1 second is okay.
To turn this in, we'll use Quicktime screen record to record a movie of the following:
Start
Wait 3 seconds
Stop
Wait 3 seconds
Start
Wait 3 seconds
Stop
Rotate
Wait 3 seconds
Start
Rotate
Wait 3 seconds
Stop
Reset
Start
Wait 3 seconds
Reset
Due:
Due Monday during class.
The bolded sections of the attached document have things for you to write and complete. The non-bolded sections have instructions for you to follow but don't need to have written answers for.
Complete the sections in a different font color so it's easy to see your work inline.
In the video: intro to the stopwatch app, how to use XML and add a chronometer widget, how to override a function through autocomplete, how to make a static constant in kotlin through a companion object.
1. Open the project that we set up github with "Logging and Lifecycle".
2. Add Chronometer widget to activity_main.xml through the code view
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chronometer_main_stopwatch"/>
and constraint it in the design view. You can also change the text size to something like 64sp so you can see it more easily.
The bolded sections of the attached document have things for you to write and complete. The non-bolded sections have instructions for you to follow but don't need to have written answers for.
Complete the sections in a different font color so it's easy to see your work inline.
In the video: intro to the stopwatch app, how to use XML and add a chronometer widget, how to override a function through autocomplete, how to make a static constant in kotlin through a companion object.
1. Open the project that we set up github with "Logging and Lifecycle".
2. Add Chronometer widget to activity_main.xml through the code view
android:layout_height="wrap_content"
android:id="@+id/chronometer_main_stopwatch"/>
and constraint it in the design view. You can also change the text size to something like 64sp so you can see it more easily.
Due:
Use a different color font to answer the questions directly inline with your copy of the document. We'll have 20 minutes at the start of class on Monday.
For the project itself, these are the features:
Self Destruct Button: Launch a CountDownTimer, change the text on the button with a countdown from 10 to 1 or 0. End the activity upon reaching the end.
Stretch goal: Make the layout blink red, increasingly faster as the timer gets closer to 0. Disable the button after it is pressed.
Useless switch: Turn it on and it automatically turns off x seconds later.
Stretch goal: Randomize the timer. Cancel the timer if it is turned off before the timer is finished.
Look Busy: Hide the regular UI, show the progress bar and the textview
Return the regular UI after the progress bar has finished filling.
For the project itself, these are the features:
Self Destruct Button: Launch a CountDownTimer, change the text on the button with a countdown from 10 to 1 or 0. End the activity upon reaching the end.
Stretch goal: Make the layout blink red, increasingly faster as the timer gets closer to 0. Disable the button after it is pressed.
Useless switch: Turn it on and it automatically turns off x seconds later.
Stretch goal: Randomize the timer. Cancel the timer if it is turned off before the timer is finished.
Look Busy: Hide the regular UI, show the progress bar and the textview
Return the regular UI after the progress bar has finished filling.
Due:
In a google doc, answer the following questions.
Compare your code to the code I've provided and answer the following questions:
1. Do you notice anything different about the content of the onClickListeners?
2. In the code provided, what do you notice about the organization of all the findViewById method calls?
3. In the code provided, where do you notice the logic is for comparing numbers and keeping score?
4. What advantages might there be for separating the game logic from the UI logic?
The kotlin files: https://gist.github.com/gshorrSPHS/8ef08ec44462024540e6d7364ff803ea
Compare your code to the code I've provided and answer the following questions:
1. Do you notice anything different about the content of the onClickListeners?
2. In the code provided, what do you notice about the organization of all the findViewById method calls?
3. In the code provided, where do you notice the logic is for comparing numbers and keeping score?
4. What advantages might there be for separating the game logic from the UI logic?
The kotlin files: https://gist.github.com/gshorrSPHS/8ef08ec44462024540e6d7364ff803ea
Due:
Submit answers in the attached google doc below.
Due:
What are 5 differences that you see in the Main Activity between Kotlin and Java?
1. No semi-colons necessary
2. The public keyword is missing. public is the default visibility.
3. Child class is defined with : instead of extends
4. return type is missing because you don't have to say void if you return nothing
5. a function has the "fun" keyword to define it
6. The primary constructor is on the class declaration line and when you extend from a superclass, you denote which constructor is used
7. parameter format: varName: DataType
8. ? after a datatype means nullable
null safety built into Kotlin
1. No semi-colons necessary
2. The public keyword is missing. public is the default visibility.
3. Child class is defined with : instead of extends
4. return type is missing because you don't have to say void if you return nothing
5. a function has the "fun" keyword to define it
6. The primary constructor is on the class declaration line and when you extend from a superclass, you denote which constructor is used
7. parameter format: varName: DataType
8. ? after a datatype means nullable
null safety built into Kotlin
Due:
Complete the attached survey and mark this assignment complete when you are done.
Due:
What are 5 differences that you see in the Main Activity between Kotlin and Java?
1. No semi-colons necessary
2. The public keyword is missing. public is the default visibility.
3. Child class is defined with : instead of extends
4. return type is missing because you don't have to say void if you return nothing
5. a function has the "fun" keyword to define it
6. The primary constructor is on the class declaration line and when you extend from a superclass, you denote which constructor is used
7. parameter format: varName: DataType
8. ? after a datatype means nullable
null safety built into Kotlin
1. No semi-colons necessary
2. The public keyword is missing. public is the default visibility.
3. Child class is defined with : instead of extends
4. return type is missing because you don't have to say void if you return nothing
5. a function has the "fun" keyword to define it
6. The primary constructor is on the class declaration line and when you extend from a superclass, you denote which constructor is used
7. parameter format: varName: DataType
8. ? after a datatype means nullable
null safety built into Kotlin