2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-23 02:15:55 +01:00

Fix tutorial pages

This commit is contained in:
Alibek Omarov 2018-01-30 21:37:15 +03:00
parent 92423c8108
commit 124bedcc59
2 changed files with 66 additions and 76 deletions

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="page_title0">Welcome!</string>
<string name="page_content0"><![CDATA[<img src="ic_launcher" />Welcome to Xash3D FWGS! Before continue, we recommend you to read our installation guide. Press "Next" to continue. Press "Skip" to close this dialog, if you already have installed the game data files.]]></string>
<string name="page_content0"><![CDATA[<img src="ic_launcher" align="middle" /><br />Welcome to Xash3D FWGS! Before continue, we recommend you to read our installation guide. Press "Next" to continue. Press "Skip" to close this dialog, if you already have installed the game data files.]]></string>
<string name="page_title1">Purchase Half-Life in Steam</string>
<string name="page_content1"><![CDATA[<img src="page1_en"/>To play, you need to have Half-Life on your Steam account. Install Steam client on your PC. Purchase the game, if you still not. Press "Install" button. Wait until download finishes.]]></string>
<string name="page_content1"><![CDATA[<img src="page1_en" align="middle" width="100%" vspace="20" /><br />To play, you need to have Half-Life on your Steam account. Install Steam client on your PC. Purchase the game, if you still not. Press "Install" button. Wait until download finishes.]]></string>
<string name="page_title2">Get game files directory</string>
<string name="page_content2"><![CDATA[<img src="page2_en"/>Open game properties in Steam, move to "Local Files" tab and press "Browse local files..." button. File manager window will appear.]]></string>
<string name="page_content2"><![CDATA[<img src="page2_en" align="middle" width="100%" vspace="20" /><br />Open game properties in Steam, move to "Local Files" tab and press "Browse local files..." button. File manager window will appear.]]></string>
<string name="page_title3">Copy game files to device</string>
<string name="page_content3"><![CDATA[Connect your device to PC. Create "xash" folder in device\'s internal storage and copy "valve" folder from game local files into "xash" on your device. If you have not enough internal storage, you may use external SD. Then you need to use "Android/data/in.celest.xash3d.hl/files" folder on external SD(create these folders, if they does not exist).]]></string>

View File

@ -408,96 +408,86 @@ public class LauncherActivity extends Activity {
});
}
int m_iFirstRunCounter;
int m_iFirstRunCounter = 0;
public void showFirstRun()
{
if(m_iFirstRunCounter < 0)
if( m_iFirstRunCounter < 0 )
m_iFirstRunCounter = 0;
final int titleres = getResources().getIdentifier("page_title" + String.valueOf(m_iFirstRunCounter), "string", getPackageName());
final int contentres = getResources().getIdentifier("page_content" + String.valueOf(m_iFirstRunCounter), "string", getPackageName());
final Activity a = this;
if( titleres == 0 || contentres == 0 )
return;
this.runOnUiThread(new Runnable()
{
public void run()
{
public void run()
{
TextView content = new TextView(LauncherActivity.this);
content.setText(Html.fromHtml(getResources().getText(contentres).toString(), new Html.ImageGetter(){
@Override
public Drawable getDrawable(String source) {
Drawable drawable;
int dourceId =
getApplicationContext()
.getResources()
.getIdentifier(source, "drawable", getPackageName());
drawable =
getApplicationContext()
.getResources()
.getDrawable(dourceId);
drawable.setBounds(
0,
0,
drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight());
return drawable;
}
}, null));
content.setMovementMethod(LinkMovementMethod.getInstance());
AlertDialog.Builder builder = new AlertDialog.Builder(a)
final TextView content = new TextView(LauncherActivity.this);
content.setMovementMethod(LinkMovementMethod.getInstance());
AlertDialog.Builder builder = new AlertDialog.Builder(a)
.setTitle(titleres)
.setView(content);
if( sdk >= 21 )
DialogInterface.OnClickListener nextClick = new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface d, int p1)
{
builder.setPositiveButton(R.string.next, new DialogInterface.OnClickListener(){
public void onClick(DialogInterface d, int p1)
{
m_iFirstRunCounter++;
showFirstRun();
}
});
if( m_iFirstRunCounter > 0 )
builder.setNegativeButton(R.string.prev, new DialogInterface.OnClickListener(){
public void onClick(DialogInterface d, int p1)
{
m_iFirstRunCounter--;
showFirstRun();
}
});
builder.setNeutralButton(R.string.skip, null);
m_iFirstRunCounter++;
showFirstRun();
}
else
};
DialogInterface.OnClickListener prevClick = new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface d, int p1)
{
builder.setNegativeButton(R.string.next, new DialogInterface.OnClickListener(){
public void onClick(DialogInterface d, int p1)
{
m_iFirstRunCounter++;
showFirstRun();
}
});
if( m_iFirstRunCounter > 0 )
builder.setNeutralButton(R.string.prev, new DialogInterface.OnClickListener(){
public void onClick(DialogInterface d, int p1)
{
m_iFirstRunCounter--;
showFirstRun();
}
});
builder.setPositiveButton(R.string.skip,null);
m_iFirstRunCounter--;
showFirstRun();
}
builder.setCancelable(false);
builder.show();
};
if( sdk >= 21 )
{
builder.setPositiveButton(R.string.next, nextClick);
if( m_iFirstRunCounter > 0 )
{
builder.setNegativeButton(R.string.prev, prevClick);
}
builder.setNeutralButton(R.string.skip, null);
}
});
else
{
builder.setNegativeButton(R.string.next, nextClick);
if( m_iFirstRunCounter > 0 )
{
builder.setNeutralButton(R.string.prev, prevClick);
}
builder.setPositiveButton(R.string.skip, null);
}
builder.setCancelable(false);
final AlertDialog dialog = builder.create();
dialog.show();
content.setText(Html.fromHtml(getResources().getText(contentres).toString(),
new Html.ImageGetter()
{
@Override
public Drawable getDrawable(String source)
{
int dourceId = getApplicationContext().getResources().getIdentifier(source, "drawable", getPackageName());
Drawable drawable = getApplicationContext().getResources().getDrawable(dourceId);
final int visibleWidth = dialog.getWindow().getDecorView().getWidth();
final int picWidth = drawable.getIntrinsicWidth();
final int picHeight = drawable.getIntrinsicHeight();
final int calcWidth = visibleWidth < picWidth ? visibleWidth : picWidth;
// final int calcHeight = (int)((float)picHeight * ((float)calcWidth / (float)picWidth));
final int calcHeight = (int)((float)picHeight);
drawable.setBounds( 0, 0, calcWidth, calcHeight);
return drawable;
}
}, null));
}
});
}
public void selectFolder(View view)