tobiasKaminsky 8 жил өмнө
parent
commit
5bfc3db0e1

+ 58 - 0
drawable_resources/ic_checkbox_marked.svg

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:cc="http://creativecommons.org/ns#"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns="http://www.w3.org/2000/svg"
+    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+    fill="#000000"
+    height="24"
+    viewBox="0 0 24 24"
+    width="24"
+    id="svg2"
+    version="1.1"
+    inkscape:version="0.91 r13725"
+    sodipodi:docname="ic_check_box_black_24px.svg">
+    <metadata
+        id="metadata12">
+        <rdf:RDF>
+            <cc:Work
+                rdf:about="">
+                <dc:format>image/svg+xml</dc:format>
+                <dc:type
+                    rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+            </cc:Work>
+        </rdf:RDF>
+    </metadata>
+    <defs
+        id="defs10"/>
+    <sodipodi:namedview
+        pagecolor="#ffffff"
+        bordercolor="#666666"
+        borderopacity="1"
+        objecttolerance="10"
+        gridtolerance="10"
+        guidetolerance="10"
+        inkscape:pageopacity="0"
+        inkscape:pageshadow="2"
+        inkscape:window-width="1600"
+        inkscape:window-height="835"
+        id="namedview8"
+        showgrid="false"
+        inkscape:zoom="19.666667"
+        inkscape:cx="12.44099"
+        inkscape:cy="9.9174774"
+        inkscape:window-x="1600"
+        inkscape:window-y="0"
+        inkscape:window-maximized="1"
+        inkscape:current-layer="svg2"/>
+    <path
+        d="M0 0h24v24H0z"
+        fill="none"
+        id="path4"/>
+    <path
+        d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
+        id="path6"
+        style="fill:#007cc2;fill-opacity:1"/>
+</svg>

+ 5 - 6
src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java

@@ -324,18 +324,17 @@ public class FileListListAdapter extends BaseAdapter {
             view.setBackgroundColor(Color.WHITE);
 
             AbsListView parentList = (AbsListView) parent;
+
             if (parentList.getChoiceMode() != AbsListView.CHOICE_MODE_NONE &&
                     parentList.getCheckedItemCount() > 0
                     ) {
                 if (parentList.isItemChecked(position)) {
-                    view.setBackgroundColor(mContext.getResources().getColor(
-                            R.color.selected_item_background));
-                    checkBoxV.setImageResource(
-                            R.drawable.ic_checkbox_marked);
+                    view.setBackgroundColor(mContext.getResources().getColor(R.color.selected_item_background));
+                    checkBoxV.setImageDrawable(MimeTypeUtil.tintDrawable(R.drawable.ic_checkbox_marked, R.color.primary));
                 } else {
                     view.setBackgroundColor(Color.WHITE);
-                    checkBoxV.setImageResource(
-                            R.drawable.ic_checkbox_blank_outline);
+                    checkBoxV.setImageDrawable(MimeTypeUtil.tintDrawable(R.drawable.ic_checkbox_blank_outline,
+                            R.color.primary));
                 }
                 checkBoxV.setVisibility(View.VISIBLE);
             }

+ 9 - 0
src/main/java/com/owncloud/android/utils/MimeTypeUtil.java

@@ -20,6 +20,8 @@ package com.owncloud.android.utils;
 
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
+import android.support.annotation.ColorRes;
+import android.support.annotation.DrawableRes;
 import android.support.v4.content.res.ResourcesCompat;
 import android.support.v4.graphics.drawable.DrawableCompat;
 import android.webkit.MimeTypeMap;
@@ -119,6 +121,13 @@ public class MimeTypeUtil {
         return getFolderTypeIcon(false, false);
     }
 
+    public static Drawable tintDrawable(@DrawableRes int id, @ColorRes int color) {
+        Drawable drawable = ResourcesCompat.getDrawable(MainApp.getAppContext().getResources(), id, null);
+        drawable = DrawableCompat.wrap(drawable);
+        DrawableCompat.setTint(drawable, MainApp.getAppContext().getResources().getColor(color));
+        return drawable;
+    }
+
     /**
      * Returns a single MIME type of all the possible, by inspection of the file extension, and taking
      * into account the MIME types known by ownCloud first.

BIN
src/main/res/drawable-hdpi/ic_checkbox_marked.png


BIN
src/main/res/drawable-mdpi/ic_checkbox_marked.png


BIN
src/main/res/drawable-xhdpi/ic_checkbox_marked.png


BIN
src/main/res/drawable-xxhdpi/ic_checkbox_marked.png


BIN
src/main/res/drawable-xxxhdpi/ic_checkbox_marked.png