forked from facebookarchive/stetho
-
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.
Merge pull request facebookarchive#91 from jferlisi/database_file_pro…
…vider Added a way to provide the database files to the DatabasePeerManager module.
- Loading branch information
Showing
6 changed files
with
112 additions
and
29 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
16 changes: 16 additions & 0 deletions
16
stetho/src/main/java/com/facebook/stetho/inspector/database/DatabaseFilesProvider.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.facebook.stetho.inspector.database; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
/** | ||
* Provides a {@link List} of database files. | ||
*/ | ||
public interface DatabaseFilesProvider { | ||
|
||
/** | ||
* Returns a {@link List} of database files. | ||
*/ | ||
List<File> getDatabaseFiles(); | ||
|
||
} |
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
27 changes: 27 additions & 0 deletions
27
...ho/src/main/java/com/facebook/stetho/inspector/database/DefaultDatabaseFilesProvider.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,27 @@ | ||
package com.facebook.stetho.inspector.database; | ||
|
||
import android.content.Context; | ||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Provides the results of {@link Context#databaseList()}. | ||
*/ | ||
public final class DefaultDatabaseFilesProvider implements DatabaseFilesProvider { | ||
|
||
private final Context mContext; | ||
|
||
public DefaultDatabaseFilesProvider(Context context) { | ||
mContext = context; | ||
} | ||
|
||
@Override | ||
public List<File> getDatabaseFiles() { | ||
List<File> databaseFiles = new ArrayList<File>(); | ||
for (String filename : mContext.databaseList()) { | ||
databaseFiles.add(new File(filename)); | ||
} | ||
return databaseFiles; | ||
} | ||
} |
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