mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-24 05:46:14 +03:00
create new instance of NoteSQLiteOpenHelper on SettingsChangedEvent
This commit is contained in:
parent
407407f6cd
commit
e92f1156c2
6 changed files with 24 additions and 20 deletions
|
@ -16,10 +16,4 @@ public class NoteTest extends TestCase {
|
|||
note.setTitle("* Aufzählung");
|
||||
assertTrue("Aufzählung".equals(note.getTitle()));
|
||||
}
|
||||
|
||||
public void testMarkDownRendering() {
|
||||
Note note = new Note(0, Calendar.getInstance(), "", "**bold**");
|
||||
System.out.println(note.getHtmlContent());
|
||||
assertTrue(note.getHtmlContent().contains("<strong>bold</strong>"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class NoteActivity extends AppCompatActivity implements View.OnClickListe
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// backToListViewIntent = new Intent();
|
||||
Log.v("Note", "NoteActivity.onCreate()");
|
||||
setContentView(R.layout.activity_single_note);
|
||||
note = (Note) getIntent().getSerializableExtra(
|
||||
NotesListViewActivity.SELECTED_NOTE);
|
||||
|
@ -38,7 +38,7 @@ public class NoteActivity extends AppCompatActivity implements View.OnClickListe
|
|||
actionBar.setTitle(note.getTitle());
|
||||
actionBar.setSubtitle(note.getModified("dd.MM.yyyy HH:mm"));
|
||||
}
|
||||
noteContent = (TextView) findViewById(R.id.singleNoteContent);
|
||||
noteContent = (TextView) findViewById(R.id.single_note_content);
|
||||
noteContent.setText(note.getSpannableContent());
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.util.Log;
|
|||
import android.widget.RemoteViews;
|
||||
|
||||
import it.niedermann.owncloud.notes.R;
|
||||
import it.niedermann.owncloud.notes.android.activity.NoteActivity;
|
||||
import it.niedermann.owncloud.notes.android.activity.NotesListViewActivity;
|
||||
import it.niedermann.owncloud.notes.model.Note;
|
||||
|
||||
|
@ -18,22 +17,28 @@ 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.singleNoteContent, note.getSpannableContent());
|
||||
}
|
||||
appWidgetManager.updateAppWidget(appWidgetId, updateViews);
|
||||
|
||||
updateViews.setTextViewText(R.id.single_note_content, note.getSpannableContent());
|
||||
//FIXME does not work!
|
||||
Intent intent = new Intent(context, NoteActivity.class);
|
||||
Intent intent = new Intent(context, SingleNoteWidget.class);
|
||||
//intent.setAction(ACTION_SHOW_NOTE);
|
||||
intent.putExtra(NotesListViewActivity.SELECTED_NOTE, note);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
|
||||
updateViews.setOnClickPendingIntent(R.id.singleNoteContent, pendingIntent);
|
||||
updateViews.setOnClickPendingIntent(R.id.single_note, pendingIntent);
|
||||
}
|
||||
appWidgetManager.updateAppWidget(appWidgetId, updateViews);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnabled(Context context) {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
super.onReceive(context, intent);
|
||||
if (intent.getAction().equals(ACTION_SHOW_NOTE)) {
|
||||
Log.v("SingleNoteWidget", "SingleNoteWidget.onReceive()");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/singleNoteContent"
|
||||
android:id="@+id/single_note_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="10dp"
|
||||
|
|
|
@ -7,5 +7,9 @@
|
|||
<ListView
|
||||
android:id="@+id/list_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/bg_transparent"
|
||||
android:padding="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/fg_contrast" />
|
||||
</FrameLayout>
|
|
@ -1,11 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/single_note"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/singleNoteContent"
|
||||
android:id="@+id/single_note_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg_transparent"
|
||||
|
|
Loading…
Reference in a new issue