Theme Support

1) Broke out the UI elements of the major Activites into stylable
   attributes.

2) Created a 'light' and 'dark' theme for the newly stylable attrs.

3) Touched up some of the UI spacing.

4) Implemented dynamic theme switching support.
This commit is contained in:
Moxie Marlinspike
2013-06-21 11:56:59 -07:00
parent 2ffc70a95b
commit 5263ac1f1a
62 changed files with 443 additions and 156 deletions

View File

@@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.components;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
@@ -45,19 +46,24 @@ public class ImageDivet extends ImageView {
}
private void setDrawable() {
Resources r = getContext().getResources();
int attributes[] = new int[] {R.attr.conversation_avatar_divet_left,
R.attr.conversation_avatar_divet_right};
TypedArray drawables = getContext().obtainStyledAttributes(attributes);
switch (position) {
case 0:
drawable = r.getDrawable(R.drawable.divet_right);
drawable = drawables.getDrawable(1);
break;
case 1:
drawable = r.getDrawable(R.drawable.divet_left);
drawable = drawables.getDrawable(0);
break;
}
drawableIntrinsicWidth = drawable.getIntrinsicWidth();
drawableIntrinsicHeight = drawable.getIntrinsicHeight();
drawables.recycle();
}
@Override