made untrust certificate warning more beautified

This commit is contained in:
Daniel Gultsch 2014-03-07 20:22:26 +01:00
parent 7738bfd072
commit 93d11b3c99
3 changed files with 29 additions and 13 deletions

View File

@ -12,21 +12,30 @@
android:textSize="18sp"/> android:textSize="18sp"/>
<TextView <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFe92727"
android:textStyle="bold"
android:textSize="18sp"
android:text="Do not connect unless you know exactly what you are doing"
android:paddingTop="8dp"
android:paddingBottom="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:text="The SHA1 fingerprint is:" />
<TextView
android:layout_gravity="center_horizontal"
android:paddingTop="8dp" android:paddingTop="8dp"
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:id="@+id/sha" android:id="@+id/sha"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:typeface="monospace" android:typeface="monospace"
android:textSize="18sp"/>
<TextView
android:id="@+id/dont"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFe92727"
android:textStyle="bold" android:textStyle="bold"
android:textSize="18sp" android:textSize="20sp"/>
android:text="Do not connect unless you know exactly what you are doing" />
</LinearLayout> </LinearLayout>

View File

@ -22,4 +22,5 @@
<string name="visitor">Visitor</string> <string name="visitor">Visitor</string>
<string name="enter_new_name">Enter a new name:</string> <string name="enter_new_name">Enter a new name:</string>
<string name="remove_contact_text">Do you want to delete %s from your roster. The conversation assoziated with this account will not be removed.</string> <string name="remove_contact_text">Do you want to delete %s from your roster. The conversation assoziated with this account will not be removed.</string>
<string name="untrusted_cert_hint">The server %s presented you with an unstrusted, possible self signed, certificate.</string>
</resources> </resources>

View File

@ -77,10 +77,16 @@ public class ManageAccountActivity extends XmppActivity {
TextView hint = (TextView) view.findViewById(R.id.hint); TextView hint = (TextView) view.findViewById(R.id.hint);
StringBuilder humanReadableSha = new StringBuilder(); StringBuilder humanReadableSha = new StringBuilder();
humanReadableSha.append(fingerprint); humanReadableSha.append(fingerprint);
for(int i = 2; i < 58; i += 3) { for(int i = 2; i < 59; i += 3) {
Log.d("gultsch","insert into "+i);
if ((i==14)||(i==29)||(i==44)) {
humanReadableSha.insert(i, "\n");
} else {
humanReadableSha.insert(i, ":"); humanReadableSha.insert(i, ":");
} }
hint.setText(account.getServer()+" presented you with an unstrusted, possible self signed, certificate.\nThe SHA1 fingerprint is");
}
hint.setText(getString(R.string.untrusted_cert_hint,account.getServer()));
sha.setText(humanReadableSha.toString()); sha.setText(humanReadableSha.toString());
builder.setView(view); builder.setView(view);
//builder.setMessage(server+" presented you with an unstrusted, possible self signed, certificate. The SHA1 fingerprint is "+fingerprint+" Do not connect unless you know exactly what you are doing"); //builder.setMessage(server+" presented you with an unstrusted, possible self signed, certificate. The SHA1 fingerprint is "+fingerprint+" Do not connect unless you know exactly what you are doing");