I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 52217859 authored by str4d's avatar str4d
Browse files

Pass tunnel wizard data back to TunnelListFragment

parent 5b665853
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ package net.i2p.android.i2ptunnel.activity;
import java.util.List;
import net.i2p.android.i2ptunnel.fragment.TunnelListFragment;
import net.i2p.android.router.R;
import net.i2p.android.wizard.model.AbstractWizardModel;
import net.i2p.android.wizard.model.ModelCallbacks;
......@@ -9,9 +10,11 @@ import net.i2p.android.wizard.model.Page;
import net.i2p.android.wizard.ui.PageFragmentCallbacks;
import net.i2p.android.wizard.ui.ReviewFragment;
import net.i2p.android.wizard.ui.StepPagerStrip;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
......@@ -95,14 +98,17 @@ public class TunnelWizardActivity extends FragmentActivity implements
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent result = new Intent();
result.putExtra(TunnelListFragment.TUNNEL_WIZARD_DATA, mWizardModel.save());
setResult(Activity.RESULT_OK, result);
finish();
}
})
.setNegativeButton(android.R.string.cancel, null)
.create();
}
};
dg.show(getSupportFragmentManager(), "place_order_dialog");
dg.show(getSupportFragmentManager(), "create_tunnel_dialog");
} else {
if (mEditingAfterReview) {
mPager.setCurrentItem(mPagerAdapter.getCount() - 1);
......
......@@ -23,6 +23,9 @@ import android.widget.ListView;
public class TunnelListFragment extends ListFragment
implements LoaderManager.LoaderCallbacks<List<TunnelEntry>> {
public static final String SHOW_CLIENT_TUNNELS = "show_client_tunnels";
public static final String TUNNEL_WIZARD_DATA = "tunnel_wizard_data";
static final int TUNNEL_WIZARD_REQUEST = 1;
private static final int CLIENT_LOADER_ID = 1;
private static final int SERVER_LOADER_ID = 2;
......@@ -143,12 +146,21 @@ public class TunnelListFragment extends ListFragment
switch (item.getItemId()) {
case R.id.action_add_tunnel:
Intent wi = new Intent(getActivity(), TunnelWizardActivity.class);
startActivity(wi);
startActivityForResult(wi, TUNNEL_WIZARD_REQUEST);
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == TUNNEL_WIZARD_REQUEST) {
if (resultCode == Activity.RESULT_OK) {
Bundle tunnelData = data.getExtras().getBundle(TUNNEL_WIZARD_DATA);
}
}
}
/**
* Turns on activate-on-click mode. When this mode is on, list items will be
* given the 'activated' state when touched.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment