├── .classpath
├── .gitignore
├── .project
├── AndroidManifest.xml
├── Readme.markdown
├── default.properties
├── proguard.cfg
├── res
├── drawable-hdpi
│ └── icon.png
├── drawable-ldpi
│ └── icon.png
├── drawable-mdpi
│ └── icon.png
├── layout
│ └── main.xml
└── values
│ └── strings.xml
└── src
└── com
└── verticaltextview
├── MainActivity.java
└── VerticalTextView.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | gen/
3 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | VerticalTextView
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Readme.markdown:
--------------------------------------------------------------------------------
1 | VerticalTextView
2 | ================
3 |
4 | This is an extension of the TextView view that prints the text rotated counter-clockwise by 90 degrees.
5 |
6 | 
7 |
--------------------------------------------------------------------------------
/default.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "build.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-10
12 |
--------------------------------------------------------------------------------
/proguard.cfg:
--------------------------------------------------------------------------------
1 | -optimizationpasses 5
2 | -dontusemixedcaseclassnames
3 | -dontskipnonpubliclibraryclasses
4 | -dontpreverify
5 | -verbose
6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7 |
8 | -keep public class * extends android.app.Activity
9 | -keep public class * extends android.app.Application
10 | -keep public class * extends android.app.Service
11 | -keep public class * extends android.content.BroadcastReceiver
12 | -keep public class * extends android.content.ContentProvider
13 | -keep public class * extends android.app.backup.BackupAgentHelper
14 | -keep public class * extends android.preference.Preference
15 | -keep public class com.android.vending.licensing.ILicensingService
16 |
17 | -keepclasseswithmembernames class * {
18 | native ;
19 | }
20 |
21 | -keepclasseswithmembernames class * {
22 | public (android.content.Context, android.util.AttributeSet);
23 | }
24 |
25 | -keepclasseswithmembernames class * {
26 | public (android.content.Context, android.util.AttributeSet, int);
27 | }
28 |
29 | -keepclassmembers enum * {
30 | public static **[] values();
31 | public static ** valueOf(java.lang.String);
32 | }
33 |
34 | -keep class * implements android.os.Parcelable {
35 | public static final android.os.Parcelable$Creator *;
36 | }
37 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/venator85/VerticalTextView/3548308555c0dc4a2337ffe21260d9fb585c850a/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/venator85/VerticalTextView/3548308555c0dc4a2337ffe21260d9fb585c850a/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/venator85/VerticalTextView/3548308555c0dc4a2337ffe21260d9fb585c850a/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
13 |
16 |
17 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World, MainActivity!
4 | VerticalTextView
5 |
6 |
--------------------------------------------------------------------------------
/src/com/verticaltextview/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.verticaltextview;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | public class MainActivity extends Activity {
7 | /** Called when the activity is first created. */
8 | @Override
9 | public void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.main);
12 | }
13 | }
--------------------------------------------------------------------------------
/src/com/verticaltextview/VerticalTextView.java:
--------------------------------------------------------------------------------
1 | package com.verticaltextview;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Rect;
6 | import android.text.TextPaint;
7 | import android.util.AttributeSet;
8 | import android.widget.TextView;
9 |
10 | public class VerticalTextView extends TextView {
11 | private Rect bounds = new Rect();
12 | private TextPaint textPaint;
13 | private int color;
14 |
15 | public VerticalTextView(Context context) {
16 | super(context);
17 | }
18 |
19 | public VerticalTextView(Context context, AttributeSet attrs) {
20 | super(context, attrs);
21 | color = getCurrentTextColor();
22 | }
23 |
24 | @Override
25 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
26 | textPaint = getPaint();
27 | textPaint.getTextBounds((String) getText(), 0, getText().length(), bounds);
28 | setMeasuredDimension((int) (bounds.height() + textPaint.descent()), bounds.width());
29 | }
30 |
31 | @Override
32 | protected void onDraw(Canvas canvas) {
33 | textPaint.setColor(color);
34 | canvas.rotate(-90, bounds.width(), 0);
35 | canvas.drawText((String) getText(), 0, -bounds.width() + bounds.height(), textPaint);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------