Skip to content

Instantly share code, notes, and snippets.

@gpetuhov
Forked from cutiko/LoginActivity.java
Created April 23, 2019 10:44
Show Gist options
  • Select an option

  • Save gpetuhov/2169c208f56ba1f16ffb54ca336a764d to your computer and use it in GitHub Desktop.

Select an option

Save gpetuhov/2169c208f56ba1f16ffb54ca336a764d to your computer and use it in GitHub Desktop.

Revisions

  1. @cutiko cutiko revised this gist Mar 20, 2018. 1 changed file with 8 additions and 9 deletions.
    17 changes: 8 additions & 9 deletions LoginActivity.java
    Original file line number Diff line number Diff line change
    @@ -8,18 +8,17 @@ protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);


    //I rather using a list, this way handling providers is separeted from the login methods
    List<AuthUI.IdpConfig> providers = Arrays.asList(
    new AuthUI.IdpConfig.EmailBuilder().build(),
    new AuthUI.IdpConfig.GoogleBuilder().build(),
    new AuthUI.IdpConfig.FacebookBuilder().build()
    );
    startActivityForResult(
    AuthUI.getInstance()
    .createSignInIntentBuilder()
    .setProviders(
    Arrays.asList(
    new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(),
    new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(),
    new AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build(),
    new AuthUI.IdpConfig.Builder(AuthUI.TWITTER_PROVIDER).build()
    )
    )
    .setAvailableProviders(providers)
    .setTheme(R.style.LoginTheme)
    .setLogo(R.mipmap.logo)
    .build(),
  2. @cutiko cutiko revised this gist Oct 23, 2017. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion Readme.md
    Original file line number Diff line number Diff line change
    @@ -6,4 +6,14 @@ This is a snippet to customize Firebase-Ui-auth login. **Thanks to the wonderful
    - [logo](https://www.dropbox.com/sh/4rz070t1s698qzw/AABJe5gSyf2aVq5MME8o18vRa?dl=0)
    2. Use the colors provided in `colors.xml`
    3. Copy paste the themes in the `styles.xml`
    4. Apply the theme and the logo in the java as the example in `LoginActivity.java`
    4. Apply the theme and the logo in the java as the example in `LoginActivity.java`

    This are the size of the background in pixels, so you can create your own:

    - mdpi: 360 x 640
    - hpdi: 540 x 960
    - xhdpi: 720 x 1280
    - xxhdpi: 1080 x 1920
    - xxxhdpi: 1440 x 2560

    *I'm still working in a solution to support correctly other devices like tablets, my first thought contemplate using the `dimens` still not sure if it is gonna be a dirty but quick fix*
  3. @cutiko cutiko revised this gist May 11, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions Readme.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    ## Instructions
    This is a snippet to customize Firebase-Ui-auth login. **Thanks to the wonderfull people in Firebase-Ui**.

    1- Download and add to your project this files
    1. Download and add to your project this files
    - [bg_login](https://www.dropbox.com/sh/xgif3cz6ryjoozo/AAC1RSCYu3-SRpf2-Wg8jjM9a?dl=0)
    - [logo](https://www.dropbox.com/sh/4rz070t1s698qzw/AABJe5gSyf2aVq5MME8o18vRa?dl=0)
    2- Use the colors provided in `colors.xml`
    3- Copy paste the themes in the `styles.xml`
    4- Apply the theme and the logo in the java as the example in `LoginActivity.java`
    2. Use the colors provided in `colors.xml`
    3. Copy paste the themes in the `styles.xml`
    4. Apply the theme and the logo in the java as the example in `LoginActivity.java`
  4. @cutiko cutiko revised this gist May 11, 2017. 2 changed files with 16 additions and 3 deletions.
    11 changes: 8 additions & 3 deletions Readme.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,9 @@
    ## Instructions
    This is a snippet to customize Firebase-Ui-auth login. **Thanks to the wonderfull people in Firebase-Ui**.

    1- Download and add to your project this files
    - [bg_login] (https://www.dropbox.com/sh/xgif3cz6ryjoozo/AAC1RSCYu3-SRpf2-Wg8jjM9a?dl=0)
    - [logo] (https://www.dropbox.com/sh/4rz070t1s698qzw/AABJe5gSyf2aVq5MME8o18vRa?dl=0)
    2-
    - [bg_login](https://www.dropbox.com/sh/xgif3cz6ryjoozo/AAC1RSCYu3-SRpf2-Wg8jjM9a?dl=0)
    - [logo](https://www.dropbox.com/sh/4rz070t1s698qzw/AABJe5gSyf2aVq5MME8o18vRa?dl=0)
    2- Use the colors provided in `colors.xml`
    3- Copy paste the themes in the `styles.xml`
    4- Apply the theme and the logo in the java as the example in `LoginActivity.java`
    8 changes: 8 additions & 0 deletions colors.xml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
    <color name="colorPrimary">#673AB7</color>
    <color name="colorPrimaryDark">#512DA8</color>
    <color name="colorPrimaryLight">#EDE7F6</color>
    <color name="colorAccent">#7C4DFF</color>
    <color name="colorSecondary">#FFC107</color>
    </resources>
  5. @cutiko cutiko renamed this gist May 11, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions assets.md → Readme.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Download the assets referred in other files from the following links:

    1- Download and add to your project this files
    - [bg_login] (https://www.dropbox.com/sh/xgif3cz6ryjoozo/AAC1RSCYu3-SRpf2-Wg8jjM9a?dl=0)
    - [logo] (https://www.dropbox.com/sh/4rz070t1s698qzw/AABJe5gSyf2aVq5MME8o18vRa?dl=0)
    2-
  6. @cutiko cutiko revised this gist May 11, 2017. 5 changed files with 48 additions and 73 deletions.
    28 changes: 28 additions & 0 deletions LoginActivity.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    public class LoginActivity extends AppCompatActivity {

    private static final int RC_SIGN_IN = 343;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    startActivityForResult(
    AuthUI.getInstance()
    .createSignInIntentBuilder()
    .setProviders(
    Arrays.asList(
    new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(),
    new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(),
    new AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build(),
    new AuthUI.IdpConfig.Builder(AuthUI.TWITTER_PROVIDER).build()
    )
    )
    .setTheme(R.style.LoginTheme)
    .setLogo(R.mipmap.logo)
    .build(),
    RC_SIGN_IN);
    }
    }
    12 changes: 0 additions & 12 deletions bg_btn_accent.xml
    Original file line number Diff line number Diff line change
    @@ -1,12 +0,0 @@
    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="true">
    <color android:color="@color/colorAccentDark"/>
    </item>

    <item>
    <color android:color="@color/colorAccent"/>
    </item>

    </selector>
    12 changes: 0 additions & 12 deletions bg_login.xml
    Original file line number Diff line number Diff line change
    @@ -1,12 +0,0 @@
    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@mipmap/bg_login"/>

    <item android:top="120dp">
    <bitmap
    android:src="@mipmap/logo"
    android:gravity="top|center_horizontal" />
    </item>

    </layer-list>
    9 changes: 0 additions & 9 deletions colors.xml
    Original file line number Diff line number Diff line change
    @@ -1,9 +0,0 @@
    <color name="colorPrimary">#673AB7</color>
    <color name="colorPrimaryDark">#512DA8</color>
    <color name="colorPrimaryLight">#EDE7F6</color>
    <color name="colorAccent">#7C4DFF</color>
    <color name="colorAccentDark">#311B92</color>
    <color name="colorAccentLight">#D1C4E9</color>
    <color name="colorWhite">#FFFFFF</color>
    <color name="colorBlack">#212121</color>
    <color name="colorGray">#727272</color>
    60 changes: 20 additions & 40 deletions styles.xml
    Original file line number Diff line number Diff line change
    @@ -1,50 +1,30 @@
    <style name="FullscreenTheme" parent="AppTheme">
    <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
    <item name="android:windowActionBarOverlay">true</item>
    <item name="android:windowBackground">@drawable/bg_login</item>
    <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
    <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
    <resources>
    <style name="LoginTheme" parent="FirebaseUI">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="colorButtonNormal">@color/colorAccent</item>
    <item name="colorControlNormal">@android:color/white</item>
    <item name="colorControlActivated">@android:color/white</item>
    <item name="colorControlHighlight">@android:color/white</item>
    <item name="android:textColor">@android:color/white</item>
    <item name="android:textColorPrimary">@android:color/white</item>
    <item name="android:textColorSecondary">@android:color/white</item>
    <item name="android:windowBackground">@mipmap/bg_login</item>
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="colorControlNormal">@color/colorWhite</item>
    <item name="colorControlActivated">@color/colorWhite</item>
    <item name="colorControlHighlight">@color/colorWhite</item>
    <item name="android:textColorHint">@android:color/white</item>
    </style>

    <style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar">
    <item name="android:background">@color/colorPrimary</item>
    </style>

    <style name="FirebaseUI.Button" parent="@style/FullscreenTheme">
    <item name="android:background">@drawable/bg_btn_accent</item>
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_gravity">right</item>
    <item name="android:layout_height">36dp</item>
    <item name="android:layout_margin">8dp</item>
    <item name="android:textColor">@color/colorWhite</item>
    <item name="android:textAllCaps">true</item>
    <item name="android:radius">2dp</item>
    </style>

    <style name="FirebaseUI.EditText">
    <item name="android:paddingBottom">14dp</item>
    <item name="android:paddingTop">14dp</item>
    <style name="FirebaseUI.Text">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="colorControlActivated">@color/colorWhite</item>
    <item name="colorControlHighlight">@color/colorWhite</item>
    <item name="android:textColorHint">@color/colorWhite</item>
    <item name="android:textColor">@color/colorWhite</item>
    <item name="android:fontFamily">sans-serif</item>
    <item name="android:textColor">@android:color/white</item>
    </style>

    <style name="FirebaseUI.Text.TextInputLayout" parent="@style/FirebaseUI.EditText" />

    <style name="FirebaseUI.Text.HintText" parent="@style/FirebaseUI.EditText" />

    <style name="FirebaseUI.ImageView.VisibilityToggle" parent="@style/FirebaseUI.EditText">
    <item name="android:visibility">gone</item>
    <style name="FirebaseUI.Text.Link">
    <item name="android:textColor">@color/colorSecondary</item>
    </style>

    <style name="FirebaseUI.Text.Link" parent="FirebaseUI.EditText" />

    <style name="FirebaseUI.Text.BodyText" parent="FirebaseUI.EditText" />
    </resources>
  7. @cutiko cutiko revised this gist Oct 3, 2016. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions colors.xml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    <color name="colorPrimary">#673AB7</color>
    <color name="colorPrimaryDark">#512DA8</color>
    <color name="colorPrimaryLight">#EDE7F6</color>
    <color name="colorAccent">#7C4DFF</color>
    <color name="colorAccentDark">#311B92</color>
    <color name="colorAccentLight">#D1C4E9</color>
    <color name="colorWhite">#FFFFFF</color>
    <color name="colorBlack">#212121</color>
    <color name="colorGray">#727272</color>
  8. @cutiko cutiko revised this gist Oct 3, 2016. No changes.
  9. @cutiko cutiko revised this gist Sep 7, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion assets.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Download the assets referred in the previous files from the following links:
    Download the assets referred in other files from the following links:

    - [bg_login] (https://www.dropbox.com/sh/xgif3cz6ryjoozo/AAC1RSCYu3-SRpf2-Wg8jjM9a?dl=0)
    - [logo] (https://www.dropbox.com/sh/4rz070t1s698qzw/AABJe5gSyf2aVq5MME8o18vRa?dl=0)
  10. @cutiko cutiko revised this gist Sep 7, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion assets.md
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,4 @@
    Download the assets referred in the previous files from the following links:
    [bg_login] (https://www.dropbox.com/sh/xgif3cz6ryjoozo/AAC1RSCYu3-SRpf2-Wg8jjM9a?dl=0)

    - [bg_login] (https://www.dropbox.com/sh/xgif3cz6ryjoozo/AAC1RSCYu3-SRpf2-Wg8jjM9a?dl=0)
    - [logo] (https://www.dropbox.com/sh/4rz070t1s698qzw/AABJe5gSyf2aVq5MME8o18vRa?dl=0)
  11. @cutiko cutiko revised this gist Sep 7, 2016. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions assets.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,2 @@
    Download the assets referred in the previous files from the following links:

    (bg_login) [https://www.dropbox.com/sh/xgif3cz6ryjoozo/AAC1RSCYu3-SRpf2-Wg8jjM9a?dl=0]
    [bg_login] (https://www.dropbox.com/sh/xgif3cz6ryjoozo/AAC1RSCYu3-SRpf2-Wg8jjM9a?dl=0)
  12. @cutiko cutiko revised this gist Sep 7, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions assets.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    Download the assets referred in the previous files from the following links:

    (bg_login) [https://www.dropbox.com/sh/xgif3cz6ryjoozo/AAC1RSCYu3-SRpf2-Wg8jjM9a?dl=0]
  13. @cutiko cutiko revised this gist Sep 7, 2016. 2 changed files with 24 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions bg_btn_accent.xml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="true">
    <color android:color="@color/colorAccentDark"/>
    </item>

    <item>
    <color android:color="@color/colorAccent"/>
    </item>

    </selector>
    12 changes: 12 additions & 0 deletions bg_login.xml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@mipmap/bg_login"/>

    <item android:top="120dp">
    <bitmap
    android:src="@mipmap/logo"
    android:gravity="top|center_horizontal" />
    </item>

    </layer-list>
  14. @cutiko cutiko created this gist Sep 7, 2016.
    50 changes: 50 additions & 0 deletions styles.xml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    <style name="FullscreenTheme" parent="AppTheme">
    <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
    <item name="android:windowActionBarOverlay">true</item>
    <item name="android:windowBackground">@drawable/bg_login</item>
    <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
    <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="colorControlNormal">@color/colorWhite</item>
    <item name="colorControlActivated">@color/colorWhite</item>
    <item name="colorControlHighlight">@color/colorWhite</item>
    </style>

    <style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar">
    <item name="android:background">@color/colorPrimary</item>
    </style>

    <style name="FirebaseUI.Button" parent="@style/FullscreenTheme">
    <item name="android:background">@drawable/bg_btn_accent</item>
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_gravity">right</item>
    <item name="android:layout_height">36dp</item>
    <item name="android:layout_margin">8dp</item>
    <item name="android:textColor">@color/colorWhite</item>
    <item name="android:textAllCaps">true</item>
    <item name="android:radius">2dp</item>
    </style>

    <style name="FirebaseUI.EditText">
    <item name="android:paddingBottom">14dp</item>
    <item name="android:paddingTop">14dp</item>
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="colorControlActivated">@color/colorWhite</item>
    <item name="colorControlHighlight">@color/colorWhite</item>
    <item name="android:textColorHint">@color/colorWhite</item>
    <item name="android:textColor">@color/colorWhite</item>
    </style>

    <style name="FirebaseUI.Text.TextInputLayout" parent="@style/FirebaseUI.EditText" />

    <style name="FirebaseUI.Text.HintText" parent="@style/FirebaseUI.EditText" />

    <style name="FirebaseUI.ImageView.VisibilityToggle" parent="@style/FirebaseUI.EditText">
    <item name="android:visibility">gone</item>
    </style>

    <style name="FirebaseUI.Text.Link" parent="FirebaseUI.EditText" />

    <style name="FirebaseUI.Text.BodyText" parent="FirebaseUI.EditText" />