Added primitive about dialog to all main windows. Added 'donate' button to main.
This commit is contained in:
parent
1c5da14cd2
commit
c514314ed3
BIN
android/res/drawable/sf_donate.png
Normal file
BIN
android/res/drawable/sf_donate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.2 KiB |
@ -44,6 +44,13 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/viewmotorslabel" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/main_donate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/sf_donate" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -25,19 +25,25 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_horizontal" >
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/main_open"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/openfilelabel" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/main_browse"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/viewmotorslabel" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/main_donate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/sf_donate" />
|
||||
|
||||
</LinearLayout>
|
@ -5,6 +5,11 @@
|
||||
android:id="@+id/main_menu_preferences"
|
||||
android:title="@string/Preferences"
|
||||
android:icon="@drawable/ic_menu_preferences"
|
||||
android:showAsAction="always"/>
|
||||
android:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_about"
|
||||
android:title="@string/About"
|
||||
android:showAsAction="never"/>
|
||||
|
||||
</menu>
|
@ -7,7 +7,10 @@
|
||||
<item
|
||||
android:id="@+id/preference_menu_option"
|
||||
android:icon="@drawable/ic_menu_preferences"
|
||||
android:title="@string/Preferences"
|
||||
/>
|
||||
android:title="@string/Preferences"/>
|
||||
<item
|
||||
android:id="@+id/menu_about"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/About"/>
|
||||
|
||||
</menu>
|
@ -3,12 +3,16 @@
|
||||
|
||||
<item
|
||||
android:id="@+id/motor_list_menu_option"
|
||||
android:title="@string/viewmotorslabel"
|
||||
android:icon="@drawable/ic_motorbrowser"
|
||||
android:showAsAction="always"/>
|
||||
android:showAsAction="always"
|
||||
android:title="@string/viewmotorslabel"/>
|
||||
<item
|
||||
android:id="@+id/preference_menu_option"
|
||||
android:title="@string/Preferences"
|
||||
android:icon="@drawable/ic_menu_preferences"/>
|
||||
android:icon="@drawable/ic_menu_preferences"
|
||||
android:title="@string/Preferences"/>
|
||||
<item
|
||||
android:id="@+id/menu_about"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/About"/>
|
||||
|
||||
</menu>
|
@ -5,6 +5,7 @@
|
||||
<string name="save">Save</string>
|
||||
<string name="MotorListTitle">Motor List</string>
|
||||
<string name="Download">Download</string>
|
||||
<string name="About">About</string>
|
||||
<string name="Preferences">Preferences</string>
|
||||
<string name="select_series">Select Series</string>
|
||||
<string name="view_events">View Events</string>
|
||||
|
@ -0,0 +1,36 @@
|
||||
package net.sf.openrocket.android;
|
||||
|
||||
import net.sf.openrocket.android.rocket.OpenRocketLoaderActivity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
|
||||
public class AboutDialogFragment extends DialogFragment {
|
||||
|
||||
public static AboutDialogFragment newInstance() {
|
||||
AboutDialogFragment frag = new AboutDialogFragment();
|
||||
return frag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
// .setIcon(android.R.drawable.alert_dialog_icon)
|
||||
builder.setTitle("About");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("OpenRocket\n");
|
||||
sb.append("Copyright 2007-2012 Sampo Niskanen\n");
|
||||
sb.append("\n");
|
||||
sb.append("The android port contains third party software:\n");
|
||||
sb.append(" AChartEngine - Apache License 2.0\n");
|
||||
sb.append(" Android Open Source Project - Apache License 2.0\n");
|
||||
sb.append(" Android tree-view-list - 2-clause BSD licensed\n");
|
||||
builder.setMessage(sb.toString());
|
||||
builder.setCancelable(true);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
}
|
@ -4,6 +4,8 @@ import net.sf.openrocket.android.motor.MotorBrowserActivity;
|
||||
import net.sf.openrocket.android.thrustcurve.TCQueryActivity;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
public abstract class ActivityHelpers {
|
||||
|
||||
@ -28,4 +30,16 @@ public abstract class ActivityHelpers {
|
||||
parent.startActivityForResult(i, requestCode);
|
||||
}
|
||||
|
||||
public static void donate( Activity parent ) {
|
||||
String url = "http://sourceforge.net/donate/index.php?group_id=260357";
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData( Uri.parse(url) );
|
||||
parent.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void showAbout( FragmentActivity parent ) {
|
||||
AboutDialogFragment frag = AboutDialogFragment.newInstance();
|
||||
frag.show(parent.getSupportFragmentManager(), "about");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.sf.openrocket.android;
|
||||
|
||||
import net.sf.openrocket.R;
|
||||
import net.sf.openrocket.android.actionbarcompat.ActionBarFragmentActivity;
|
||||
import net.sf.openrocket.android.filebrowser.SimpleFileBrowser;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
@ -9,14 +10,13 @@ import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
public class Main extends FragmentActivity {
|
||||
public class Main extends ActionBarFragmentActivity {
|
||||
|
||||
private static final int PICK_ORK_FILE_RESULT = 1;
|
||||
|
||||
@ -24,6 +24,7 @@ public class Main extends FragmentActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
setTitle("");
|
||||
setContentView(R.layout.main);
|
||||
((Button) findViewById(R.id.main_open)).setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@ -39,6 +40,13 @@ public class Main extends FragmentActivity {
|
||||
ActivityHelpers.browseMotors(Main.this);
|
||||
}
|
||||
});
|
||||
((Button) findViewById(R.id.main_donate)).setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ActivityHelpers.donate(Main.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,6 +62,9 @@ public class Main extends FragmentActivity {
|
||||
case R.id.main_menu_preferences:
|
||||
ActivityHelpers.startPreferences(this);
|
||||
return true;
|
||||
case R.id.menu_about:
|
||||
ActivityHelpers.showAbout(this);
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
@ -60,6 +60,9 @@ implements MotorListFragment.OnMotorSelectedListener
|
||||
Intent intent = new Intent().setClass(this, PreferencesActivity.class);
|
||||
this.startActivity(intent);
|
||||
return true;
|
||||
case R.id.menu_about:
|
||||
ActivityHelpers.showAbout(this);
|
||||
return true;
|
||||
}
|
||||
return super.onMenuItemSelected(featureId, item);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.util.Set;
|
||||
import net.sf.openrocket.R;
|
||||
import net.sf.openrocket.aerodynamics.WarningSet;
|
||||
import net.sf.openrocket.android.Application;
|
||||
import net.sf.openrocket.android.actionbarcompat.ActionBarFragmentActivity;
|
||||
import net.sf.openrocket.android.thrustcurve.TCMissingMotorDownloadAction;
|
||||
import net.sf.openrocket.android.thrustcurve.TCQueryAction;
|
||||
import net.sf.openrocket.android.util.AndroidLogWrapper;
|
||||
@ -17,9 +18,8 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
public class OpenRocketLoaderActivity extends FragmentActivity
|
||||
public class OpenRocketLoaderActivity extends ActionBarFragmentActivity
|
||||
implements TCQueryAction.OnTCQueryCompleteListener, OpenRocketLoaderFragment.OnOpenRocketFileLoaded
|
||||
{
|
||||
|
||||
@ -29,6 +29,7 @@ implements TCQueryAction.OnTCQueryCompleteListener, OpenRocketLoaderFragment.OnO
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setTitle("");
|
||||
setContentView(R.layout.main);
|
||||
if ( savedInstanceState == null || savedInstanceState.getBoolean("isLoading", false) == false ) {
|
||||
Intent i = getIntent();
|
||||
|
@ -64,6 +64,9 @@ implements Simulations.OnSimulationSelectedListener
|
||||
case R.id.preference_menu_option:
|
||||
ActivityHelpers.startPreferences(this);
|
||||
return true;
|
||||
case R.id.menu_about:
|
||||
ActivityHelpers.showAbout(this);
|
||||
return true;
|
||||
}
|
||||
return super.onMenuItemSelected(featureId, item);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user