-
Notifications
You must be signed in to change notification settings - Fork 17
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
Showing
6 changed files
with
169 additions
and
23 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
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
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
76 changes: 76 additions & 0 deletions
76
testing-app/src/main/java/net/studymongolian/testingapp/MongolTextViewSpacingActivity.java
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,76 @@ | ||
package net.studymongolian.testingapp; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
import android.widget.RadioButton; | ||
import android.widget.SeekBar; | ||
import android.widget.TextView; | ||
|
||
import net.studymongolian.mongollibrary.MongolTextView; | ||
|
||
public class MongolTextViewSpacingActivity extends AppCompatActivity { | ||
|
||
private static final String TEXT = "ᠨᠢᠭᠡ ᠬᠣᠶᠠᠷ ᠭᠣᠷᠪᠠ ᠳᠥᠷᠪᠡ ᠲᠠᠪᠤ ᠵᠢᠷᠭᠤᠭᠠ ᠳᠣᠯᠣᠭᠠ ᠨᠠ\u200dᠢᠮᠠ ᠶᠢᠰᠦ ᠠᠷᠪᠠ ᠠᠷᠪᠠᠨ ᠨᠢᠭᠡ ᠠᠷᠪᠠᠨ ᠬᠣᠶᠠᠷ ᠠᠷᠪᠠᠨ ᠭᠣᠷᠪᠠ ᠠᠷᠪᠠᠨ ᠳᠥᠷᠪᠡ ᠠᠷᠪᠠᠨ ᠲᠠᠪᠤ ᠠᠷᠪᠠᠨ ᠵᠢᠷᠭᠤᠭᠠ ᠠᠷᠪᠠᠨ ᠳᠣᠯᠣᠭᠠ ᠠᠷᠪᠠᠨ ᠨᠠ\u200dᠢᠮᠠ ᠠᠷᠪᠠ ᠶᠢᠰᠦ ᠬᠣᠷᠢ \uD83D\uDE42 ᠬᠣᠷᠢᠨ ᠨᠢᠭᠡ ᠬᠣᠷᠢᠨ ᠬᠣᠶᠠᠷ ᠬᠣᠷᠢᠨ ᠭᠣᠷᠪᠠ ᠬᠣᠷᠢᠨ ᠳᠥᠷᠪᠡ ᠬᠣᠷᠢᠨ ᠲᠠᠪᠤ ᠬᠣᠷᠢᠨ ᠵᠢᠷᠭᠤᠭᠠ ᠬᠣᠷᠢᠨ ᠳᠣᠯᠣᠭᠠ ᠬᠣᠷᠢᠨ ᠨᠠ\u200dᠢᠮᠠ ᠬᠣᠷᠢ ᠶᠢᠰᠦ ᠭᠣᠴᠢ one two three four five six seven eight nine ten 一二三四五六七八九十\uD83D\uDE03\uD83D\uDE0A\uD83D\uDE1C\uD83D\uDE01\uD83D\uDE2C\uD83D\uDE2E\uD83D\uDC34\uD83D\uDC02\uD83D\uDC2B\uD83D\uDC11\uD83D\uDC10ᆾ①②③㉑㊿〖汉字〗한국어モンゴル語English?︽ᠮᠣᠩᠭᠣᠯ︖︾"; | ||
|
||
MongolTextView tvSampleText; | ||
TextView tvLineHeight; | ||
SeekBar seekBar; | ||
RadioButton rbAdd; | ||
RadioButton rbMult; | ||
|
||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_mtv_spacing); | ||
|
||
seekBar = findViewById(R.id.seekBar); | ||
tvSampleText = findViewById(R.id.tv_sample_text); | ||
tvSampleText.setText(TEXT); | ||
tvLineHeight = findViewById(R.id.tv_line_height); | ||
seekBar.setOnSeekBarChangeListener(seekBarChangeListener); | ||
rbAdd = findViewById(R.id.radioButtonAdd); | ||
rbMult = findViewById(R.id.radioButtonMultiply); | ||
|
||
} | ||
|
||
private SeekBar.OnSeekBarChangeListener seekBarChangeListener = new SeekBar.OnSeekBarChangeListener() { | ||
@Override | ||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { | ||
if (rbAdd.isChecked()) { | ||
tvSampleText.setLineSpacing(progress, 1); | ||
setLabels(progress, 1); | ||
} else { | ||
float multiplier = progress / 50f; | ||
tvSampleText.setLineSpacing(0, multiplier); | ||
setLabels(0, multiplier); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public void onStartTrackingTouch(SeekBar seekBar) { | ||
|
||
} | ||
|
||
@Override | ||
public void onStopTrackingTouch(SeekBar seekBar) { | ||
|
||
} | ||
}; | ||
|
||
private void setLabels(float add, float mult) { | ||
tvLineHeight.setText("Line height = " + tvSampleText.getLineWidth()); | ||
rbAdd.setText("Add " + add); | ||
rbMult.setText("Multiply " + mult); | ||
} | ||
|
||
public void onAddClick(View view) { | ||
seekBar.setProgress(0); | ||
} | ||
|
||
public void onMultiplyClick(View view) { | ||
seekBar.setProgress(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,80 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".MongolTextViewSpacingActivity"> | ||
|
||
<net.studymongolian.mongollibrary.MongolTextView | ||
android:id="@+id/tv_sample_text" | ||
android:layout_width="0dp" | ||
android:layout_height="0dp" | ||
android:layout_marginStart="8dp" | ||
android:layout_marginLeft="8dp" | ||
android:layout_marginTop="8dp" | ||
android:layout_marginEnd="8dp" | ||
android:layout_marginRight="8dp" | ||
android:layout_marginBottom="8dp" | ||
app:layout_constraintBottom_toTopOf="@+id/tv_line_height" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." | ||
app:textColor="#fff" /> | ||
|
||
<SeekBar | ||
android:id="@+id/seekBar" | ||
android:layout_width="0dp" | ||
android:layout_height="18dp" | ||
android:layout_marginStart="8dp" | ||
android:layout_marginLeft="8dp" | ||
android:layout_marginEnd="8dp" | ||
android:layout_marginRight="8dp" | ||
android:layout_marginBottom="24dp" | ||
android:max="100" | ||
android:progress="0" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
<RadioGroup | ||
android:id="@+id/radioGroup" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="8dp" | ||
android:layout_marginLeft="8dp" | ||
android:layout_marginBottom="8dp" | ||
app:layout_constraintBottom_toTopOf="@+id/seekBar" | ||
app:layout_constraintStart_toStartOf="parent"> | ||
|
||
<RadioButton | ||
android:id="@+id/radioButtonAdd" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" | ||
android:checked="true" | ||
android:onClick="onAddClick" | ||
android:text="Add" /> | ||
|
||
<RadioButton | ||
android:id="@+id/radioButtonMultiply" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" | ||
android:onClick="onMultiplyClick" | ||
android:text="Multiply" /> | ||
</RadioGroup> | ||
|
||
<TextView | ||
android:id="@+id/tv_line_height" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="8dp" | ||
android:layout_marginLeft="8dp" | ||
android:layout_marginBottom="8dp" | ||
android:text="TextView" | ||
app:layout_constraintBottom_toTopOf="@+id/radioGroup" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
</android.support.constraint.ConstraintLayout> |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<resources> | ||
<string name="app_name">Testing App</string> | ||
<string name="mongol_textview_activity_title">MongolTextView tests</string> | ||
<string name="mongol_textview_spacing_activity_title">MongolTextView text spacing</string> | ||
</resources> |