parent
a8366387ab
commit
9273f5cc67
@ -1,100 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="8dip">
|
||||
|
||||
|
||||
<!--LinearLayout android:id="@+id/export_encrypted_backup"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dip"
|
||||
android:background="@drawable/clickable_card_light"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="8dip"
|
||||
android:paddingBottom="8dip"
|
||||
android:layout_marginLeft="16dip"
|
||||
android:layout_marginRight="16dip">
|
||||
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:src="@drawable/encrypted_backup"/>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Registration.Description"
|
||||
android:text="@string/export_fragment__export_encrypted_backup"/>
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/export_fragment__export_an_encrypted_backup_to_the_sd_card"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout-->
|
||||
|
||||
|
||||
<LinearLayout android:id="@+id/export_plaintext_backup"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dip"
|
||||
android:background="?import_export_item_card_background"
|
||||
android:orientation="vertical"
|
||||
android:focusable="true">
|
||||
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="8dip"
|
||||
android:paddingBottom="8dip"
|
||||
android:layout_marginLeft="16dip"
|
||||
android:layout_marginRight="16dip">
|
||||
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginEnd="10dip"
|
||||
android:src="?plaintext_backup"/>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
style="@style/Registration.Description"
|
||||
android:text="@string/export_fragment__export_plaintext_backup"/>
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/export_fragment__export_a_plaintext_backup_compatible_with"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -0,0 +1,189 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="8dip">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
card_view:cardElevation="3dp"
|
||||
card_view:cardCornerRadius="3dp"
|
||||
card_view:cardUseCompatPadding="true">
|
||||
|
||||
<LinearLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/import_export_fragment__import"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gray10"/>
|
||||
|
||||
<LinearLayout android:id="@+id/import_sms"
|
||||
android:clickable="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="8dip"
|
||||
android:paddingBottom="8dip"
|
||||
android:layout_marginLeft="16dip"
|
||||
android:layout_marginRight="16dip">
|
||||
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginEnd="10dip"
|
||||
android:src="?import_sms"/>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
style="@style/Registration.Description"
|
||||
android:text="@string/import_fragment__import_system_sms_database"/>
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/import_fragment__import_the_database_from_the_default_system"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gray10"/>
|
||||
|
||||
<LinearLayout android:id="@+id/import_plaintext_backup"
|
||||
android:clickable="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="8dip"
|
||||
android:paddingBottom="8dip"
|
||||
android:layout_marginLeft="16dip"
|
||||
android:layout_marginRight="16dip">
|
||||
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginEnd="10dip"
|
||||
android:src="?plaintext_backup"/>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
style="@style/Registration.Description"
|
||||
android:text="@string/import_fragment__import_plaintext_backup"/>
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/import_fragment__import_a_plaintext_backup_file"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_marginTop="20dp"
|
||||
card_view:cardElevation="3dp"
|
||||
card_view:cardCornerRadius="2dp"
|
||||
card_view:cardUseCompatPadding="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/export"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gray10"/>
|
||||
|
||||
<LinearLayout android:id="@+id/export_plaintext_backup"
|
||||
android:clickable="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="8dip"
|
||||
android:paddingBottom="8dip"
|
||||
android:layout_marginLeft="16dip"
|
||||
android:layout_marginRight="16dip">
|
||||
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginEnd="10dip"
|
||||
android:src="?plaintext_backup"/>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
style="@style/Registration.Description"
|
||||
android:text="@string/export_fragment__export_plaintext_backup"/>
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/export_fragment__export_a_plaintext_backup_compatible_with"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -1,146 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="8dip">
|
||||
|
||||
<LinearLayout android:id="@+id/import_sms"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?import_export_item_card_background"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="8dip"
|
||||
android:paddingBottom="8dip"
|
||||
android:layout_marginLeft="16dip"
|
||||
android:layout_marginRight="16dip">
|
||||
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginEnd="10dip"
|
||||
android:src="?import_sms"/>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
style="@style/Registration.Description"
|
||||
android:text="@string/import_fragment__import_system_sms_database"/>
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/import_fragment__import_the_database_from_the_default_system"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/import_encrypted_backup"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dip"
|
||||
android:background="?import_export_item_card_background"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="8dip"
|
||||
android:paddingBottom="8dip"
|
||||
android:layout_marginLeft="16dip"
|
||||
android:layout_marginRight="16dip">
|
||||
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginEnd="10dip"
|
||||
android:src="?encrypted_backup"/>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
style="@style/Registration.Description"
|
||||
android:text="@string/import_fragment__restore_encrypted_backup"/>
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/import_fragment__restore_a_previously_exported_encrypted_signal_backup"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout android:id="@+id/import_plaintext_backup"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dip"
|
||||
android:background="?import_export_item_card_background"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="8dip"
|
||||
android:paddingBottom="8dip"
|
||||
android:layout_marginLeft="16dip"
|
||||
android:layout_marginRight="16dip">
|
||||
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginEnd="10dip"
|
||||
android:src="?plaintext_backup"/>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
style="@style/Registration.Description"
|
||||
android:text="@string/import_fragment__import_plaintext_backup"/>
|
||||
|
||||
<TextView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/import_fragment__import_a_plaintext_backup_file"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -1,196 +0,0 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.database.NoExternalStorageException;
|
||||
import org.thoughtcrime.securesms.database.PlaintextBackupExporter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class ExportFragment extends Fragment {
|
||||
|
||||
private static final int SUCCESS = 0;
|
||||
private static final int NO_SD_CARD = 1;
|
||||
private static final int IO_ERROR = 2;
|
||||
|
||||
private MasterSecret masterSecret;
|
||||
|
||||
public void setMasterSecret(MasterSecret masterSecret) {
|
||||
this.masterSecret = masterSecret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
|
||||
View layout = inflater.inflate(R.layout.export_fragment, container, false);
|
||||
// View exportEncryptedView = layout.findViewById(R.id.export_encrypted_backup);
|
||||
View exportPlaintextView = layout.findViewById(R.id.export_plaintext_backup);
|
||||
|
||||
// exportEncryptedView.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// handleExportEncryptedBackup();
|
||||
// }
|
||||
// });
|
||||
|
||||
exportPlaintextView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
handleExportPlaintextBackup();
|
||||
}
|
||||
});
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
// private void handleExportEncryptedBackup() {
|
||||
// AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
// builder.setIcon(Dialogs.getDrawable(getActivity(), R.attr.dialog_info_icon));
|
||||
// builder.setTitle(getActivity().getString(R.string.ExportFragment_export_to_sd_card));
|
||||
// builder.setMessage(getActivity().getString(R.string.ExportFragment_this_will_export_your_encrypted_keys_settings_and_messages));
|
||||
// builder.setPositiveButton(getActivity().getString(R.string.ExportFragment_export), new Dialog.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
// new ExportEncryptedTask().execute();
|
||||
// }
|
||||
// });
|
||||
// builder.setNegativeButton(getActivity().getString(R.string.ExportFragment_cancel), null);
|
||||
// builder.show();
|
||||
// }
|
||||
|
||||
private void handleExportPlaintextBackup() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setIconAttribute(R.attr.dialog_alert_icon);
|
||||
builder.setTitle(getActivity().getString(R.string.ExportFragment_export_plaintext_to_storage));
|
||||
builder.setMessage(getActivity().getString(R.string.ExportFragment_warning_this_will_export_the_plaintext_contents));
|
||||
builder.setPositiveButton(getActivity().getString(R.string.ExportFragment_export), new Dialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
new ExportPlaintextTask().execute();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(getActivity().getString(R.string.ExportFragment_cancel), null);
|
||||
builder.show();
|
||||
}
|
||||
|
||||
private class ExportPlaintextTask extends AsyncTask<Void, Void, Integer> {
|
||||
private ProgressDialog dialog;
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
dialog = ProgressDialog.show(getActivity(),
|
||||
getActivity().getString(R.string.ExportFragment_exporting),
|
||||
getActivity().getString(R.string.ExportFragment_exporting_plaintext_to_storage),
|
||||
true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer doInBackground(Void... params) {
|
||||
try {
|
||||
PlaintextBackupExporter.exportPlaintextToSd(getActivity(), masterSecret);
|
||||
return SUCCESS;
|
||||
} catch (NoExternalStorageException e) {
|
||||
Log.w("ExportFragment", e);
|
||||
return NO_SD_CARD;
|
||||
} catch (IOException e) {
|
||||
Log.w("ExportFragment", e);
|
||||
return IO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Integer result) {
|
||||
Context context = getActivity();
|
||||
|
||||
if (dialog != null)
|
||||
dialog.dismiss();
|
||||
|
||||
if (context == null)
|
||||
return;
|
||||
|
||||
switch (result) {
|
||||
case NO_SD_CARD:
|
||||
Toast.makeText(context,
|
||||
context.getString(R.string.ExportFragment_error_unable_to_write_to_storage),
|
||||
Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case IO_ERROR:
|
||||
Toast.makeText(context,
|
||||
context.getString(R.string.ExportFragment_error_while_writing_to_storage),
|
||||
Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case SUCCESS:
|
||||
Toast.makeText(context,
|
||||
context.getString(R.string.ExportFragment_export_successful),
|
||||
Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private class ExportEncryptedTask extends AsyncTask<Void, Void, Integer> {
|
||||
// private ProgressDialog dialog;
|
||||
//
|
||||
// @Override
|
||||
// protected void onPreExecute() {
|
||||
// dialog = ProgressDialog.show(getActivity(),
|
||||
// getActivity().getString(R.string.ExportFragment_exporting),
|
||||
// getActivity().getString(R.string.ExportFragment_exporting_keys_settings_and_messages),
|
||||
// true, false);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onPostExecute(Integer result) {
|
||||
// Context context = getActivity();
|
||||
//
|
||||
// if (dialog != null) dialog.dismiss();
|
||||
//
|
||||
// if (context == null) return;
|
||||
//
|
||||
// switch (result) {
|
||||
// case NO_SD_CARD:
|
||||
// Toast.makeText(context,
|
||||
// context.getString(R.string.ExportFragment_error_unable_to_write_to_storage),
|
||||
// Toast.LENGTH_LONG).show();
|
||||
// break;
|
||||
// case IO_ERROR:
|
||||
// Toast.makeText(context,
|
||||
// context.getString(R.string.ExportFragment_error_while_writing_to_storage),
|
||||
// Toast.LENGTH_LONG).show();
|
||||
// break;
|
||||
// case SUCCESS:
|
||||
// Toast.makeText(context,
|
||||
// context.getString(R.string.ExportFragment_success),
|
||||
// Toast.LENGTH_LONG).show();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected Integer doInBackground(Void... params) {
|
||||
// try {
|
||||
// EncryptedBackupExporter.exportToSd(getActivity());
|
||||
// return SUCCESS;
|
||||
// } catch (NoExternalStorageException e) {
|
||||
// Log.w("ExportFragment", e);
|
||||
// return NO_SD_CARD;
|
||||
// } catch (IOException e) {
|
||||
// Log.w("ExportFragment", e);
|
||||
// return IO_ERROR;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
Loading…
Reference in New Issue