Android: Convert FilePicker to Kotlin
This commit is contained in:
parent
1553477c09
commit
f7ad065408
|
@ -1,60 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractStringSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
||||
public final class FilePicker extends SettingsItem
|
||||
{
|
||||
private AbstractStringSetting mSetting;
|
||||
private int mRequestType;
|
||||
private String mDefaultPathRelativeToUserDirectory;
|
||||
|
||||
public FilePicker(Context context, AbstractStringSetting setting, int titleId, int descriptionId,
|
||||
int requestType, @Nullable String defaultPathRelativeToUserDirectory)
|
||||
{
|
||||
super(context, titleId, descriptionId);
|
||||
mSetting = setting;
|
||||
mRequestType = requestType;
|
||||
mDefaultPathRelativeToUserDirectory = defaultPathRelativeToUserDirectory;
|
||||
}
|
||||
|
||||
public String getSelectedValue()
|
||||
{
|
||||
return mSetting.getString();
|
||||
}
|
||||
|
||||
public void setSelectedValue(Settings settings, String selection)
|
||||
{
|
||||
mSetting.setString(settings, selection);
|
||||
}
|
||||
|
||||
public int getRequestType()
|
||||
{
|
||||
return mRequestType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getDefaultPathRelativeToUserDirectory()
|
||||
{
|
||||
return mDefaultPathRelativeToUserDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return TYPE_FILE_PICKER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractSetting getSetting()
|
||||
{
|
||||
return mSetting;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.dolphinemu.dolphinemu.features.settings.model.view
|
||||
|
||||
import android.content.Context
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractStringSetting
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings
|
||||
|
||||
class FilePicker(
|
||||
context: Context,
|
||||
override var setting: AbstractStringSetting,
|
||||
titleId: Int,
|
||||
descriptionId: Int,
|
||||
val requestType: Int,
|
||||
val defaultPathRelativeToUserDirectory: String?
|
||||
) : SettingsItem(context, titleId, descriptionId) {
|
||||
override val type: Int = TYPE_FILE_PICKER
|
||||
|
||||
fun getSelectedValue() : String {
|
||||
return setting.string
|
||||
}
|
||||
|
||||
fun setSelectedValue(settings: Settings, selection: String) {
|
||||
setting.setString(settings, selection)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue