aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/AndroidManifest.xml4
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java10
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java9
-rw-r--r--src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java9
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/utils/UIHelper.java21
-rw-r--r--src/main/res/layout/activity_contact_details.xml1
-rw-r--r--src/main/res/layout/activity_edit_account.xml1
-rw-r--r--src/main/res/layout/activity_muc_details.xml1
9 files changed, 57 insertions, 1 deletions
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index 117bce92..32545985 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -39,6 +39,7 @@
<activity
android:name=".ui.ConversationActivity"
android:label="@string/app_name"
+ android:configChanges="orientation|screenSize"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden">
<intent-filter>
@@ -95,14 +96,17 @@
android:launchMode="singleTask"/>
<activity
android:name=".ui.EditAccountActivity"
+ android:configChanges="orientation|screenSize"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden|adjustResize"/>
<activity
android:name=".ui.ConferenceDetailsActivity"
+ android:configChanges="orientation|screenSize"
android:label="@string/title_activity_conference_details"
android:windowSoftInputMode="stateHidden"/>
<activity
android:name=".ui.ContactDetailsActivity"
+ android:configChanges="orientation|screenSize"
android:label="@string/title_activity_contact_details"
android:windowSoftInputMode="stateHidden"/>
<activity
diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
index 42ce5349..20195256 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
@@ -6,6 +6,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface;
import android.content.IntentSender.SendIntentException;
+import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
@@ -41,6 +42,7 @@ import eu.siacs.conversations.entities.MucOptions.User;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.services.XmppConnectionService.OnConversationUpdate;
import eu.siacs.conversations.services.XmppConnectionService.OnMucRosterUpdate;
+import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.jid.Jid;
public class ConferenceDetailsActivity extends XmppActivity implements OnConversationUpdate, OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnRoleChanged, XmppConnectionService.OnConferenceOptionsPushed {
@@ -53,6 +55,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
inviteToConversation(mConversation);
}
};
+ private LinearLayout mMainLayout;
private TextView mYourNick;
private ImageView mYourPhoto;
private ImageButton mEditNickButton;
@@ -187,6 +190,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_muc_details);
+ mMainLayout = (LinearLayout) findViewById(R.id.muc_main_layout);
mYourNick = (TextView) findViewById(R.id.muc_your_nick);
mYourPhoto = (ImageView) findViewById(R.id.your_photo);
mEditNickButton = (ImageButton) findViewById(R.id.edit_nick_button);
@@ -450,6 +454,12 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
}
+ @Override
+ public void onConfigurationChanged (Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ UIHelper.resetChildMargins(mMainLayout);
+ }
+
private void updateView() {
final MucOptions mucOptions = mConversation.getMucOptions();
final User self = mucOptions.getSelf();
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
index 10bdaab1..ebac6feb 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -7,6 +7,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.content.SharedPreferences;
+import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
@@ -99,6 +100,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
}
}
};
+ private LinearLayout mainLayout;
private Jid accountJid;
private Jid contactJid;
private TextView contactJidTv;
@@ -197,6 +199,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
this.messageFingerprint = getIntent().getStringExtra("fingerprint");
setContentView(R.layout.activity_contact_details);
+ mainLayout = (LinearLayout) findViewById(R.id.details_main_layout);
contactJidTv = (TextView) findViewById(R.id.details_contactjid);
accountJidTv = (TextView) findViewById(R.id.details_account);
lastseen = (TextView) findViewById(R.id.details_lastseen);
@@ -297,6 +300,12 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
return true;
}
+ @Override
+ public void onConfigurationChanged (Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ UIHelper.resetChildMargins(mainLayout);
+ }
+
private void populateView() {
invalidateOptionsMenu();
setTitle(contact.getDisplayName());
diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
index e57a7b68..180fc8b8 100644
--- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
@@ -5,6 +5,7 @@ import android.app.AlertDialog.Builder;
import android.app.PendingIntent;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.security.KeyChain;
@@ -51,6 +52,7 @@ import eu.siacs.conversations.xmpp.pep.Avatar;
public class EditAccountActivity extends XmppActivity implements OnAccountUpdate,
OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast {
+ private LinearLayout mMainLayout;
private AutoCompleteTextView mAccountJid;
private EditText mPassword;
private EditText mPasswordConfirm;
@@ -333,6 +335,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_account);
+ this.mMainLayout = (LinearLayout) findViewById(R.id.account_main_layout);
this.mAccountJid = (AutoCompleteTextView) findViewById(R.id.account_jid);
this.mAccountJid.addTextChangedListener(this.mTextWatcher);
this.mAccountJidLabel = (TextView) findViewById(R.id.account_jid_label);
@@ -480,6 +483,12 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
}
@Override
+ public void onConfigurationChanged (Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ UIHelper.resetChildMargins(mMainLayout);
+ }
+
+ @Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case R.id.action_show_block_list:
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 0cdae2cd..aa03a61d 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -441,7 +441,7 @@ public abstract class XmppActivity extends Activity {
}
public void switchToAccount(Account account) {
- switchToAccount(account,false);
+ switchToAccount(account, false);
}
public void switchToAccount(Account account, boolean init) {
diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
index cac23f07..8a73d35f 100644
--- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
@@ -3,7 +3,11 @@ package eu.siacs.conversations.utils;
import android.content.Context;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
+import android.util.DisplayMetrics;
import android.util.Pair;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
import java.util.ArrayList;
import java.util.Arrays;
@@ -261,4 +265,21 @@ public class UIHelper {
body = body.replace("?","").replace("¿","");
return LOCATION_QUESTIONS.contains(body);
}
+
+ public static void resetChildMargins(LinearLayout view) {
+ int childCount = view.getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ UIHelper.resetMargins(view.getChildAt(i));
+ }
+ }
+
+ private static void resetMargins(View view) {
+ LinearLayout.MarginLayoutParams marginLayoutParams = new LinearLayout.MarginLayoutParams(view.getLayoutParams());
+ marginLayoutParams.setMargins(view.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin),
+ view.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin),
+ view.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin),
+ view.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin));
+ LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(marginLayoutParams);
+ view.setLayoutParams(layoutParams);
+ }
}
diff --git a/src/main/res/layout/activity_contact_details.xml b/src/main/res/layout/activity_contact_details.xml
index 5f6a2dd0..c35f26bb 100644
--- a/src/main/res/layout/activity_contact_details.xml
+++ b/src/main/res/layout/activity_contact_details.xml
@@ -5,6 +5,7 @@
android:background="@color/grey200" >
<LinearLayout
+ android:id="@+id/details_main_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml
index 0be934a8..8d60f5f1 100644
--- a/src/main/res/layout/activity_edit_account.xml
+++ b/src/main/res/layout/activity_edit_account.xml
@@ -13,6 +13,7 @@
android:layout_alignParentTop="true" >
<LinearLayout
+ android:id="@+id/account_main_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
diff --git a/src/main/res/layout/activity_muc_details.xml b/src/main/res/layout/activity_muc_details.xml
index 1a88424e..5f9424a9 100644
--- a/src/main/res/layout/activity_muc_details.xml
+++ b/src/main/res/layout/activity_muc_details.xml
@@ -6,6 +6,7 @@
android:background="@color/grey200">
<LinearLayout
+ android:id="@+id/muc_main_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">