mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Fix captcha, FAQ, issues page, icons on settings buttons
This commit is contained in:
parent
70939cbac6
commit
d4afba929b
10 changed files with 107 additions and 16 deletions
|
@ -22,6 +22,7 @@ import com.futo.platformplayer.views.FeedStyle
|
|||
import com.futo.platformplayer.views.fields.DropdownFieldOptionsId
|
||||
import com.futo.platformplayer.views.fields.FormField
|
||||
import com.futo.platformplayer.views.fields.FieldForm
|
||||
import com.futo.platformplayer.views.fields.FormFieldButton
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
@ -45,8 +46,9 @@ class Settings : FragmentedStorageFileJson() {
|
|||
|
||||
@FormField(
|
||||
"Manage Polycentric identity", FieldForm.BUTTON,
|
||||
"Manage your Polycentric identity", -3
|
||||
"Manage your Polycentric identity", -4
|
||||
)
|
||||
@FormFieldButton(R.drawable.ic_person)
|
||||
fun managePolycentricIdentity() {
|
||||
SettingsActivity.getActivity()?.let {
|
||||
if (StatePolycentric.instance.processHandle != null) {
|
||||
|
@ -58,12 +60,26 @@ class Settings : FragmentedStorageFileJson() {
|
|||
}
|
||||
|
||||
@FormField(
|
||||
"Open FAQ", FieldForm.BUTTON,
|
||||
"Get answers to common questions", -2
|
||||
"Show FAQ", FieldForm.BUTTON,
|
||||
"Get answers to common questions", -3
|
||||
)
|
||||
@FormFieldButton(R.drawable.ic_quiz)
|
||||
fun openFAQ() {
|
||||
try {
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("https://grayjay.app/faq.html"))
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(Settings.URL_FAQ))
|
||||
SettingsActivity.getActivity()?.startActivity(browserIntent);
|
||||
} catch (e: Throwable) {
|
||||
//Ignored
|
||||
}
|
||||
}
|
||||
@FormField(
|
||||
"Show Issues", FieldForm.BUTTON,
|
||||
"A list of user-reported and self-reported issues", -2
|
||||
)
|
||||
@FormFieldButton(R.drawable.ic_data_alert)
|
||||
fun openIssues() {
|
||||
try {
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/futo-org/grayjay-android/issues"))
|
||||
SettingsActivity.getActivity()?.startActivity(browserIntent);
|
||||
} catch (e: Throwable) {
|
||||
//Ignored
|
||||
|
@ -74,6 +90,7 @@ class Settings : FragmentedStorageFileJson() {
|
|||
"Submit feedback", FieldForm.BUTTON,
|
||||
"Give feedback on the application", -1
|
||||
)
|
||||
@FormFieldButton(R.drawable.ic_bug)
|
||||
fun submitFeedback() {
|
||||
try {
|
||||
val i = Intent(Intent.ACTION_VIEW);
|
||||
|
@ -93,6 +110,7 @@ class Settings : FragmentedStorageFileJson() {
|
|||
"Manage Tabs", FieldForm.BUTTON,
|
||||
"Change tabs visible on the home screen", -1
|
||||
)
|
||||
@FormFieldButton(R.drawable.ic_tabs)
|
||||
fun manageTabs() {
|
||||
try {
|
||||
SettingsActivity.getActivity()?.let {
|
||||
|
@ -615,6 +633,7 @@ class Settings : FragmentedStorageFileJson() {
|
|||
|
||||
companion object {
|
||||
private const val TAG = "Settings";
|
||||
const val URL_FAQ = "https://grayjay.app/faq.html";
|
||||
|
||||
private var _isFirst = true;
|
||||
|
||||
|
|
|
@ -220,6 +220,13 @@ class MenuBottomBarFragment : MainActivityFragment() {
|
|||
buttons.removeAt(buyIndex)
|
||||
buttons.add(0, button)
|
||||
}
|
||||
//Force faq to be second
|
||||
val faqIndex = buttons.indexOfFirst { b -> b.id == 97 };
|
||||
if (faqIndex != -1) {
|
||||
val button = buttons[faqIndex]
|
||||
buttons.removeAt(faqIndex)
|
||||
buttons.add(1, button)
|
||||
}
|
||||
|
||||
for (data in buttons) {
|
||||
val button = MenuButton(context, data, _fragment, true);
|
||||
|
@ -289,6 +296,9 @@ class MenuBottomBarFragment : MainActivityFragment() {
|
|||
if (!StatePayment.instance.hasPaid) {
|
||||
newCurrentButtonDefinitions.add(ButtonDefinition(98, R.drawable.ic_paid, R.drawable.ic_paid, R.string.buy, canToggle = false, { it.currentMain is BuyFragment }, { it.navigate<BuyFragment>() }))
|
||||
}
|
||||
newCurrentButtonDefinitions.add(ButtonDefinition(97, R.drawable.ic_quiz, R.drawable.ic_quiz, R.string.faq, canToggle = false, { false }, {
|
||||
it.navigate<BrowserFragment>(Settings.URL_FAQ);
|
||||
}))
|
||||
|
||||
//Add conditional buttons here, when you add a conditional button, be sure to add the register and unregister events for when the button needs to be updated
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import com.futo.platformplayer.constructs.Event0
|
|||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import com.google.android.material.shape.ShapeAppearanceModel
|
||||
|
||||
class BigButton : LinearLayout {
|
||||
open class BigButton : LinearLayout {
|
||||
private val _root: LinearLayout;
|
||||
private val _icon: ShapeableImageView;
|
||||
private val _textPrimary: TextView;
|
||||
|
@ -78,6 +78,10 @@ class BigButton : LinearLayout {
|
|||
_textSecondary.text = text;
|
||||
return this;
|
||||
}
|
||||
fun withSecondaryTextMaxLines(lines: Int): BigButton {
|
||||
_textSecondary.maxLines = lines;
|
||||
return this;
|
||||
}
|
||||
|
||||
fun withIcon(resourceId: Int, rounded: Boolean = false): BigButton {
|
||||
if (resourceId != -1) {
|
||||
|
|
|
@ -4,13 +4,21 @@ import android.content.Context
|
|||
import android.util.AttributeSet
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.futo.platformplayer.R
|
||||
import com.futo.platformplayer.constructs.Event2
|
||||
import com.futo.platformplayer.dp
|
||||
import com.futo.platformplayer.views.buttons.BigButton
|
||||
import java.lang.reflect.Field
|
||||
import java.lang.reflect.Method
|
||||
|
||||
class ButtonField : LinearLayout, IField {
|
||||
|
||||
@Target(AnnotationTarget.FIELD, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class FormFieldButton(val drawable: Int = 0)
|
||||
|
||||
class ButtonField : BigButton, IField {
|
||||
override var descriptor: FormField? = null;
|
||||
private var _obj : Any? = null;
|
||||
private var _method : Method? = null;
|
||||
|
@ -26,17 +34,22 @@ class ButtonField : LinearLayout, IField {
|
|||
return null;
|
||||
};
|
||||
|
||||
private val _title : TextView;
|
||||
private val _subtitle : TextView;
|
||||
//private val _title : TextView;
|
||||
//private val _subtitle : TextView;
|
||||
|
||||
override val onChanged = Event2<IField, Any>();
|
||||
|
||||
constructor(context : Context, attrs : AttributeSet? = null) : super(context, attrs){
|
||||
inflate(context, R.layout.field_button, this);
|
||||
_title = findViewById(R.id.field_title);
|
||||
_subtitle = findViewById(R.id.field_subtitle);
|
||||
//inflate(context, R.layout.field_button, this);
|
||||
//_title = findViewById(R.id.field_title);
|
||||
//_subtitle = findViewById(R.id.field_subtitle);
|
||||
|
||||
setOnClickListener {
|
||||
layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply {
|
||||
val dp5 = 5.dp(context.resources);
|
||||
setMargins(0, dp5, 0, dp5)
|
||||
};
|
||||
|
||||
super.onClick.subscribe {
|
||||
if(_method?.parameterCount == 1)
|
||||
_method?.invoke(_obj, context);
|
||||
else if(_method?.parameterCount == 2)
|
||||
|
@ -51,13 +64,17 @@ class ButtonField : LinearLayout, IField {
|
|||
this._obj = obj;
|
||||
|
||||
val attrField = method.getAnnotation(FormField::class.java);
|
||||
val attrButtonField = method.getAnnotation(FormFieldButton::class.java);
|
||||
if(attrField != null) {
|
||||
_title.text = attrField.title;
|
||||
_subtitle.text = attrField.subtitle;
|
||||
super.withPrimaryText(attrField.title)
|
||||
.withSecondaryText(attrField.subtitle)
|
||||
.withSecondaryTextMaxLines(2);
|
||||
descriptor = attrField;
|
||||
}
|
||||
else
|
||||
_title.text = method.name;
|
||||
super.withPrimaryText(method.name);
|
||||
if(attrButtonField != null)
|
||||
super.withIcon(attrButtonField.drawable, false);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
10
app/src/main/res/drawable/ic_bug.xml
Normal file
10
app/src/main/res/drawable/ic_bug.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M480,760Q546,760 593,713Q640,666 640,600L640,440Q640,374 593,327Q546,280 480,280Q414,280 367,327Q320,374 320,440L320,600Q320,666 367,713Q414,760 480,760ZM400,640L560,640L560,560L400,560L400,640ZM400,480L560,480L560,400L400,400L400,480ZM480,520Q480,520 480,520Q480,520 480,520L480,520Q480,520 480,520Q480,520 480,520Q480,520 480,520Q480,520 480,520L480,520Q480,520 480,520Q480,520 480,520ZM480,840Q415,840 359.5,808Q304,776 272,720L160,720L160,640L244,640Q241,620 240.5,600Q240,580 240,560L160,560L160,480L240,480Q240,460 240.5,440Q241,420 244,400L160,400L160,320L272,320Q286,297 303.5,277Q321,257 344,242L280,176L336,120L422,206Q450,197 479,197Q508,197 536,206L624,120L680,176L614,242Q637,257 655.5,276.5Q674,296 688,320L800,320L800,400L716,400Q719,420 719.5,440Q720,460 720,480L800,480L800,560L720,560Q720,580 719.5,600Q719,620 716,640L800,640L800,720L688,720Q656,776 600.5,808Q545,840 480,840Z"/>
|
||||
</vector>
|
10
app/src/main/res/drawable/ic_data_alert.xml
Normal file
10
app/src/main/res/drawable/ic_data_alert.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M120,800L120,720L600,720L600,800L120,800ZM640,520Q557,520 498.5,461.5Q440,403 440,320Q440,237 498.5,178.5Q557,120 640,120Q723,120 781.5,178.5Q840,237 840,320Q840,403 781.5,461.5Q723,520 640,520ZM120,480L120,400L372,400Q379,422 388,442Q397,462 410,480L120,480ZM120,640L120,560L496,560Q519,574 545,583.5Q571,593 600,597L600,640L120,640ZM620,360L660,360L660,200L620,200L620,360ZM640,440Q648,440 654,434Q660,428 660,420Q660,412 654,406Q648,400 640,400Q632,400 626,406Q620,412 620,420Q620,428 626,434Q632,440 640,440Z"/>
|
||||
</vector>
|
10
app/src/main/res/drawable/ic_quiz.xml
Normal file
10
app/src/main/res/drawable/ic_quiz.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M560,600Q577,600 589.5,587.5Q602,575 602,558Q602,541 589.5,528.5Q577,516 560,516Q543,516 530.5,528.5Q518,541 518,558Q518,575 530.5,587.5Q543,600 560,600ZM530,472L590,472Q590,443 596,429.5Q602,416 624,394Q654,364 664,345.5Q674,327 674,302Q674,257 642.5,228.5Q611,200 560,200Q519,200 488.5,223Q458,246 446,284L500,306Q509,281 524.5,268.5Q540,256 560,256Q584,256 599,269.5Q614,283 614,306Q614,320 606,332.5Q598,345 578,364Q545,393 537.5,409.5Q530,426 530,472ZM320,720Q287,720 263.5,696.5Q240,673 240,640L240,160Q240,127 263.5,103.5Q287,80 320,80L800,80Q833,80 856.5,103.5Q880,127 880,160L880,640Q880,673 856.5,696.5Q833,720 800,720L320,720ZM320,640L800,640Q800,640 800,640Q800,640 800,640L800,160Q800,160 800,160Q800,160 800,160L320,160Q320,160 320,160Q320,160 320,160L320,640Q320,640 320,640Q320,640 320,640ZM160,880Q127,880 103.5,856.5Q80,833 80,800L80,240L160,240L160,800Q160,800 160,800Q160,800 160,800L720,800L720,880L160,880ZM320,160L320,160Q320,160 320,160Q320,160 320,160L320,640Q320,640 320,640Q320,640 320,640L320,640Q320,640 320,640Q320,640 320,640L320,160Q320,160 320,160Q320,160 320,160Z"/>
|
||||
</vector>
|
10
app/src/main/res/drawable/ic_tabs.xml
Normal file
10
app/src/main/res/drawable/ic_tabs.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M160,720L800,720Q800,720 800,720Q800,720 800,720L800,400L520,400L520,240L160,240Q160,240 160,240Q160,240 160,240L160,720Q160,720 160,720Q160,720 160,720ZM160,800Q127,800 103.5,776.5Q80,753 80,720L80,240Q80,207 103.5,183.5Q127,160 160,160L800,160Q833,160 856.5,183.5Q880,207 880,240L880,720Q880,753 856.5,776.5Q833,800 800,800L160,800ZM160,720Q160,720 160,720Q160,720 160,720L160,240Q160,240 160,240Q160,240 160,240L160,240Q160,240 160,240Q160,240 160,240L160,720Q160,720 160,720Q160,720 160,720L160,720Z"/>
|
||||
</vector>
|
|
@ -20,6 +20,7 @@
|
|||
<string name="history">History</string>
|
||||
<string name="sources">Sources</string>
|
||||
<string name="buy">Buy</string>
|
||||
<string name="faq">FAQ</string>
|
||||
<string name="the_top_source_will_be_considered_primary">The top source will be considered primary</string>
|
||||
<string name="defaults">Defaults</string>
|
||||
<string name="home_screen">Home Screen</string>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 239960b932c00a194cf2af6350bb5bde4207acf8
|
||||
Subproject commit a1d432865ef87cc4860be998a02ba95f60ccfcd8
|
Loading…
Add table
Reference in a new issue