Migrate Enums and Interfaces to kotlin (#2710)

Co-authored-by: Sylvia van Os <sylvia@hackerchick.me>
This commit is contained in:
PRATHAMESH BHAGAT
2025-09-26 22:27:10 +05:30
committed by GitHub
parent 3e77ab6845
commit 81db39d4e1
12 changed files with 92 additions and 75 deletions

View File

@@ -1,5 +0,0 @@
package protect.card_locker;
public interface BarcodeImageWriterResultCallback {
void onBarcodeImageWriterResult(boolean success);
}

View File

@@ -0,0 +1,5 @@
package protect.card_locker
interface BarcodeImageWriterResultCallback {
fun onBarcodeImageWriterResult(success: Boolean)
}

View File

@@ -1,9 +0,0 @@
package protect.card_locker.async;
import java.util.concurrent.Callable;
public interface CompatCallable<T> extends Callable<T> {
void onPostExecute(Object result);
void onPreExecute();
}

View File

@@ -0,0 +1,9 @@
package protect.card_locker.async
import java.util.concurrent.Callable
interface CompatCallable<T> : Callable<T?> {
fun onPostExecute(result: Any?)
fun onPreExecute()
}

View File

@@ -1,7 +0,0 @@
package protect.card_locker.importexport;
public enum DataFormat {
Catima,
Fidme,
VoucherVault;
}

View File

@@ -0,0 +1,7 @@
package protect.card_locker.importexport
enum class DataFormat {
Catima,
Fidme,
VoucherVault
}

View File

@@ -1,20 +0,0 @@
package protect.card_locker.importexport;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import java.io.IOException;
import java.io.OutputStream;
/**
* Interface for a class which can export the contents of the database
* in a given format.
*/
public interface Exporter {
/**
* Export the database to the output stream in a given format.
*
* @throws IOException
*/
void exportData(Context context, SQLiteDatabase database, OutputStream output, char[] password) throws IOException, InterruptedException;
}

View File

@@ -0,0 +1,25 @@
package protect.card_locker.importexport
import android.content.Context
import android.database.sqlite.SQLiteDatabase
import java.io.IOException
import java.io.OutputStream
/**
* Interface for a class which can export the contents of the database
* in a given format.
*/
interface Exporter {
/**
* Export the database to the output stream in a given format.
*
* @throws IOException, InterruptedException
*/
@Throws(IOException::class, InterruptedException::class)
fun exportData(
context: Context,
database: SQLiteDatabase,
output: OutputStream,
password: CharArray
)
}

View File

@@ -1,7 +0,0 @@
package protect.card_locker.importexport;
public enum ImportExportResultType {
Success,
GenericFailure,
BadPassword;
}

View File

@@ -0,0 +1,7 @@
package protect.card_locker.importexport
enum class ImportExportResultType {
Success,
GenericFailure,
BadPassword
}

View File

@@ -1,27 +0,0 @@
package protect.card_locker.importexport;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import org.json.JSONException;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import protect.card_locker.FormatException;
/**
* Interface for a class which can import the contents of a stream
* into the database.
*/
public interface Importer {
/**
* Import data from the input stream in a given format into
* the database.
*
* @throws IOException
* @throws FormatException
*/
void importData(Context context, SQLiteDatabase database, File inputFile, char[] password) throws IOException, FormatException, InterruptedException, JSONException, ParseException;
}

View File

@@ -0,0 +1,39 @@
package protect.card_locker.importexport
import android.content.Context
import android.database.sqlite.SQLiteDatabase
import org.json.JSONException
import protect.card_locker.FormatException
import java.io.File
import java.io.IOException
import java.text.ParseException
/**
* Interface for a class which can import the contents of a stream
* into the database.
*/
interface Importer {
/**
* Import data from the input stream in a given format into
* the database.
*
* @throws IOException
* @throws FormatException
* @throws InterruptedException
* @throws JSONException
* @throws ParseException
*/
@Throws(
IOException::class,
FormatException::class,
InterruptedException::class,
JSONException::class,
ParseException::class
)
fun importData(
context: Context,
database: SQLiteDatabase,
inputFile: File,
password: CharArray
)
}