-
Notifications
You must be signed in to change notification settings - Fork 892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text size and brightness preferences to show a preview under seek bar #1522
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.quran.labs.androidquran.ui.preference | ||
|
||
import android.content.Context | ||
import android.graphics.Color | ||
import android.util.AttributeSet | ||
import android.view.View | ||
import android.widget.SeekBar | ||
|
||
class SeekBarTextBrightnessPreference(context: Context?, attrs: AttributeSet?) : SeekBarPreference(context, attrs) { | ||
|
||
override fun getPreviewVisibility(): Int = View.VISIBLE | ||
|
||
override fun onProgressChanged(seek: SeekBar, value: Int, fromTouch: Boolean) { | ||
super.onProgressChanged(seek, value, fromTouch) | ||
val lineColor = Color.argb(value, 255, 255, 255) | ||
mPreviewText.setTextColor(lineColor) | ||
mArabicPreviewText.setTextColor(lineColor) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.quran.labs.androidquran.ui.preference | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.View | ||
import android.widget.SeekBar | ||
|
||
class SeekBarTextSizePreference(context: Context?, attrs: AttributeSet?) : SeekBarPreference(context, attrs) { | ||
|
||
override fun getPreviewVisibility(): Int = View.VISIBLE | ||
|
||
override fun onProgressChanged(seek: SeekBar, value: Int, fromTouch: Boolean) { | ||
super.onProgressChanged(seek, value, fromTouch) | ||
mPreviewText.textSize = value.toFloat() | ||
mArabicPreviewText.textSize = value.toFloat() * com.quran.labs.androidquran.ui.translation.TranslationAdapter.ARABIC_MULTIPLIER | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,28 @@ | |
/> | ||
</LinearLayout> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding these 2 text views under the seekbar, one for arabic and one for the translated language. |
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<TextView | ||
android:id="@+id/pref_preview" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:text="@string/prefs_preview" | ||
android:gravity="center" | ||
android:layout_weight="1"/> | ||
|
||
<TextView | ||
android:id="@+id/arabic_preview" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:text="معاينة" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh - i see why now - will just show one depending on the language |
||
android:gravity="center" | ||
android:layout_weight="1"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout | ||
android:id="@android:id/widget_frame" | ||
android:layout_width="wrap_content" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,28 @@ | |
/> | ||
</LinearLayout> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<TextView | ||
android:id="@+id/pref_preview" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:text="@string/prefs_preview" | ||
android:gravity="center" | ||
android:layout_weight="1"/> | ||
|
||
<TextView | ||
android:id="@+id/arabic_preview" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:text="معاينة" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
android:gravity="center" | ||
android:layout_weight="1"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout | ||
android:id="@android:id/widget_frame" | ||
android:layout_width="wrap_content" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
making this public so SeekBarTextSizePreference can show an accurate preview of arabic text size