forked from dooreelko/MeditationTracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added backup and it's safely ignored on 1.6 will test on 2.2
- Loading branch information
doo
committed
Jan 19, 2012
1 parent
01961bc
commit 4b867d9
Showing
19 changed files
with
839 additions
and
681 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.meditationtracker" android:versionCode="6" android:versionName="Torma"> | ||
<application android:icon="@drawable/launcher_48" | ||
android:label="@string/app_name" android:debuggable="false" android:theme="@android:style/Theme.Light.NoTitleBar"> | ||
<activity android:name=".MainActivity" android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
package="com.meditationtracker" | ||
android:versionCode="6" | ||
android:versionName="Torma" android:installLocation="auto"> | ||
|
||
<activity android:name="SettingsActivity" android:theme="@android:style/Theme.Light"></activity> | ||
<activity android:name="NewOrEditPracticeDBActivity"></activity> | ||
<activity android:name="NewOrEditPracticeScreenActivity"></activity> | ||
<activity android:name="PracticeActivity"></activity> | ||
<activity android:name="ScheduleActivity"></activity> | ||
<activity android:name="ImagePicker"></activity> | ||
<provider android:name="PracticeImageProvider" | ||
android:authorities="com.meditationtracker.imageProvider"></provider> | ||
<activity android:name="SessionActivity"></activity> | ||
</application> | ||
<uses-sdk android:minSdkVersion="4" /> | ||
<uses-permission android:name="android.permission.VIBRATE" /> | ||
<!-- uses-permission android:name="android.permission.INTERNET" / --> | ||
</manifest> | ||
<application | ||
android:allowBackup="true" | ||
android:backupAgent="com.meditationtracker.sync.backup.BackupAgent" | ||
android:debuggable="true" | ||
android:hardwareAccelerated="true" | ||
android:icon="@drawable/launcher_48" | ||
android:label="@string/app_name" | ||
android:restoreAnyVersion="true" | ||
android:theme="@android:style/Theme.Light.NoTitleBar"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name="SettingsActivity" | ||
android:theme="@android:style/Theme.Light" > | ||
</activity> | ||
<activity android:name="NewOrEditPracticeDBActivity" > | ||
</activity> | ||
<activity android:name="NewOrEditPracticeScreenActivity" > | ||
</activity> | ||
<activity android:name="PracticeActivity" > | ||
</activity> | ||
<activity android:name="ScheduleActivity" > | ||
</activity> | ||
<activity android:name="ImagePicker" > | ||
</activity> | ||
|
||
<provider | ||
android:name="PracticeImageProvider" | ||
android:authorities="com.meditationtracker.imageProvider" > | ||
</provider> | ||
|
||
<activity android:name="SessionActivity" > | ||
</activity> | ||
</application> | ||
|
||
<uses-sdk android:minSdkVersion="4" /> | ||
|
||
<uses-permission android:name="android.permission.VIBRATE" /> | ||
<!-- uses-permission android:name="android.permission.INTERNET" / --> | ||
|
||
</manifest> |
628 changes: 314 additions & 314 deletions
628
MeditationTracker/gen/com/meditationtracker/R.java
100644 → 100755
Large diffs are not rendered by default.
Oops, something went wrong.
628 changes: 314 additions & 314 deletions
628
MeditationTracker/gen/doo/util/root/R.java
100644 → 100755
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
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
42 changes: 42 additions & 0 deletions
42
MeditationTracker/src/com/meditationtracker/sync/backup/BackupAgent.java
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,42 @@ | ||
package com.meditationtracker.sync.backup; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.meditationtracker.PracticeDatabase; | ||
|
||
import android.app.backup.BackupHelper; | ||
import android.app.backup.FileBackupHelper; | ||
import android.app.backup.SharedPreferencesBackupHelper; | ||
|
||
public class BackupAgent extends android.app.backup.BackupAgentHelper { | ||
|
||
private BackupHelper prefsHelper; | ||
//private BackupHelper meditationHelper; | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
prefsHelper = new SharedPreferencesBackupHelper(this); | ||
addHelper("settings", prefsHelper); | ||
|
||
/* meditationHelper = new MeditationBackupHelper(); | ||
addHelper("meditations", meditationHelper);*/ | ||
|
||
|
||
List<String> files = new ArrayList<String>(); | ||
files.add("../databases/" + PracticeDatabase.DBNAME); | ||
|
||
File filesDir = getFilesDir(); | ||
for (File f : filesDir.listFiles()) { | ||
files.add(f.getAbsolutePath()); | ||
} | ||
|
||
FileBackupHelper dbData = new FileBackupHelper(this, | ||
(String[])files.toArray()); | ||
addHelper(PracticeDatabase.DBNAME, dbData); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
MeditationTracker/src/com/meditationtracker/sync/backup/BackupManagerWrapper.java
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,26 @@ | ||
package com.meditationtracker.sync.backup; | ||
|
||
import android.app.backup.RestoreObserver; | ||
import android.content.Context; | ||
import android.util.Log; | ||
|
||
public class BackupManagerWrapper { | ||
private IBackupManager instance; | ||
|
||
public BackupManagerWrapper(Context context) { | ||
try { | ||
instance = new RealBackupManager(context); | ||
}catch (VerifyError e) { | ||
Log.d("MTRK", "Will skip backup ops"); | ||
instance = new DummyBackupManager(context); | ||
} | ||
} | ||
|
||
public void dataChanged() { | ||
instance.dataChanged(); | ||
} | ||
|
||
public int requestRestore(RestoreObserver observer) { | ||
return instance.requestRestore(observer); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
MeditationTracker/src/com/meditationtracker/sync/backup/DummyBackupManager.java
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,16 @@ | ||
package com.meditationtracker.sync.backup; | ||
|
||
import android.app.backup.RestoreObserver; | ||
import android.content.Context; | ||
|
||
public class DummyBackupManager implements IBackupManager { | ||
|
||
public DummyBackupManager(Context context) { } | ||
|
||
@Override | ||
public void dataChanged() { } | ||
|
||
@Override | ||
public int requestRestore(RestoreObserver observer) { return 1; } | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
MeditationTracker/src/com/meditationtracker/sync/backup/IBackupManager.java
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,8 @@ | ||
package com.meditationtracker.sync.backup; | ||
|
||
import android.app.backup.RestoreObserver; | ||
|
||
public interface IBackupManager { | ||
void dataChanged(); | ||
int requestRestore(RestoreObserver observer); | ||
} |
32 changes: 32 additions & 0 deletions
32
MeditationTracker/src/com/meditationtracker/sync/backup/MeditationBackupHelper.java
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,32 @@ | ||
package com.meditationtracker.sync.backup; | ||
|
||
import android.app.backup.BackupAgentHelper; | ||
import android.app.backup.BackupDataInputStream; | ||
import android.app.backup.BackupDataOutput; | ||
import android.app.backup.BackupHelper; | ||
import android.os.ParcelFileDescriptor; | ||
|
||
public class MeditationBackupHelper extends BackupAgentHelper implements BackupHelper { | ||
|
||
public MeditationBackupHelper() { | ||
} | ||
|
||
@Override | ||
public void performBackup(ParcelFileDescriptor arg0, BackupDataOutput arg1, ParcelFileDescriptor arg2) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void restoreEntity(BackupDataInputStream arg0) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void writeNewStateDescription(ParcelFileDescriptor arg0) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
MeditationTracker/src/com/meditationtracker/sync/backup/RealBackupManager.java
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,24 @@ | ||
package com.meditationtracker.sync.backup; | ||
|
||
import android.app.backup.BackupManager; | ||
import android.app.backup.RestoreObserver; | ||
import android.content.Context; | ||
|
||
public class RealBackupManager implements IBackupManager { | ||
private BackupManager instance; | ||
|
||
public RealBackupManager(Context context) { | ||
instance = new BackupManager(context); | ||
} | ||
|
||
@Override | ||
public void dataChanged() { | ||
instance.dataChanged(); | ||
} | ||
|
||
@Override | ||
public int requestRestore(RestoreObserver observer) { | ||
return instance.requestRestore(observer); | ||
} | ||
|
||
} |