/* * Copyright (c) 2011 Denis Solonenko. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v2.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ package ru.orangesoftware.financisto2.export; import android.app.ProgressDialog; import android.content.Context; import ru.orangesoftware.financisto2.R; import ru.orangesoftware.financisto2.activity.MainActivity; import ru.orangesoftware.financisto2.backup.DatabaseImport; import ru.orangesoftware.financisto2.db.CategoryRepository; import ru.orangesoftware.financisto2.db.DatabaseAdapter; /** * Created by IntelliJ IDEA. * User: Denis Solonenko * Date: 11/9/11 2:21 AM */ public class BackupImportTask extends ImportExportAsyncTask { public BackupImportTask(Context context, ProgressDialog dialog) { super(context, dialog); } @Override protected Object work(Context context, DatabaseAdapter db, CategoryRepository categoryRepository, String... params) throws Exception { DatabaseImport.createFromFileBackup(context, db, categoryRepository, params[0]).importDatabase(); return true; } @Override protected String getSuccessMessage(Object result) { return context.getString(R.string.restore_database_success); } }