Skip to content

My code review suggestions#25

Open
ZLongC wants to merge 1 commit intomasterfrom
Zilong_codeReview
Open

My code review suggestions#25
ZLongC wants to merge 1 commit intomasterfrom
Zilong_codeReview

Conversation

@ZLongC
Copy link
Copy Markdown
Collaborator

@ZLongC ZLongC commented Apr 6, 2022

Analysis:
This program can trace the ranking and evaluation of movies for those who use it.

Was the program available in Github on time?
Yes

Is the program documented/commented well enough for you to understand?
Yes, some places are annotated and overall it's easy to be understood.

Does the program compile?
Yes

Rationale behind your changes:
The main reason for my change is to change some rules in the program to make the program more compliant with the specification and more reasonable declaration of variables.

Links to three specific commits:
1
2
3

Three specific technical concepts :

  1. I learned when is a good time to use inline function in coding.
    2.I learned how to directly call .xml to display the surface of a program.
    3.I learned how to classify res documents more reasonably.

</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-04-06T16:20:07.143355400Z" />
</component>
</project> No newline at end of file
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an automatically generated document. Ignore it if it's not important for your program.

Comment thread .idea/misc.xml
<map>
<entry key="..\:/G/Android projects/MobileMovieApp/app/src/main/res/layout/activity_main.xml" value="0.2" />
<entry key="..\:/G/Android projects/MobileMovieApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.1" />
<entry key="..\:/G/Android projects/MobileMovieApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.1" />
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made changes to make the program can be compile normally.

Comment thread app/build.gradle
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation 'com.squareup.retrofit2:retrofit:2.8.2'
implementation 'com.sqeareup.retrofit2:converter-gson:2.7.1'
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete an implementation which is never used in program.

import java.io.InputStream

class MainActivity : AppCompatActivity() {
class MainActivity : AppCompatActivity() {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do apologize this is my carelessness. Please ignore it.

object RetrofitClientInstance {
private var retrofit: Retrofit? = null
private val BASE_URL = "https://api.jsonbin.io/"
private const val BASE_URL = "https://api.jsonbin.io/"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added const to make it a constant.

@SerializedName("openingWeekendGross")var openingWeekendGross: Double, @SerializedName("distributor")var distributor: String){
data class Movie(var rank: Int, var title: String,
var country: String,var boxOfficeGross: Double,
var openingWeekendGross: Double, var distributor: String){
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted unnecessary statement.

package com.example.mymovieinfo.service

import android.content.ContentValues.TAG
import android.util.Log
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete redunctant import.

var result = movies.await()?.awaitResponse()?.body()
return@withContext result
val movies = async { service?.getAllMovies() }
return@withContext movies.await()?.awaitResponse()?.body()
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used inline function to make it more brief and easier to understand.

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"/> No newline at end of file
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added .xml to make the program can be compiled.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an XML layout file. Are they using this, or are they using Compose?

@discospiff
Copy link
Copy Markdown

From this review:
Some of the suggestions can be performed automatically by the IDE (auto format code, organize imports), so no need to merge a branch for that. Formatting code is really programmer's preference anyway, and doesn't necessarily decrease technical debt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants