-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Runs getNotes() upon restore finish
- Loading branch information
Showing
15 changed files
with
430 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (C) 2020 Arseniy Graur | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package me.argraur.notes.helpers | ||
|
||
import android.app.backup.BackupAgent | ||
import android.app.backup.BackupDataInput | ||
import android.app.backup.BackupDataOutput | ||
import android.os.ParcelFileDescriptor | ||
import android.util.Log | ||
|
||
class BackupAgent: BackupAgent() { | ||
/** | ||
* Send log message when backup started | ||
* @see BackupAgent.onBackup | ||
*/ | ||
override fun onBackup( | ||
oldState: ParcelFileDescriptor?, | ||
data: BackupDataOutput?, | ||
newState: ParcelFileDescriptor? | ||
) { | ||
Log.d(javaClass.simpleName, "Backing up!") | ||
} | ||
|
||
/** | ||
* Send log message when restore finished | ||
* @see BackupAgent.onRestore | ||
*/ | ||
override fun onRestore( | ||
data: BackupDataInput?, | ||
appVersionCode: Int, | ||
newState: ParcelFileDescriptor? | ||
) { | ||
Log.d(javaClass.simpleName, "Restoring from backup!") | ||
} | ||
|
||
/** | ||
* Updates notes when restore finished. | ||
* @see BackupAgent.onRestoreFinished | ||
*/ | ||
override fun onRestoreFinished() { | ||
super.onRestoreFinished() | ||
NoteManager.getInstance(null).getNotes() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
~ Copyright (C) 2020 Arseniy Graur | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<full-backup-content xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<include domain="database" path="." requireFlags="clientSideEncryption" /> | ||
</full-backup-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<HTML> | ||
<HEAD> | ||
<meta charset="UTF-8"> | ||
<title>BackupAgent.<init> - app</title> | ||
<link rel="stylesheet" href="../../../style.css"> | ||
</HEAD> | ||
<BODY> | ||
<a href="../../index.html">app</a> / <a href="../index.html">me.argraur.notes.helpers</a> / <a href="index.html">BackupAgent</a> / <a href="./-init-.html"><init></a><br/> | ||
<br/> | ||
<h1><init></h1> | ||
<a name="me.argraur.notes.helpers.BackupAgent$<init>()"></a> | ||
<code><span class="identifier">BackupAgent</span><span class="symbol">(</span><span class="symbol">)</span></code> | ||
</BODY> | ||
</HTML> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<HTML> | ||
<HEAD> | ||
<meta charset="UTF-8"> | ||
<title>BackupAgent - app</title> | ||
<link rel="stylesheet" href="../../../style.css"> | ||
</HEAD> | ||
<BODY> | ||
<a href="../../index.html">app</a> / <a href="../index.html">me.argraur.notes.helpers</a> / <a href="./index.html">BackupAgent</a><br/> | ||
<br/> | ||
<h1>BackupAgent</h1> | ||
<code><span class="keyword">class </span><span class="identifier">BackupAgent</span> <span class="symbol">:</span> <a href="https://developer.android.com/reference/android/app/backup/BackupAgent.html"><span class="identifier">BackupAgent</span></a></code> | ||
<h3>Constructors</h3> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<h4><a href="-init-.html"><init></a></h4> | ||
</td> | ||
<td> | ||
<code><span class="identifier">BackupAgent</span><span class="symbol">(</span><span class="symbol">)</span></code></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<h3>Functions</h3> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<h4><a href="on-backup.html">onBackup</a></h4> | ||
</td> | ||
<td> | ||
<p>Send log message when backup started</p> | ||
<code><span class="keyword">fun </span><span class="identifier">onBackup</span><span class="symbol">(</span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)/oldState">oldState</span><span class="symbol">:</span> <a href="https://developer.android.com/reference/android/os/ParcelFileDescriptor.html"><span class="identifier">ParcelFileDescriptor</span></a><span class="symbol">?</span><span class="symbol">, </span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)/data">data</span><span class="symbol">:</span> <a href="https://developer.android.com/reference/android/app/backup/BackupDataOutput.html"><span class="identifier">BackupDataOutput</span></a><span class="symbol">?</span><span class="symbol">, </span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)/newState">newState</span><span class="symbol">:</span> <a href="https://developer.android.com/reference/android/os/ParcelFileDescriptor.html"><span class="identifier">ParcelFileDescriptor</span></a><span class="symbol">?</span><span class="symbol">)</span><span class="symbol">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html"><span class="identifier">Unit</span></a></code></td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<h4><a href="on-restore.html">onRestore</a></h4> | ||
</td> | ||
<td> | ||
<p>Send log message when restore finished</p> | ||
<code><span class="keyword">fun </span><span class="identifier">onRestore</span><span class="symbol">(</span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onRestore(android.app.backup.BackupDataInput, kotlin.Int, android.os.ParcelFileDescriptor)/data">data</span><span class="symbol">:</span> <a href="https://developer.android.com/reference/android/app/backup/BackupDataInput.html"><span class="identifier">BackupDataInput</span></a><span class="symbol">?</span><span class="symbol">, </span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onRestore(android.app.backup.BackupDataInput, kotlin.Int, android.os.ParcelFileDescriptor)/appVersionCode">appVersionCode</span><span class="symbol">:</span> <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html"><span class="identifier">Int</span></a><span class="symbol">, </span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onRestore(android.app.backup.BackupDataInput, kotlin.Int, android.os.ParcelFileDescriptor)/newState">newState</span><span class="symbol">:</span> <a href="https://developer.android.com/reference/android/os/ParcelFileDescriptor.html"><span class="identifier">ParcelFileDescriptor</span></a><span class="symbol">?</span><span class="symbol">)</span><span class="symbol">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html"><span class="identifier">Unit</span></a></code></td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<h4><a href="on-restore-finished.html">onRestoreFinished</a></h4> | ||
</td> | ||
<td> | ||
<p>Updates notes when restore finished.</p> | ||
<code><span class="keyword">fun </span><span class="identifier">onRestoreFinished</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html"><span class="identifier">Unit</span></a></code></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</BODY> | ||
</HTML> |
18 changes: 18 additions & 0 deletions
18
docs/me.argraur.notes.helpers/-backup-agent/on-backup.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<HTML> | ||
<HEAD> | ||
<meta charset="UTF-8"> | ||
<title>BackupAgent.onBackup - app</title> | ||
<link rel="stylesheet" href="../../../style.css"> | ||
</HEAD> | ||
<BODY> | ||
<a href="../../index.html">app</a> / <a href="../index.html">me.argraur.notes.helpers</a> / <a href="index.html">BackupAgent</a> / <a href="./on-backup.html">onBackup</a><br/> | ||
<br/> | ||
<h1>onBackup</h1> | ||
<a name="me.argraur.notes.helpers.BackupAgent$onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)"></a> | ||
<code><span class="keyword">fun </span><span class="identifier">onBackup</span><span class="symbol">(</span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)/oldState">oldState</span><span class="symbol">:</span> <a href="https://developer.android.com/reference/android/os/ParcelFileDescriptor.html"><span class="identifier">ParcelFileDescriptor</span></a><span class="symbol">?</span><span class="symbol">, </span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)/data">data</span><span class="symbol">:</span> <a href="https://developer.android.com/reference/android/app/backup/BackupDataOutput.html"><span class="identifier">BackupDataOutput</span></a><span class="symbol">?</span><span class="symbol">, </span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)/newState">newState</span><span class="symbol">:</span> <a href="https://developer.android.com/reference/android/os/ParcelFileDescriptor.html"><span class="identifier">ParcelFileDescriptor</span></a><span class="symbol">?</span><span class="symbol">)</span><span class="symbol">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html"><span class="identifier">Unit</span></a></code> | ||
<p>Send log message when backup started</p> | ||
<p><strong>See Also</strong><br/> | ||
<p><a href="https://developer.android.com/reference/android/app/backup/BackupAgent.html#onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)">BackupAgent.onBackup</a></p> | ||
</p> | ||
</BODY> | ||
</HTML> |
18 changes: 18 additions & 0 deletions
18
docs/me.argraur.notes.helpers/-backup-agent/on-restore-finished.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<HTML> | ||
<HEAD> | ||
<meta charset="UTF-8"> | ||
<title>BackupAgent.onRestoreFinished - app</title> | ||
<link rel="stylesheet" href="../../../style.css"> | ||
</HEAD> | ||
<BODY> | ||
<a href="../../index.html">app</a> / <a href="../index.html">me.argraur.notes.helpers</a> / <a href="index.html">BackupAgent</a> / <a href="./on-restore-finished.html">onRestoreFinished</a><br/> | ||
<br/> | ||
<h1>onRestoreFinished</h1> | ||
<a name="me.argraur.notes.helpers.BackupAgent$onRestoreFinished()"></a> | ||
<code><span class="keyword">fun </span><span class="identifier">onRestoreFinished</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html"><span class="identifier">Unit</span></a></code> | ||
<p>Updates notes when restore finished.</p> | ||
<p><strong>See Also</strong><br/> | ||
<p><a href="https://developer.android.com/reference/android/app/backup/BackupAgent.html#onRestoreFinished()">BackupAgent.onRestoreFinished</a></p> | ||
</p> | ||
</BODY> | ||
</HTML> |
18 changes: 18 additions & 0 deletions
18
docs/me.argraur.notes.helpers/-backup-agent/on-restore.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<HTML> | ||
<HEAD> | ||
<meta charset="UTF-8"> | ||
<title>BackupAgent.onRestore - app</title> | ||
<link rel="stylesheet" href="../../../style.css"> | ||
</HEAD> | ||
<BODY> | ||
<a href="../../index.html">app</a> / <a href="../index.html">me.argraur.notes.helpers</a> / <a href="index.html">BackupAgent</a> / <a href="./on-restore.html">onRestore</a><br/> | ||
<br/> | ||
<h1>onRestore</h1> | ||
<a name="me.argraur.notes.helpers.BackupAgent$onRestore(android.app.backup.BackupDataInput, kotlin.Int, android.os.ParcelFileDescriptor)"></a> | ||
<code><span class="keyword">fun </span><span class="identifier">onRestore</span><span class="symbol">(</span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onRestore(android.app.backup.BackupDataInput, kotlin.Int, android.os.ParcelFileDescriptor)/data">data</span><span class="symbol">:</span> <a href="https://developer.android.com/reference/android/app/backup/BackupDataInput.html"><span class="identifier">BackupDataInput</span></a><span class="symbol">?</span><span class="symbol">, </span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onRestore(android.app.backup.BackupDataInput, kotlin.Int, android.os.ParcelFileDescriptor)/appVersionCode">appVersionCode</span><span class="symbol">:</span> <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html"><span class="identifier">Int</span></a><span class="symbol">, </span><span class="identifier" id="me.argraur.notes.helpers.BackupAgent$onRestore(android.app.backup.BackupDataInput, kotlin.Int, android.os.ParcelFileDescriptor)/newState">newState</span><span class="symbol">:</span> <a href="https://developer.android.com/reference/android/os/ParcelFileDescriptor.html"><span class="identifier">ParcelFileDescriptor</span></a><span class="symbol">?</span><span class="symbol">)</span><span class="symbol">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html"><span class="identifier">Unit</span></a></code> | ||
<p>Send log message when restore finished</p> | ||
<p><strong>See Also</strong><br/> | ||
<p><a href="https://developer.android.com/reference/android/app/backup/BackupAgent.html#onRestore(android.app.backup.BackupDataInput, int, android.os.ParcelFileDescriptor)">BackupAgent.onRestore</a></p> | ||
</p> | ||
</BODY> | ||
</HTML> |
17 changes: 17 additions & 0 deletions
17
docs/me.argraur.notes.helpers/-note-manager/get-notes.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<HTML> | ||
<HEAD> | ||
<meta charset="UTF-8"> | ||
<title>NoteManager.getNotes - app</title> | ||
<link rel="stylesheet" href="../../../style.css"> | ||
</HEAD> | ||
<BODY> | ||
<a href="../../index.html">app</a> / <a href="../index.html">me.argraur.notes.helpers</a> / <a href="index.html">NoteManager</a> / <a href="./get-notes.html">getNotes</a><br/> | ||
<br/> | ||
<h1>getNotes</h1> | ||
<a name="me.argraur.notes.helpers.NoteManager$getNotes()"></a> | ||
<code><span class="keyword">fun </span><span class="identifier">getNotes</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html"><span class="identifier">Unit</span></a></code> | ||
<p>Retrieves all notes from database | ||
Creates array of Note types based on title, value, color and creation time | ||
If current notes array doesn't match new one, update current and notify observers</p> | ||
</BODY> | ||
</HTML> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters