Merge "Fragmentize MessageView."
This commit is contained in:
commit
bab0d45904
|
@ -1,80 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2008 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.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white">
|
||||
<ScrollView
|
||||
android:id="@+id/scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:scrollbarStyle="outsideInset"
|
||||
android:fadingEdge="none">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1">
|
||||
<!-- put invisible views for prev/next in order to not special-case the lanscape in code -->
|
||||
<FrameLayout
|
||||
android:visibility="gone"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="0dip">
|
||||
<View
|
||||
android:id="@+id/moveToNewer"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="0dip" />
|
||||
<View android:id="@+id/moveToOlder"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="0dip" />
|
||||
</FrameLayout>
|
||||
<include layout="@layout/message_view_header" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dip"
|
||||
android:paddingLeft="4dip"
|
||||
android:paddingRight="4dip"
|
||||
android:paddingBottom="1dip"
|
||||
android:background="@android:drawable/bottom_bar">
|
||||
<Button
|
||||
android:id="@+id/reply"
|
||||
android:text="@string/reply_action"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/reply_all"
|
||||
android:text="@string/reply_all_action"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/delete"
|
||||
android:text="@string/delete_action"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -20,58 +20,14 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white">
|
||||
<ScrollView
|
||||
android:id="@+id/scrollview"
|
||||
<fragment
|
||||
android:id="@+id/message_view_fragment"
|
||||
android:name="com.android.email.activity.MessageViewFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
android:fadingEdge="none"
|
||||
android:fillViewport="true">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<!-- Note, height is 2+35+0. There is a 4pixel fade on top of header image -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="37dip"
|
||||
android:paddingTop="2dip"
|
||||
android:background="#101010">
|
||||
<ImageButton
|
||||
android:id="@+id/moveToNewer"
|
||||
android:layout_height="35dip"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:src="@drawable/btn_arrow_left"
|
||||
android:scaleType="fitStart"
|
||||
android:paddingLeft="6dip"
|
||||
android:background="@drawable/btn_arrow_background"
|
||||
android:paddingTop="0dip"
|
||||
android:paddingBottom="0dip"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/moveToOlder"
|
||||
android:layout_height="35dip"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:src="@drawable/btn_arrow_right"
|
||||
android:scaleType="fitEnd"
|
||||
android:paddingRight="9dip"
|
||||
android:background="@drawable/btn_arrow_background"
|
||||
android:paddingTop="0dip"
|
||||
android:paddingBottom="0dip"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/message_view_header" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
<!-- Bottom buttons -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -99,5 +55,17 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/moveToNewer"
|
||||
android:text="@string/message_view_move_to_newer"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/moveToOlder"
|
||||
android:text="@string/message_view_move_to_older"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -14,7 +14,25 @@
|
|||
limitations under the License.
|
||||
-->
|
||||
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--
|
||||
TODO Rename to message_view_fragment.xml
|
||||
Can't do it now because git wouldn't detect renaming.
|
||||
-->
|
||||
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
android:fadingEdge="none"
|
||||
android:fillViewport="true"
|
||||
>
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<!-- header area -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -181,4 +199,6 @@
|
|||
android:padding="4dip"
|
||||
android:background="#ffffff">
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
|
|
@ -332,6 +332,11 @@
|
|||
<item quantity="other"><xliff:g id="size_in_gigabytes" example="279">%d</xliff:g>GB</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Do Not Translate. The label of the next button on the message view screen. -->
|
||||
<string name="message_view_move_to_newer"><</string>
|
||||
<!-- Do Not Translate. The label of the previous button on the message view screen. -->
|
||||
<string name="message_view_move_to_older">></string>
|
||||
|
||||
<!-- Title of screen when setting up new email account -->
|
||||
<string name="account_setup_basics_title">Set up email</string>
|
||||
<!-- Title of the screen when adding exchange account -->
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright (C) 2010 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.email.activity;
|
||||
|
||||
import com.android.email.R;
|
||||
import com.android.email.Utility;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.media.MediaScannerConnection;
|
||||
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
|
||||
import android.net.Uri;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Call to pass a media file to the media scanner service and open it when scanned.
|
||||
*
|
||||
* TODO We maight want to set FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET when starting intent, as its
|
||||
* javadoc suggest. (But seems like Gmail doesn't do that either.)
|
||||
*/
|
||||
public class MediaOpener {
|
||||
private final Activity mActivity;
|
||||
private final MediaScannerConnection mConnection;
|
||||
private final File mFile;
|
||||
|
||||
private MediaOpener(Activity activity, File file) {
|
||||
mActivity = activity;
|
||||
mFile = file;
|
||||
mConnection = new MediaScannerConnection(mActivity.getApplicationContext(),
|
||||
new MediaScannerConnectionClient() {
|
||||
@Override
|
||||
public void onMediaScannerConnected() {
|
||||
mConnection.scanFile(mFile.getAbsolutePath(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScanCompleted(String path, Uri uri) {
|
||||
MediaOpener.this.onScanCompleted(path, uri);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void start() {
|
||||
mConnection.connect();
|
||||
}
|
||||
|
||||
private void onScanCompleted(String path, Uri uri) {
|
||||
try {
|
||||
if (uri != null) {
|
||||
mActivity.startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
}
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Utility.showToast(mActivity, R.string.message_view_display_attachment_toast);
|
||||
// TODO: Add a proper warning message (and lots of upstream cleanup to prevent
|
||||
// it from happening)
|
||||
} finally {
|
||||
mConnection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start scanning a file and opening it when scanned.
|
||||
*
|
||||
* @param activity activity used as a parent when starting an intent.
|
||||
* @param file file to open.
|
||||
*/
|
||||
public static void scanAndOpen(Activity activity, File file) {
|
||||
new MediaOpener(activity, file).start();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue