show modpack description at modpack install page
This commit is contained in:
parent
349bd9facf
commit
d4695e8205
|
@ -3,6 +3,7 @@ package com.tungsten.fcl.ui.download;
|
|||
import static com.tungsten.fclcore.util.Logging.LOG;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -90,6 +91,7 @@ public class LocalModpackPage extends ModpackPage implements View.OnClickListene
|
|||
|
||||
this.manifest = null;
|
||||
isManuallyCreated = true;
|
||||
describe.setVisibility(View.GONE);
|
||||
} else if (exception != null) {
|
||||
LOG.log(Level.WARNING, "Failed to read modpack manifest", exception);
|
||||
FCLAlertDialog.Builder builder = new FCLAlertDialog.Builder(getContext());
|
||||
|
@ -115,6 +117,7 @@ public class LocalModpackPage extends ModpackPage implements View.OnClickListene
|
|||
if (updateVersion == null) {
|
||||
editText.setText(manifest.getName().trim());
|
||||
}
|
||||
describe.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
@ -163,4 +166,18 @@ public class LocalModpackPage extends ModpackPage implements View.OnClickListene
|
|||
}
|
||||
ModpackInstaller.installModpack(getContext(), task, updateVersion != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDescribe() {
|
||||
if (manifest != null) {
|
||||
FCLAlertDialog.Builder builder = new FCLAlertDialog.Builder(getContext());
|
||||
builder.setAlertLevel(FCLAlertDialog.AlertLevel.ALERT);
|
||||
builder.setCancelable(false);
|
||||
builder.setTitle(getContext().getString(R.string.modpack_description));
|
||||
CharSequence charSequence = Html.fromHtml(manifest.getDescription(), 0);
|
||||
builder.setMessage(charSequence);
|
||||
builder.setNegativeButton(getContext().getString(com.tungsten.fcllibrary.R.string.dialog_positive), null);
|
||||
builder.create().show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ public abstract class ModpackPage extends FCLTempPage implements View.OnClickLis
|
|||
protected FCLTextView author;
|
||||
|
||||
protected FCLButton install;
|
||||
protected FCLButton describe;
|
||||
|
||||
public ModpackPage(Context context, int id, FCLUILayout parent, int resId, Profile profile) {
|
||||
super(context, id, parent, resId);
|
||||
|
@ -48,7 +49,9 @@ public abstract class ModpackPage extends FCLTempPage implements View.OnClickLis
|
|||
version = findViewById(R.id.version);
|
||||
author = findViewById(R.id.author);
|
||||
install = findViewById(R.id.install);
|
||||
describe = findViewById(R.id.describe);
|
||||
install.setOnClickListener(this);
|
||||
describe.setOnClickListener(this);
|
||||
ThemeEngine.getInstance().registerEvent(infoLayout, () -> infoLayout.setBackgroundTintList(new ColorStateList(new int[][] { { } }, new int[] { ThemeEngine.getInstance().getTheme().getLtColor() })));
|
||||
}
|
||||
|
||||
|
@ -64,10 +67,15 @@ public abstract class ModpackPage extends FCLTempPage implements View.OnClickLis
|
|||
|
||||
protected abstract void onInstall();
|
||||
|
||||
protected abstract void onDescribe();
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v == install) {
|
||||
onInstall();
|
||||
}
|
||||
if (v == describe) {
|
||||
onDescribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.tungsten.fcl.ui.download;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -58,6 +59,7 @@ public class RemoteModpackPage extends ModpackPage {
|
|||
|
||||
progressBar.setVisibility(View.GONE);
|
||||
layout.setVisibility(View.VISIBLE);
|
||||
describe.setVisibility(View.VISIBLE);
|
||||
|
||||
name.setText(manifest.getName());
|
||||
version.setText(manifest.getVersion());
|
||||
|
@ -98,4 +100,16 @@ public class RemoteModpackPage extends ModpackPage {
|
|||
}
|
||||
ModpackInstaller.installModpack(getContext(), task, updateVersion != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDescribe() {
|
||||
FCLAlertDialog.Builder builder = new FCLAlertDialog.Builder(getContext());
|
||||
builder.setAlertLevel(FCLAlertDialog.AlertLevel.ALERT);
|
||||
builder.setCancelable(false);
|
||||
builder.setTitle(getContext().getString(R.string.modpack_description));
|
||||
CharSequence charSequence = Html.fromHtml(manifest.getDescription(), 0);
|
||||
builder.setMessage(charSequence);
|
||||
builder.setNegativeButton(getContext().getString(com.tungsten.fcllibrary.R.string.dialog_positive), null);
|
||||
builder.create().show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,6 +183,14 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
<com.tungsten.fcllibrary.component.view.FCLButton
|
||||
app:ripple="true"
|
||||
android:id="@+id/describe"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/modpack_description"/>
|
||||
|
||||
<com.tungsten.fcllibrary.component.view.FCLButton
|
||||
app:ripple="true"
|
||||
android:id="@+id/install"
|
||||
|
|
|
@ -105,6 +105,10 @@ public class FCLAlertDialog extends FCLDialog implements View.OnClickListener {
|
|||
this.message.setText(message);
|
||||
}
|
||||
|
||||
public void setMessage(CharSequence message) {
|
||||
this.message.setText(message);
|
||||
}
|
||||
|
||||
public void setPositiveButton(String text, ButtonListener listener) {
|
||||
positive.setVisibility(View.VISIBLE);
|
||||
positive.setText(text);
|
||||
|
@ -151,6 +155,11 @@ public class FCLAlertDialog extends FCLDialog implements View.OnClickListener {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder setMessage(CharSequence message) {
|
||||
dialog.setMessage(message);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPositiveButton(ButtonListener listener) {
|
||||
dialog.setPositiveButton(context.getString(R.string.dialog_positive), listener);
|
||||
return this;
|
||||
|
|
Loading…
Reference in New Issue