This commit is contained in:
Harald Hoyer 2014-07-31 16:35:38 +02:00
parent 67f1270606
commit a76de7534d
4 changed files with 14 additions and 10 deletions

View file

@ -218,7 +218,8 @@ public class GenerateFragment extends Fragment implements FragmentSupport {
builder.setTitle("ssss-1"); builder.setTitle("ssss-1");
builder.setView(view); builder.setView(view);
if (PrintHelper.systemSupportsPrint()) { if (PrintHelper.systemSupportsPrint()) {
builder.setPositiveButton(R.string.print, new DialogInterface.OnClickListener() { builder.setPositiveButton(R.string.print,
new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Renderer.printCode(activity, "sss-1", data); Renderer.printCode(activity, "sss-1", data);

View file

@ -104,7 +104,9 @@ public class Renderer {
Paint codePaint = new Paint(); Paint codePaint = new Paint();
codePaint.setAntiAlias(false); codePaint.setAntiAlias(false);
codePaint.setDither(false); codePaint.setDither(false);
canvas.drawBitmap(codeBitmap, centerXForAddress - codeBitmap.getWidth() / 2, y, codePaint); canvas.drawBitmap(codeBitmap,
centerXForAddress - codeBitmap.getWidth() / 2, y,
codePaint);
y += codePadding - textPaint.ascent(); y += codePadding - textPaint.ascent();
canvas.drawText(label, centerXForAddress, y + codeBitmap.getHeight(), textPaint); canvas.drawText(label, centerXForAddress, y + codeBitmap.getHeight(), textPaint);
return bmp; return bmp;
@ -259,7 +261,8 @@ public class Renderer {
public static SecretShare.PublicInfo decodePublicInfo(final String buf) { public static SecretShare.PublicInfo decodePublicInfo(final String buf) {
int index64 = buf.indexOf("=") + 1; int index64 = buf.indexOf("=") + 1;
final ByteBuffer byteBuffer = ByteBuffer.wrap(Base64.decode(buf.substring(index64), Base64.DEFAULT)); final ByteBuffer byteBuffer;
byteBuffer = ByteBuffer.wrap(Base64.decode(buf.substring(index64), Base64.DEFAULT));
int x = byteBuffer.getInt(); int x = byteBuffer.getInt();
int k = byteBuffer.getInt(); int k = byteBuffer.getInt();
int n = byteBuffer.getInt(); int n = byteBuffer.getInt();
@ -274,9 +277,12 @@ public class Renderer {
return new SecretShare.PublicInfo(n, k, inPrimeModulus, tryUnicodeExpand(byteDescription)); return new SecretShare.PublicInfo(n, k, inPrimeModulus, tryUnicodeExpand(byteDescription));
} }
public static SecretShare.ShareInfo decodeShareInfo(final String buf, final SecretShare.PublicInfo publicInfo) throws InvalidParameterException { public static SecretShare.ShareInfo decodeShareInfo(final String buf,
final SecretShare.PublicInfo publicInfo)
throws InvalidParameterException {
int index64 = buf.indexOf("=") + 1; int index64 = buf.indexOf("=") + 1;
final ByteBuffer byteBuffer = ByteBuffer.wrap(Base64.decode(buf.substring(index64), Base64.DEFAULT)); final ByteBuffer byteBuffer;
byteBuffer = ByteBuffer.wrap(Base64.decode(buf.substring(index64), Base64.DEFAULT));
int x = byteBuffer.getInt(); int x = byteBuffer.getInt();
int k = byteBuffer.getInt(); int k = byteBuffer.getInt();
int n = byteBuffer.getInt(); int n = byteBuffer.getInt();

View file

@ -23,7 +23,6 @@
android:id="@+id/generate_status" android:id="@+id/generate_status"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:text="@string/hello_blank_fragment"
/> />
</ScrollView> </ScrollView>
</LinearLayout> </LinearLayout>

View file

@ -2,12 +2,10 @@
<resources> <resources>
<string name="app_name">SecretShare</string> <string name="app_name">SecretShare</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="string_clear_text_secret">Clear text secret</string> <string name="string_clear_text_secret">The secret you want to split.</string>
<string name="string_generate_secrets">Generate Secrets</string> <string name="string_generate_secrets">Generate split secret</string>
<string name="string_encrypted_secrets">Encrypted secrets</string> <string name="string_encrypted_secrets">Encrypted secrets</string>
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="print">Print</string> <string name="print">Print</string>
</resources> </resources>