-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 960df34
Showing
12 changed files
with
510 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
*.iml | ||
.idea | ||
*.idb | ||
out | ||
|
||
.DS_Store | ||
|
||
target/ | ||
|
||
*~ | ||
*.swp | ||
*.orig | ||
|
||
bin/ | ||
gen/ | ||
.settings/ | ||
.DS_Store | ||
proguard/ | ||
build.xml | ||
build.properties | ||
ant.properties | ||
local.properties | ||
pkgs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.vincestyling.android" | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
|
||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" /> | ||
|
||
<application android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar"> | ||
<activity | ||
android:name="MainActivity" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# To enable ProGuard in your project, edit project.properties | ||
# to define the proguard.config property as described in that file. | ||
# | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in ${sdk.dir}/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the ProGuard | ||
# include property in project.properties. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This file is automatically generated by Android Tools. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must be checked in Version Control Systems. | ||
# | ||
# To customize properties used by the Ant build system edit | ||
# "ant.properties", and override values to adapt the script to your | ||
# project structure. | ||
# | ||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): | ||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt | ||
|
||
# Project target. | ||
target=android-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<rotate xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:drawable="@drawable/book_detail_arrow_ltr" | ||
android:fromDegrees="90" android:toDegrees="0" | ||
android:pivotX="50%" android:pivotY="50%"/> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<rotate xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:drawable="@drawable/book_detail_arrow_ltr" | ||
android:fromDegrees="-90" android:toDegrees="0" | ||
android:pivotX="50%" android:pivotY="50%"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:vincestyling="http://schemas.android.com/apk/res/com.vincestyling.android" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="#ffffff" | ||
android:paddingTop="10dp"> | ||
|
||
<RelativeLayout | ||
android:id="@+id/lotEllipsize" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:padding="10dp"> | ||
|
||
<com.vincestyling.android.ui.EllipsizeEndTextView | ||
android:id="@+id/txvEllipsize" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
vincestyling:textSize="15sp" | ||
vincestyling:textColor="#2b2b2b" | ||
vincestyling:maxLines="4" | ||
vincestyling:lineSpacing="10dp"/> | ||
|
||
<TextView | ||
android:id="@+id/btnExpand" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentRight="true" | ||
android:layout_below="@id/txvEllipsize" | ||
android:text="@string/book_detail_summary_expand" | ||
android:textSize="14sp" | ||
android:textColor="#909090" | ||
android:drawableRight="@drawable/book_detail_arrow_down" | ||
android:drawablePadding="2dp"/> | ||
|
||
</RelativeLayout> | ||
|
||
</LinearLayout> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<string name="app_name">ellipsize-textview</string> | ||
|
||
<string name="book_detail_summary_collapse">收起</string> | ||
<string name="book_detail_summary_expand">展开</string> | ||
|
||
<string name="ellipsize_txt_chn"> | ||
大白鲨以其好奇心而闻名 ——它经常从水中抬起它的头,并且更令在水中的人担心的是,它经常通过啃咬的方式去探索不熟悉的目标, 还会将一切它们感兴趣的东西吞下去:肉、骨头、木块,甚至钢笔、玻璃瓶什么的(它们的胃内有一层坚韧的壁,这样吞入的东西不会弄伤它们)。许多鲨鱼生物学家认为对人类的进攻是这种探索行为的结果,由于大白鲨令人难以置信的锋利牙齿和上下颚的力量,很可能会轻易地导致人的死亡。\n | ||
即便如此,现今仍然有很多的冒险者愿意以生命作为代价去揭示大白鲨不为人知的一面。在他们眼中,大白鲨智力高,好奇心强,最重要的是它们乐于与人接触。当你亲切的去对待它时,它亦会亲切地去对待你。 | ||
</string> | ||
|
||
|
||
<string name="ellipsize_txt_eng"> | ||
Android powers hundreds of millions of mobile devices in more than 190 countries around the world. It\'s the largest installed base of any mobile platform and growing fast—every day another million users power up their Android devices for the first time and start looking for apps, games, and other digital content.\n | ||
Android gives you a world-class platform for creating apps and games for Android users everywhere, as well as an open marketplace for distributing to them instantly. | ||
</string> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<declare-styleable name="EllipsizeEndTextView"> | ||
<attr name="maxLines" format="integer" /> | ||
<attr name="textColor" format="color" /> | ||
<attr name="textSize" format="dimension" /> | ||
<attr name="lineSpacing" format="dimension" /> | ||
</declare-styleable> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.vincestyling.android; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.TextView; | ||
import com.vincestyling.android.ui.EllipsizeEndTextView; | ||
|
||
public class MainActivity extends Activity implements View.OnClickListener { | ||
private EllipsizeEndTextView mTxvEllipsize; | ||
private TextView mBtnExpand; | ||
private View mLotEllipsize; | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.main); | ||
|
||
mTxvEllipsize = (EllipsizeEndTextView) findViewById(R.id.txvEllipsize); | ||
|
||
mLotEllipsize = findViewById(R.id.lotEllipsize); | ||
|
||
mBtnExpand = (TextView) findViewById(R.id.btnExpand); | ||
|
||
mTxvEllipsize.setOnMeasureDoneListener(new EllipsizeEndTextView.OnMeasureDoneListener() { | ||
@Override | ||
public void onMeasureDone(View v) { | ||
if (mTxvEllipsize.isExpanded()) { | ||
mBtnExpand.setVisibility(View.GONE); | ||
} else { | ||
mLotEllipsize.setOnClickListener(MainActivity.this); | ||
} | ||
mTxvEllipsize.setOnMeasureDoneListener(null); | ||
} | ||
}); | ||
mTxvEllipsize.setText(getString(R.string.ellipsize_txt_chn)); | ||
} | ||
|
||
@Override | ||
public void onClick(View v) { | ||
mTxvEllipsize.setOnMeasureDoneListener(new EllipsizeEndTextView.OnMeasureDoneListener() { | ||
@Override | ||
public void onMeasureDone(View v) { | ||
int resId = mTxvEllipsize.isExpanded() ? R.string.book_detail_summary_collapse : R.string.book_detail_summary_expand; | ||
mBtnExpand.setText(resId); | ||
resId = mTxvEllipsize.isExpanded() ? R.drawable.book_detail_arrow_up : R.drawable.book_detail_arrow_down; | ||
mBtnExpand.setCompoundDrawablesWithIntrinsicBounds(0, 0, resId, 0); | ||
} | ||
}); | ||
mTxvEllipsize.elipsizeSwitch(); | ||
} | ||
|
||
} |
Oops, something went wrong.