mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-22 04:46:04 +03:00
#33 Empty state for no notes
This commit is contained in:
parent
71f4d8086f
commit
f6fdc80824
5 changed files with 20 additions and 11 deletions
|
@ -5,6 +5,7 @@ import android.appwidget.AppWidgetManager;
|
|||
import android.appwidget.AppWidgetProvider;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
import it.niedermann.owncloud.notes.R;
|
||||
|
@ -17,29 +18,20 @@ import it.niedermann.owncloud.notes.model.Note;
|
|||
* Created by stefan on 08.10.15.
|
||||
*/
|
||||
public class SingleNoteWidget extends AppWidgetProvider {
|
||||
public final static String ACTION_SHOW_NOTE = "ACTION_SHOW_NOTE";
|
||||
|
||||
public static void updateAppWidget(Note note, Context context, AppWidgetManager appWidgetManager, int appWidgetId) {
|
||||
RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.widget_single_note);
|
||||
if (note != null) {
|
||||
updateViews.setTextViewText(R.id.single_note_content, note.getSpannableContent());
|
||||
//FIXME does not work!
|
||||
Intent intent = new Intent(context, NoteActivity.class);
|
||||
//intent.setAction(ACTION_SHOW_NOTE);
|
||||
intent.putExtra(NotesListViewActivity.SELECTED_NOTE, note);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
|
||||
updateViews.setOnClickPendingIntent(R.id.single_note, pendingIntent);
|
||||
}
|
||||
Log.v("Note", "Note is null: " + (note == null));
|
||||
appWidgetManager.updateAppWidget(appWidgetId, updateViews);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
super.onReceive(context, intent);
|
||||
//if (intent.getAction().equals(ACTION_SHOW_NOTE)) {
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
||||
for (int i = 0; i < appWidgetIds.length; i++) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout
|
||||
android:id="@+id/select_single_note"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
|
13
app/src/main/res/layout/fragment_no_notes.xml
Normal file
13
app/src/main/res/layout/fragment_no_notes.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawableTop="@drawable/ic_launcher"
|
||||
android:text="@string/no_notes"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/fg_default_low"
|
||||
android:textSize="26sp"
|
||||
/>
|
|
@ -2,6 +2,7 @@
|
|||
<resources>
|
||||
|
||||
<string name="app_name">ownCloud Notes</string>
|
||||
<string name="no_notes">Noch keine Notizen vorhanden</string>
|
||||
<string name="action_create">Neue Notiz</string>
|
||||
<string name="action_settings">Einstellungen</string>
|
||||
<string name="action_create_save">Speichern</string>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<resources>
|
||||
|
||||
<string name="app_name">ownCloud Notes</string>
|
||||
<string name="no_notes">No notes yet</string>
|
||||
<string name="action_create">New Note</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="action_create_save">Save</string>
|
||||
|
|
Loading…
Reference in a new issue