diff --git a/.idea/misc.xml b/.idea/misc.xml
index f16a0ff..ce9de9a 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -53,7 +53,7 @@
-
+
diff --git a/app/build.gradle b/app/build.gradle
index dfccf3b..c5f7f12 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,8 +8,8 @@ android {
applicationId "org.kore.kolabnotes.android"
minSdkVersion 16
targetSdkVersion 23
- versionCode 73
- versionName "2.0.8"
+ versionCode 74
+ versionName "2.1.0"
//Running test
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
diff --git a/app/src/main/java/org/kore/kolabnotes/android/adapter/NoteAdapter.java b/app/src/main/java/org/kore/kolabnotes/android/adapter/NoteAdapter.java
index e4e4947..6b5a631 100755
--- a/app/src/main/java/org/kore/kolabnotes/android/adapter/NoteAdapter.java
+++ b/app/src/main/java/org/kore/kolabnotes/android/adapter/NoteAdapter.java
@@ -11,6 +11,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -25,6 +26,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Set;
public class NoteAdapter extends SelectableAdapter {
@@ -34,10 +36,11 @@ public class NoteAdapter extends SelectableAdapter {
private ViewHolder.ClickListener clickListener;
private DateFormat dateFormatter;
private int COLOR_SELECTED_NOTE;
+ private Set notesWithAttachment;
private List views;
- public NoteAdapter(List notes, int rowLayout, Context context, ViewHolder.ClickListener clickListener) {
+ public NoteAdapter(List notes, int rowLayout, Context context, ViewHolder.ClickListener clickListener, Set notesWithAttachment) {
this.notes = notes;
this.rowLayout = rowLayout;
this.context = context;
@@ -45,6 +48,7 @@ public NoteAdapter(List notes, int rowLayout, Context context, ViewHolder.
this.dateFormatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
views = new ArrayList<>(notes.size());
COLOR_SELECTED_NOTE = ContextCompat.getColor(context, R.color.theme_selected_notes);
+ this.notesWithAttachment = notesWithAttachment;
}
public void clearNotes() {
@@ -108,7 +112,7 @@ public void onBindViewHolder(final ViewHolder viewHolder, int i) {
viewHolder.name.setText(note.getSummary());
viewHolder.classification.setText(context.getResources().getString(R.string.classification)+": "+note.getClassification());
viewHolder.createdDate.setText(context.getResources().getString(R.string.creationDate)+": "+ dateFormatter.format(note.getAuditInformation().getCreationDate()));
- viewHolder.modificationDate.setText(context.getResources().getString(R.string.modificationDate)+": "+dateFormatter.format(note.getAuditInformation().getLastModificationDate()));
+ viewHolder.modificationDate.setText(context.getResources().getString(R.string.modificationDate) + ": " + dateFormatter.format(note.getAuditInformation().getLastModificationDate()));
viewHolder.categories.removeAllViews();
boolean useLightColor = Utils.useLightTextColor(context, note.getColor());
@@ -239,6 +243,18 @@ public void onBindViewHolder(final ViewHolder viewHolder, int i) {
}else{
viewHolder.hideCharacteristics();
}
+
+ if(notesWithAttachment.contains(note.getIdentification().getUid())){
+ viewHolder.attachmentImage.setVisibility(View.VISIBLE);
+
+ if(useLightColor){
+ viewHolder.attachmentImage.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_attach_file_white_24dp));
+ }
+ }
+ }
+
+ public void setNotesWithAttachment(Set ids){
+ this.notesWithAttachment = ids;
}
public void restoreElevation(RecyclerView recyclerView){
@@ -267,6 +283,7 @@ public static class ViewHolder extends RecyclerView.ViewHolder implements View.O
TextView modificationDate;
LinearLayout categories;
CardView cardView;
+ ImageView attachmentImage;
private ClickListener listener;
private List notes;
@@ -285,6 +302,7 @@ public ViewHolder(View itemView, ClickListener listener, List notes) {
modificationDate = (TextView) itemView.findViewById(R.id.modificationDate);
categories = (LinearLayout) itemView.findViewById(R.id.categories);
cardView = (CardView)itemView;
+ attachmentImage = (ImageView)itemView.findViewById(R.id.attachmentHint);
}
@Override
diff --git a/app/src/main/java/org/kore/kolabnotes/android/content/AttachmentRepository.java b/app/src/main/java/org/kore/kolabnotes/android/content/AttachmentRepository.java
index f9f48bd..172e797 100644
--- a/app/src/main/java/org/kore/kolabnotes/android/content/AttachmentRepository.java
+++ b/app/src/main/java/org/kore/kolabnotes/android/content/AttachmentRepository.java
@@ -35,7 +35,10 @@
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Created by koni on 12.03.15.
@@ -258,6 +261,25 @@ public boolean hasNoteAttachments(String account, String rootFolder, String note
return ret;
}
+ public Set getNoteIDsWithAttachments(String account, String rootFolder) {
+ Cursor cursor = ConnectionManager.getDatabase(context).query(DatabaseHelper.TABLE_ATTACHMENT,
+ new String[]{DatabaseHelper.COLUMN_IDNOTE},
+ DatabaseHelper.COLUMN_ACCOUNT + " = '" + account + "' AND " +
+ DatabaseHelper.COLUMN_ROOT_FOLDER + " = '" + rootFolder + "' ",
+ null,
+ null,
+ null,
+ null);
+
+ HashSet ids = new HashSet<>();
+ while(cursor.moveToNext()){
+ ids.add(cursor.getString(0));
+ }
+
+ cursor.close();
+ return ids;
+ }
+
public boolean attachmentsCreatedAfterLastSync(String account, String rootFolder, String noteUID, Date date) {
List attachments = new ArrayList();
diff --git a/app/src/main/java/org/kore/kolabnotes/android/fragment/OverviewFragment.java b/app/src/main/java/org/kore/kolabnotes/android/fragment/OverviewFragment.java
index 4b814ae..5e68103 100644
--- a/app/src/main/java/org/kore/kolabnotes/android/fragment/OverviewFragment.java
+++ b/app/src/main/java/org/kore/kolabnotes/android/fragment/OverviewFragment.java
@@ -283,8 +283,9 @@ public void onActivityCreated(Bundle savedInstanceState) {
mRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
//mRecyclerView.setItemAnimator(new CustomItemAnimator());
//mRecyclerView.setItemAnimator(new ReboundItemAnimator());
+ final ActiveAccount activeAccount = activeAccountRepository.getActiveAccount();
- mAdapter = new NoteAdapter(new ArrayList(), R.layout.row_note_overview, activity, this);
+ mAdapter = new NoteAdapter(new ArrayList(), R.layout.row_note_overview, activity, this, attachmentRepository.getNoteIDsWithAttachments(activeAccount.getAccount(),activeAccount.getRootFolder()));
mRecyclerView.setAdapter(mAdapter);
mSwipeRefreshLayout = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);
@@ -1678,9 +1679,15 @@ final synchronized void reloadData(List notebooks, List notes, M
orderDrawerItems(tags, mDrawer);
if(mAdapter == null){
- mAdapter = new NoteAdapter(new ArrayList(), R.layout.row_note_overview, activity, this);
+ final ActiveAccount activeAccount = activeAccountRepository.getActiveAccount();
+ mAdapter = new NoteAdapter(new ArrayList(), R.layout.row_note_overview, activity, this, attachmentRepository.getNoteIDsWithAttachments(activeAccount.getAccount(),activeAccount.getRootFolder()));
+ }else{
+ final ActiveAccount activeAccount = activeAccountRepository.getActiveAccount();
+ mAdapter.setNotesWithAttachment(attachmentRepository.getNoteIDsWithAttachments(activeAccount.getAccount(),activeAccount.getRootFolder()));
}
+
+
mAdapter.clearNotes();
if(notes.size() == 0){
mAdapter.notifyDataSetChanged();
diff --git a/app/src/main/res/drawable-hdpi/ic_attach_file_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_attach_file_black_24dp.png
new file mode 100644
index 0000000..af04153
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_attach_file_black_24dp.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_attach_file_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_attach_file_white_24dp.png
new file mode 100644
index 0000000..29dfa5d
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_attach_file_white_24dp.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_attach_file_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_attach_file_black_24dp.png
new file mode 100644
index 0000000..40d81af
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_attach_file_black_24dp.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_attach_file_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_attach_file_white_24dp.png
new file mode 100644
index 0000000..ac433ef
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_attach_file_white_24dp.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_attach_file_black_24dp.png b/app/src/main/res/drawable-xhdpi/ic_attach_file_black_24dp.png
new file mode 100644
index 0000000..30ac6f9
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_attach_file_black_24dp.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_attach_file_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_attach_file_white_24dp.png
new file mode 100644
index 0000000..c3ff2bd
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_attach_file_white_24dp.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_attach_file_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_attach_file_black_24dp.png
new file mode 100644
index 0000000..d8e2bd9
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_attach_file_black_24dp.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_attach_file_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_attach_file_white_24dp.png
new file mode 100644
index 0000000..7091eca
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_attach_file_white_24dp.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_attach_file_black_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_attach_file_black_24dp.png
new file mode 100644
index 0000000..620226d
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_attach_file_black_24dp.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_attach_file_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_attach_file_white_24dp.png
new file mode 100644
index 0000000..771425c
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_attach_file_white_24dp.png differ
diff --git a/app/src/main/res/layout/row_note_overview.xml b/app/src/main/res/layout/row_note_overview.xml
index 8b3c137..54dd63d 100755
--- a/app/src/main/res/layout/row_note_overview.xml
+++ b/app/src/main/res/layout/row_note_overview.xml
@@ -19,14 +19,30 @@
android:orientation="horizontal"
android:columnCount="1">
-
+ android:layout_rowSpan="2">
+
+
+
+
+
+