convert license page to a ListActivity
This commit is contained in:
@ -1,110 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_main"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="License Overview"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_bf"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Blockfile"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_bsd"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="BSD"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_elg"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="ElGamal/DSA"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_gplv2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="GPLv2"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_lgplv21"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="LGPLv2.1"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_gplv3"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="GPLv3"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_lgplv3"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="LGPLv3"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_cert"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="InstallCert"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_sha256"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="SHA-256"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_sntp"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="SNTP"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
android:id="@+id/license_addressbook"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Addressbook"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
@ -1,48 +1,42 @@
|
|||||||
package net.i2p.android.router.activity;
|
package net.i2p.android.router.activity;
|
||||||
|
|
||||||
|
import android.app.ListActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
import net.i2p.android.router.R;
|
import net.i2p.android.router.R;
|
||||||
|
|
||||||
public class LicenseActivity extends I2PActivityBase {
|
public class LicenseActivity extends ListActivity {
|
||||||
|
|
||||||
private static final int[] buttons = {
|
private static final String[] names = {
|
||||||
R.id.license_main, R.id.license_bf, R.id.license_bsd, R.id.license_elg,
|
"License Overview", "Blockfile", "BSD", "ElGamal / DSA",
|
||||||
R.id.license_gplv2, R.id.license_lgplv21, R.id.license_gplv3, R.id.license_lgplv3,
|
"GPLv2", "LGPLv2.1", "GPLv3", "LGPLv3",
|
||||||
R.id.license_cert, R.id.license_sha256, R.id.license_sntp, R.id.license_addressbook};
|
"InstallCert", "SHA-256", "SNTP", "Addressbook"};
|
||||||
|
|
||||||
private static final int[] files = {
|
private static final int[] files = {
|
||||||
R.raw.licenses_txt, R.raw.license_blockfile_txt, R.raw.license_bsd_txt, R.raw.license_elgamaldsa_txt,
|
R.raw.licenses_txt, R.raw.license_blockfile_txt, R.raw.license_bsd_txt, R.raw.license_elgamaldsa_txt,
|
||||||
R.raw.license_gplv2_txt, R.raw.license_lgplv2_1_txt, R.raw.license_gplv3_txt, R.raw.license_lgplv3_txt,
|
R.raw.license_gplv2_txt, R.raw.license_lgplv2_1_txt, R.raw.license_gplv3_txt, R.raw.license_lgplv3_txt,
|
||||||
R.raw.license_installcert_txt, R.raw.license_sha256_txt, R.raw.license_sntp_txt, R.raw.license_addressbook_txt};
|
R.raw.license_installcert_txt, R.raw.license_sha256_txt, R.raw.license_sntp_txt, R.raw.license_addressbook_txt};
|
||||||
|
|
||||||
/** Called when the activity is first created. */
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.license);
|
|
||||||
|
|
||||||
for (int i = 0; i < buttons.length; i++) {
|
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, names));
|
||||||
Button b = (Button) findViewById(buttons[i]);
|
ListView lv = getListView();
|
||||||
b.setOnClickListener(new LicenseClick(files[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class LicenseClick implements View.OnClickListener {
|
// set the callback
|
||||||
private final int resource;
|
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
public void onItemClick(AdapterView parent, View view, int pos, long id) {
|
||||||
public LicenseClick(int r) {
|
Intent intent = new Intent(view.getContext(), TextResourceActivity.class);
|
||||||
resource = r;
|
intent.putExtra(TextResourceActivity.TEXT_RESOURCE_ID, files[pos]);
|
||||||
}
|
startActivity(intent);
|
||||||
|
}
|
||||||
public void onClick(View view) {
|
});
|
||||||
Intent intent = new Intent(view.getContext(), TextResourceActivity.class);
|
|
||||||
intent.putExtra(TextResourceActivity.TEXT_RESOURCE_ID, resource);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ class Init {
|
|||||||
ctx = c;
|
ctx = c;
|
||||||
myDir = c.getFilesDir().getAbsolutePath();
|
myDir = c.getFilesDir().getAbsolutePath();
|
||||||
_ourVersion = Util.getOurVersion(c);
|
_ourVersion = Util.getOurVersion(c);
|
||||||
System.setProperty(PROP_INSTALLED_VERSION, _ourVersion);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void debugStuff() {
|
void debugStuff() {
|
||||||
|
Reference in New Issue
Block a user