parent
4ccd7484dc
commit
5f06a07674
@ -0,0 +1,65 @@ |
||||
package com.example.marat.wal.views; |
||||
|
||||
import android.content.DialogInterface; |
||||
import android.os.Bundle; |
||||
import android.support.v7.app.AlertDialog; |
||||
import android.support.v7.app.AppCompatActivity; |
||||
import android.support.v7.widget.Toolbar; |
||||
import android.view.View; |
||||
import android.widget.Button; |
||||
import android.widget.EditText; |
||||
import android.widget.TextView; |
||||
import android.widget.Toast; |
||||
|
||||
import com.example.marat.wal.R; |
||||
import com.example.marat.wal.controller.Controller; |
||||
|
||||
public class ExportAccountActivity extends AppCompatActivity { |
||||
|
||||
private Controller mController; |
||||
|
||||
private String mAddress; |
||||
private EditText mPasswordText; |
||||
private Button mExportButton; |
||||
|
||||
@Override |
||||
protected void onCreate(Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
setContentView(R.layout.activity_export_account); |
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); |
||||
setSupportActionBar(toolbar); |
||||
|
||||
mAddress = getIntent().getStringExtra(getString(R.string.address_key)); |
||||
|
||||
getSupportActionBar().setTitle(getString(R.string.action_export) + mAddress); |
||||
|
||||
mController = Controller.get(); |
||||
|
||||
mPasswordText = (EditText) findViewById(R.id.export_password); |
||||
mExportButton = (Button) findViewById(R.id.export_account_button); |
||||
mExportButton.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View view) { |
||||
String keystoreJson = mController.clickExportAccount(ExportAccountActivity.this, mAddress, mPasswordText.getText().toString()); |
||||
showKeystore(keystoreJson); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void showKeystore(String keystoreJson) { |
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this); |
||||
builder.setMessage(keystoreJson) |
||||
.setTitle(getString(R.string.message_save_this)); |
||||
|
||||
// Add the button
|
||||
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { |
||||
public void onClick(DialogInterface dialog, int id) { |
||||
finish(); |
||||
} |
||||
}); |
||||
|
||||
AlertDialog dialog = builder.create(); |
||||
dialog.show(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,9 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="24.0" |
||||
android:viewportHeight="24.0"> |
||||
<path |
||||
android:fillColor="#FF000000" |
||||
android:pathData="M9.4,16.6L4.8,12l4.6,-4.6L8,6l-6,6 6,6 1.4,-1.4zM14.6,16.6l4.6,-4.6 -4.6,-4.6L16,6l6,6 -6,6 -1.4,-1.4z"/> |
||||
</vector> |
@ -0,0 +1,9 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="24.0" |
||||
android:viewportHeight="24.0"> |
||||
<path |
||||
android:fillColor="#FF000000" |
||||
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/> |
||||
</vector> |
@ -0,0 +1,26 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
tools:context="com.example.marat.wal.views.ExportAccountActivity"> |
||||
|
||||
<android.support.design.widget.AppBarLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:theme="@style/AppTheme.AppBarOverlay"> |
||||
|
||||
<android.support.v7.widget.Toolbar |
||||
android:id="@+id/toolbar" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="?attr/actionBarSize" |
||||
android:title="@string/action_export" |
||||
android:background="?attr/colorPrimary" |
||||
app:popupTheme="@style/AppTheme.PopupOverlay" /> |
||||
|
||||
</android.support.design.widget.AppBarLayout> |
||||
|
||||
<include layout="@layout/content_export_account" /> |
||||
|
||||
</android.support.design.widget.CoordinatorLayout> |
@ -0,0 +1,46 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" |
||||
tools:context="com.example.marat.wal.views.ExportAccountActivity" |
||||
tools:showIn="@layout/activity_export_account"> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/import_form" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical"> |
||||
|
||||
<android.support.design.widget.TextInputLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content"> |
||||
|
||||
<EditText |
||||
android:id="@+id/export_password" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:hint="@string/prompt_password" |
||||
android:imeActionId="@+id/login" |
||||
android:imeActionLabel="@string/action_sign_in_short" |
||||
android:imeOptions="actionUnspecified" |
||||
android:inputType="textPassword" |
||||
android:maxLines="1" |
||||
android:singleLine="true" /> |
||||
|
||||
</android.support.design.widget.TextInputLayout> |
||||
|
||||
<Button |
||||
android:id="@+id/export_account_button" |
||||
style="?android:textAppearanceSmall" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="16dp" |
||||
android:text="@string/action_export" |
||||
android:textStyle="bold" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</android.support.constraint.ConstraintLayout> |
Loading…
Reference in new issue