Merge "Import translations. DO NOT MERGE" into jb-ub-mail
diff --git a/res/layout/photo_fragment_view.xml b/res/layout/photo_fragment_view.xml
index 05babdf..926ca69 100644
--- a/res/layout/photo_fragment_view.xml
+++ b/res/layout/photo_fragment_view.xml
@@ -20,19 +20,11 @@
android:layout_height="match_parent"
android:background="@color/solid_black"
>
- <com.android.mail.photo.views.PhotoLayout
- android:id="@+id/photo_layout"
+ <com.android.mail.photo.views.PhotoView
+ android:id="@+id/photo_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical"
- >
- <com.android.mail.photo.views.PhotoView
- android:id="@+id/photo_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- />
- </com.android.mail.photo.views.PhotoLayout>
-
+ />
<FrameLayout
android:id="@id/android:empty"
diff --git a/res/values/themes.xml b/res/values/themes.xml
index b62c714..a3d0162 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -20,6 +20,7 @@
<style name="PhotoViewTheme" parent="android:Theme.Holo">
<item name="android:windowNoTitle">false</item>
<item name="android:windowContentOverlay">@null</item>
+ <item name="android:windowActionBarOverlay">true</item>
<item name="android:windowBackground">@drawable/photo_view_background</item>
</style>
</resources>
diff --git a/src/com/android/mail/photo/fragments/PhotoViewFragment.java b/src/com/android/mail/photo/fragments/PhotoViewFragment.java
index 6d3a7ef..fc39d7b 100644
--- a/src/com/android/mail/photo/fragments/PhotoViewFragment.java
+++ b/src/com/android/mail/photo/fragments/PhotoViewFragment.java
@@ -39,7 +39,6 @@
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.view.ViewParent;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ProgressBar;
@@ -53,7 +52,6 @@
import com.android.mail.photo.PhotoViewActivity.OnScreenListener;
import com.android.mail.photo.loaders.PhotoBitmapLoader;
import com.android.mail.photo.util.ImageUtils;
-import com.android.mail.photo.views.PhotoLayout;
import com.android.mail.photo.views.PhotoView;
import java.io.File;
@@ -199,7 +197,6 @@
/** Whether or not the photo is a place holder */
private boolean mIsPlaceHolder = true;
- private PhotoLayout mPhotoLayout;
private PhotoView mPhotoView;
/** The height of the action bar; may be {@code 0} if there is no action bar available */
@@ -289,15 +286,11 @@
final View view = super.onCreateView(inflater, container, savedInstanceState,
R.layout.photo_fragment_view);
- mPhotoLayout = (PhotoLayout) view.findViewById(R.id.photo_layout);
mPhotoView = (PhotoView) view.findViewById(R.id.photo_view);
mIsPlaceHolder = true;
mPhotoView.setPhotoLoading(true);
- // Bind the photo data
- setPhotoLayoutFixedHeight();
-
mPhotoView.setOnClickListener(this);
mPhotoView.setFullScreen(mFullScreen, false);
// mPhotoView.setVideoBlob(videoData);
@@ -339,11 +332,6 @@
mPhotoView = null;
}
- if (mPhotoLayout != null) {
- mPhotoLayout.clear();
- mPhotoLayout = null;
- }
-
super.onDestroyView();
}
@@ -510,22 +498,6 @@
@Override
public void onActionBarHeightCalculated(int actionBarHeight) {
- final boolean heightChanged = (actionBarHeight != mActionBarHeight);
- mActionBarHeight = actionBarHeight;
- if (heightChanged && mActionBarHeight > 0) {
- setPhotoLayoutFixedHeight();
- }
- }
-
- private void setPhotoLayoutFixedHeight() {
- if (mPhotoLayout != null) {
- ViewParent viewParent = mPhotoLayout.getParent();
- if (viewParent instanceof View) {
- mPhotoLayout.setFixedHeight(
- ((View) mPhotoLayout.getParent()).getMeasuredHeight() -
- (mDisableSpacer ? 0 : mActionBarHeight));
- }
- }
}
@Override
diff --git a/src/com/android/mail/photo/views/PhotoLayout.java b/src/com/android/mail/photo/views/PhotoLayout.java
deleted file mode 100644
index 30c8b42..0000000
--- a/src/com/android/mail/photo/views/PhotoLayout.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc.
- * Licensed to The Android Open Source Project.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mail.photo.views;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.LinearLayout;
-
-import com.android.mail.R;
-
-/**
- * Custom layout for the photo view.
- * <p>
- * The photo view gives the photo a dynamic height -- it always takes up whatever's left of the
- * screen. A normal {@link LinearLayout} does not allow this [at least not in the context of a
- * list]. So, we create a layout that can fix it's height and ensures its children [such as the
- * photo itself] are sized appropriately.
- */
-public class PhotoLayout extends LinearLayout {
- /** The fixed height of this view. If {@code -1}, calculate the height */
- private int mFixedHeight = -1;
- /** The view containing primary photo information */
- private PhotoView mPhotoView;
-
- public PhotoLayout(Context context) {
- super(context);
- }
-
- public PhotoLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public PhotoLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- @Override
- public void addView(View child, int index, android.view.ViewGroup.LayoutParams params) {
- super.addView(child, index, params);
-
- if (child.getId() == R.id.photo_view) {
- mPhotoView = (PhotoView) child;
- }
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- setFixedHeight(mFixedHeight);
- }
-
- /**
- * Clears any state or resources from the views. The layout cannot be used after this method
- * is called.
- */
- public void clear() {
- removeAllViews();
- mPhotoView = null;
- }
-
- /**
- * Sets the fixed height for this layout. If the given height is <= 0, it is ignored.
- */
- public void setFixedHeight(int fixedHeight) {
- if (fixedHeight <= 0) {
- return;
- }
-
- final boolean adjustBounds = (fixedHeight != mFixedHeight);
- mFixedHeight = fixedHeight;
-
- if (mPhotoView != null) {
- int adjustHeight = 0;
- mPhotoView.setFixedHeight(mFixedHeight - adjustHeight);
- }
- setMeasuredDimension(getMeasuredWidth(), mFixedHeight);
-
- if (adjustBounds) {
- requestLayout();
- }
- }
-}
diff --git a/src/com/android/mail/providers/UIProvider.java b/src/com/android/mail/providers/UIProvider.java
index a283c26..228530e 100644
--- a/src/com/android/mail/providers/UIProvider.java
+++ b/src/com/android/mail/providers/UIProvider.java
@@ -568,6 +568,10 @@
* All the messages in this folder are important.
*/
public static final int ONLY_IMPORTANT = 0x0100;
+ /**
+ * Deletions in this folder can't be undone (could include archive if desirable)
+ */
+ public static final int DELETE_ACTION_FINAL = 0x0200;
}
public static final class FolderColumns {
diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java
index 55a5d0b..1fa57af 100644
--- a/src/com/android/mail/ui/AbstractActivityController.java
+++ b/src/com/android/mail/ui/AbstractActivityController.java
@@ -518,6 +518,11 @@
}
@Override
+ public Folder getFolder() {
+ return mFolder;
+ }
+
+ @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == ADD_ACCOUNT_REQUEST_CODE) {
// We were waiting for the user to create an account
@@ -1517,6 +1522,9 @@
case R.id.delete:
LogUtils.d(LOG_TAG, "Deleting");
mConversationListCursor.delete(mContext, mTarget);
+ if (!mFolder.supportsCapability(FolderCapabilities.DELETE_ACTION_FINAL)) {
+ undoEnabled = false;
+ }
break;
case R.id.mute:
LogUtils.d(LOG_TAG, "Muting");
diff --git a/src/com/android/mail/ui/ActivityController.java b/src/com/android/mail/ui/ActivityController.java
index d35e189..ee36df0 100644
--- a/src/com/android/mail/ui/ActivityController.java
+++ b/src/com/android/mail/ui/ActivityController.java
@@ -299,4 +299,9 @@
* Load the default inbox associated with the current account.
*/
public abstract void loadAccountInbox();
+
+ /**
+ * Return the folder currently being viewed by the activity.
+ */
+ public abstract Folder getFolder();
}
diff --git a/src/com/android/mail/ui/ControllableActivity.java b/src/com/android/mail/ui/ControllableActivity.java
index 3950a98..486b863 100644
--- a/src/com/android/mail/ui/ControllableActivity.java
+++ b/src/com/android/mail/ui/ControllableActivity.java
@@ -18,6 +18,7 @@
package com.android.mail.ui;
import com.android.mail.providers.Conversation;
+import com.android.mail.providers.Folder;
import com.android.mail.ui.ViewMode.ModeChangeListener;
import com.android.mail.ui.FolderListFragment;
@@ -78,4 +79,9 @@
DragListener getDragListener();
void onConversationSeen(Conversation conv);
+
+ /**
+ * Get the folder currently being accessed by the activity.
+ */
+ Folder getCurrentFolder();
}
diff --git a/src/com/android/mail/ui/FolderListFragment.java b/src/com/android/mail/ui/FolderListFragment.java
index 2e980ec..912f7d7 100644
--- a/src/com/android/mail/ui/FolderListFragment.java
+++ b/src/com/android/mail/ui/FolderListFragment.java
@@ -114,6 +114,7 @@
// Activity is finishing, just bail.
return;
}
+ selectFolder(mActivity.getCurrentFolder());
getLoaderManager().initLoader(FOLDER_LOADER_ID, Bundle.EMPTY, this);
}
diff --git a/src/com/android/mail/ui/FolderSelectionActivity.java b/src/com/android/mail/ui/FolderSelectionActivity.java
index ba2317a..b9deaaf 100644
--- a/src/com/android/mail/ui/FolderSelectionActivity.java
+++ b/src/com/android/mail/ui/FolderSelectionActivity.java
@@ -319,4 +319,9 @@
public void onConversationSeen(Conversation conv) {
// Do nothing.
}
+
+ @Override
+ public Folder getCurrentFolder() {
+ return null;
+ }
}
diff --git a/src/com/android/mail/ui/MailActivity.java b/src/com/android/mail/ui/MailActivity.java
index ba44317..dd2c149 100644
--- a/src/com/android/mail/ui/MailActivity.java
+++ b/src/com/android/mail/ui/MailActivity.java
@@ -300,4 +300,9 @@
public void onConversationSeen(Conversation conv) {
mController.onConversationSeen(conv);
}
+
+ @Override
+ public Folder getCurrentFolder() {
+ return mController.getFolder();
+ }
}