-# Encoding is UTF-8
diff --git a/bin/res/crunch/drawable-hdpi/ic_launcher.png b/bin/res/crunch/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index efa7c5f..0000000
Binary files a/bin/res/crunch/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/bin/res/crunch/drawable-mdpi/ic_launcher.png b/bin/res/crunch/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index ec27f2e..0000000
Binary files a/bin/res/crunch/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/bin/res/crunch/drawable-xhdpi/ic_launcher.png b/bin/res/crunch/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 92fc57d..0000000
Binary files a/bin/res/crunch/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/bin/res/crunch/drawable-xxhdpi/ic_launcher.png b/bin/res/crunch/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index b6f8f4e..0000000
Binary files a/bin/res/crunch/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/bin/resources.ap_ b/bin/resources.ap_
deleted file mode 100644
index 4c3cadc..0000000
Binary files a/bin/resources.ap_ and /dev/null differ
diff --git a/gen/com/yoog/widget/BuildConfig.java b/gen/com/yoog/widget/BuildConfig.java
deleted file mode 100644
index f90c66d..0000000
--- a/gen/com/yoog/widget/BuildConfig.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/** Automatically generated file. DO NOT MODIFY */
-package com.yoog.widget;
-
-public final class BuildConfig {
- public final static boolean DEBUG = true;
-}
\ No newline at end of file
diff --git a/gen/com/yoog/widget/R.java b/gen/com/yoog/widget/R.java
deleted file mode 100644
index 98a4450..0000000
--- a/gen/com/yoog/widget/R.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
-
-package com.yoog.widget;
-
-public final class R {
- public static final class attr {
- /** Must be one of the following constant values.
-
-
-
-
-| Constant | Value | Description |
-uptodown | 0 | |
-downtoup | 1 | |
-lefttoright | 2 | |
-righttoleft | 3 | |
-
- */
- public static final int direction=0x7f010000;
- }
- public static final class dimen {
- /** Default screen margins, per the Android Design guidelines.
-
- Customize dimensions originally defined in res/values/dimens.xml (such as
- screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
-
- */
- public static final int activity_horizontal_margin=0x7f050000;
- public static final int activity_vertical_margin=0x7f050001;
- }
- public static final class drawable {
- public static final int ic_launcher=0x7f020000;
- }
- public static final class id {
- public static final int action_settings=0x7f040004;
- public static final int downtoup=0x7f040001;
- public static final int lefttoright=0x7f040002;
- public static final int righttoleft=0x7f040003;
- public static final int uptodown=0x7f040000;
- }
- public static final class layout {
- public static final int activity_main=0x7f030000;
- }
- public static final class menu {
- public static final int main=0x7f080000;
- }
- public static final class string {
- public static final int action_settings=0x7f060001;
- public static final int app_name=0x7f060000;
- public static final int hello_world=0x7f060002;
- }
- public static final class style {
- /**
- Base application theme, dependent on API level. This theme is replaced
- by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-
-
- Theme customizations available in newer API levels can go in
- res/values-vXX/styles.xml, while customizations related to
- backward-compatibility can go here.
-
-
- Base application theme for API 11+. This theme completely replaces
- AppBaseTheme from res/values/styles.xml on API 11+ devices.
-
- API 11 theme customizations can go here.
-
- Base application theme for API 14+. This theme completely replaces
- AppBaseTheme from BOTH res/values/styles.xml and
- res/values-v11/styles.xml on API 14+ devices.
-
- API 14 theme customizations can go here.
- */
- public static final int AppBaseTheme=0x7f070000;
- /** Application theme.
- All customizations that are NOT specific to a particular API-level can go here.
- */
- public static final int AppTheme=0x7f070001;
- }
- public static final class styleable {
- /** Attributes that can be used with a verticaltextview.
- Includes the following attributes:
-
-
-
- | Attribute | Description |
- {@link #verticaltextview_direction com.yoog.widget:direction} | |
-
- @see #verticaltextview_direction
- */
- public static final int[] verticaltextview = {
- 0x7f010000
- };
- /**
- This symbol is the offset where the {@link com.yoog.widget.R.attr#direction}
- attribute's value can be found in the {@link #verticaltextview} array.
-
-
-
Must be one of the following constant values.
-
-
-
-
-| Constant | Value | Description |
-uptodown | 0 | |
-downtoup | 1 | |
-lefttoright | 2 | |
-righttoleft | 3 | |
-
- @attr name com.yoog.widget:direction
- */
- public static final int verticaltextview_direction = 0;
- };
-}
diff --git a/hs_err_pid9628.log b/hs_err_pid9628.log
deleted file mode 100644
index 777195b..0000000
--- a/hs_err_pid9628.log
+++ /dev/null
@@ -1,109 +0,0 @@
-#
-# A fatal error has been detected by the Java Runtime Environment:
-#
-# Internal Error (javaClasses.cpp:136), pid=9628, tid=5540
-# fatal error: Invalid layout of preloaded class
-#
-# JRE version: (7.0_45-b18) (build )
-# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode windows-amd64 compressed oops)
-# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
-#
-# If you would like to submit a bug report, please visit:
-# http://bugreport.sun.com/bugreport/crash.jsp
-#
-
---------------- T H R E A D ---------------
-
-Current thread (0x000000000257d800): JavaThread "Unknown thread" [_thread_in_vm, id=5540, stack(0x00000000028d0000,0x00000000029d0000)]
-
-Stack: [0x00000000028d0000,0x00000000029d0000]
-
---------------- P R O C E S S ---------------
-
-Java Threads: ( => current thread )
-
-Other Threads:
-
-=>0x000000000257d800 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=5540, stack(0x00000000028d0000,0x00000000029d0000)]
-
-VM state:not at safepoint (not fully initialized)
-
-VM Mutex/Monitor currently owned by a thread: None
-
-GC Heap History (0 events):
-No events
-
-Deoptimization events (0 events):
-No events
-
-Internal exceptions (0 events):
-No events
-
-Events (10 events):
-Event: 0.160 loading class 0x00000000025fc620 done
-Event: 0.160 loading class 0x00000000025fc040 done
-Event: 0.160 loading class 0x00000000025fc020
-Event: 0.160 loading class 0x0000000002604120
-Event: 0.160 loading class 0x0000000002604120 done
-Event: 0.160 loading class 0x0000000002604150
-Event: 0.160 loading class 0x0000000002604150 done
-Event: 0.160 loading class 0x0000000002604180
-Event: 0.160 loading class 0x0000000002604180 done
-Event: 0.160 loading class 0x00000000025fc020 done
-
-
-Dynamic libraries:
-0x000000013f220000 - 0x000000013f253000 D:\Java\jre7\bin\javaw.exe
-0x0000000077240000 - 0x00000000773eb000 C:\Windows\SYSTEM32\ntdll.dll
-0x0000000077120000 - 0x000000007723f000 C:\Windows\system32\kernel32.dll
-0x000007fefd170000 - 0x000007fefd1db000 C:\Windows\system32\KERNELBASE.dll
-0x000007feff190000 - 0x000007feff26b000 C:\Windows\system32\ADVAPI32.dll
-0x000007fefee20000 - 0x000007fefeebf000 C:\Windows\system32\msvcrt.dll
-0x000007fefeec0000 - 0x000007fefeedf000 C:\Windows\SYSTEM32\sechost.dll
-0x000007fefeee0000 - 0x000007feff00e000 C:\Windows\system32\RPCRT4.dll
-0x0000000076ee0000 - 0x0000000076fda000 C:\Windows\system32\USER32.dll
-0x000007feff010000 - 0x000007feff077000 C:\Windows\system32\GDI32.dll
-0x000007fefe9d0000 - 0x000007fefe9de000 C:\Windows\system32\LPK.dll
-0x000007fefea70000 - 0x000007fefeb3a000 C:\Windows\system32\USP10.dll
-0x000007fefb770000 - 0x000007fefb964000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16385_none_fa645303170382f6\COMCTL32.dll
-0x000007fefd700000 - 0x000007fefd771000 C:\Windows\system32\SHLWAPI.dll
-0x000007fefec70000 - 0x000007fefec9e000 C:\Windows\system32\IMM32.DLL
-0x000007fefd470000 - 0x000007fefd579000 C:\Windows\system32\MSCTF.dll
-0x000007fefcf30000 - 0x000007fefcf70000 C:\Windows\system32\nvinitx.dll
-0x000000006ead0000 - 0x000000006eba2000 D:\Java\jre7\bin\msvcr100.dll
-0x000000005d380000 - 0x000000005db49000 D:\Java\jre7\bin\server\jvm.dll
-0x000007fefb6d0000 - 0x000007fefb6d9000 C:\Windows\system32\WSOCK32.dll
-0x000007fefe510000 - 0x000007fefe55d000 C:\Windows\system32\WS2_32.dll
-0x000007fefe9e0000 - 0x000007fefe9e8000 C:\Windows\system32\NSI.dll
-0x000007fefd070000 - 0x000007fefd0ab000 C:\Windows\system32\WINMM.dll
-0x0000000077400000 - 0x0000000077407000 C:\Windows\system32\PSAPI.DLL
-0x00000000743c0000 - 0x00000000743cf000 D:\Java\jre7\bin\verify.dll
-0x0000000074390000 - 0x00000000743b8000 D:\Java\jre7\bin\java.dll
-0x0000000071f30000 - 0x0000000071f45000 D:\Java\jre7\bin\zip.dll
-
-VM Arguments:
-jvm_args: -Dfile.encoding=UTF-8 -Xbootclasspath:D:\GoogleEclipseBit64\sdk\platforms\android-19\android.jar
-java_command: com.letv.lepai.common.utils.ZipUtils
-Launcher Type: SUN_STANDARD
-
-Environment Variables:
-PATH=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\TortoiseSVN\bin;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;D:\GoogleEclipseBit64\sdk\platform-tools;D:\GoogleEclipseBit64\sdk\tools;
-USERNAME=chenyueguo
-OS=Windows_NT
-PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
-
-
-
---------------- S Y S T E M ---------------
-
-OS: Windows 7 , 64 bit Build 7600
-
-CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 58 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, erms, ht, tsc, tscinvbit, tscinv
-
-Memory: 4k page, physical 3786988k(942124k free), swap 7789168k(1870796k free)
-
-vm_info: Java HotSpot(TM) 64-Bit Server VM (24.45-b08) for windows-amd64 JRE (1.7.0_45-b18), built on Oct 8 2013 05:47:22 by "java_re" with unknown MS VC++:1600
-
-time: Thu Oct 23 14:16:02 2014
-elapsed time: 0 seconds
-
diff --git a/src/com/yoog/widget/VerticalTextView.java b/src/com/yoog/widget/VerticalTextView.java
index 4822422..0a3ef26 100644
--- a/src/com/yoog/widget/VerticalTextView.java
+++ b/src/com/yoog/widget/VerticalTextView.java
@@ -11,135 +11,143 @@
import android.widget.TextView;
public class VerticalTextView extends TextView {
-
- public final static int ORIENTATION_UP_TO_DOWN = 0;
- public final static int ORIENTATION_DOWN_TO_UP = 1;
- public final static int ORIENTATION_LEFT_TO_RIGHT = 2;
- public final static int ORIENTATION_RIGHT_TO_LEFT = 3;
-
- Rect text_bounds = new Rect();
- private int direction;
-
- public VerticalTextView(Context context) {
- super(context);
- }
-
- public VerticalTextView(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- TypedArray a = context.obtainStyledAttributes(attrs,
- R.styleable.verticaltextview);
- direction = a.getInt(R.styleable.verticaltextview_direction, 0);
- a.recycle();
-
- requestLayout();
- invalidate();
-
- }
-
- public void setDirection(int direction) {
- this.direction = direction;
-
- requestLayout();
- invalidate();
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- getPaint().getTextBounds(getText().toString(), 0, getText().length(),
- text_bounds);
- if (direction == ORIENTATION_LEFT_TO_RIGHT
- || direction == ORIENTATION_RIGHT_TO_LEFT) {
- setMeasuredDimension(measureHeight(widthMeasureSpec),
- measureWidth(heightMeasureSpec));
- } else if (direction == ORIENTATION_UP_TO_DOWN
- || direction == ORIENTATION_DOWN_TO_UP) {
- setMeasuredDimension(measureWidth(widthMeasureSpec),
- measureHeight(heightMeasureSpec));
- }
-
- }
-
- private int measureWidth(int measureSpec) {
- int result = 0;
- int specMode = MeasureSpec.getMode(measureSpec);
- int specSize = MeasureSpec.getSize(measureSpec);
-
- if (specMode == MeasureSpec.EXACTLY) {
- result = specSize;
- } else {
- result = text_bounds.height() + getPaddingTop()
- + getPaddingBottom();
- // result = text_bounds.height();
- if (specMode == MeasureSpec.AT_MOST) {
- result = Math.min(result, specSize);
- }
- }
- return result;
- }
-
- private int measureHeight(int measureSpec) {
- int result = 0;
- int specMode = MeasureSpec.getMode(measureSpec);
- int specSize = MeasureSpec.getSize(measureSpec);
-
- if (specMode == MeasureSpec.EXACTLY) {
- result = specSize;
- } else {
- result = text_bounds.width() + getPaddingLeft() + getPaddingRight();
- // result = text_bounds.width();
- if (specMode == MeasureSpec.AT_MOST) {
- result = Math.min(result, specSize);
- }
- }
- return result;
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
-// super.onDraw(canvas);
-
- canvas.save();
-
- int startX = 0;
- int startY = 0;
- int stopX = 0;
- int stopY = 0;
- Path path = new Path();
- if (direction == ORIENTATION_UP_TO_DOWN) {
- startX = (getWidth() - text_bounds.height() >> 1);
- startY = (getHeight() - text_bounds.width() >> 1);
- stopX = (getWidth() - text_bounds.height() >> 1);
- stopY = (getHeight() + text_bounds.width() >> 1);
- path.moveTo(startX, startY);
- path.lineTo(stopX, stopY);
- } else if (direction == ORIENTATION_DOWN_TO_UP) {
- startX = (getWidth() + text_bounds.height() >> 1);
- startY = (getHeight() + text_bounds.width() >> 1);
- stopX = (getWidth() + text_bounds.height() >> 1);
- stopY = (getHeight() - text_bounds.width() >> 1);
- path.moveTo(startX, startY);
- path.lineTo(stopX, stopY);
- } else if (direction == ORIENTATION_LEFT_TO_RIGHT) {
- startX = (getWidth() - text_bounds.width() >> 1);
- startY = (getHeight() + text_bounds.height() >> 1);
- stopX = (getWidth() + text_bounds.width() >> 1);
- stopY = (getHeight() + text_bounds.height() >> 1);
- path.moveTo(startX, startY);
- path.lineTo(stopX, stopY);
- } else if (direction == ORIENTATION_RIGHT_TO_LEFT) {
- startX = (getWidth() + text_bounds.width() >> 1);
- startY = (getHeight() - text_bounds.height() >> 1);
- stopX = (getWidth() - text_bounds.width() >> 1);
- stopY = (getHeight() - text_bounds.height() >> 1);
- path.moveTo(startX, startY);
- path.lineTo(stopX, stopY);
- }
-
- this.getPaint().setColor(this.getCurrentTextColor());
-// canvas.drawLine(startX, startY, stopX, stopY, this.getPaint());
- canvas.drawTextOnPath(getText().toString(), path, 0, 0, this.getPaint());
-
- canvas.restore();
- }
+ public final static int ORIENTATION_UP_TO_DOWN = 0;
+ public final static int ORIENTATION_DOWN_TO_UP = 1;
+ public final static int ORIENTATION_LEFT_TO_RIGHT = 2;
+ public final static int ORIENTATION_RIGHT_TO_LEFT = 3;
+
+ private Rect text_bounds = new Rect();
+ private int text_width = 0, text_height = 0;
+ private Path path = new Path();
+ private int direction;
+
+ public VerticalTextView(Context context) {
+ super(context);
+ }
+
+ public VerticalTextView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.VerticalTextView);
+ direction = a.getInt(R.styleable.VerticalTextView_direction, 0);
+ a.recycle();
+
+ requestLayout();
+ invalidate();
+ }
+
+ public void setDirection(int direction) {
+ this.direction = direction;
+
+ requestLayout();
+ invalidate();
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ getPaint().getTextBounds(getText().toString(), 0, getText().length(), text_bounds);
+ text_width = (int) getPaint().measureText(getText().toString());
+ text_height = text_bounds.height() + Math.abs(text_width - text_bounds.width());
+ if (direction == ORIENTATION_LEFT_TO_RIGHT || direction == ORIENTATION_RIGHT_TO_LEFT) {
+ setMeasuredDimension(measureHeight(widthMeasureSpec), measureWidth(heightMeasureSpec));
+ } else if (direction == ORIENTATION_UP_TO_DOWN || direction == ORIENTATION_DOWN_TO_UP) {
+ setMeasuredDimension(measureWidth(widthMeasureSpec), measureHeight(heightMeasureSpec));
+ }
+ }
+
+ private int measureWidth(int measureSpec) {
+ int result;
+ int specMode = MeasureSpec.getMode(measureSpec);
+ int specSize = MeasureSpec.getSize(measureSpec);
+
+ if (specMode == MeasureSpec.EXACTLY) {
+ result = specSize;
+ } else {
+ result = text_height + getPaddingTop() + getPaddingBottom();
+ // result = text_bounds.height();
+ if (specMode == MeasureSpec.AT_MOST) {
+ result = Math.min(result, specSize);
+ }
+ }
+ return result;
+ }
+
+ private int measureHeight(int measureSpec) {
+ int result;
+ int specMode = MeasureSpec.getMode(measureSpec);
+ int specSize = MeasureSpec.getSize(measureSpec);
+
+ if (specMode == MeasureSpec.EXACTLY) {
+ result = specSize;
+ } else {
+ result = text_width + getPaddingLeft() + getPaddingRight();
+ // result = text_bounds.width();
+ if (specMode == MeasureSpec.AT_MOST) {
+ result = Math.min(result, specSize);
+ }
+ }
+ return result;
+ }
+
+ private int startX = 0, startY = 0;
+ private int stopX = 0, stopY = 0;
+ private int hOffset = 0, vOffset = 0;
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ //super.onDraw(canvas);
+
+ canvas.save();
+
+ switch (direction) {
+ case ORIENTATION_UP_TO_DOWN:
+ startX = (getWidth() - text_height >> 1);
+ startY = (getHeight() - text_width >> 1);
+ stopX = (getWidth() - text_height >> 1);
+ stopY = (getHeight() + text_width >> 1);
+ break;
+ case ORIENTATION_DOWN_TO_UP:
+ startX = (getWidth() + text_height >> 1);
+ startY = (getHeight() + text_width >> 1);
+ stopX = (getWidth() + text_height >> 1);
+ stopY = (getHeight() - text_width >> 1);
+ break;
+ case ORIENTATION_LEFT_TO_RIGHT:
+ startX = (getWidth() - text_width >> 1);
+ startY = (getHeight() + text_height >> 1);
+ stopX = (getWidth() + text_width >> 1);
+ stopY = (getHeight() + text_height >> 1);
+ break;
+ case ORIENTATION_RIGHT_TO_LEFT:
+ startX = (getWidth() + text_width >> 1);
+ startY = (getHeight() - text_height >> 1);
+ stopX = (getWidth() - text_width >> 1);
+ stopY = (getHeight() - text_height >> 1);
+ break;
+ }
+ if (text_height >= text_bounds.height()) {//adjust negative offset
+ hOffset = (text_bounds.height() - text_height) >> 1;
+ }
+ if (text_width >= text_bounds.width()) {//adjust negative offset
+ vOffset = (text_bounds.width() - text_width) >> 1;
+ }
+ path.moveTo(startX, startY);
+ path.lineTo(stopX, stopY);
+
+ this.getPaint().setColor(this.getCurrentTextColor());
+ //canvas.drawLine(startX, startY, stopX, stopY, this.getPaint());
+ canvas.drawTextOnPath(getText().toString(), path, hOffset, vOffset, this.getPaint());
+
+ canvas.restore();
+ }
+
+ @Override
+ public void setText(CharSequence text, BufferType type) {
+ super.setText(text, type);
+
+ //https://github.com/yoog568/VerticalTextView/issues/3
+ requestLayout();
+ // redraw view with new layout
+ invalidate();
+ }
}