private OrProof makeProf(Vote[] reEncryptedVotes, Vote vote, int key, int place) { int[] r = new int[reEncryptedVotes.length]; int[] d = new int[reEncryptedVotes.length]; GroupMember[] a = new GroupMember[reEncryptedVotes.length]; GroupMember[] b = new GroupMember[reEncryptedVotes.length]; for (int i = 0; i < r.length; i++) r[i] = rand(); for (int i = 0; i < d.length; i++) d[i] = rand(); for (int i = 0; i < a.length; i++) { a[i] = compute(reEncryptedVotes[i].key, vote.key, g, d[i], r[i]); } for (int i = 0; i < b.length; i++) { b[i] = compute(reEncryptedVotes[i].message, vote.message, h, d[i], r[i]); } history.UpdateHistory(reEncryptedVotes, vote, a, b); int c = hash(history.getHistory()); int d_tag = updateD(c, d, place); int r_tag = updateR(key, d[place], d_tag); d[place] = d_tag; r[place] = r_tag; history.UpdateHistory(d, r); OrProof prof = new OrProof(a, b, c, d, r); return prof; }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.mainapp); TableLayout t1 = (TableLayout) findViewById(R.id.tableLayout1); TableLayout t2 = (TableLayout) findViewById(R.id.tableLayout2); TableLayout t3 = (TableLayout) findViewById(R.id.tableLayout3); t1.setVisibility(View.GONE); t2.setVisibility(View.GONE); t3.setVisibility(View.GONE); TabHost tabs = (TabHost) findViewById(R.id.TabHost01); tabs.setup(); TabHost.TabSpec spec1 = tabs.newTabSpec("tag1"); spec1.setContent(R.id.myPlacesList); spec1.setIndicator( getString(R.string.maTabPlaces), getResources().getDrawable(android.R.drawable.ic_menu_mylocation)); tabs.addTab(spec1); TabHost.TabSpec spec2 = tabs.newTabSpec("tag2"); spec2.setContent(R.id.myRoutesList); spec2.setIndicator( getString(R.string.maTabRoutes), getResources().getDrawable(android.R.drawable.ic_menu_myplaces)); tabs.addTab(spec2); myPlaces = (ListView) findViewById(R.id.myPlacesList); myRoutes = (ListView) findViewById(R.id.myRoutesList); history = History.getHistory(this); routes = History.getRoutes(this); historyAdapter = new History.HistoryAdapter(this); routesAdapter = new History.RoutesAdapter(this); myPlaces.setAdapter(historyAdapter); myRoutes.setAdapter(routesAdapter); Utils.setListViewHeightBasedOnChildren((ListView) findViewById(R.id.myPlacesList)); Utils.setListViewHeightBasedOnChildren((ListView) findViewById(R.id.myRoutesList)); myPlaces.setOnItemClickListener( new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { HistoryItem h = history.get(arg2); String str = h.address; if (!h.name.equals("")) str = h.name; createShortcut(str, null, h.address); } }); myRoutes.setOnItemClickListener( new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { RouteHistoryItem r = routes.get(arg2); String n1 = r.start.substring(0, 5); if (r.start.length() > 0) n1 += "."; String n2 = r.end; // .substring(0, 5); if (r.end.length() > 0) n2 +="."; Utils.addHomeScreenShortcut( ShortcutActivity.this, n1 + "-" + n2, r.start, r.end, r.coords, r.coords2); } }); }