Skip to content

Commit

Permalink
add memory bar and cancel label tint to night colors
Browse files Browse the repository at this point in the history
  • Loading branch information
codekidX committed Jan 4, 2017
1 parent 2da6e7d commit 30a147f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public void onSelect(String path) {
});

StorageChooserView.setViewSc(StorageChooserView.SC_LAYOUT_SHEET);
int[] nightModerColors = {R.color.memory_status_color, R.color.new_folder_color, R.color.select_color};
int[] nightModerColors = {R.color.memory_status_color, R.color.memory_bar_color,
R.color.new_folder_color, R.color.select_color, R.color.cancel_color};
StorageChooserView.setNightColors(nightModerColors);
storageChooser.setMode(StorageChooser.NIGHT_MODE);
storageChooser.show();
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
<color name="colorAccent">#FBC02D</color>

<color name="memory_status_color">#de6565</color>
<color name="memory_bar_color">#7bde65</color>
<color name="new_folder_color">#c14b84</color>
<color name="select_color">#6b3fa1</color>
<color name="cancel_color">#3fa19f</color>

<color name="colorExplanationBox">#ececec</color>
</resources>
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package com.codekidlabs.storagechooser.adapters;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.StyleSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -71,14 +78,16 @@ public View getView(int i, View view, ViewGroup viewGroup) {
Storages storages = storagesList.get(i);
final SpannableStringBuilder str = new SpannableStringBuilder(storages.getStorageTitle() + " (" + storages.getMemoryTotalSize() + ")");

str.setSpan(new android.text.style.StyleSpan(Typeface.ITALIC), getSpannableIndex(str), str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
str.setSpan(new StyleSpan(Typeface.ITALIC), getSpannableIndex(str), str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
String availableText = mContext.getString(R.string.text_freespace, storages.getMemoryAvailableSize());
storageName.setText(str);
memoryStatus.setText(availableText);

if(StorageChooser.sConfig.getMode() == StorageChooser.NIGHT_MODE) {
if(StorageChooserView.nightColors != null) {
memoryStatus.setTextColor(ContextCompat.getColor(mContext, StorageChooserView.nightColors[0]));
DrawableCompat.setTint(memoryBar.getProgressDrawable(), StorageChooserView.nightColors[1]);

} else {
Log.i("StorageChooser", "Storage Chooser view colors not set. Set it using StorageChooserView.setNightColors(colors[]);");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ private void showAddFolderView() {
} else {
mNewFolderButton.setOnClickListener(mNewFolderButtonCloseListener);
mNewFolderButton.setText(StorageChooserView.LABEL_CANCEL);
// mNewFolderButton.setTextColor(ContextCompat.getColor(getContext(), android.R.color.holo_red_light));
if(mConfig.getMode() == StorageChooser.NIGHT_MODE) {
if(StorageChooserView.nightColors != null) {
mNewFolderButton.setTextColor(ContextCompat.getColor(getContext(), StorageChooserView.nightColors[4]));
}
}
}
// mNewFolderButton.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.window_close));

Expand All @@ -183,7 +187,11 @@ private void hideAddFolderView() {
} else {
mNewFolderButton.setOnClickListener(mNewFolderButtonClickListener);
mNewFolderButton.setText(StorageChooserView.LABEL_NEW_FOLDER);
// mNewFolderButton.setTextColor(ContextCompat.getColor(getContext(), StorageChooserView.SC_SECONDARY_ACTION_COLOR));
if(mConfig.getMode() == StorageChooser.NIGHT_MODE) {
if(StorageChooserView.nightColors != null) {
mNewFolderButton.setTextColor(ContextCompat.getColor(getContext(), StorageChooserView.nightColors[2]));
}
}
}
//listview should be clickable
StorageChooserCustomListAdapter.shouldEnable = true;
Expand Down Expand Up @@ -261,7 +269,7 @@ private View getLayout(LayoutInflater inflater, ViewGroup container) {
mNewFolderButton.setTextColor(ContextCompat.getColor(getContext(), StorageChooserView.SC_SECONDARY_ACTION_COLOR));
} else {
if(StorageChooserView.nightColors != null) {
mNewFolderButton.setTextColor(ContextCompat.getColor(getContext(), StorageChooserView.nightColors[1]));
mNewFolderButton.setTextColor(ContextCompat.getColor(getContext(), StorageChooserView.nightColors[2]));
}
}
}
Expand Down Expand Up @@ -294,7 +302,7 @@ private View getLayout(LayoutInflater inflater, ViewGroup container) {
mSelectButton.setTextColor(ContextCompat.getColor(getContext(), StorageChooserView.SC_SECONDARY_ACTION_COLOR));
} else {
if(StorageChooserView.nightColors != null) {
mSelectButton.setTextColor(ContextCompat.getColor(getContext(), StorageChooserView.nightColors[2]));
mSelectButton.setTextColor(ContextCompat.getColor(getContext(), StorageChooserView.nightColors[3]));
}
}

Expand Down

0 comments on commit 30a147f

Please sign in to comment.