First-run crash fix, colored nav bar setting should be on for all by default if translucent nav bars are no longer being used, etc.
This commit is contained in:
parent
c004a5b112
commit
135c8233ec
6 changed files with 25 additions and 29 deletions
|
|
@ -65,7 +65,6 @@ public class MainActivity extends AbsFabActivity
|
|||
implements NavigationDrawerFragment.NavigationDrawerCallbacks, KabViewsDisableAble {
|
||||
|
||||
public static final String TAG = MainActivity.class.getSimpleName();
|
||||
private static final boolean DEBUG = true;
|
||||
|
||||
private DrawerLayout drawerLayout;
|
||||
private ActionBarDrawerToggle drawerToggle;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import android.support.v4.view.GravityCompat;
|
|||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
@ -60,7 +61,7 @@ public class NavigationDrawerFragment extends Fragment {
|
|||
|
||||
|
||||
if (!userLearnedDrawer && !fromSavedInstanceState) {
|
||||
this.drawerLayout.openDrawer(fragmentContainerView);
|
||||
this.drawerLayout.openDrawer(Gravity.START);
|
||||
userLearnedDrawer = true;
|
||||
PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putBoolean(AppKeys.SP_USER_LEARNED_DRAWER, true).apply();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ import android.preference.PreferenceManager;
|
|||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.dialogs.ColorChooserDialog;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public final class PreferenceUtils {
|
||||
|
||||
public static final int DEFAULT_PAGE = 1;
|
||||
|
|
@ -131,18 +134,30 @@ public final class PreferenceUtils {
|
|||
return coloredNavigationBarFor(COLORED_NAVIGATION_BAR_OTHER_SCREENS);
|
||||
}
|
||||
|
||||
private final boolean coloredNavigationBarFor(String key) {
|
||||
@SuppressLint("CommitPrefEdits")
|
||||
private boolean coloredNavigationBarFor(String key) {
|
||||
Set<String> defaultVals = new HashSet<>();
|
||||
defaultVals.add(COLORED_NAVIGATION_BAR_ALBUM);
|
||||
defaultVals.add(COLORED_NAVIGATION_BAR_ARTIST);
|
||||
defaultVals.add(COLORED_NAVIGATION_BAR_CURRENT_PLAYING);
|
||||
defaultVals.add(COLORED_NAVIGATION_BAR_PLAYIST);
|
||||
defaultVals.add(COLORED_NAVIGATION_BAR_TAG_EDITOR);
|
||||
defaultVals.add(COLORED_NAVIGATION_BAR_OTHER_SCREENS);
|
||||
|
||||
if (!mPreferences.contains(COLORED_NAVIGATION_BAR))
|
||||
mPreferences.edit().putStringSet(COLORED_NAVIGATION_BAR, defaultVals).commit();
|
||||
|
||||
try {
|
||||
return mPreferences.getStringSet(COLORED_NAVIGATION_BAR, null).contains(key);
|
||||
return mPreferences.getStringSet(COLORED_NAVIGATION_BAR, defaultVals).contains(key);
|
||||
} catch (NullPointerException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CommitPrefEdits")
|
||||
private void setColoredNavigationBarOtherScreens(boolean coloredNavbar) {
|
||||
mPreferences.edit().putBoolean(COLORED_NAVIGATION_BAR_OTHER_SCREENS, coloredNavbar).commit();
|
||||
}
|
||||
// @SuppressLint("CommitPrefEdits")
|
||||
// private void setColoredNavigationBarOtherScreens(boolean coloredNavbar) {
|
||||
// mPreferences.edit().putBoolean(COLORED_NAVIGATION_BAR_OTHER_SCREENS, coloredNavbar).commit();
|
||||
// }
|
||||
|
||||
public final boolean playbackControllerBoxEnabled() {
|
||||
return mPreferences.getBoolean(PLAYBACK_CONTROLLER_BOX, false);
|
||||
|
|
|
|||
|
|
@ -205,23 +205,4 @@ public class Util {
|
|||
}
|
||||
return drawable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of {@param set}. Used only for debugging purposes.
|
||||
*/
|
||||
@NonNull
|
||||
public static String setToString(@NonNull Set<String> set) {
|
||||
Iterator<String> i = set.iterator();
|
||||
if (!i.hasNext()) {
|
||||
return "[]";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder().append('[');
|
||||
while (true) {
|
||||
sb.append(i.next());
|
||||
if (!i.hasNext()) {
|
||||
return sb.append(']').toString();
|
||||
}
|
||||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue