Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix pinned notes widget preview and remove add button

kashaf-ansari-dev79df8db40910
diff --git a/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/PinnedNotesWidgetProvider.java b/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/PinnedNotesWidgetProvider.java
index f8a3a51e6..0af2ab25f 100644
--- a/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/PinnedNotesWidgetProvider.java
+++ b/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/PinnedNotesWidgetProvider.java
@@ -35,10 +35,6 @@ public class PinnedNotesWidgetProvider extends AppWidgetProvider {
PendingIntent pendingIntent = PendingIntent.getActivity(context, appWidgetId, listview_intent_template, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE, WidgetUtils.getActivityOptionsBundle());
views.setPendingIntentTemplate(R.id.widget_list_view, pendingIntent);
- // Header '+' button opens the quick note composer (ShareActivity) without loading the full app.
- Intent new_note_intent = new Intent(context, ShareActivity.class);
- PendingIntent pendingIntent2 = PendingIntent.getActivity(context, appWidgetId, new_note_intent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE, WidgetUtils.getActivityOptionsBundle());
- views.setOnClickPendingIntent(R.id.add_button, pendingIntent2);
// Build list items using RemoteCollectionItems: rows travel directly inside the widget update,
// so no bound RemoteViewsService is required and updates are completely self-contained.
diff --git a/apps/mobile/android/app/src/main/res/drawable/pinned_notes_preview.png b/apps/mobile/android/app/src/main/res/drawable/pinned_notes_preview.png
new file mode 100644
index 000000000..ff187221f
Binary files /dev/null and b/apps/mobile/android/app/src/main/res/drawable/pinned_notes_preview.png differ
diff --git a/apps/mobile/android/app/src/main/res/layout/widget_pinned_notes.xml b/apps/mobile/android/app/src/main/res/layout/widget_pinned_notes.xml
index 8ff45a57f..6fba28f5a 100644
--- a/apps/mobile/android/app/src/main/res/layout/widget_pinned_notes.xml
+++ b/apps/mobile/android/app/src/main/res/layout/widget_pinned_notes.xml
@@ -4,33 +4,16 @@
android:layout_height="match_parent"
android:background="@drawable/layout_bg">
- <RelativeLayout
+ <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal"
android:paddingHorizontal="12dp"
- android:layout_gravity="center"
android:paddingTop="8dp"
- android:paddingBottom="8dp">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_marginTop="2dp"
- android:textSize="15sp"
- android:textStyle="bold"
- android:textColor="@color/text"
- android:text="@string/pinned_notes_title"/>
-
- <ImageButton
- android:layout_width="25dp"
- android:id="@+id/add_button"
- android:layout_height="25dp"
- android:layout_alignParentRight="true"
- android:background="@drawable/ic_newnote"
- android:contentDescription="@string/add_widget" />
- </RelativeLayout>
+ android:paddingBottom="8dp"
+ android:textSize="15sp"
+ android:textStyle="bold"
+ android:textColor="@color/text"
+ android:text="@string/pinned_notes_title"/>
<LinearLayout
android:layout_width="match_parent"
diff --git a/apps/mobile/android/app/src/main/res/layout/widget_pinned_notes_preview.xml b/apps/mobile/android/app/src/main/res/layout/widget_pinned_notes_preview.xml
index d311d5add..c77f4f2ab 100644
--- a/apps/mobile/android/app/src/main/res/layout/widget_pinned_notes_preview.xml
+++ b/apps/mobile/android/app/src/main/res/layout/widget_pinned_notes_preview.xml
@@ -9,30 +9,16 @@
android:background="@drawable/layout_bg"
android:orientation="vertical">
- <RelativeLayout
+ <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center"
android:paddingHorizontal="12dp"
- android:paddingTop="12dp">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_marginTop="2dp"
- android:text="@string/pinned_notes_title"
- android:textColor="@color/text"
- android:textSize="15sp"
- android:textStyle="bold" />
-
- <ImageButton
- android:layout_width="25dp"
- android:layout_height="25dp"
- android:layout_alignParentRight="true"
- android:background="@drawable/ic_newnote"
- android:contentDescription="@string/add_widget" />
- </RelativeLayout>
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:text="@string/pinned_notes_title"
+ android:textColor="@color/text"
+ android:textSize="15sp"
+ android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
@@ -48,21 +34,68 @@
android:paddingHorizontal="12dp"
android:paddingBottom="12dp">
- <TextView
+ <!-- Sample Note 1 -->
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/widget_preview_note_title"
- android:textColor="@color/text"
- android:textSize="15sp"
- android:textStyle="bold" />
+ android:orientation="vertical"
+ android:paddingVertical="8dp">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/widget_preview_note_title"
+ android:textColor="@color/text"
+ android:textSize="15sp"
+ android:textStyle="bold"
+ android:maxLines="1"
+ android:ellipsize="end" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="2dp"
+ android:text="@string/widget_preview_note_body"
+ android:textColor="@color/text"
+ android:textSize="13sp"
+ android:maxLines="2"
+ android:ellipsize="end" />
+ </LinearLayout>
- <TextView
+ <!-- Divider -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="@color/border" />
+
+ <!-- Sample Note 2 -->
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="2dp"
- android:text="@string/widget_preview_note_body"
- android:textColor="@color/text"
- android:textSize="13sp" />
+ android:orientation="vertical"
+ android:paddingVertical="8dp">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/widget_preview_note_title_alt"
+ android:textColor="@color/text"
+ android:textSize="15sp"
+ android:textStyle="bold"
+ android:maxLines="1"
+ android:ellipsize="end" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="2dp"
+ android:text="@string/widget_preview_note_body_alt"
+ android:textColor="@color/text"
+ android:textSize="13sp"
+ android:maxLines="2"
+ android:ellipsize="end" />
+ </LinearLayout>
+
</LinearLayout>
</LinearLayout>
diff --git a/apps/mobile/android/app/src/main/res/values/strings.xml b/apps/mobile/android/app/src/main/res/values/strings.xml
index fd8b2862d..7a92951b7 100644
--- a/apps/mobile/android/app/src/main/res/values/strings.xml
+++ b/apps/mobile/android/app/src/main/res/values/strings.xml
@@ -17,6 +17,8 @@
<!-- Sample content, only ever shown in the widget picker's preview. -->
<string name="widget_preview_note_title">Meeting notes</string>
<string name="widget_preview_note_body">Discuss the roadmap and agree on timelines.</string>
+ <string name="widget_preview_note_title_alt">Grocery list</string>
+ <string name="widget_preview_note_body_alt">Milk, sourdough bread, eggs, coffee beans</string>
<string name="widget_preview_reminder_title">Take a walk</string>
<string name="widget_preview_reminder_time">Upcoming: Today, 5:00 PM</string>
<string name="widget_preview_reminder_title_alt">Call the dentist</string>
diff --git a/apps/mobile/android/app/src/main/res/xml-v36/widget_pinned_notes_info.xml b/apps/mobile/android/app/src/main/res/xml-v36/widget_pinned_notes_info.xml
index 79699923e..cc9c6757c 100644
--- a/apps/mobile/android/app/src/main/res/xml-v36/widget_pinned_notes_info.xml
+++ b/apps/mobile/android/app/src/main/res/xml-v36/widget_pinned_notes_info.xml
@@ -8,7 +8,7 @@
android:targetCellWidth="4"
android:targetCellHeight="2"
android:resizeMode="horizontal|vertical"
- android:previewImage="@drawable/note_widget_preview"
+ android:previewImage="@drawable/pinned_notes_preview"
android:previewLayout="@layout/widget_pinned_notes_preview"
android:updatePeriodMillis="1800000"
android:widgetCategory="home_screen|not_keyguard"
diff --git a/apps/mobile/android/app/src/main/res/xml/widget_pinned_notes_info.xml b/apps/mobile/android/app/src/main/res/xml/widget_pinned_notes_info.xml
index 703000c94..bb5d60697 100644
--- a/apps/mobile/android/app/src/main/res/xml/widget_pinned_notes_info.xml
+++ b/apps/mobile/android/app/src/main/res/xml/widget_pinned_notes_info.xml
@@ -8,7 +8,7 @@
android:targetCellWidth="4"
android:targetCellHeight="2"
android:resizeMode="horizontal|vertical"
- android:previewImage="@drawable/note_widget_preview"
+ android:previewImage="@drawable/pinned_notes_preview"
android:previewLayout="@layout/widget_pinned_notes_preview"
android:updatePeriodMillis="1800000"
android:widgetCategory="home_screen"