Skip to content

Commit

Permalink
Merge pull request #19 from SecUSo/feat/add-privacy-friendly-backup-s…
Browse files Browse the repository at this point in the history
…upport

Add support for Privacy Friendly Backup
  • Loading branch information
udenr authored Nov 23, 2022
2 parents 3c04b42 + 8d562dd commit c80a27e
Show file tree
Hide file tree
Showing 64 changed files with 609 additions and 279 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "libs/privacy-friendly-backup-api"]
path = libs/privacy-friendly-backup-api
url = https://github.com/SecUSo/privacy-friendly-backup-api.git
35 changes: 25 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 28
compileSdkVersion 32

defaultConfig {
applicationId "org.secuso.privacyfriendlycircuittraining"
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 32
versionCode 2
versionName "1.1"
}
Expand All @@ -21,7 +23,7 @@ android {
android.applicationVariants.all { variant ->
variant.outputs.all {
def appName = "pfa-circuit-training"
outputFileName = appName+"-${variant.name}-v${variant.versionName}.apk"
outputFileName = appName + "-${variant.name}-v${variant.versionName}.apk"
}
}

Expand All @@ -31,13 +33,26 @@ repositories {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'

def room_version = "2.4.3"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"

// Backup API
implementation project(':backup-api')
def work_version = '2.7.1'
implementation "androidx.work:work-runtime:$work_version"
implementation "androidx.work:work-runtime-ktx:$work_version"
androidTestImplementation "androidx.work:work-testing:$work_version"
}
52 changes: 36 additions & 16 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.secuso.privacyfriendlycircuittraining">

<supports-screens
Expand All @@ -13,14 +14,18 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />


<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

<application
android:name=".PFCircuitTrainingApplication"
android:allowBackup="true"
android:icon="@mipmap/icon"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="org.secuso.privacyfriendlycircuittraining.activities.SplashActivity"
android:exported="true"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down Expand Up @@ -79,20 +84,6 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="org.secuso.privacyfriendlycircuittraining.activities.SettingsActivity" />
</activity>

<service
android:name="org.secuso.privacyfriendlycircuittraining.services.TimerService"
android:enabled="true"
android:exported="true" />

<receiver android:name="org.secuso.privacyfriendlycircuittraining.receivers.OnBootCompletedBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

<receiver android:name="org.secuso.privacyfriendlycircuittraining.receivers.MotivationAlertReceiver" />

<activity
android:name="org.secuso.privacyfriendlycircuittraining.activities.StatisticsActivity"
android:label="@string/title_activity_statistics"
Expand All @@ -102,7 +93,6 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="org.secuso.privacyfriendlycircuittraining.activities.MainActivity" />
</activity>

<activity
android:name="org.secuso.privacyfriendlycircuittraining.activities.ExerciseSetActivity"
android:label="@string/title_activity_exercisesets"
Expand All @@ -112,7 +102,6 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="org.secuso.privacyfriendlycircuittraining.activities.MainActivity" />
</activity>

<activity
android:name="org.secuso.privacyfriendlycircuittraining.activities.ExerciseActivity"
android:label="@string/title_activity_exercises"
Expand All @@ -122,6 +111,37 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="org.secuso.privacyfriendlycircuittraining.activities.MainActivity" />
</activity>

<service
android:name=".backup.PFABackupService"
android:enabled="true"
android:exported="true"
android:process=":backup"
tools:ignore="ExportedService">
<intent-filter>
<action android:name="org.secuso.privacyfriendlybackup.api.pfa.PFAAuthService" />
</intent-filter>
</service>

<service
android:name="org.secuso.privacyfriendlycircuittraining.services.TimerService"
android:enabled="true"
android:exported="true" />

<receiver
android:name="org.secuso.privacyfriendlycircuittraining.receivers.OnBootCompletedBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

<receiver android:name="org.secuso.privacyfriendlycircuittraining.receivers.MotivationAlertReceiver" />

<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.secuso.privacyfriendlycircuittraining

import android.app.Application
import android.util.Log
import androidx.work.Configuration
import org.secuso.privacyfriendlybackup.api.pfa.BackupManager
import org.secuso.privacyfriendlycircuittraining.backup.BackupCreator
import org.secuso.privacyfriendlycircuittraining.backup.BackupRestorer

class PFCircuitTrainingApplication : Application(), Configuration.Provider {

override fun onCreate() {
super.onCreate()
BackupManager.backupCreator = BackupCreator()
BackupManager.backupRestorer = BackupRestorer()
}

override fun getWorkManagerConfiguration(): Configuration {
return Configuration.Builder().setMinimumLoggingLevel(Log.INFO).build()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
package org.secuso.privacyfriendlycircuittraining.activities;

import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.TextView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.widget.Toolbar;
import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.design.widget.NavigationView;
import android.support.design.widget.NavigationView.OnNavigationItemSelectedListener;
import android.support.v4.app.TaskStackBuilder;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.navigation.NavigationView.OnNavigationItemSelectedListener;
import androidx.core.app.TaskStackBuilder;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.ActionBar;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.view.View;
import android.widget.CheckBox;
import android.widget.LinearLayout;
Expand Down Expand Up @@ -90,13 +89,13 @@ protected void onCreate(Bundle savedInstanceState) {
acceptFab = (FloatingActionButton) findViewById(R.id.fab_accept_item_ex);
noListsLayout = (LinearLayout) findViewById(R.id.no_lists_layout_ex);

deleteFab.setVisibility(View.GONE);
((View)deleteFab).setVisibility(View.GONE);
if(is_in_picker_mode) {
acceptFab.setVisibility(View.VISIBLE);
newListFab.setVisibility(View.GONE);
((View)acceptFab).setVisibility(View.VISIBLE);
((View)newListFab).setVisibility(View.GONE);
}else{
acceptFab.setVisibility(View.GONE);
newListFab.setVisibility(View.VISIBLE);
((View)acceptFab).setVisibility(View.GONE);
((View)newListFab).setVisibility(View.VISIBLE);
}
noListsLayout.setVisibility(View.VISIBLE);
setNoExererciseMessage();
Expand Down Expand Up @@ -214,9 +213,9 @@ public void clearActionMode(){
is_in_picker_mode = false;
if(is_in_delete_mode)
selection_list.clear();
newListFab.setVisibility(View.VISIBLE);
deleteFab.setVisibility(View.GONE);
acceptFab.setVisibility(View.GONE);
((View)newListFab).setVisibility(View.VISIBLE);
((View)deleteFab).setVisibility(View.GONE);
((View)acceptFab).setVisibility(View.GONE);
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary)));
this.getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimary));
}
Expand All @@ -238,9 +237,9 @@ public boolean onLongClick(View v) {
is_in_delete_mode = true;
mAdapter.notifyDataSetChanged();
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
newListFab.setVisibility(View.GONE);
deleteFab.setVisibility(View.VISIBLE);
acceptFab.setVisibility(View.GONE);
((View)newListFab).setVisibility(View.GONE);
((View)deleteFab).setVisibility(View.VISIBLE);
((View)acceptFab).setVisibility(View.GONE);
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.LTGRAY));
this.getWindow().setStatusBarColor(Color.LTGRAY);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.widget.CheckBox;
import android.widget.LinearLayout;
Expand All @@ -32,7 +32,6 @@
import org.secuso.privacyfriendlycircuittraining.adapters.ExerciseSetAdapter;
import org.secuso.privacyfriendlycircuittraining.database.PFASQLiteHelper;
import org.secuso.privacyfriendlycircuittraining.fragments.ExerciseSetDialogFragment;
import org.secuso.privacyfriendlycircuittraining.models.Exercise;
import org.secuso.privacyfriendlycircuittraining.models.ExerciseSet;

import java.util.ArrayList;
Expand Down Expand Up @@ -79,7 +78,7 @@ protected void onCreate(Bundle savedInstanceState) {
deleteFab = (FloatingActionButton) findViewById(R.id.fab_delete_item);
noListsLayout = (LinearLayout) findViewById(R.id.no_lists_layout);

deleteFab.setVisibility(View.GONE);
((View)deleteFab).setVisibility(View.GONE);
noListsLayout.setVisibility(View.VISIBLE);
setNoExererciseSetsMessage();

Expand Down Expand Up @@ -149,8 +148,8 @@ public void setNoExererciseSetsMessage(){
public void clearActionMode(){
is_in_action_mode = false;
selection_list.clear();
newListFab.setVisibility(View.VISIBLE);
deleteFab.setVisibility(View.GONE);
((View)newListFab).setVisibility(View.VISIBLE);
((View)deleteFab).setVisibility(View.GONE);
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary)));
this.getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimary));
}
Expand All @@ -171,8 +170,8 @@ public boolean onLongClick(View v) {
is_in_action_mode = true;
mAdapter.notifyDataSetChanged();
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
newListFab.setVisibility(View.GONE);
deleteFab.setVisibility(View.VISIBLE);
((View)newListFab).setVisibility(View.GONE);
((View)deleteFab).setVisibility(View.VISIBLE);
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.LTGRAY));
this.getWindow().setStatusBarColor(Color.LTGRAY);
return true;
Expand Down
Loading

0 comments on commit c80a27e

Please sign in to comment.