Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank screen#240 fix #241

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

arvind-1
Copy link
Member

No description provided.

@arvind-1 arvind-1 requested a review from a team as a code owner August 16, 2021 18:49
finish();


runOnUiThread(new Runnable() {
Copy link
Member

Choose a reason for hiding this comment

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

Why was runOnUiThread added?

Copy link
Member Author

Choose a reason for hiding this comment

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

While running application on local i faced an issue where after coming back to app it was running on different thread while loading data on to Screen. So i used runOnUiThread to in UI thread.

Copy link
Member

@nya-elimu nya-elimu Aug 18, 2021

Choose a reason for hiding this comment

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

While running application on local i faced an issue where after coming back to app it was running on different thread while loading data on to Screen. So i used runOnUiThread to in UI thread.

@arvind-1 Are you saying that the application was already downloading content from the REST API when you came back to the app after having opened it previously? If that's the case, maybe it would be better if we implement code that will cancel the download if the user leaves the activity (onStop()) before the download completes?

CC @gscdev

@@ -65,13 +65,21 @@ protected void onStart() {
RoomDb.databaseWriteExecutor.execute(() -> {
List<Application> applications = applicationDao.loadAll();
Log.d(getClass().getName(), "applications.size(): " + applications.size());
applicationListAdapter.setApplications(applications);

if(null!=applications) {
Copy link
Member

Choose a reason for hiding this comment

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

Change to if (applications != null) {

Copy link
Member Author

Choose a reason for hiding this comment

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

ok i will update it.

Copy link
Member

@nya-elimu nya-elimu left a comment

Choose a reason for hiding this comment

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

I had trouble understanding what the code changes were doing. Maybe you could add some in-line comments for increased readability?

@nya-elimu nya-elimu removed the request for review from So-Somila August 30, 2021 13:36
Comment on lines +68 to +70
if(applications != null) {
applicationListAdapter.setApplications(applications);
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if(applications != null) {
applicationListAdapter.setApplications(applications);
}

This code change is not necessary, right? (Since applicationListAdapter.notifyDataSetChanged(); is the line causing the error.)

List<ApplicationVersion> applicationVersions = applicationVersionDao.loadAll();
Log.d(getClass().getName(), "applicationVersions.size(): " + applicationVersions.size());
applicationListAdapter.setApplicationVersions(applicationVersions);

applicationListAdapter.notifyDataSetChanged();

recyclerView.post(new Runnable() {
Copy link
Member

Choose a reason for hiding this comment

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

To avoid the dependence on recyclerView, use runOnUiThread instead?:

Suggested change
recyclerView.post(new Runnable() {
runOnUiThread(new Runnable() {

applicationListAdapter.notifyDataSetChanged();
}
});

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

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.

3 participants