Skip to content

TE7-T1046: Add App components#22

Open
Kruna1Pate1 wants to merge 1 commit intofeature/recyclerview-practicefrom
feature/AppComponents
Open

TE7-T1046: Add App components#22
Kruna1Pate1 wants to merge 1 commit intofeature/recyclerview-practicefrom
feature/AppComponents

Conversation

@Kruna1Pate1
Copy link
Copy Markdown
Owner

@Kruna1Pate1 Kruna1Pate1 commented Jun 8, 2023

  • Data passing between Activity <--> Activity
  • Data passing between Fragment <--> Activity
  • Data passing between Fragment <--> Fragment
  • Shared viewModel
  • registerActivityForResult
  • Implicit & Explicit intent
  • Capture image from camera
  • Activity launch modes
  • LifecycleOwner demo

Add: Navigation component

Add: Search Web view

Summary by AIReviewRadar 1.0.2

Release Notes:

  • New Feature: Added new activities, fragments, view models, and repositories to the app.
  • New Feature: Included navigation components, camera and internet permissions, image picker, trivia game activities, and a file provider.
  • Refactor: Organized changes and followed best practices such as using coroutines and state flow.

"New features galore,
Navigation and more.
Coroutines in tow,
The app's functionality now aglow."

- Data passing between Activity <--> Activity
- Data passing between Fragment <--> Activity
- Data passing between Fragment <--> Fragment
- Shared viewModel
- registerActivityForResult
- Implicit & Explicit intent
- Capture image from camera
- Activity launch modes
- LifecycleOwner demo

Add: Navigation component

Add: Search Web view
@Kruna1Pate1 Kruna1Pate1 requested a review from nishchal-v June 8, 2023 13:23
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 8, 2023

🤖 AIReviewRadar

Thank you for letting me participate in the code review.

The pull request titled "TE7-T1046: Add App components" adds new activities, fragments, view models, and repositories to the app. It also includes navigation components, camera and internet permissions, image picker, trivia game activities, and a file provider. The changes are well-organized and follow best practices such as using coroutines and state flow. Overall, this is a comprehensive update that enhances the functionality of the app.


Chat with 🤖 AIReviewRadar (@openai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @openai in a reply.

Files ignored due to filter (19)

Ignored files

  • Demo/app/src/main/res/drawable/avatar_10_raster.png
  • Demo/app/src/main/res/drawable/avatar_11_raster.png
  • Demo/app/src/main/res/drawable/avatar_12_raster.png
  • Demo/app/src/main/res/drawable/avatar_13_raster.png
  • Demo/app/src/main/res/drawable/avatar_14_raster.png
  • Demo/app/src/main/res/drawable/avatar_15_raster.png
  • Demo/app/src/main/res/drawable/avatar_16_raster.png
  • Demo/app/src/main/res/drawable/avatar_1_raster.png
  • Demo/app/src/main/res/drawable/avatar_2_raster.png
  • Demo/app/src/main/res/drawable/avatar_3_raster.png
  • Demo/app/src/main/res/drawable/avatar_4_raster.png
  • Demo/app/src/main/res/drawable/avatar_5_raster.png
  • Demo/app/src/main/res/drawable/avatar_6_raster.png
  • Demo/app/src/main/res/drawable/avatar_7_raster.png
  • Demo/app/src/main/res/drawable/avatar_8_raster.png
  • Demo/app/src/main/res/drawable/avatar_9_raster.png
  • Demo/app/src/main/res/drawable/icon_category_leaderboard_raster.png
  • Demo/app/src/main/res/drawable/image_category_entertainment_raster.png
  • Demo/app/src/main/res/drawable/image_category_tvmovies_raster.png
Files not summarized due to max files limit (77)

Not summarized

  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/viewmodels/TitleScreenViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/viewmodels/TriviaGameViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/viewmodels/UserProfileViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/data/models/PackageDetail.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/data/repositories/PackagesRepository.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/data/repositories/WebViewRepository.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/helpers/PackageHelper.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/helpers/SearchCountDownTimer.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/helpers/WebClient.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/activities/SearchWebActivity.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/adapters/PackageDetailAdapter.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/fragments/SearchViewFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/fragments/WebViewFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/viewmodels/SearchViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/viewmodels/WebViewViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/uicomponents/ThemeFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/utils/PreferenceKeys.kt
  • Demo/app/src/main/res/anim/nav_slide_in_bottom.xml
  • Demo/app/src/main/res/anim/nav_slide_in_left.xml
  • Demo/app/src/main/res/anim/nav_slide_in_right.xml
  • Demo/app/src/main/res/anim/nav_slide_in_up.xml
  • Demo/app/src/main/res/anim/nav_slide_out_bottom.xml
  • Demo/app/src/main/res/anim/nav_slide_out_left.xml
  • Demo/app/src/main/res/anim/nav_slide_out_right.xml
  • Demo/app/src/main/res/anim/nav_slide_out_up.xml
  • Demo/app/src/main/res/drawable/button_press.xml
  • Demo/app/src/main/res/drawable/button_press_dark.xml
  • Demo/app/src/main/res/drawable/circle.xml
  • Demo/app/src/main/res/drawable/dark_frame.xml
  • Demo/app/src/main/res/drawable/ic_arrow_outward.xml
  • Demo/app/src/main/res/drawable/ic_feedback.xml
  • Demo/app/src/main/res/drawable/ic_home.xml
  • Demo/app/src/main/res/drawable/ic_list.xml
  • Demo/app/src/main/res/drawable/ic_termux.xml
  • Demo/app/src/main/res/drawable/ic_web.xml
  • Demo/app/src/main/res/drawable/lose_button.xml
  • Demo/app/src/main/res/drawable/mask.xml
  • Demo/app/src/main/res/drawable/purple_frame.xml
  • Demo/app/src/main/res/drawable/rounded_button.xml
  • Demo/app/src/main/res/drawable/rounded_button_dark.xml
  • Demo/app/src/main/res/drawable/rounded_button_white.xml
  • Demo/app/src/main/res/drawable/rounded_rect.xml
  • Demo/app/src/main/res/drawable/white_outline.xml
  • Demo/app/src/main/res/drawable/win_button.xml
  • Demo/app/src/main/res/layout/activity_first.xml
  • Demo/app/src/main/res/layout/activity_fragment_demo.xml
  • Demo/app/src/main/res/layout/activity_image_picker.xml
  • Demo/app/src/main/res/layout/activity_search_web.xml
  • Demo/app/src/main/res/layout/activity_second.xml
  • Demo/app/src/main/res/layout/activity_trivia_game.xml
  • Demo/app/src/main/res/layout/fragment_chatting.xml
  • Demo/app/src/main/res/layout/fragment_first.xml
  • Demo/app/src/main/res/layout/fragment_game_over.xml
  • Demo/app/src/main/res/layout/fragment_in_game.xml
  • Demo/app/src/main/res/layout/fragment_leaderboard.xml
  • Demo/app/src/main/res/layout/fragment_match.xml
  • Demo/app/src/main/res/layout/fragment_register.xml
  • Demo/app/src/main/res/layout/fragment_result_winner.xml
  • Demo/app/src/main/res/layout/fragment_search_view.xml
  • Demo/app/src/main/res/layout/fragment_second.xml
  • Demo/app/src/main/res/layout/fragment_title_screen.xml
  • Demo/app/src/main/res/layout/fragment_user_profile.xml
  • Demo/app/src/main/res/layout/fragment_web_view.xml
  • Demo/app/src/main/res/layout/item_leaderboard_user.xml
  • Demo/app/src/main/res/layout/item_package_detail.xml
  • Demo/app/src/main/res/layout/item_search_suggestion.xml
  • Demo/app/src/main/res/layout/user_card.xml
  • Demo/app/src/main/res/menu/search_web_bottom_nav.xml
  • Demo/app/src/main/res/menu/trivia_game_bottom_nav.xml
  • Demo/app/src/main/res/navigation/search_web_nav_graph.xml
  • Demo/app/src/main/res/navigation/trivia_nav_graph.xml
  • Demo/app/src/main/res/raw/unauthorised.html
  • Demo/app/src/main/res/values/colors.xml
  • Demo/app/src/main/res/values/dimens.xml
  • Demo/app/src/main/res/values/strings.xml
  • Demo/app/src/main/res/xml/provider_paths.xml
  • Demo/build.gradle
🤖 AIReviewRadar
  <details>
Files not reviewed due to max files limit (92)

Not reviewed

  • Demo/app/src/main/java/com/krunal/demo/navigation/data/repositories/UserProfileRepository.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/activities/TriviaGameActivity.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/adapters/LeaderboardAdapter.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/fragments/GameOverFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/fragments/InGameFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/fragments/LeaderboardFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/fragments/MatchFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/fragments/RegisterFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/fragments/ResultWinnerFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/fragments/TitleScreenFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/fragments/UserProfileFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/viewmodels/InGameViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/viewmodels/LeaderboardViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/viewmodels/MatchViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/viewmodels/RegisterViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/viewmodels/TitleScreenViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/viewmodels/TriviaGameViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/navigation/ui/viewmodels/UserProfileViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/data/models/PackageDetail.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/data/repositories/PackagesRepository.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/data/repositories/WebViewRepository.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/helpers/PackageHelper.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/helpers/SearchCountDownTimer.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/helpers/WebClient.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/activities/SearchWebActivity.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/adapters/PackageDetailAdapter.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/fragments/SearchViewFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/fragments/WebViewFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/viewmodels/SearchViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/searchwebview/ui/viewmodels/WebViewViewModel.kt
  • Demo/app/src/main/java/com/krunal/demo/uicomponents/ThemeFragment.kt
  • Demo/app/src/main/java/com/krunal/demo/utils/PreferenceKeys.kt
  • Demo/app/src/main/res/anim/nav_slide_in_bottom.xml
  • Demo/app/src/main/res/anim/nav_slide_in_left.xml
  • Demo/app/src/main/res/anim/nav_slide_in_right.xml
  • Demo/app/src/main/res/anim/nav_slide_in_up.xml
  • Demo/app/src/main/res/anim/nav_slide_out_bottom.xml
  • Demo/app/src/main/res/anim/nav_slide_out_left.xml
  • Demo/app/src/main/res/anim/nav_slide_out_right.xml
  • Demo/app/src/main/res/anim/nav_slide_out_up.xml
  • Demo/app/src/main/res/drawable/button_press.xml
  • Demo/app/src/main/res/drawable/button_press_dark.xml
  • Demo/app/src/main/res/drawable/circle.xml
  • Demo/app/src/main/res/drawable/dark_frame.xml
  • Demo/app/src/main/res/drawable/ic_arrow_outward.xml
  • Demo/app/src/main/res/drawable/ic_feedback.xml
  • Demo/app/src/main/res/drawable/ic_home.xml
  • Demo/app/src/main/res/drawable/ic_list.xml
  • Demo/app/src/main/res/drawable/ic_termux.xml
  • Demo/app/src/main/res/drawable/ic_web.xml
  • Demo/app/src/main/res/drawable/lose_button.xml
  • Demo/app/src/main/res/drawable/mask.xml
  • Demo/app/src/main/res/drawable/purple_frame.xml
  • Demo/app/src/main/res/drawable/rounded_button.xml
  • Demo/app/src/main/res/drawable/rounded_button_dark.xml
  • Demo/app/src/main/res/drawable/rounded_button_white.xml
  • Demo/app/src/main/res/drawable/rounded_rect.xml
  • Demo/app/src/main/res/drawable/white_outline.xml
  • Demo/app/src/main/res/drawable/win_button.xml
  • Demo/app/src/main/res/layout/activity_first.xml
  • Demo/app/src/main/res/layout/activity_fragment_demo.xml
  • Demo/app/src/main/res/layout/activity_image_picker.xml
  • Demo/app/src/main/res/layout/activity_search_web.xml
  • Demo/app/src/main/res/layout/activity_second.xml
  • Demo/app/src/main/res/layout/activity_trivia_game.xml
  • Demo/app/src/main/res/layout/fragment_chatting.xml
  • Demo/app/src/main/res/layout/fragment_first.xml
  • Demo/app/src/main/res/layout/fragment_game_over.xml
  • Demo/app/src/main/res/layout/fragment_in_game.xml
  • Demo/app/src/main/res/layout/fragment_leaderboard.xml
  • Demo/app/src/main/res/layout/fragment_match.xml
  • Demo/app/src/main/res/layout/fragment_register.xml
  • Demo/app/src/main/res/layout/fragment_result_winner.xml
  • Demo/app/src/main/res/layout/fragment_search_view.xml
  • Demo/app/src/main/res/layout/fragment_second.xml
  • Demo/app/src/main/res/layout/fragment_title_screen.xml
  • Demo/app/src/main/res/layout/fragment_user_profile.xml
  • Demo/app/src/main/res/layout/fragment_web_view.xml
  • Demo/app/src/main/res/layout/item_leaderboard_user.xml
  • Demo/app/src/main/res/layout/item_package_detail.xml
  • Demo/app/src/main/res/layout/item_search_suggestion.xml
  • Demo/app/src/main/res/layout/user_card.xml
  • Demo/app/src/main/res/menu/search_web_bottom_nav.xml
  • Demo/app/src/main/res/menu/trivia_game_bottom_nav.xml
  • Demo/app/src/main/res/navigation/search_web_nav_graph.xml
  • Demo/app/src/main/res/navigation/trivia_nav_graph.xml
  • Demo/app/src/main/res/raw/unauthorised.html
  • Demo/app/src/main/res/values/colors.xml
  • Demo/app/src/main/res/values/dimens.xml
  • Demo/app/src/main/res/values/strings.xml
  • Demo/app/src/main/res/xml/provider_paths.xml
  • Demo/build.gradle

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 8, 2023

🤖 AIReviewRadar

Reviewing existing code in: Demo/app/src/main/AndroidManifest.xml

Thank you for providing the context. I will keep this in mind when reviewing the patches.

private fun setupInitialValue() {
arguments?.getString(IntentData.MESSAGE)?.let(viewModel::setMessage)
}
} No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 AIReviewRadar

The code changes look good. However, it is recommended to add a newline at the end of the file to follow common coding practices.

this@FirstActivityViewModel.message.emit(message)
}
}
} No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 AIReviewRadar

There are no issues with the code changes in this patch. The new FirstActivityViewModel class extends the ViewModel class and provides a MutableStateFlow object to hold the message. The setMessage function sets the message using the emit method of the message object, which is wrapped in a coroutine launched by the viewModelScope.

this@ImagePickerViewModel.image.emit(image)
}
}
} No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 AIReviewRadar

The code changes look good. However, it would be helpful to add some comments to the code to explain what the ImagePickerViewModel class does and how it is used. Additionally, it may be useful to add some error handling in case the Uri passed to setImage is null.

this@FragmentDemoViewModel.message.emit(message)
}
}
} No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 AIReviewRadar

The code changes look good. However, it would be better to add some comments to explain the purpose of the FragmentDemoViewModel class and the setMessage function. This will make it easier for other developers to understand the code in the future.

Also, it's a good practice to add a newline at the end of the file. Please add it.

package com.krunal.demo.helpers

import android.content.Context
import android.content.SharedPreferences
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 AIReviewRadar

There are no issues with this code change. The package name has been updated to better reflect the purpose of the class.

data class Credential(
val email: String,
val password: String
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 AIReviewRadar

The code changes look good. However, it would be helpful to add some documentation to the Credential data class to explain what it is used for and how it should be used. This will make it easier for other developers to understand the purpose of this class and use it correctly in their code.

For example:

/**
 * Represents a user's login credentials.
 *
 * @property email The user's email address.
 * @property password The user's password.
 */
data class Credential(
    val email: String,
    val password: String
)

field = value
notifyPropertyChanged(BR.password)
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 AIReviewRadar

There are no issues with this code. It is a simple data class that uses BaseObservable to make the properties observable and bindable. The Bindable annotation is used to indicate that the property can be observed and the notifyPropertyChanged method is called to notify any observers of changes to the property.

companion object {
private const val TAG = "LifecycleLogger"
}
} No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 AIReviewRadar

The code changes look good and the new LifecycleLogger class seems to be a useful utility for logging lifecycle events of a LifecycleOwner. However, I would suggest adding some documentation to the class and its methods to make it easier for other developers to understand how to use it. Here's an example of what could be added:

/**
 * A utility class for logging [Lifecycle.Event]s of a [LifecycleOwner].
 *
 * To use this class, simply create an instance of it with a [LifecycleOwner] as the constructor parameter.
 * The logger will automatically start observing the [Lifecycle.Event]s of the [LifecycleOwner] and log them
 * using the Android Logcat system.
 */
class LifecycleLogger(lifecycleOwner: LifecycleOwner) {

    /**
     * Logs the given [event] for the [source] [LifecycleOwner].
     */
    private fun log(name: String?, state: String) {
        Log.i(TAG, "[$name state]: $state")
    }

    companion object {
        private const val TAG = "LifecycleLogger"
    }
}

Other than that, the code looks good and should work as expected.

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.

1 participant