Lots of progress with dynamic theming, the nav drawer now uses a RecyclerView, AboutDeveloperDialogHelper is now a DialogFragment, RTL support (to suppress Lint warnings), other various small fixes, cleaned up and formatted lot of code (and removed un-used resources), R.string.ok > android.R.string.ok, R.string.cancel > android.R.string.cancel, switched dialog helpers to DialogFragments.

This commit is contained in:
Aidan Follestad 2015-04-16 16:47:02 -05:00
commit 7ce86afd74
265 changed files with 2853 additions and 2292 deletions

View file

@ -0,0 +1,56 @@
package com.kabouzeid.gramophone.prefs;
import android.content.Context;
import android.preference.Preference;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;
import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.views.CircleView;
public class ColorChooserPreference extends Preference {
private View mView;
private int color;
private int border;
public ColorChooserPreference(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public ColorChooserPreference(Context context) {
this(context, null, 0);
}
public ColorChooserPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setLayoutResource(R.layout.preference_custom);
}
@Override
protected void onBindView(@NonNull View view) {
super.onBindView(view);
mView = view;
invalidateColor();
}
public void setColor(int color, int border) {
this.color = color;
this.border = border;
invalidateColor();
}
private void invalidateColor() {
if (mView != null) {
CircleView circle = (CircleView) mView.findViewById(R.id.circle);
if (this.color != 0) {
circle.setVisibility(View.VISIBLE);
circle.setBackgroundColor(color);
circle.setBorderColor(border);
} else {
circle.setVisibility(View.GONE);
}
}
}
}

View file

@ -0,0 +1,39 @@
package com.kabouzeid.gramophone.prefs;
import android.content.Context;
import android.preference.PreferenceCategory;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import com.afollestad.materialdialogs.ThemeSingleton;
import com.kabouzeid.gramophone.R;
/**
* Uses the theme's primary color as the text color of the category.
*
* @author Aidan Follestad (afollestad)
*/
public class DynamicPreferenceCategory extends PreferenceCategory {
public DynamicPreferenceCategory(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public DynamicPreferenceCategory(Context context) {
this(context, null, 0);
}
public DynamicPreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setLayoutResource(R.layout.preference_category_custom);
setSelectable(false);
}
@Override
protected void onBindView(@NonNull View view) {
super.onBindView(view);
((TextView) view.findViewById(android.R.id.title)).setTextColor(ThemeSingleton.get().positiveColor);
}
}