setting to increase font size. fixed #420

This commit is contained in:
iNPUTmice 2014-09-08 23:58:37 +02:00
parent d9c4637b31
commit d92e8381db
40 changed files with 229 additions and 172 deletions

View File

@ -28,14 +28,14 @@
android:scrollHorizontally="false"
android:singleLine="true"
android:textColor="@color/primarytext"
android:textSize="18sp" />
android:textSize="?attr/TextSizeHeadline" />
<TextView
android:id="@+id/account_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/account_status_unknown"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/secondarytext"
android:textStyle="bold"/>
</LinearLayout>

View File

@ -44,7 +44,7 @@
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:singleLine="true"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/primarytext"/>
<TextView
@ -52,7 +52,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:textSize="18sp"
android:textSize="?attr/TextSizeHeadline"
android:textColor="@color/primarytext"
android:textStyle="bold" />
<TextView
@ -61,7 +61,7 @@
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:singleLine="true"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/primarytext"/>
</LinearLayout>
@ -80,7 +80,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/primarytext" />
<TextView
style="@style/sectionHeader"
@ -95,7 +95,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_presence_updates"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/primarytext" />
<CheckBox
@ -103,7 +103,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/receive_presence_updates"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/primarytext" />
<TextView
style="@style/sectionHeader"

View File

@ -27,7 +27,7 @@
android:layout_height="wrap_content"
android:text="@string/account_settings_jabber_id"
android:textColor="@color/primarytext"
android:textSize="14sp" />
android:textSize="?attr/TextSizeBody" />
<AutoCompleteTextView
android:id="@+id/account_jid"
@ -42,7 +42,7 @@
android:layout_marginTop="8dp"
android:text="@string/account_settings_password"
android:textColor="@color/primarytext"
android:textSize="14sp" />
android:textSize="?attr/TextSizeBody" />
<EditText
android:id="@+id/account_password"
@ -58,7 +58,7 @@
android:layout_marginTop="8dp"
android:text="@string/register_account"
android:textColor="@color/primarytext"
android:textSize="14sp" />
android:textSize="?attr/TextSizeBody" />
<TextView
android:id="@+id/account_confirm_password_desc"
@ -66,7 +66,7 @@
android:layout_height="wrap_content"
android:text="@string/account_settings_confirm_password"
android:textColor="@color/primarytext"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:visibility="gone" />
<EditText
@ -94,7 +94,7 @@
android:gravity="center_horizontal"
android:text="@string/additional_information"
android:textColor="@color/secondarytext"
android:textSize="18sp"
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold" />
<TableLayout
@ -177,7 +177,7 @@
android:gravity="center_horizontal"
android:text="@string/otr_fingerprint"
android:textColor="@color/secondarytext"
android:textSize="18sp"
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold" />
<TextView
@ -185,7 +185,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:typeface="monospace" />
</LinearLayout>
</LinearLayout>

View File

@ -24,7 +24,7 @@
android:singleLine="true"
android:text="@string/account_settings_example_jabber_id"
android:textColor="@color/primarytext"
android:textSize="14sp"/>
android:textSize="?attr/TextSizeBody"/>
<TextView
style="@style/sectionHeader"
@ -64,7 +64,7 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="@color/primarytext"
android:textSize="18sp" />
android:textSize="?attr/TextSizeHeadline" />
<TextView
android:id="@+id/muc_role"
@ -72,7 +72,7 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="@color/primarytext"
android:textSize="14sp" />
android:textSize="?attr/TextSizeBody" />
</LinearLayout>
<ImageButton

View File

@ -90,7 +90,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/primarytext"
android:textSize="18sp"/>
android:textSize="?attr/TextSizeHeadline"/>
<TextView
android:id="@+id/hint_or_warning"
@ -99,7 +99,7 @@
android:layout_height="wrap_content"
android:text="@string/publish_avatar_explanation"
android:textColor="@color/primarytext"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:minLines="3" />
</LinearLayout>

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:paddingBottom="8dp"
android:background="?android:attr/activatedBackgroundIndicator">
android:background="?android:attr/activatedBackgroundIndicator"
android:padding="8dp" >
<ImageView
android:id="@+id/contact_photo"
@ -12,40 +11,41 @@
android:layout_height="48dp"
android:layout_alignParentLeft="true"
android:scaleType="centerCrop"
android:src="@drawable/ic_profile">
android:src="@drawable/ic_profile" >
</ImageView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/contact_photo"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/contact_photo"
android:orientation="vertical"
android:paddingLeft="8dp">
<TextView
android:id="@+id/contact_display_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textColor="@color/primarytext"
android:singleLine="true"
/>
<TextView
android:id="@+id/contact_jid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="14sp"
android:textColor="@color/primarytext"
/>
<TextView
android:id="@+id/key"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textColor="@color/primarytext"
android:typeface="monospace"
android:visibility="gone"
/>
android:paddingLeft="8dp" >
<TextView
android:id="@+id/contact_display_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="?attr/TextSizeHeadline"
android:textColor="@color/primarytext" />
<TextView
android:id="@+id/contact_jid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="@color/primarytext"
android:textSize="?attr/TextSizeBody" />
<TextView
android:id="@+id/key"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/primarytext"
android:textSize="?attr/TextSizeHeadline"
android:typeface="monospace"
android:visibility="gone" />
</LinearLayout>
</RelativeLayout>

View File

@ -16,7 +16,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/primarytext"
android:textSize="18sp"
android:textSize="?attr/TextSizeHeadline"
android:typeface="monospace" />
<TextView

View File

@ -26,7 +26,7 @@
android:layout_alignLeft="@+id/conversation_lastwrapper"
android:layout_toLeftOf="@+id/conversation_lastupdate"
android:singleLine="true"
android:textSize="18sp"
android:textSize="?attr/TextSizeHeadline"
android:textColor="@color/primarytext"
android:typeface="sans" />
@ -42,7 +42,7 @@
android:id="@+id/conversation_lastmsg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/primarytext"
android:singleLine="true"
android:scrollHorizontally="false"
@ -63,7 +63,7 @@
android:layout_alignBaseline="@+id/conversation_name"
android:layout_alignParentRight="true"
android:gravity="right"
android:textSize="12sp"
android:textSize="?attr/TextSizeInfo"
android:textColor="@color/secondarytext"/>
</RelativeLayout>

View File

@ -9,7 +9,7 @@
android:id="@+id/your_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/primarytext"
android:text="@string/your_account" />
<Spinner
@ -22,7 +22,7 @@
android:layout_marginTop="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/primarytext"
android:text="@string/account_settings_jabber_id" />

View File

@ -8,7 +8,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/clear_histor_msg"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:paddingBottom="8dp"/>
<CheckBox
android:id="@+id/end_conversation_checkbox"

View File

@ -13,14 +13,14 @@
android:paddingTop="8dp"
android:text="Jabber ID"
android:textColor="@color/primarytext"
android:textSize="18sp"/>
android:textSize="?attr/TextSizeHeadline"/>
<TextView
android:id="@+id/verify_otr_jid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/secondarytext"/>
<TextView
android:layout_width="wrap_content"
@ -28,14 +28,14 @@
android:paddingTop="8dp"
android:text="@string/otr_fingerprint"
android:textColor="@color/primarytext"
android:textSize="18sp"/>
android:textSize="?attr/TextSizeHeadline"/>
<TextView
android:id="@+id/verify_otr_fingerprint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:typeface="monospace"
android:textColor="@color/secondarytext"/>
<TextView
@ -43,7 +43,7 @@
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:text="@string/your_fingerprint"
android:textSize="18sp"
android:textSize="?attr/TextSizeHeadline"
android:textColor="@color/primarytext"/>
<TextView
@ -51,7 +51,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:typeface="monospace"
android:textColor="@color/secondarytext"/>
</LinearLayout>

View File

@ -81,7 +81,7 @@
android:layout_centerVertical="true"
android:paddingLeft="24dp"
android:textColor="@color/ondarktext"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:layout_toLeftOf="@+id/snackbar_action"/>
<TextView
@ -96,7 +96,7 @@
android:paddingTop="16dp"
android:textAllCaps="true"
android:textColor="@color/ondarktext"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textStyle="bold" />
</RelativeLayout>

View File

@ -9,7 +9,7 @@
android:id="@+id/your_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/primarytext"
android:text="@string/your_account" />
<Spinner
@ -22,7 +22,7 @@
android:layout_marginTop="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textSize="?attr/TextSizeBody"
android:textColor="@color/primarytext"
android:text="@string/conference_address" />

View File

@ -44,7 +44,7 @@
android:autoLink="web"
android:textColor="@color/primarytext"
android:textIsSelectable="true"
android:textSize="14sp" />
android:textSize="?attr/TextSizeBody" />
<Button
android:id="@+id/download_button"
@ -62,8 +62,8 @@
<ImageView
android:id="@+id/security_indicator"
android:layout_width="12sp"
android:layout_height="12sp"
android:layout_width="?attr/TextSizeInfo"
android:layout_height="?attr/TextSizeInfo"
android:layout_gravity="center_vertical"
android:layout_marginRight="6sp"
android:layout_marginTop="2sp"
@ -78,7 +78,7 @@
android:gravity="center_vertical"
android:text="@string/sending"
android:textColor="@color/secondarytext"
android:textSize="12sp" />
android:textSize="?attr/TextSizeInfo" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -44,7 +44,7 @@
android:autoLink="web"
android:textColor="@color/primarytext"
android:textIsSelectable="true"
android:textSize="14sp" />
android:textSize="?attr/TextSizeBody" />
<LinearLayout
android:layout_width="wrap_content"
@ -61,12 +61,12 @@
android:gravity="center_vertical"
android:text="@string/sending"
android:textColor="@color/secondarytext"
android:textSize="12sp" />
android:textSize="?attr/TextSizeInfo" />
<ImageView
android:id="@+id/security_indicator"
android:layout_width="12sp"
android:layout_height="12sp"
android:layout_width="?attr/TextSizeInfo"
android:layout_height="?attr/TextSizeInfo"
android:layout_gravity="center_vertical"
android:layout_marginLeft="6sp"
android:layout_marginTop="2sp"

6
res/values/attrs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="TextSizeInfo" format="dimension"/>
<attr name="TextSizeBody" format="dimension"/>
<attr name="TextSizeHeadline" format="dimension"/>
</resources>

View File

@ -108,6 +108,7 @@
<string name="pref_never_send_crash_summary">By sending in stack traces you are helping the ongoing development of Conversations</string>
<string name="pref_confirm_messages">Confirm Messages</string>
<string name="pref_confirm_messages_summary">Let your contact know when you have received and read a message</string>
<string name="pref_ui_options">UI Options</string>
<string name="openpgp_error">OpenKeychain reported an error</string>
<string name="error_decrypting_file">I/O Error decrypting file</string>
<string name="accept">Accept</string>
@ -251,4 +252,6 @@
<string name="pref_dont_save_encrypted_summary">Warning: This could lead to message loss</string>
<string name="pref_expert_options">Expert options</string>
<string name="pref_expert_options_summary">Please be very careful with those</string>
<string name="pref_use_larger_font">Increase font size</string>
<string name="pref_use_larger_font_summary">Use larger font sizes across the entire app</string>
</resources>

View File

@ -5,6 +5,15 @@
<item name="android:actionBarStyle">@style/ConversationsActionBar</item>
<item name="android:actionBarWidgetTheme">@style/ConversationsActionBarWidget</item>
<item name="android:actionBarTabStyle">@style/ConversationsActionBarTabs</item>
<item name="TextSizeInfo">12sp</item>
<item name="TextSizeBody">14sp</item>
<item name="TextSizeHeadline">20sp</item>
</style>
<style name="ConversationsTheme.LargerText" parent="ConversationsTheme">
<item name="TextSizeInfo">14sp</item>
<item name="TextSizeBody">16sp</item>
<item name="TextSizeHeadline">22sp</item>
</style>
<style name="ConversationsActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">

View File

@ -62,6 +62,14 @@
android:summary="@string/pref_notification_grace_period_summary"
android:title="@string/pref_notification_grace_period" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/pref_ui_options">
<CheckBoxPreference
android:defaultValue="false"
android:key="use_larger_font"
android:title="@string/pref_use_larger_font"
android:summary="@string/pref_use_larger_font_summary"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_advanced_options" >
<PreferenceScreen
android:summary="@string/pref_expert_options_summary"

View File

@ -14,9 +14,9 @@ public final class Config {
public static final int AVATAR_SIZE = 192;
public static final Bitmap.CompressFormat AVATAR_FORMAT = Bitmap.CompressFormat.WEBP;
public static final int MESSAGE_MERGE_WINDOW = 20;
public static final boolean PARSE_EMOTICONS = false;
private Config() {

View File

@ -174,7 +174,8 @@ public class OtrEngine implements OtrEngineHost {
@Override
public void messageFromAnotherInstanceReceived(SessionID id) {
Log.d(Config.LOGTAG,"unreadable message received from "+id.getAccountID());
Log.d(Config.LOGTAG,
"unreadable message received from " + id.getAccountID());
}
@Override

View File

@ -106,8 +106,8 @@ public class PgpEngine {
outputFile.getAbsolutePath(), options);
int imageHeight = options.outHeight;
int imageWidth = options.outWidth;
message.setBody(Long.toString(outputFile.getSize()) + ','
+ imageWidth + ',' + imageHeight);
message.setBody(Long.toString(outputFile.getSize())
+ ',' + imageWidth + ',' + imageHeight);
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
PgpEngine.this.mXmppConnectionService
.updateMessage(message);
@ -301,7 +301,7 @@ public class PgpEngine {
os.flush();
String[] lines = os.toString().split("\n");
boolean sig = false;
for(String line : lines) {
for (String line : lines) {
if (sig) {
if (line.contains("END PGP SIGNATURE")) {
sig = false;

View File

@ -149,9 +149,11 @@ public class Message extends AbstractEntity {
public String getReadableBody(Context context) {
if ((encryption == ENCRYPTION_PGP) && (type == TYPE_TEXT)) {
return context.getText(R.string.encrypted_message_received).toString();
return context.getText(R.string.encrypted_message_received)
.toString();
} else if ((encryption == ENCRYPTION_OTR) && (type == TYPE_IMAGE)) {
return context.getText(R.string.encrypted_image_received).toString();
return context.getText(R.string.encrypted_image_received)
.toString();
} else if (encryption == ENCRYPTION_DECRYPTION_FAILED) {
return context.getText(R.string.decryption_failed).toString();
} else if (type == TYPE_IMAGE) {
@ -339,7 +341,7 @@ public class Message extends AbstractEntity {
}
return body.trim();
}
public int getMergedStatus() {
Message next = this.next();
if (this.mergable(next)) {
@ -348,7 +350,7 @@ public class Message extends AbstractEntity {
return getStatus();
}
}
public long getMergedTimeSent() {
Message next = this.next();
if (this.mergable(next)) {

View File

@ -158,8 +158,8 @@ public class MucOptions {
}
aboutToRename = false;
}
if (conversation.getBookmark() != null &&
conversation.getBookmark().isProvidePassword()) {
if (conversation.getBookmark() != null
&& conversation.getBookmark().isProvidePassword()) {
this.passwordChanged = false;
}
} else {
@ -194,8 +194,8 @@ public class MucOptions {
this.error = ERROR_NICK_IN_USE;
}
} else if (error.hasChild("not-authorized")) {
if (conversation.getBookmark() != null &&
conversation.getBookmark().isProvidePassword()) {
if (conversation.getBookmark() != null
&& conversation.getBookmark().isProvidePassword()) {
this.passwordChanged = true;
}
this.error = ERROR_PASSWORD_REQUIRED;
@ -323,17 +323,17 @@ public class MucOptions {
}
public String getPassword() {
if (conversation.getBookmark() != null &&
conversation.getBookmark().getPassword() != null) {
if (conversation.getBookmark() != null
&& conversation.getBookmark().getPassword() != null) {
return conversation.getBookmark().getPassword();
} else {
return this.password;
}
}
public void setPassword(String password) {
if (conversation.getBookmark() != null &&
conversation.getBookmark().isProvidePassword()) {
if (conversation.getBookmark() != null
&& conversation.getBookmark().isProvidePassword()) {
conversation.getBookmark().setPassword(password);
} else {
this.password = password;

View File

@ -75,9 +75,8 @@ public class MessageParser extends AbstractParser implements
}
if (!conversation.hasValidOtrSession()) {
if (properlyAddressed) {
conversation.startOtrSession(
mXmppConnectionService,
presence, false);
conversation.startOtrSession(mXmppConnectionService, presence,
false);
} else {
return null;
}
@ -87,8 +86,7 @@ public class MessageParser extends AbstractParser implements
if (!foreignPresence.equals(presence)) {
conversation.endOtrIfNeeded();
if (properlyAddressed) {
conversation.startOtrSession(
mXmppConnectionService,
conversation.startOtrSession(mXmppConnectionService,
presence, false);
} else {
return null;
@ -289,7 +287,8 @@ public class MessageParser extends AbstractParser implements
if (!conversation.getMucOptions().online()) {
if (x.hasChild("password")) {
Element password = x.findChild("password");
conversation.getMucOptions().setPassword(password.getContent());
conversation.getMucOptions().setPassword(
password.getContent());
}
mXmppConnectionService.joinMuc(conversation);
mXmppConnectionService.updateConversationUi();
@ -453,7 +452,8 @@ public class MessageParser extends AbstractParser implements
Conversation conversation = message.getConversation();
conversation.getMessages().add(message);
if (packet.getType() != MessagePacket.TYPE_ERROR) {
if (message.getEncryption() == Message.ENCRYPTION_NONE || mXmppConnectionService.saveEncryptedMessages()) {
if (message.getEncryption() == Message.ENCRYPTION_NONE
|| mXmppConnectionService.saveEncryptedMessages()) {
mXmppConnectionService.databaseBackend.createMessage(message);
}
}

View File

@ -107,7 +107,8 @@ public class PresenceParser extends AbstractParser implements
contact.setOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST);
}
}
Element nick = packet.findChild("nick", "http://jabber.org/protocol/nick");
Element nick = packet.findChild("nick",
"http://jabber.org/protocol/nick");
if (nick != null) {
contact.setPresenceName(nick.getContent());
}

View File

@ -163,7 +163,8 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ "=?", selectionArgs, null, null, Message.TIME_SENT
+ " DESC", String.valueOf(limit));
} else {
String[] selectionArgs = { conversation.getUuid(), Long.toString(timestamp) };
String[] selectionArgs = { conversation.getUuid(),
Long.toString(timestamp) };
cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION
+ "=? and " + Message.TIME_SENT + "<?", selectionArgs,
null, null, Message.TIME_SENT + " DESC",

View File

@ -585,7 +585,8 @@ public class XmppConnectionService extends Service {
}
if (saveInDb) {
if (message.getEncryption() == Message.ENCRYPTION_NONE || saveEncryptedMessages()) {
if (message.getEncryption() == Message.ENCRYPTION_NONE
|| saveEncryptedMessages()) {
databaseBackend.createMessage(message);
}
}
@ -1546,7 +1547,7 @@ public class XmppConnectionService extends Service {
return PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
}
public boolean forceEncryption() {
return getPreferences().getBoolean("force_encryption", false);
}
@ -1554,7 +1555,7 @@ public class XmppConnectionService extends Service {
public boolean confirmMessages() {
return getPreferences().getBoolean("confirm_messages", true);
}
public boolean saveEncryptedMessages() {
return !getPreferences().getBoolean("dont_save_encrypted", false);
}

View File

@ -82,8 +82,7 @@ public class ChooseContactActivity extends XmppActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_choose_contact);
mListView = (ListView) findViewById(R.id.choose_contact_list);
mContactsAdapter = new ListItemAdapter(getApplicationContext(),
contacts);
mContactsAdapter = new ListItemAdapter(this, contacts);
mListView.setAdapter(mContactsAdapter);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@ -98,7 +97,7 @@ public class ChooseContactActivity extends XmppActivity {
ListItem mListItem = contacts.get(position);
data.putExtra("contact", mListItem.getJid());
String account = request.getStringExtra("account");
if (account==null && mListItem instanceof Contact) {
if (account == null && mListItem instanceof Contact) {
account = ((Contact) mListItem).getAccount().getJid();
}
data.putExtra("account", account);

View File

@ -325,16 +325,18 @@ public class ContactDetailsActivity extends XmppActivity {
for (Iterator<String> iterator = contact.getOtrFingerprints()
.iterator(); iterator.hasNext();) {
final String otrFingerprint = iterator.next();
View view = (View) inflater.inflate(R.layout.contact_key, keys,false);
View view = (View) inflater.inflate(R.layout.contact_key, keys,
false);
TextView key = (TextView) view.findViewById(R.id.key);
TextView keyType = (TextView) view.findViewById(R.id.key_type);
ImageButton remove = (ImageButton) view.findViewById(R.id.button_remove);
ImageButton remove = (ImageButton) view
.findViewById(R.id.button_remove);
remove.setVisibility(View.VISIBLE);
keyType.setText("OTR Fingerprint");
key.setText(otrFingerprint);
keys.addView(view);
remove.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
confirmToDeleteFingerprint(otrFingerprint);
@ -342,7 +344,8 @@ public class ContactDetailsActivity extends XmppActivity {
});
}
if (contact.getPgpKeyId() != 0) {
View view = (View) inflater.inflate(R.layout.contact_key, keys,false);
View view = (View) inflater.inflate(R.layout.contact_key, keys,
false);
TextView key = (TextView) view.findViewById(R.id.key);
TextView keyType = (TextView) view.findViewById(R.id.key_type);
keyType.setText("PGP Key ID");
@ -370,23 +373,25 @@ public class ContactDetailsActivity extends XmppActivity {
keys.addView(view);
}
}
protected void confirmToDeleteFingerprint(final String fingerprint) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.delete_fingerprint);
builder.setMessage(R.string.sure_delete_fingerprint);
builder.setNegativeButton(R.string.cancel, null);
builder.setPositiveButton(R.string.delete,new android.content.DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.delete,
new android.content.DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (contact.deleteOtrFingerprint(fingerprint)) {
populateView();
xmppConnectionService.syncRosterToDisk(contact.getAccount());
}
}
});
@Override
public void onClick(DialogInterface dialog, int which) {
if (contact.deleteOtrFingerprint(fingerprint)) {
populateView();
xmppConnectionService.syncRosterToDisk(contact
.getAccount());
}
}
});
builder.create().show();
}

View File

@ -324,7 +324,8 @@ public class ConversationActivity extends XmppActivity {
} else {
showInstallPgpDialog();
}
} else if (getSelectedConversation().getNextEncryption(forceEncryption()) == Message.ENCRYPTION_NONE) {
} else if (getSelectedConversation().getNextEncryption(
forceEncryption()) == Message.ENCRYPTION_NONE) {
selectPresenceToAttachFile(attachmentChoice);
} else {
selectPresenceToAttachFile(attachmentChoice);
@ -440,7 +441,8 @@ public class ConversationActivity extends XmppActivity {
popup.inflate(R.menu.encryption_choices);
MenuItem otr = popup.getMenu().findItem(
R.id.encryption_choice_otr);
MenuItem none = popup.getMenu().findItem(R.id.encryption_choice_none);
MenuItem none = popup.getMenu().findItem(
R.id.encryption_choice_none);
if (conversation.getMode() == Conversation.MODE_MULTI) {
otr.setEnabled(false);
} else {

View File

@ -2,6 +2,7 @@ package eu.siacs.conversations.ui;
import java.util.Locale;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;

View File

@ -191,8 +191,7 @@ public class StartConversationActivity extends XmppActivity {
}
});
mConferenceAdapter = new ListItemAdapter(getApplicationContext(),
conferences);
mConferenceAdapter = new ListItemAdapter(this, conferences);
mConferenceListFragment.setListAdapter(mConferenceAdapter);
mConferenceListFragment.setContextMenu(R.menu.conference_context);
mConferenceListFragment
@ -205,8 +204,7 @@ public class StartConversationActivity extends XmppActivity {
}
});
mContactsAdapter = new ListItemAdapter(getApplicationContext(),
contacts);
mContactsAdapter = new ListItemAdapter(this, contacts);
mContactsListFragment.setListAdapter(mContactsAdapter);
mContactsListFragment.setContextMenu(R.menu.contact_context);
mContactsListFragment

View File

@ -21,6 +21,7 @@ import android.app.AlertDialog.Builder;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnClickListener;
import android.content.IntentSender.SendIntentException;
import android.content.res.Resources;
@ -33,6 +34,7 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.text.InputType;
import android.util.DisplayMetrics;
import android.util.Log;
@ -183,6 +185,14 @@ public abstract class XmppActivity extends Activity {
mSecondaryTextColor = getResources().getColor(R.color.secondarytext);
mWarningTextColor = getResources().getColor(R.color.warningtext);
mPrimaryColor = getResources().getColor(R.color.primary);
if (getPreferences().getBoolean("use_larger_font", false)) {
setTheme(R.style.ConversationsTheme_LargerText);
}
}
protected SharedPreferences getPreferences() {
return PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
}
public void switchToConversation(Conversation conversation) {
@ -309,26 +319,28 @@ public abstract class XmppActivity extends Activity {
@Override
public void onClick(DialogInterface dialog, int which) {
if (xmppConnectionServiceBound) {
xmppConnectionService.sendPresencePacket(contact.getAccount(),
xmppConnectionService.getPresenceGenerator()
.requestPresenceUpdatesFrom(contact));
xmppConnectionService.sendPresencePacket(contact
.getAccount(), xmppConnectionService
.getPresenceGenerator()
.requestPresenceUpdatesFrom(contact));
}
}
});
builder.create().show();
}
private void warnMutalPresenceSubscription(final Conversation conversation,final OnPresenceSelected listener) {
private void warnMutalPresenceSubscription(final Conversation conversation,
final OnPresenceSelected listener) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(conversation.getContact().getJid());
builder.setMessage(R.string.without_mutual_presence_updates);
builder.setNegativeButton(R.string.cancel, null);
builder.setPositiveButton(R.string.ignore, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
conversation.setNextPresence(null);
if (listener!=null) {
if (listener != null) {
listener.onPresenceSelected();
}
}
@ -388,8 +400,9 @@ public abstract class XmppActivity extends Activity {
&& !contact.getOption(Contact.Options.ASKING)
&& contact.getAccount().getStatus() == Account.STATUS_ONLINE) {
showAskForPresenceDialog(contact);
} else if (!contact.getOption(Contact.Options.TO) || !contact.getOption(Contact.Options.FROM)) {
warnMutalPresenceSubscription(conversation,listener);
} else if (!contact.getOption(Contact.Options.TO)
|| !contact.getOption(Contact.Options.FROM)) {
warnMutalPresenceSubscription(conversation, listener);
} else {
conversation.setNextPresence(null);
listener.onPresenceSelected();

View File

@ -462,7 +462,8 @@ public class MessageAdapter extends ArrayAdapter<Message> {
@Override
public void onClick(View v) {
Downloadable downloadable = item.getDownloadable();
Downloadable downloadable = item
.getDownloadable();
if (downloadable != null) {
downloadable.start();
}

View File

@ -215,8 +215,8 @@ public class UIHelper {
List<User> members = conversation.getMucOptions().getUsers();
if (members.size() == 0) {
return getUnknownContactPicture(
new String[] { conversation.getName() }, size,
bgColor, fgColor);
new String[] { conversation.getName() }, size, bgColor,
fgColor);
}
ArrayList<String> names = new ArrayList<String>();
names.add(conversation.getMucOptions().getActualNick());
@ -548,35 +548,37 @@ public class UIHelper {
private final static class EmoticonPattern {
Pattern pattern;
String replacement;
EmoticonPattern(String ascii, int unicode) {
this.pattern = Pattern.compile("(?<=(^|\\s))" + ascii + "(?=(\\s|$))");
this.replacement = new String(new int[]{unicode, }, 0, 1);
this.pattern = Pattern.compile("(?<=(^|\\s))" + ascii
+ "(?=(\\s|$))");
this.replacement = new String(new int[] { unicode, }, 0, 1);
}
String replaceAll(String body) {
return pattern.matcher(body).replaceAll(replacement);
}
}
private static final EmoticonPattern[] patterns = new EmoticonPattern[] {
new EmoticonPattern(":-?D", 0x1f600),
new EmoticonPattern("\\^\\^", 0x1f601),
new EmoticonPattern(":'D", 0x1f602),
new EmoticonPattern("\\]-?D", 0x1f608),
new EmoticonPattern(";-?\\)", 0x1f609),
new EmoticonPattern(":-?\\)", 0x1f60a),
new EmoticonPattern("[B8]-?\\)", 0x1f60e),
new EmoticonPattern(":-?\\|", 0x1f610),
new EmoticonPattern(":-?[/\\\\]", 0x1f615),
new EmoticonPattern(":-?\\*", 0x1f617),
new EmoticonPattern(":-?[Ppb]", 0x1f61b),
new EmoticonPattern(":-?\\(", 0x1f61e),
new EmoticonPattern(":-?[0Oo]", 0x1f62e),
new EmoticonPattern("\\\\o/", 0x1F631),
};
new EmoticonPattern(":-?D", 0x1f600),
new EmoticonPattern("\\^\\^", 0x1f601),
new EmoticonPattern(":'D", 0x1f602),
new EmoticonPattern("\\]-?D", 0x1f608),
new EmoticonPattern(";-?\\)", 0x1f609),
new EmoticonPattern(":-?\\)", 0x1f60a),
new EmoticonPattern("[B8]-?\\)", 0x1f60e),
new EmoticonPattern(":-?\\|", 0x1f610),
new EmoticonPattern(":-?[/\\\\]", 0x1f615),
new EmoticonPattern(":-?\\*", 0x1f617),
new EmoticonPattern(":-?[Ppb]", 0x1f61b),
new EmoticonPattern(":-?\\(", 0x1f61e),
new EmoticonPattern(":-?[0Oo]", 0x1f62e),
new EmoticonPattern("\\\\o/", 0x1F631), };
public static String transformAsciiEmoticons(String body) {
if (body != null) {
for (EmoticonPattern p: patterns) {
for (EmoticonPattern p : patterns) {
body = p.replaceAll(body);
}
body = body.trim();

View File

@ -763,12 +763,15 @@ public class XmppConnection implements Runnable {
});
}
private void processStreamError(Tag currentTag) throws XmlPullParserException, IOException {
private void processStreamError(Tag currentTag)
throws XmlPullParserException, IOException {
Element streamError = tagReader.readElement(currentTag);
if (streamError!=null && streamError.hasChild("conflict")) {
if (streamError != null && streamError.hasChild("conflict")) {
String resource = account.getResource().split("\\.")[0];
account.setResource(resource+"."+nextRandomId());
Log.d(Config.LOGTAG,account.getJid()+": switching resource due to conflict ("+account.getResource()+")");
account.setResource(resource + "." + nextRandomId());
Log.d(Config.LOGTAG,
account.getJid() + ": switching resource due to conflict ("
+ account.getResource() + ")");
}
}

View File

@ -96,8 +96,8 @@ public class JingleConnection implements Downloadable {
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
int imageHeight = options.outHeight;
int imageWidth = options.outWidth;
message.setBody(Long.toString(file.getSize()) + ',' + imageWidth + ','
+ imageHeight);
message.setBody(Long.toString(file.getSize()) + ','
+ imageWidth + ',' + imageHeight);
mXmppConnectionService.databaseBackend.createMessage(message);
mXmppConnectionService.markMessage(message,
Message.STATUS_RECEIVED);

View File

@ -135,7 +135,8 @@ public class JingleInbandTransport extends JingleTransport {
Element data = iq.addChild("data",
"http://jabber.org/protocol/ibb");
data.setAttribute("seq", Integer.toString(this.seq));
data.setAttribute("block-size", Integer.toString(this.blockSize));
data.setAttribute("block-size",
Integer.toString(this.blockSize));
data.setAttribute("sid", this.sessionId);
data.setContent(base64);
this.account.getXmppConnection().sendIqPacket(iq,

View File

@ -58,9 +58,9 @@ public class JingleSocks5Transport extends JingleTransport {
byte[] reply = new byte[2];
outputStream.write(login);
inputStream.read(reply);
final String connect = Character.toString('\u0005') + '\u0001' + '\u0000'
+ '\u0003' + '\u0028' + destination + '\u0000'
+ '\u0000';
final String connect = Character.toString('\u0005')
+ '\u0001' + '\u0000' + '\u0003' + '\u0028'
+ destination + '\u0000' + '\u0000';
if (Arrays.equals(reply, expectedReply)) {
outputStream.write(connect.getBytes());
byte[] result = new byte[2];