Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 418a152a authored by Stephen Bird's avatar Stephen Bird
Browse files

Login Card: Remember the dismiss event

Change-Id: I9c15886f32ab17dc65137f1385edfd0323755cce
parent d2d74879
Loading
Loading
Loading
Loading
+39 −14
Original line number Diff line number Diff line
@@ -195,10 +195,12 @@ public class MainActivity extends ActionBarActivity
        });

        final CardView cV = (CardView) findViewById(R.id.add_provider);
        if (isLoginCardNotDisabled(false)) {
            cV.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    StorageProviderUtils.loadProviderLogin(getApplicationContext());
                    isLoginCardNotDisabled(true);
                }
            });

@@ -207,10 +209,14 @@ public class MainActivity extends ActionBarActivity
                @Override
                public void onClick(View view) {
                    cV.setVisibility(View.GONE);
                // TODO: Save that the card has been dismissed
                    isLoginCardNotDisabled(true);
                }
            });

        } else {
            cV.setVisibility(View.GONE);
        }

        handleSearchBar();
        initQuickSearch();
        setHomeStatusBarColor();
@@ -624,6 +630,25 @@ public class MainActivity extends ActionBarActivity
        }
    }

    private boolean isLoginCardNotDisabled(boolean disable) {
        boolean status = Preferences.getSharedPreferences().getBoolean(
                FileManagerSettings.CLOUD_LOGIN_USED.getId(),
                ((Boolean) FileManagerSettings.CLOUD_LOGIN_USED
                        .getDefaultValue()).booleanValue());
        if (disable) {
            try {
                Preferences.savePreference(FileManagerSettings.CLOUD_LOGIN_USED, Boolean.FALSE,
                        true);
                status = false;
            } catch (InvalidClassException e) {
                // Unable to save preference
                // continue to return previous preference state
                e.printStackTrace();
            }
        }
        return status;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
+6 −0
Original line number Diff line number Diff line
@@ -29,6 +29,12 @@ public enum FileManagerSettings {
     */
    SETTINGS_FIRST_USE("cm_filemanager_first_use", Boolean.TRUE),  //$NON-NLS-1$

    /**
     * Whether the cloud login card has been used
     * @hide
     */
    CLOUD_LOGIN_USED("cm_filemanager_cloud_login_used", Boolean.TRUE),  //$NON-NLS-1$

    /**
     * The access mode to use
     * @hide