add missing icons in bright theme
* missing white icons * update attrs.xml and styles.xml
|
@ -7,9 +7,12 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.AttrRes;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
@ -89,7 +92,7 @@ public class MissionsFragment extends Fragment {
|
|||
mEmpty = v.findViewById(R.id.list_empty_view);
|
||||
mList = v.findViewById(R.id.mission_recycler);
|
||||
|
||||
// Init
|
||||
// Init layouts managers
|
||||
mGridManager = new GridLayoutManager(getActivity(), SPAN_SIZE);
|
||||
mGridManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
|
||||
@Override
|
||||
|
@ -103,7 +106,6 @@ public class MissionsFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
mLinearManager = new LinearLayoutManager(getActivity());
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
|
@ -120,7 +122,7 @@ public class MissionsFragment extends Fragment {
|
|||
|
||||
// Bug: in api< 23 this is never called
|
||||
// so mActivity=null
|
||||
// so app crashes with nullpointer exception
|
||||
// so app crashes with null-pointer exception
|
||||
mActivity = activity;
|
||||
}
|
||||
|
||||
|
@ -189,12 +191,21 @@ public class MissionsFragment extends Fragment {
|
|||
mList.setAdapter(mAdapter);
|
||||
|
||||
if (mSwitch != null) {
|
||||
mSwitch.setIcon(mLinear ? R.drawable.grid : R.drawable.list);
|
||||
mSwitch.setIcon(getDrawableFromAttribute(mLinear ? R.attr.ic_grid : R.attr.ic_list));
|
||||
mSwitch.setTitle(mLinear ? R.string.grid : R.string.list);
|
||||
mPrefs.edit().putBoolean("linear", mLinear).apply();
|
||||
}
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
private int getDrawableFromAttribute(@AttrRes int ic) {
|
||||
TypedArray styledAttributes = mActivity.obtainStyledAttributes(new int[]{ic});
|
||||
int resId = styledAttributes.getResourceId(0, -1);
|
||||
styledAttributes.recycle();
|
||||
|
||||
return resId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
|
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 319 B |
After Width: | Height: | Size: 422 B |
After Width: | Height: | Size: 415 B |
After Width: | Height: | Size: 265 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 198 B |
After Width: | Height: | Size: 198 B |
After Width: | Height: | Size: 270 B |
After Width: | Height: | Size: 279 B |
After Width: | Height: | Size: 248 B |
After Width: | Height: | Size: 254 B |
After Width: | Height: | Size: 270 B |
After Width: | Height: | Size: 274 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 288 B |
After Width: | Height: | Size: 247 B |
After Width: | Height: | Size: 249 B |
After Width: | Height: | Size: 506 B |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 419 B |
After Width: | Height: | Size: 292 B |
After Width: | Height: | Size: 295 B |
After Width: | Height: | Size: 541 B |
After Width: | Height: | Size: 547 B |
After Width: | Height: | Size: 363 B |
After Width: | Height: | Size: 382 B |
After Width: | Height: | Size: 330 B |
After Width: | Height: | Size: 320 B |
|
@ -239,7 +239,7 @@
|
|||
android:focusable="true"
|
||||
android:padding="5dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/list"
|
||||
android:src="@drawable/ic_list_white_24dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
tools:ignore="ContentDescription,RtlHardcoded"/>
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@
|
|||
android:focusable="true"
|
||||
android:padding="5dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/list"
|
||||
android:src="@drawable/ic_list_white_24dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
tools:ignore="ContentDescription,RtlHardcoded"/>
|
||||
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item android:id="@+id/switch_mode"
|
||||
android:icon="@drawable/list"
|
||||
android:icon="?attr/ic_grid"
|
||||
android:title="@string/grid"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item android:id="@+id/action_settings"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/settings"/>
|
||||
|
||||
<item android:id="@+id/clear_list"
|
||||
android:visible="false"
|
||||
android:icon="@drawable/ic_delete_sweep_white_24dp"
|
||||
app:showAsAction="ifRoom"
|
||||
android:title="@string/clear_finished_download"/>
|
||||
android:icon="?attr/ic_delete"
|
||||
android:title="@string/clear_finished_download"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item android:id="@+id/action_settings"
|
||||
android:title="@string/settings"
|
||||
app:showAsAction="never" />
|
||||
|
||||
</menu>
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
<attr name="ic_add" format="reference"/>
|
||||
<attr name="ic_restore_defaults" format="reference"/>
|
||||
<attr name="ic_blank_page" format="reference"/>
|
||||
<attr name="ic_list" format="reference"/>
|
||||
<attr name="ic_grid" format="reference"/>
|
||||
<attr name="ic_delete" format="reference"/>
|
||||
|
||||
<!-- Can't refer to colors directly in drawable's xml-->
|
||||
<attr name="toolbar_shadow_drawable" format="reference"/>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<item name="info">@drawable/ic_info_outline_black_24dp</item>
|
||||
<item name="bug">@drawable/ic_bug_report_black_24dp</item>
|
||||
<item name="audio">@drawable/ic_headset_black_24dp</item>
|
||||
<item name="clear_history">@drawable/ic_delete_sweep_white_24dp</item>
|
||||
<item name="download">@drawable/ic_file_download_black_24dp</item>
|
||||
<item name="share">@drawable/ic_share_black_24dp</item>
|
||||
<item name="cast">@drawable/ic_cast_black_24dp</item>
|
||||
|
@ -54,6 +53,9 @@
|
|||
<item name="ic_add">@drawable/ic_add_black_24dp</item>
|
||||
<item name="ic_restore_defaults">@drawable/ic_settings_backup_restore_black_24dp</item>
|
||||
<item name="ic_blank_page">@drawable/ic_blank_page_black_24dp</item>
|
||||
<item name="ic_list">@drawable/ic_list_black_24dp</item>
|
||||
<item name="ic_grid">@drawable/ic_grid_black_24dp</item>
|
||||
<item name="ic_delete">@drawable/ic_delete_black_24dp</item>
|
||||
|
||||
<item name="separator_color">@color/light_separator_color</item>
|
||||
<item name="contrast_background_color">@color/light_contrast_background_color</item>
|
||||
|
@ -82,7 +84,6 @@
|
|||
<item name="audio">@drawable/ic_headset_white_24dp</item>
|
||||
<item name="info">@drawable/ic_info_outline_white_24dp</item>
|
||||
<item name="bug">@drawable/ic_bug_report_white_24dp</item>
|
||||
<item name="clear_history">@drawable/ic_delete_sweep_black_24dp</item>
|
||||
<item name="download">@drawable/ic_file_download_white_24dp</item>
|
||||
<item name="share">@drawable/ic_share_white_24dp</item>
|
||||
<item name="cast">@drawable/ic_cast_white_24dp</item>
|
||||
|
@ -114,6 +115,9 @@
|
|||
<item name="ic_add">@drawable/ic_add_white_24dp</item>
|
||||
<item name="ic_restore_defaults">@drawable/ic_settings_backup_restore_white_24dp</item>
|
||||
<item name="ic_blank_page">@drawable/ic_blank_page_white_24dp</item>
|
||||
<item name="ic_list">@drawable/ic_list_white_24dp</item>
|
||||
<item name="ic_grid">@drawable/ic_grid_white_24dp</item>
|
||||
<item name="ic_delete">@drawable/ic_delete_white_24dp</item>
|
||||
|
||||
<item name="separator_color">@color/dark_separator_color</item>
|
||||
<item name="contrast_background_color">@color/dark_contrast_background_color</item>
|
||||
|
|