mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-28 11:29:01 +03:00
fix: update widget after synchronization
This commit is contained in:
parent
15a57f4a7e
commit
7d634e9021
3 changed files with 15 additions and 9 deletions
|
@ -207,15 +207,7 @@ public class EditNoteActivity extends AppCompatActivity {
|
||||||
data.putExtra(PARAM_NOTE, note);
|
data.putExtra(PARAM_NOTE, note);
|
||||||
data.putExtra(PARAM_NOTE_POSITION, notePosition);
|
data.putExtra(PARAM_NOTE_POSITION, notePosition);
|
||||||
setResult(RESULT_OK, data);
|
setResult(RESULT_OK, data);
|
||||||
updateSingleNoteWidgets();
|
db.updateSingleNoteWidgets();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateSingleNoteWidgets() {
|
|
||||||
|
|
||||||
Intent intent = new Intent(this, SingleNoteWidget.class);
|
|
||||||
intent.setAction("android.appwidget.action.APPWIDGET_UPDATE");
|
|
||||||
sendBroadcast(intent);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@ package it.niedermann.owncloud.notes.persistence;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
@ -16,6 +17,7 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import it.niedermann.owncloud.notes.android.activity.SingleNoteWidget;
|
||||||
import it.niedermann.owncloud.notes.model.DBNote;
|
import it.niedermann.owncloud.notes.model.DBNote;
|
||||||
import it.niedermann.owncloud.notes.model.DBStatus;
|
import it.niedermann.owncloud.notes.model.DBStatus;
|
||||||
import it.niedermann.owncloud.notes.model.CloudNote;
|
import it.niedermann.owncloud.notes.model.CloudNote;
|
||||||
|
@ -445,4 +447,15 @@ public class NoteSQLiteOpenHelper extends SQLiteOpenHelper {
|
||||||
key_id + " = ? AND " + key_status + " = ?",
|
key_id + " = ? AND " + key_status + " = ?",
|
||||||
new String[]{String.valueOf(id), forceDBStatus.getTitle()});
|
new String[]{String.valueOf(id), forceDBStatus.getTitle()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update single note widget, if the note data was changed.
|
||||||
|
* TODO This should be replaced by using the observer pattern
|
||||||
|
*/
|
||||||
|
public void updateSingleNoteWidgets() {
|
||||||
|
Intent intent = new Intent(getContext(), SingleNoteWidget.class);
|
||||||
|
intent.setAction("android.appwidget.action.APPWIDGET_UPDATE");
|
||||||
|
getContext().sendBroadcast(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,6 +384,7 @@ public class NoteServerSyncHelper {
|
||||||
for (ICallback callback : callbacks) {
|
for (ICallback callback : callbacks) {
|
||||||
callback.onFinish();
|
callback.onFinish();
|
||||||
}
|
}
|
||||||
|
dbHelper.updateSingleNoteWidgets();
|
||||||
// start next sync if scheduled meanwhile
|
// start next sync if scheduled meanwhile
|
||||||
if(syncScheduled) {
|
if(syncScheduled) {
|
||||||
scheduleSync(false);
|
scheduleSync(false);
|
||||||
|
|
Loading…
Reference in a new issue