Added padding to IconicsDrawables measured from original drawables
This commit is contained in:
@@ -130,7 +130,7 @@ public class EmailListActivity extends BoteActivityBase implements
|
|||||||
.withIconTintingEnabled(true)
|
.withIconTintingEnabled(true)
|
||||||
.withSelectedIconColorRes(R.color.primary);
|
.withSelectedIconColorRes(R.color.primary);
|
||||||
IDrawerItem networkStatus = getNetStatusItem(
|
IDrawerItem networkStatus = getNetStatusItem(
|
||||||
R.string.network_status, GoogleMaterial.Icon.gmd_cloud_off, R.color.md_grey_600);
|
R.string.network_status, GoogleMaterial.Icon.gmd_cloud_off, R.color.md_grey_600, 0);
|
||||||
|
|
||||||
// Set the drawer width per Material design spec
|
// Set the drawer width per Material design spec
|
||||||
// http://www.google.com/design/spec/layout/structure.html#structure-side-nav-1
|
// http://www.google.com/design/spec/layout/structure.html#structure-side-nav-1
|
||||||
@@ -333,11 +333,11 @@ public class EmailListActivity extends BoteActivityBase implements
|
|||||||
.withIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_lock).color(Color.WHITE).sizeRes(com.mikepenz.materialdrawer.R.dimen.material_drawer_item_profile_icon));
|
.withIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_lock).color(Color.WHITE).sizeRes(com.mikepenz.materialdrawer.R.dimen.material_drawer_item_profile_icon));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IDrawerItem getNetStatusItem(int nameRes, IIcon icon, int iconColorRes) {
|
private IDrawerItem getNetStatusItem(int nameRes, IIcon icon, int iconColorRes, int padding) {
|
||||||
return new PrimaryDrawerItem()
|
return new PrimaryDrawerItem()
|
||||||
.withIdentifier(ID_NET_STATUS)
|
.withIdentifier(ID_NET_STATUS)
|
||||||
.withName(nameRes)
|
.withName(nameRes)
|
||||||
.withIcon(new IconicsDrawable(this, icon).colorRes(iconColorRes).sizeDp(24))
|
.withIcon(new IconicsDrawable(this, icon).colorRes(iconColorRes).sizeDp(24).paddingDp(padding))
|
||||||
.withIconTintingEnabled(true)
|
.withIconTintingEnabled(true)
|
||||||
.withSelectedIconColorRes(R.color.primary);
|
.withSelectedIconColorRes(R.color.primary);
|
||||||
}
|
}
|
||||||
@@ -556,7 +556,7 @@ public class EmailListActivity extends BoteActivityBase implements
|
|||||||
.withTag(folder)
|
.withTag(folder)
|
||||||
.withIconTintingEnabled(true)
|
.withIconTintingEnabled(true)
|
||||||
.withSelectedIconColorRes(R.color.primary)
|
.withSelectedIconColorRes(R.color.primary)
|
||||||
.withIcon(new IconicsDrawable(getContext(), BoteHelper.getFolderIcon(folder)).colorRes(R.color.md_grey_600).sizeDp(24))
|
.withIcon(BoteHelper.getFolderIcon(getContext(), folder))
|
||||||
.withName(BoteHelper.getFolderDisplayName(getContext(), folder));
|
.withName(BoteHelper.getFolderDisplayName(getContext(), folder));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -665,36 +665,45 @@ public class EmailListActivity extends BoteActivityBase implements
|
|||||||
// Update network status
|
// Update network status
|
||||||
final int statusText;
|
final int statusText;
|
||||||
final IIcon statusIcon;
|
final IIcon statusIcon;
|
||||||
int colorRes = R.color.md_grey_600;
|
final int colorRes;
|
||||||
|
final int padding;
|
||||||
switch (I2PBote.getInstance().getNetworkStatus()) {
|
switch (I2PBote.getInstance().getNetworkStatus()) {
|
||||||
case DELAY:
|
case DELAY:
|
||||||
statusText = R.string.connect_delay;
|
statusText = R.string.connect_delay;
|
||||||
statusIcon = GoogleMaterial.Icon.gmd_av_timer;
|
statusIcon = GoogleMaterial.Icon.gmd_av_timer;
|
||||||
|
colorRes = R.color.md_grey_600;
|
||||||
|
padding = 3;
|
||||||
break;
|
break;
|
||||||
case CONNECTING:
|
case CONNECTING:
|
||||||
statusText = R.string.connecting;
|
statusText = R.string.connecting;
|
||||||
statusIcon = GoogleMaterial.Icon.gmd_cloud_queue;
|
statusIcon = GoogleMaterial.Icon.gmd_cloud_queue;
|
||||||
|
colorRes = R.color.md_grey_600;
|
||||||
|
padding = 0;
|
||||||
break;
|
break;
|
||||||
case CONNECTED:
|
case CONNECTED:
|
||||||
statusText = R.string.connected;
|
statusText = R.string.connected;
|
||||||
statusIcon = GoogleMaterial.Icon.gmd_cloud_done;
|
statusIcon = GoogleMaterial.Icon.gmd_cloud_done;
|
||||||
|
colorRes = R.color.md_grey_600;
|
||||||
|
padding = 0;
|
||||||
break;
|
break;
|
||||||
case ERROR:
|
case ERROR:
|
||||||
statusText = R.string.error;
|
statusText = R.string.error;
|
||||||
statusIcon = GoogleMaterial.Icon.gmd_error;
|
statusIcon = GoogleMaterial.Icon.gmd_error;
|
||||||
colorRes = R.color.red;
|
colorRes = R.color.red;
|
||||||
|
padding = 2;
|
||||||
break;
|
break;
|
||||||
case NOT_STARTED:
|
case NOT_STARTED:
|
||||||
default:
|
default:
|
||||||
statusText = R.string.not_started;
|
statusText = R.string.not_started;
|
||||||
statusIcon = GoogleMaterial.Icon.gmd_cloud_off;
|
statusIcon = GoogleMaterial.Icon.gmd_cloud_off;
|
||||||
|
colorRes = R.color.md_grey_600;
|
||||||
|
padding = 0;
|
||||||
}
|
}
|
||||||
final int statusIconColorRes = colorRes;
|
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// TODO change this when #378 is resolved
|
// TODO change this when #378 is resolved
|
||||||
mDrawer.updateItem(getNetStatusItem(statusText, statusIcon, statusIconColorRes));
|
mDrawer.updateItem(getNetStatusItem(statusText, statusIcon, colorRes, padding));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ public class NewEmailFragment extends Fragment {
|
|||||||
mSpinner.setSelection(mDefaultPos);
|
mSpinner.setSelection(mDefaultPos);
|
||||||
|
|
||||||
// Set up Cc/Bcc button
|
// Set up Cc/Bcc button
|
||||||
mMore.setImageDrawable(new IconicsDrawable(getActivity(), GoogleMaterial.Icon.gmd_unfold_more).colorRes(R.color.md_grey_600).sizeDp(20));
|
mMore.setImageDrawable(new IconicsDrawable(getActivity(), GoogleMaterial.Icon.gmd_unfold_more).colorRes(R.color.md_grey_600).sizeDp(24).paddingDp(3));
|
||||||
mMore.setOnClickListener(new View.OnClickListener() {
|
mMore.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
@@ -222,7 +222,8 @@ public class NewEmailFragment extends Fragment {
|
|||||||
mMore.setImageDrawable(new IconicsDrawable(getActivity(), mMoreVisible ?
|
mMore.setImageDrawable(new IconicsDrawable(getActivity(), mMoreVisible ?
|
||||||
GoogleMaterial.Icon.gmd_unfold_more : GoogleMaterial.Icon.gmd_unfold_less)
|
GoogleMaterial.Icon.gmd_unfold_more : GoogleMaterial.Icon.gmd_unfold_less)
|
||||||
.colorRes(R.color.md_grey_600)
|
.colorRes(R.color.md_grey_600)
|
||||||
.sizeDp(mMoreVisible ? 20 : 18));
|
.sizeDp(24)
|
||||||
|
.paddingDp(mMoreVisible ? 3 : 4));
|
||||||
mMoreVisible = !mMoreVisible;
|
mMoreVisible = !mMoreVisible;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -461,7 +462,7 @@ public class NewEmailFragment extends Fragment {
|
|||||||
((TextView) v.findViewById(R.id.filename)).setText(attachment.getFileName());
|
((TextView) v.findViewById(R.id.filename)).setText(attachment.getFileName());
|
||||||
((TextView) v.findViewById(R.id.size)).setText(attachment.getHumanReadableSize());
|
((TextView) v.findViewById(R.id.size)).setText(attachment.getHumanReadableSize());
|
||||||
ImageView attachmentAction = (ImageView) v.findViewById(R.id.attachment_action);
|
ImageView attachmentAction = (ImageView) v.findViewById(R.id.attachment_action);
|
||||||
attachmentAction.setImageDrawable(new IconicsDrawable(getActivity(), GoogleMaterial.Icon.gmd_clear).colorRes(R.color.md_grey_600).sizeDp(14));
|
attachmentAction.setImageDrawable(new IconicsDrawable(getActivity(), GoogleMaterial.Icon.gmd_clear).colorRes(R.color.md_grey_600).sizeDp(24).paddingDp(5));
|
||||||
attachmentAction.setOnClickListener(new View.OnClickListener() {
|
attachmentAction.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ public class ViewEmailFragment extends Fragment {
|
|||||||
((TextView) a.findViewById(R.id.size)).setText(attachment.getHumanReadableSize());
|
((TextView) a.findViewById(R.id.size)).setText(attachment.getHumanReadableSize());
|
||||||
|
|
||||||
final ImageView action = (ImageView) a.findViewById(R.id.attachment_action);
|
final ImageView action = (ImageView) a.findViewById(R.id.attachment_action);
|
||||||
action.setImageDrawable(new IconicsDrawable(getActivity(), GoogleMaterial.Icon.gmd_more_vert).colorRes(R.color.md_grey_600).sizeDp(16));
|
action.setImageDrawable(new IconicsDrawable(getActivity(), GoogleMaterial.Icon.gmd_more_vert).colorRes(R.color.md_grey_600).sizeDp(24).paddingDp(4));
|
||||||
action.setOnClickListener(new View.OnClickListener() {
|
action.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.Bitmap.CompressFormat;
|
import android.graphics.Bitmap.CompressFormat;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
@@ -22,6 +23,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.lambdaworks.codec.Base64;
|
import com.lambdaworks.codec.Base64;
|
||||||
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
||||||
|
import com.mikepenz.iconics.IconicsDrawable;
|
||||||
import com.mikepenz.iconics.typeface.IIcon;
|
import com.mikepenz.iconics.typeface.IIcon;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@@ -122,18 +124,31 @@ public class BoteHelper extends GeneralHelper {
|
|||||||
return displayName;
|
return displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IIcon getFolderIcon(EmailFolder folder) {
|
public static Drawable getFolderIcon(Context ctx, EmailFolder folder) {
|
||||||
String name = folder.getName();
|
IIcon icon;
|
||||||
if ("inbox".equals(name))
|
int padding;
|
||||||
return GoogleMaterial.Icon.gmd_inbox;
|
switch (folder.getName()) {
|
||||||
else if ("outbox".equals(name))
|
case "inbox":
|
||||||
return GoogleMaterial.Icon.gmd_cloud_upload;
|
icon = GoogleMaterial.Icon.gmd_inbox;
|
||||||
else if ("sent".equals(name))
|
padding = 3;
|
||||||
return GoogleMaterial.Icon.gmd_send;
|
break;
|
||||||
else if ("trash".equals(name))
|
case "outbox":
|
||||||
return GoogleMaterial.Icon.gmd_delete;
|
icon = GoogleMaterial.Icon.gmd_cloud_upload;
|
||||||
else
|
padding = 0;
|
||||||
return null;
|
break;
|
||||||
|
case "sent":
|
||||||
|
icon = GoogleMaterial.Icon.gmd_send;
|
||||||
|
padding = 1;
|
||||||
|
break;
|
||||||
|
case "trash":
|
||||||
|
icon = GoogleMaterial.Icon.gmd_delete;
|
||||||
|
padding = 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
icon = null;
|
||||||
|
padding = 0;
|
||||||
|
}
|
||||||
|
return new IconicsDrawable(ctx, icon).colorRes(R.color.md_grey_600).sizeDp(24).paddingDp(padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDisplayAddress(String address) throws PasswordException, IOException, GeneralSecurityException, MessagingException {
|
public static String getDisplayAddress(String address) throws PasswordException, IOException, GeneralSecurityException, MessagingException {
|
||||||
|
|||||||
Reference in New Issue
Block a user