Skip to content

Commit

Permalink
Move backup classes to a new package
Browse files Browse the repository at this point in the history
  • Loading branch information
italankin committed Feb 27, 2021
1 parent 6cd2444 commit 61d3620
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import com.italankin.lnch.feature.settings.apps.details.AppDetailsPresenter;
import com.italankin.lnch.feature.settings.apps.details.aliases.AppAliasesPresenter;
import com.italankin.lnch.feature.settings.backup.BackupPresenter;
import com.italankin.lnch.feature.settings.backup.impl.BackupReader;
import com.italankin.lnch.feature.settings.backup.impl.BackupWriter;
import com.italankin.lnch.feature.settings.lookfeel.LookAndFeelPresenter;
import com.italankin.lnch.feature.widgets.WidgetsPresenter;
import com.italankin.lnch.model.backup.BackupReader;
import com.italankin.lnch.model.backup.BackupWriter;
import com.italankin.lnch.model.repository.prefs.SeparatorState;
import com.italankin.lnch.model.repository.prefs.WidgetsState;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import android.content.SharedPreferences;

import com.google.gson.GsonBuilder;
import com.italankin.lnch.feature.settings.backup.impl.BackupReader;
import com.italankin.lnch.feature.settings.backup.impl.BackupReaderImpl;
import com.italankin.lnch.feature.settings.backup.impl.BackupWriter;
import com.italankin.lnch.feature.settings.backup.impl.BackupWriterImpl;
import com.italankin.lnch.feature.settings.backup.impl.PreferencesBackup;
import com.italankin.lnch.feature.settings.backup.impl.PreferencesBackupImpl;
import com.italankin.lnch.model.backup.BackupReader;
import com.italankin.lnch.model.backup.BackupReaderImpl;
import com.italankin.lnch.model.backup.BackupWriter;
import com.italankin.lnch.model.backup.BackupWriterImpl;
import com.italankin.lnch.model.backup.PreferencesBackup;
import com.italankin.lnch.model.backup.PreferencesBackupImpl;
import com.italankin.lnch.model.repository.descriptor.DescriptorRepository;
import com.italankin.lnch.model.repository.store.DescriptorStore;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import com.arellomobile.mvp.InjectViewState;
import com.italankin.lnch.feature.base.AppPresenter;
import com.italankin.lnch.feature.settings.backup.impl.BackupReader;
import com.italankin.lnch.feature.settings.backup.impl.BackupWriter;
import com.italankin.lnch.model.backup.BackupReader;
import com.italankin.lnch.model.backup.BackupWriter;
import com.italankin.lnch.model.repository.descriptor.DescriptorRepository;

import javax.inject.Inject;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.italankin.lnch.feature.settings.backup.impl;
package com.italankin.lnch.model.backup;

import com.google.gson.annotations.SerializedName;
import com.italankin.lnch.model.descriptor.Descriptor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.italankin.lnch.feature.settings.backup.impl;
package com.italankin.lnch.model.backup;

import android.net.Uri;

Expand All @@ -7,7 +7,11 @@

import io.reactivex.Completable;

/**
* A class which reads data from a backup resource
*/
public interface BackupReader {

Completable read(Uri uri);

Completable read(InputStreamFactory factory);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.italankin.lnch.feature.settings.backup.impl;
package com.italankin.lnch.model.backup;

import android.content.ContentResolver;
import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.italankin.lnch.feature.settings.backup.impl;
package com.italankin.lnch.model.backup;

import java.io.Closeable;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.italankin.lnch.feature.settings.backup.impl;
package com.italankin.lnch.model.backup;

import android.net.Uri;

Expand All @@ -7,7 +7,11 @@

import io.reactivex.Completable;

/**
* A class which dumps current state of descriptors and preferences to a resource (e.g. file)
*/
public interface BackupWriter {

Completable write(Uri uri);

Completable write(OutputStreamFactory factory);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.italankin.lnch.feature.settings.backup.impl;
package com.italankin.lnch.model.backup;

import android.content.ContentResolver;
import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.italankin.lnch.model.backup;

import java.util.Map;

public interface PreferencesBackup {

/**
* @return a dump of current preferences' values
*/
Map<String, Object> read();

/**
* Override preference' values with a values from the {@code map}
*
* @param map a map of preference keys and their values
*/
void write(Map<String, ?> map);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.italankin.lnch.feature.settings.backup.impl;
package com.italankin.lnch.model.backup;

import android.annotation.SuppressLint;
import android.content.SharedPreferences;
Expand Down

0 comments on commit 61d3620

Please sign in to comment.