| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| package org.dolphinemu.dolphinemu.features.settings.ui.viewholder; | ||
|
|
||
| import android.content.Context; | ||
| import android.text.method.LinkMovementMethod; | ||
| import android.view.View; | ||
|
|
||
| import androidx.core.content.ContextCompat; | ||
|
|
||
| import org.dolphinemu.dolphinemu.R; | ||
| import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem; | ||
| import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter; | ||
|
|
||
| public final class HeaderHyperLinkViewHolder extends HeaderViewHolder | ||
| { | ||
| private Context mContext; | ||
|
|
||
| public HeaderHyperLinkViewHolder(View itemView, SettingsAdapter adapter, Context context) | ||
| { | ||
| super(itemView, adapter); | ||
| mContext = context; | ||
| itemView.setOnClickListener(null); | ||
| } | ||
|
|
||
| @Override | ||
| public void bind(SettingsItem item) | ||
| { | ||
| super.bind(item); | ||
| mHeaderName.setMovementMethod(LinkMovementMethod.getInstance()); | ||
| mHeaderName.setLinkTextColor(ContextCompat.getColor(mContext, R.color.dolphin_blue_secondary)); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| package org.dolphinemu.dolphinemu.features.settings.ui.viewholder; | ||
|
|
||
| import android.text.TextUtils; | ||
| import android.view.View; | ||
| import android.widget.TextView; | ||
|
|
||
| import androidx.annotation.Nullable; | ||
|
|
||
| import org.dolphinemu.dolphinemu.R; | ||
| import org.dolphinemu.dolphinemu.features.settings.model.view.InputStringSetting; | ||
| import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem; | ||
| import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter; | ||
|
|
||
| public final class InputStringSettingViewHolder extends SettingViewHolder | ||
| { | ||
| private InputStringSetting mInputString; | ||
|
|
||
| private TextView mTextSettingName; | ||
| private TextView mTextSettingDescription; | ||
|
|
||
| public InputStringSettingViewHolder(View itemView, SettingsAdapter adapter) | ||
| { | ||
| super(itemView, adapter); | ||
| } | ||
|
|
||
| @Override | ||
| protected void findViews(View root) | ||
| { | ||
| mTextSettingName = root.findViewById(R.id.text_setting_name); | ||
| mTextSettingDescription = root.findViewById(R.id.text_setting_description); | ||
| } | ||
|
|
||
| @Override | ||
| public void bind(SettingsItem item) | ||
| { | ||
| mInputString = (InputStringSetting) item; | ||
|
|
||
| String inputString = mInputString.getSelectedValue(getAdapter().getSettings()); | ||
|
|
||
| mTextSettingName.setText(item.getName()); | ||
|
|
||
| if (!TextUtils.isEmpty(inputString)) | ||
| { | ||
| mTextSettingDescription.setText(inputString); | ||
| } | ||
| else | ||
| { | ||
| mTextSettingDescription.setText(item.getDescription()); | ||
| } | ||
|
|
||
| setStyle(mTextSettingName, mInputString); | ||
| } | ||
|
|
||
| @Override | ||
| public void onClick(View clicked) | ||
| { | ||
| if (!mInputString.isEditable()) | ||
| { | ||
| showNotRuntimeEditableError(); | ||
| return; | ||
| } | ||
|
|
||
| int position = getAdapterPosition(); | ||
|
|
||
| getAdapter().onInputStringClick(mInputString, position); | ||
|
|
||
| setStyle(mTextSettingName, mInputString); | ||
| } | ||
|
|
||
| @Nullable @Override | ||
| protected SettingsItem getItem() | ||
| { | ||
| return mInputString; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <LinearLayout 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="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:orientation="vertical"> | ||
|
|
||
| <EditText | ||
| android:id="@+id/input" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| android:layout_marginStart="20dp" | ||
| android:layout_marginEnd="20dp" | ||
| android:ems="10" | ||
| android:inputType="text" | ||
| android:importantForAutofill="no" /> | ||
|
|
||
| </LinearLayout> |