Skip to content

Commit

Permalink
Merge pull request #5 from leon3000/develop
Browse files Browse the repository at this point in the history
fix last line
  • Loading branch information
Leon authored Mar 20, 2017
2 parents 1ca4627 + 4eb1f21 commit 65a2944
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ private void performClipboardCheck() {
if (description.hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
CharSequence sequence = item.getText();
if (sequence != null) {
String text = sequence.toString();
String text = sequence.toString() + "\r\n";
mTextSnaper.showContent(text, source);
}
} else if (description.hasMimeType(ClipDescription.MIMETYPE_TEXT_HTML)) {
CharSequence sequence = item.coerceToText(this);
if (sequence != null) {
String text = sequence.toString();
String text = sequence.toString() + "\r\n";
mTextSnaper.showContent(text, source);
}
} else if (description.hasMimeType(ClipDescription.MIMETYPE_TEXT_INTENT)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ protected void onDraw(Canvas canvas) {
paint.drawableState = getDrawableState();
mViewWidth = getMeasuredWidth();
String text = getText().toString();
mLineY = 0;
mLineY += getTextSize();
mLineY = (int)getTextSize();
Layout layout = getLayout();

if (layout == null) {
Expand Down
19 changes: 9 additions & 10 deletions app/src/main/java/com/droidrise/snaptext/TextSnaper.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,17 @@ public void onClick(View view) {
}
});

TextView tv = (TextView) topView.findViewById(R.id.text_content);
if (Locale.getDefault().getLanguage().equals(new Locale("zh").getLanguage())) {
if (Locale.getDefault().getCountry().equals(new Locale("zh","TW").getCountry())) {
// Set content to traditional for TaiWan
tv.setTypeface(mFontTitle);
} else {
tv.setTypeface(mFontContent);
}
TextView contentView = (TextView) topView.findViewById(R.id.text_content);
if (Locale.getDefault().getCountry().equals(new Locale("zh","TW").getCountry())
|| Locale.getDefault().getCountry().equals(new Locale("zh","HK").getCountry())) {
// Set content to traditional for TaiWan & HongKong
contentView.setTypeface(mFontTitle);
} else {
contentView.setTypeface(mFontContent);
}
tv.setText(content);
contentView.setText(content);

tv = (TextView) topView.findViewById(R.id.text_data_source);
TextView tv = (TextView) topView.findViewById(R.id.text_data_source);
tv.setTypeface(mFontTitle);
if (source != null) {
tv.setText(mContext.getString(R.string.snap_from) + " " + source);
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/res/layout/view_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@
android:textColor="@color/colorSnapTitle" />

<!-- Text content -->
<!--<com.bluejamesbond.text.DocumentView-->
<!--xmlns:ext="https://schemas.android.com/apk/res-auto"-->
<!--android:id="@+id/text_content"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--ext:documentView_textSize="20sp"-->
<!--ext:documentView_antialias="true"-->
<!--ext:documentView_cacheConfig="auto_quality"-->
<!--ext:documentView_hyphen="-"-->
<!--ext:documentView_lineHeightMultiplier="2.0"-->
<!--ext:documentView_reverse="false"-->
<!--ext:documentView_textAlignment="justified"-->
<!--ext:documentView_textColor="@color/colorSnapText"-->
<!--ext:documentView_textFormat="plain"-->
<!--ext:documentView_textSubPixel="false"-->
<!--ext:documentView_textTypefacePath="fonts/fz_suxinshiliukai_jian.ttf" />-->

<com.droidrise.snaptext.JustifyTextView
android:id="@+id/text_content"
android:layout_width="wrap_content"
Expand Down

0 comments on commit 65a2944

Please sign in to comment.