Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Fix: Add Toast "Press BACK to exit" for exit #374

Closed
wants to merge 1 commit into from
Closed

Fix: Add Toast "Press BACK to exit" for exit #374

wants to merge 1 commit into from

Conversation

prit29
Copy link

@prit29 prit29 commented Mar 21, 2020

Closes #372

What has been done to verify that this works as intended?

I tested it on Android 9.0.

Why is this the best possible solution? Were any other approaches considered?

As comments in this issue, I figure out that exit confirmation is good, but not by dialog so I'm doing this by an easy approach.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

No regression risks

Before submitting this PR, please make sure you have:

  • run ./gradlew checkCode and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.

@prit29
Copy link
Author

prit29 commented Mar 21, 2020

@Chromicle can you help me I don't get this Circleci work?

@ajay-prabhakar
Copy link
Contributor

There are some checkstyle violation to solve that please run ./gradlew checkcode locally with that you will get a detailed explanation to solve that error

I don't know this is a valid approach or not, I am just giving you a suggestion to solve that error
@huangyz0918 can you give your opinion on this approach(double press to exit)

Copy link
Contributor

@huangyz0918 huangyz0918 left a comment

Choose a reason for hiding this comment

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

This is a great change! Thanks so much for the contribution, I have some little suggestions and you can have a look when you have time.

@@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
Copy link
Contributor

Choose a reason for hiding this comment

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

The file should not be change, since this is another issue to update the gradle.

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Copy link
Contributor

Choose a reason for hiding this comment

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

The same above.

@@ -292,4 +294,22 @@ private void setUpLoader() {
}
}
}

// Add toast "Press BACK to exit"
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment is self-explanatory, no need here.

return;
}
BACK_FLAG = true;
Toast.makeText(getApplicationContext(),"Press BACK to exit",Toast.LENGTH_SHORT).show();
Copy link
Contributor

Choose a reason for hiding this comment

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

Press BACK to exit should be something like Press BACK again to exit program, and put the string in string.xml.

public void run() {
BACK_FLAG = false;
}
},2000);
Copy link
Contributor

Choose a reason for hiding this comment

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

If the delay time 2000 is static, is better to use a static variable to present.

@prit29
Copy link
Author

prit29 commented Mar 22, 2020

@huangyz0918 Thanks for the suggestion, I make changes and make a new pull request

@Chromicle I run ./gradlew checkout but It still gives me error- "Do not use Windows line endings" in all files even in all lines and can help me how to add new commits in this PR.

@huangyz0918
Copy link
Contributor

@huangyz0918 Thanks for the suggestion, I make changes and make a new pull request

I'm a bit confused why you need a new PR? @pritsahkar

@prit29
Copy link
Author

prit29 commented Mar 23, 2020

@huangyz0918 Thanks for the suggestion, I make changes and make a new pull request

I'm a bit confused why you need a new PR? @pritsahkar

In this PR, my commit is in an unknown repository, now I try to add commit but this time code is in the master branch so this forces me to new PR and apologizes me for a push into the master branch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: Add exit confirmation dialog
3 participants