Picture fixes

This commit is contained in:
str4d
2014-05-16 10:43:14 +00:00
parent 108096e022
commit f500036276
5 changed files with 21 additions and 10 deletions

View File

@@ -66,7 +66,7 @@ public class ViewEmailFragment extends Fragment {
private void displayEmail(Email email, View v) {
TextView subject = (TextView) v.findViewById(R.id.email_subject);
ImageView picture = (ImageView) v.findViewById(R.id.contact_picture);
ImageView picture = (ImageView) v.findViewById(R.id.picture);
TextView sender = (TextView) v.findViewById(R.id.email_sender);
LinearLayout recipients = (LinearLayout) v.findViewById(R.id.email_recipients);
TextView sent = (TextView) v.findViewById(R.id.email_sent);

View File

@@ -60,7 +60,7 @@ public class EditIdentityFragment extends EditPictureFragment {
public static final String IDENTITY_KEY = "identity_key";
// Code to identify the fragment that is calling onActivityResult().
static final int IDENTITY_WAITER = 0;
static final int IDENTITY_WAITER = 3;
// Tag so we can find the task fragment again, in another
// instance of this fragment after rotation.
static final String IDENTITY_WAITER_TAG = "identityWaiterTask";
@@ -204,6 +204,8 @@ public class EditIdentityFragment extends EditPictureFragment {
setInterfaceEnabled(true);
mError.setText(data.getStringExtra("error"));
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}

View File

@@ -8,6 +8,7 @@ import i2p.bote.android.util.BoteHelper;
import i2p.bote.email.EmailIdentity;
import i2p.bote.fileencryption.PasswordException;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
@@ -16,6 +17,7 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
public class ViewIdentityFragment extends Fragment {
@@ -24,6 +26,7 @@ public class ViewIdentityFragment extends Fragment {
private String mKey;
private EmailIdentity mIdentity;
ImageView mIdentityPicture;
TextView mNameField;
TextView mDescField;
TextView mCryptoField;
@@ -53,14 +56,16 @@ public class ViewIdentityFragment extends Fragment {
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mIdentityPicture = (ImageView) view.findViewById(R.id.identity_picture);
mNameField = (TextView) view.findViewById(R.id.public_name);
mDescField = (TextView) view.findViewById(R.id.description);
mCryptoField = (TextView) view.findViewById(R.id.crypto_impl);
mKeyField = (TextView) view.findViewById(R.id.key);
mKey = getArguments().getString(IDENTITY_KEY);
if (mKey != null) {
try {
mIdentity = BoteHelper.getIdentity(mKey);
mNameField = (TextView) view.findViewById(R.id.public_name);
mDescField = (TextView) view.findViewById(R.id.description);
mCryptoField = (TextView) view.findViewById(R.id.crypto_impl);
mKeyField = (TextView) view.findViewById(R.id.key);
} catch (PasswordException e) {
// TODO Handle
e.printStackTrace();
@@ -79,6 +84,10 @@ public class ViewIdentityFragment extends Fragment {
super.onResume();
if (mIdentity != null) {
Bitmap picture = BoteHelper.decodePicture(mIdentity.getPictureBase64());
if (picture != null)
mIdentityPicture.setImageBitmap(picture);
mNameField.setText(mIdentity.getPublicName());
mDescField.setText(mIdentity.getDescription());
mCryptoField.setText(mIdentity.getCryptoImpl().getName());