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

Remove progress dialogs #1280

Merged
merged 12 commits into from
May 17, 2018
Merged

Remove progress dialogs #1280

merged 12 commits into from
May 17, 2018

Conversation

samtstern
Copy link
Contributor

@samtstern samtstern commented May 3, 2018

Beginning investigate of #724

Video of what a Google sign in looks like:
https://drive.google.com/open?id=1LSKpQMyT1yew4A2ardO97AhoP1gbXH40

Video of full email flow (no dialogs at all!):
https://drive.google.com/open?id=1VP-fRyEut_FHlsSfDrS3aawVRZtuiAQq

General approach:

  • Invisible activities become visible with a dim background and a small, centered spinner
  • Activities with a single action button show a horizontal loading bar under the action bar and have the button disabled while loading

TODO:

  • Create spinner overlay with minimum show time
  • Pass theme to overlaid spinner
  • Add overlaid spinner to KickoffActivity
  • Add overlaid spinner to SaveCredentialsActivity
  • Remove dialogs from WelcomeBack screens
  • Remove dialogs from CheckEmailFragment
  • Remove dialogs from RegisterEmailFragment
  • Figure out loading state for AuthMethodPickerActivity

Future TODO:

  • Make the custom phone verification progress dialog into something else (maybe a custom button)
  • Remove dialogs from phone code confirmation screen (after your phone auth rewrite)

cc @SUPERCILEX wdyt of the approach?

Change-Id: Ie8e5a0c5dd0105b1b9d79ef385836286cfe6375f
@samtstern samtstern changed the title Dialog investigate [WIP] Remove progress dialogs May 3, 2018
Change-Id: I5b39edaa31002baa1352628b818ff46b55f28fbf
@samtstern
Copy link
Contributor Author

samtstern commented May 3, 2018

Lint error:

  /home/travis/build/firebase/FirebaseUI-Android/auth/src/main/res/values/styles.xml:236: Error: Margin values should not be negative [NegativeMargin]
          <item name="android:layout_marginTop">-7dp</item>
                                                ^

Looks like negative margin trick is not cool. I'll have to find another way to jam the progress bar under the action bar.


Edit: I could solve it using this library
https://github.com/DreaminginCodeZH/MaterialProgressBar

But I am not sure if that's worth it:
http://www.methodscount.com/?lib=me.zhanghai.android.materialprogressbar%3Alibrary%3A1.4.2


Edit 2: went for the library. It doesn't have any deps we don't already have.

samtstern added 2 commits May 3, 2018 11:39
Change-Id: I95e08b3f2150387918ddf6a7455eda54a71f8296
Change-Id: I85f2cc7aa3a0e33234f7819e15fc955633175fb1
@samtstern samtstern changed the title [WIP] Remove progress dialogs Remove progress dialogs May 3, 2018
@samtstern samtstern changed the base branch from version-3.4.0-dev to version-4.0.0-dev May 4, 2018 17:24
samtstern added 2 commits May 4, 2018 10:38
Change-Id: Iee54a95d47c0af7cc2e83cb0986153d2172007c3
Change-Id: I04e32ea437446ba4240187a3cb2d42b0a706b338
@samtstern samtstern requested a review from SUPERCILEX May 4, 2018 19:49
@samtstern samtstern added this to the 4.0.0 milestone May 4, 2018
Change-Id: Ia02bdc186239fe32e804f37ac2c3c74ea715dd14
@samtstern
Copy link
Contributor Author

Review note: a lot of the changes are just churn from having to indent some layouts by another level. Github's new "hide whitespace changes" setting will help a lot with that.

@SUPERCILEX
Copy link
Collaborator

Sorry for the delay, I've been bogged down writing samples for issues I submitted about I/O announcements (if only stuff worked on the first try, am I right? 🤣). Anyway, hoping to look at this and the phone auth rewrite tomorrow. If not, definitely Wednesday. 👍

@SUPERCILEX
Copy link
Collaborator

Damn, I just watched the videos... lookin' hot! 🔥

Change-Id: I6d6429742bf3d4293c611a7ac741dac2654e2ec0
Copy link
Collaborator

@SUPERCILEX SUPERCILEX left a comment

Choose a reason for hiding this comment

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

I can't say this enough: thank you! This has been nagging me months now and I just never got around to it. I have a few comments, but other than those, it's looking great so far! 😊

@@ -11,7 +11,7 @@
import com.google.firebase.auth.FirebaseUser;

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class FragmentBase extends Fragment {
public class FragmentBase extends Fragment implements ProgressView {
private HelperActivityBase mActivity;
private ProgressDialogHolder mProgressDialogHolder;
Copy link
Collaborator

Choose a reason for hiding this comment

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

So we haven't gotten rid of all of progress dialogs yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think once you're done with Phone auth we can really kill the whole ProgressDialogHolder thing.


import com.firebase.ui.auth.R;


Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: extra new line

setContentView(R.layout.fui_activity_invisible);

// Create an indeterminate, circular progress bar in the app's theme
mProgressBar = new ProgressBar(new ContextThemeWrapper(this, getFlowParams().themeId));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we use the material library version to get sexiness pre-L? (And consistent behavior in general.)

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class InvisibleActivityBase extends HelperActivityBase {

private static final long MIN_SPINNER_MS = 1000;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ooof, this seems like a long time. How about 500ms or even 750?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to 750. You'd be surprised how "flickery" 500 feels.

@Override
public void showProgress(int message) {
if (mProgressBar.getVisibility() == View.VISIBLE) {
mHandler.removeCallbacksAndMessages(null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Glad to see you know that trick too! I've been burned so many times using removeCallbacks without the messages bit. 🤦‍♂️😆

style="@style/FirebaseUI.TopProgressBar"
android:visibility="invisible"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: space before />

@@ -7,31 +7,44 @@
android:layout_height="match_parent">

<LinearLayout
Copy link
Collaborator

Choose a reason for hiding this comment

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

I can't motivate you to use ConstraintLayout? 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think once @lsirac finishes the ToS update I'll have to use ConstraintLayout to get around the merge conflicts anyway.

<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/top_progress_bar"
style="@style/FirebaseUI.TopProgressBar"
android:visibility="invisible"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we move the visibility to the style as well?

@@ -12,11 +12,11 @@

<style name="FirebaseUI.Transparent" parent="FirebaseUI">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Scared of Samsung, I see! 🤣

<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">4dp</item>
<item name="android:indeterminate">true</item>
<item name="mpb_progressStyle">horizontal</item>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wish the Android team would fix style attributes, those look so dang ugly! 😭 Anyway, 👍

samtstern added 2 commits May 16, 2018 09:29
Change-Id: I7a60cd497bc00b6b9e6f92b44df1527725d96daa
Change-Id: Id976c22c8a9a820377940a953265484bf6e1dfae
Copy link
Collaborator

@SUPERCILEX SUPERCILEX left a comment

Choose a reason for hiding this comment

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

Cool, all of your explanations make sense. 👍 Just a few more invisible thingys that could be GONE. Or would that shift the rest of the layout around?

@Override
public void hideProgress() {
mNextButton.setEnabled(true);
mProgressBar.setVisibility(View.INVISIBLE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here

@Override
public void hideProgress() {
mNextButton.setEnabled(true);
mProgressBar.setVisibility(View.INVISIBLE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here

@Override
public void hideProgress() {
mDoneButton.setEnabled(true);
mProgressBar.setVisibility(View.INVISIBLE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here


@Override
public void hideProgress() {
mProgressBar.setVisibility(View.INVISIBLE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here

@Override
public void hideProgress() {
mDoneButton.setEnabled(true);
mProgressBar.setVisibility(View.INVISIBLE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here

@samtstern
Copy link
Contributor Author

@SUPERCILEX now that you mention it, I have gone back to all invisible/visible for the top bar as I don't want layout to jump by ~8dp each time it changes. Worth the small inefficiency IMO.

Change-Id: I65272097018400f1f9df498d757151985650d747
Copy link
Collaborator

@SUPERCILEX SUPERCILEX left a comment

Choose a reason for hiding this comment

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

SGTM!

@samtstern
Copy link
Contributor Author

Gonna wait to merge this until the ToS/PP thing is done to save @lsirac from the nasty layout merge commits. Don't say I never did anything for you Leo!

Change-Id: I540fca91aa8e33f79cc364a5ed267a4fb76e6cf4
@samtstern samtstern merged commit 66be717 into version-4.0.0-dev May 17, 2018
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