Fix export

This commit is contained in:
stom79 2019-02-23 14:16:15 +01:00
parent 33bfb87d26
commit d4c3ffed58
4 changed files with 8 additions and 3 deletions

View File

@ -93,7 +93,7 @@ dependencies {
implementation 'org.apache.poi:poi:3.16'
implementation 'com.github.mabbas007:TagsEditText:1.0.5'
implementation 'com.jaredrummler:material-spinner:1.3.1'
implementation 'com.github.stom79:SQLite2XL:1.0.5'
implementation 'com.github.stom79:SQLite2XL:1.2'
implementation "com.tonyodev.fetch2:fetch2:2.3.6"
playstoreImplementation "io.github.kobakei:ratethisapp:$ratethisappLibraryVersion"
}

View File

@ -1437,6 +1437,9 @@ public abstract class BaseMainActivity extends BaseActivity
SQLiteToExcel sqliteToExcel = new SQLiteToExcel(BaseMainActivity.this, DB_NAME);
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());
final String fileName = "Mastalab_export_"+timeStamp+".xls";
List<String> excludedValues = new ArrayList<>();
excludedValues.add(Sqlite.TABLE_TRACKING_BLOCK);
sqliteToExcel.setExcludeValuesFromTables(excludedValues);
sqliteToExcel.exportAllTables(fileName, new SQLiteToExcel.ExportListener() {
@Override
public void onStart() {
@ -1453,10 +1456,11 @@ public abstract class BaseMainActivity extends BaseActivity
intent.setDataAndType(uri, "application/vnd.ms-excel");
Helper.notify_user(getApplicationContext(), intent, notificationIdTmp, BitmapFactory.decodeResource(getResources(),
R.mipmap.ic_launcher), Helper.NotifType.STORE, getString(R.string.save_over), getString(R.string.download_from, fileName));
Toasty.success(getApplicationContext(), getString(R.string.toast_saved),Toast.LENGTH_LONG).show();
Toasty.success(getApplicationContext(), getString(R.string.data_base_exported),Toast.LENGTH_LONG).show();
}
@Override
public void onError(Exception e) {
e.printStackTrace();
Toasty.error(getApplicationContext(), getString(R.string.data_export_error_simple),Toast.LENGTH_LONG).show();
}
});

View File

@ -65,7 +65,7 @@ public class Sqlite extends SQLiteOpenHelper {
static final String TABLE_BOOST_SCHEDULE = "BOOST_SCHEDULE";
//Table for blocking tracking domains
static final String TABLE_TRACKING_BLOCK = "TRACKING_BLOCK";
public static final String TABLE_TRACKING_BLOCK = "TRACKING_BLOCK";
static final String COL_USER_ID = "USER_ID";
static final String COL_USERNAME = "USERNAME";

View File

@ -897,6 +897,7 @@
<string name="calls_blocked">http calls blocked by the application</string>
<string name="list_of_blocked_domains">List of blocked calls</string>
<string name="submit">Submit</string>
<string name="data_base_exported">The data base has been exported!</string>
<!-- end languages -->