Skip to content

Commit

Permalink
Merge pull request #64 from proninyaroslav/master
Browse files Browse the repository at this point in the history
Update icons, text color inversion and indent in text editor
  • Loading branch information
konradrenner committed Aug 27, 2015
2 parents da6ec9f + 7435a41 commit 6fe92e7
Show file tree
Hide file tree
Showing 82 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
Expand All @@ -27,6 +28,12 @@ public class NoteAdapter extends RecyclerView.Adapter<NoteAdapter.ViewHolder> {
private Context context;
private NoteSelectedListener listener;
private DateFormat dateFormatter;
private static final int CYAN = 210;
private static final int RED = 0;
private static final int RED_ORANGE = 20;
private static final int HUE = 0;
private static final int SATURATION = 1;
private static final int BRIGHTNESS = 2;

public NoteAdapter(List<Note> notes, int rowLayout, Context context, NoteSelectedListener listener) {
this.notes = notes;
Expand Down Expand Up @@ -87,13 +94,43 @@ public void onBindViewHolder(final ViewHolder viewHolder, int i) {
viewHolder.modificationDate.setBackgroundColor(Color.parseColor(note.getColor().getHexcode()));
viewHolder.categories.setBackgroundColor(Color.parseColor(note.getColor().getHexcode()));

/*
* Text color depending on background color.
*/
float[] HSV = new float[3];
Color.colorToHSV(Color.parseColor(note.getColor().getHexcode()), HSV);

/*
* If spectrum from cyan to red and saturation greater than or equal to 0.5 - text is white.
* If spectrum is not included in these borders or brightness greater than or equal to 0.8 - text is black.
*/
if (((HSV[HUE] >= CYAN || (HSV[HUE] >= RED && HSV[HUE] <= RED_ORANGE)) && HSV[SATURATION] >= 0.5) || HSV[BRIGHTNESS] <= 0.8) {
viewHolder.name.setTextColor(Color.WHITE);
viewHolder.classification.setTextColor(Color.WHITE);
viewHolder.createdDate.setTextColor(Color.WHITE);
viewHolder.modificationDate.setTextColor(Color.WHITE);
viewHolder.categories.setTextColor(Color.WHITE);
} else {
viewHolder.name.setTextColor(Color.BLACK);
viewHolder.classification.setTextColor(Color.GRAY);
viewHolder.createdDate.setTextColor(Color.GRAY);
viewHolder.modificationDate.setTextColor(Color.GRAY);
viewHolder.categories.setTextColor(Color.BLACK);
}

}else{
viewHolder.cardView.setCardBackgroundColor(Color.WHITE);
viewHolder.name.setBackgroundColor(Color.WHITE);
viewHolder.classification.setBackgroundColor(Color.WHITE);
viewHolder.createdDate.setBackgroundColor(Color.WHITE);
viewHolder.modificationDate.setBackgroundColor(Color.WHITE);
viewHolder.categories.setBackgroundColor(Color.WHITE);

viewHolder.name.setTextColor(Color.BLACK);
viewHolder.classification.setTextColor(Color.GRAY);
viewHolder.createdDate.setTextColor(Color.GRAY);
viewHolder.modificationDate.setTextColor(Color.GRAY);
viewHolder.categories.setTextColor(Color.BLACK);
}
Utils.setElevation(viewHolder.cardView,5);

Expand Down
Binary file modified app/src/main/res/drawable-hdpi/ic_action_accept.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_add_person.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_choose_color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_collection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_collection_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_collection_remove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_discard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_labels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_labels_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_new_label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_not_secure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_person.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_select_all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_share.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-hdpi/ic_action_sort_by_size.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_action_accept.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_action_add_person.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_action_choose_color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_action_collection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_action_collection_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_action_collection_remove.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_discard.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_edit.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_group.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_labels.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_labels_white.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_new.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_new_label.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_not_secure.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_person.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_search.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_select_all.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_settings.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_share.png
Binary file modified app/src/main/res/drawable-mdpi/ic_action_sort_by_size.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_accept.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_add_person.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_choose_color.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_collection.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_collection_new.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_collection_remove.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_discard.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_edit.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_group.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_labels.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_labels_white.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_new.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_new_label.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_not_secure.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_person.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_search.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_select_all.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_settings.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_share.png
Binary file modified app/src/main/res/drawable-xhdpi/ic_action_sort_by_size.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_accept.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_add_person.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_choose_color.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_collection.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_collection_new.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_collection_remove.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_discard.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_edit.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_group.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_labels.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_labels_white.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_new.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_new_label.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_not_secure.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_person.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_search.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_select_all.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_settings.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_share.png
Binary file modified app/src/main/res/drawable-xxhdpi/ic_action_sort_by_size.png
5 changes: 4 additions & 1 deletion app/src/main/res/layout/fragment_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_material_light"
android:weightSum="1">

<HorizontalScrollView
Expand Down Expand Up @@ -244,10 +245,12 @@
android:textColorHint="@color/secondary_text_default_material_light" />
</FrameLayout>


<jp.wasabeef.richeditor.RichEditor
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:id="@id/detail_description"
android:gravity="top"
android:isScrollContainer="true"
Expand Down

0 comments on commit 6fe92e7

Please sign in to comment.