messageview: remove support for "hidden" attachments
This commit is contained in:
parent
035aba1c1e
commit
bd925567e4
2 changed files with 5 additions and 74 deletions
|
@ -20,12 +20,9 @@ import android.view.Menu;
|
|||
import android.view.MenuItem;
|
||||
import android.view.MenuItem.OnMenuItemClickListener;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnCreateContextMenuListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebView.HitTestResult;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -44,8 +41,7 @@ import com.fsck.k9.view.MessageWebView;
|
|||
import com.fsck.k9.view.MessageWebView.OnPageFinishedListener;
|
||||
|
||||
|
||||
public class MessageContainerView extends LinearLayout implements OnClickListener,
|
||||
OnLayoutChangedListener, OnCreateContextMenuListener {
|
||||
public class MessageContainerView extends LinearLayout implements OnLayoutChangedListener, OnCreateContextMenuListener {
|
||||
private static final int MENU_ITEM_LINK_VIEW = Menu.FIRST;
|
||||
private static final int MENU_ITEM_LINK_SHARE = Menu.FIRST + 1;
|
||||
private static final int MENU_ITEM_LINK_COPY = Menu.FIRST + 2;
|
||||
|
@ -64,8 +60,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||
|
||||
private MessageWebView mMessageContentView;
|
||||
private LinearLayout mAttachments;
|
||||
private Button mShowHiddenAttachments;
|
||||
private LinearLayout mHiddenAttachments;
|
||||
private View unsignedTextContainer;
|
||||
private TextView unsignedText;
|
||||
private View mAttachmentsContainer;
|
||||
|
@ -95,11 +89,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||
|
||||
mAttachmentsContainer = findViewById(R.id.attachments_container);
|
||||
mAttachments = (LinearLayout) findViewById(R.id.attachments);
|
||||
mHiddenAttachments = (LinearLayout) findViewById(R.id.hidden_attachments);
|
||||
mHiddenAttachments.setVisibility(View.GONE);
|
||||
mShowHiddenAttachments = (Button) findViewById(R.id.show_hidden_attachments);
|
||||
mShowHiddenAttachments.setVisibility(View.GONE);
|
||||
mShowHiddenAttachments.setOnClickListener(this);
|
||||
|
||||
unsignedTextContainer = findViewById(R.id.message_unsigned_container);
|
||||
unsignedText = (TextView) findViewById(R.id.message_unsigned_text);
|
||||
|
@ -356,21 +345,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.show_hidden_attachments: {
|
||||
onShowHiddenAttachments();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onShowHiddenAttachments() {
|
||||
mShowHiddenAttachments.setVisibility(View.GONE);
|
||||
mHiddenAttachments.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public MessageContainerView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
@ -417,10 +391,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||
setLoadPictures(true);
|
||||
}
|
||||
|
||||
if (mSavedState.hiddenAttachmentsVisible) {
|
||||
onShowHiddenAttachments();
|
||||
}
|
||||
|
||||
mSavedState = null;
|
||||
}
|
||||
|
||||
|
@ -479,45 +449,27 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||
|
||||
if (messageViewInfo.attachments != null) {
|
||||
for (AttachmentViewInfo attachment : messageViewInfo.attachments) {
|
||||
ViewGroup parent;
|
||||
if (attachment.firstClassAttachment) {
|
||||
parent = mAttachments;
|
||||
} else {
|
||||
parent = mHiddenAttachments;
|
||||
hasHiddenAttachments = true;
|
||||
}
|
||||
AttachmentView view =
|
||||
(AttachmentView) mInflater.inflate(R.layout.message_view_attachment, parent, false);
|
||||
(AttachmentView) mInflater.inflate(R.layout.message_view_attachment, mAttachments, false);
|
||||
view.setCallback(attachmentCallback);
|
||||
view.setAttachment(attachment);
|
||||
|
||||
attachments.put(attachment, view);
|
||||
parent.addView(view);
|
||||
mAttachments.addView(view);
|
||||
}
|
||||
}
|
||||
|
||||
if (messageViewInfo.extraAttachments != null) {
|
||||
for (AttachmentViewInfo attachment : messageViewInfo.extraAttachments) {
|
||||
ViewGroup parent;
|
||||
if (attachment.firstClassAttachment) {
|
||||
parent = mAttachments;
|
||||
} else {
|
||||
parent = mHiddenAttachments;
|
||||
hasHiddenAttachments = true;
|
||||
}
|
||||
LockedAttachmentView view = (LockedAttachmentView) mInflater
|
||||
.inflate(R.layout.message_view_attachment_locked, parent, false);
|
||||
.inflate(R.layout.message_view_attachment_locked, mAttachments, false);
|
||||
view.setCallback(attachmentCallback);
|
||||
view.setAttachment(attachment);
|
||||
|
||||
// attachments.put(attachment, view);
|
||||
parent.addView(view);
|
||||
mAttachments.addView(view);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasHiddenAttachments) {
|
||||
mShowHiddenAttachments.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void zoom(KeyEvent event) {
|
||||
|
@ -535,8 +487,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||
public void resetView() {
|
||||
setLoadPictures(false);
|
||||
mAttachments.removeAllViews();
|
||||
mHiddenAttachments.removeAllViews();
|
||||
mHiddenAttachments.setVisibility(View.GONE);
|
||||
|
||||
currentHtmlText = null;
|
||||
currentAttachmentResolver = null;
|
||||
|
@ -559,8 +509,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||
|
||||
savedState.attachmentViewVisible = (mAttachmentsContainer != null &&
|
||||
mAttachmentsContainer.getVisibility() == View.VISIBLE);
|
||||
savedState.hiddenAttachmentsVisible = (mHiddenAttachments != null &&
|
||||
mHiddenAttachments.getVisibility() == View.VISIBLE);
|
||||
savedState.showingPictures = showingPictures;
|
||||
|
||||
return savedState;
|
||||
|
@ -604,7 +552,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||
|
||||
static class SavedState extends BaseSavedState {
|
||||
boolean attachmentViewVisible;
|
||||
boolean hiddenAttachmentsVisible;
|
||||
boolean showingPictures;
|
||||
|
||||
public static final Parcelable.Creator<SavedState> CREATOR =
|
||||
|
@ -628,7 +575,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||
private SavedState(Parcel in) {
|
||||
super(in);
|
||||
this.attachmentViewVisible = (in.readInt() != 0);
|
||||
this.hiddenAttachmentsVisible = (in.readInt() != 0);
|
||||
this.showingPictures = (in.readInt() != 0);
|
||||
}
|
||||
|
||||
|
@ -636,7 +582,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||
public void writeToParcel(Parcel out, int flags) {
|
||||
super.writeToParcel(out, flags);
|
||||
out.writeInt((this.attachmentViewVisible) ? 1 : 0);
|
||||
out.writeInt((this.hiddenAttachmentsVisible) ? 1 : 0);
|
||||
out.writeInt((this.showingPictures) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,20 +77,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/show_hidden_attachments"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/message_view_show_more_attachments_action" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/hidden_attachments"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.fsck.k9.ui.messageview.MessageContainerView>
|
Loading…
Reference in a new issue