<?xml version="1.0" encoding="utf-8"?>
-<!--
+<!--
ownCloud Android client application
Copyright (C) 2012 Bartek Przybylski
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
+-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:background="#F7F7F7"
+ android:background="@color/owncloud_white"
android:orientation="vertical" >
- <LinearLayout
- android:id="@+id/linearLayout1"
+ <ScrollView
+ android:id="@+id/fdScrollView"
android:layout_width="fill_parent"
- android:layout_height="wrap_content" >
-
- <LinearLayout
- android:id="@+id/linearLayout2"
- android:layout_width="wrap_content"
- android:layout_height="fill_parent" >
-
- <ImageView
- android:id="@+id/imageView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/icon" >
- </ImageView>
- </LinearLayout>
+ android:layout_height="fill_parent" >
<LinearLayout
- android:id="@+id/linearLayout3"
- android:layout_width="wrap_content"
- android:layout_height="fill_parent"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
android:orientation="vertical" >
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="TextView" >
- </TextView>
-
- <TextView
- android:id="@+id/textView2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="TextView" >
- </TextView>
-
- <TextView
- android:id="@+id/textView3"
+ <ImageView
+ android:id="@+id/fdIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="TextView" >
- </TextView>
+ android:layout_alignParentLeft="true"
+ android:layout_marginLeft="16dp"
+ android:src="@drawable/file" />
<TextView
- android:id="@+id/textView4"
+ android:id="@+id/fdFilename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="TextView" >
- </TextView>
+ android:layout_alignBottom="@+id/fdIcon"
+ android:layout_centerHorizontal="true"
+ android:text="file.name"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
- <TextView
- android:id="@+id/textView5"
+ <LinearLayout
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="TextView" >
- </TextView>
+ android:layout_height="wrap_content" >
+
+ <TextView
+ android:id="@+id/fdType"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/fdCreatedLabel"
+ android:layout_alignLeft="@+id/fdFilename"
+ android:text="JPG Image"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/fdSize"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/fdSizeLabel"
+ android:layout_alignLeft="@+id/fdFilename"
+ android:text="389 KB"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/fdCreated"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/fdModifiedLabel"
+ android:layout_alignLeft="@+id/fdFilename"
+ android:text="2012/05/18 12:23 PM"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/fdModified"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignBaseline="@+id/fdModifiedLabel"
+ android:layout_alignBottom="@+id/fdModifiedLabel"
+ android:layout_alignLeft="@+id/fdCreated"
+ android:text="2012/05/19 02:56 PM"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <ImageView
+ android:id="@+id/fdPreview"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/fdModified"
+ android:layout_centerHorizontal="true"
+ android:layout_marginTop="16dp"
+ android:src="@drawable/owncloud_logo" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true" >
+
+ <TextView
+ android:id="@+id/fdTypeLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@+id/fdIcon"
+ android:layout_below="@+id/fdIcon"
+ android:layout_marginTop="24dp"
+ android:text="@string/filedetails_type"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/fdSizeLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@+id/fdIcon"
+ android:layout_below="@+id/fdTypeLabel"
+ android:layout_marginTop="12dp"
+ android:text="@string/filedetails_size"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/fdCreatedLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@+id/fdIcon"
+ android:layout_below="@+id/fdSizeLabel"
+ android:layout_marginTop="12dp"
+ android:text="@string/filedetails_created"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/fdModifiedLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@+id/fdIcon"
+ android:layout_below="@+id/fdCreatedLabel"
+ android:layout_marginTop="12dp"
+ android:text="@string/filedetails_modified"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+ </LinearLayout>
+ </LinearLayout>
</LinearLayout>
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/linearLayout4"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent" >
-
- <ImageView
- android:id="@+id/imageView2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/action_item_btn" />
-
- <VideoView
- android:id="@+id/videoView1"
- android:layout_width="wrap_content"
- android:layout_height="match_parent" />
-
- <ListView
- android:id="@android:id/list"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:divider="@drawable/uploader_list_separator"
- android:dividerHeight="1dip" >
- </ListView>
- </LinearLayout>
+ </ScrollView>
+
+ <Button
+ android:id="@+id/fdDownloadBtn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/fdScrollView"
+ android:layout_centerHorizontal="true"
+ android:text="@string/filedetails_download" />
</LinearLayout>
\ No newline at end of file
import android.view.View;\r
import android.view.View.OnClickListener;\r
import android.view.ViewGroup;\r
+import android.widget.Button;\r
import android.widget.ImageView;\r
import android.widget.TextView;\r
import android.widget.Toast;\r
-import android.widget.VideoView;\r
\r
import com.actionbarsherlock.app.SherlockFragment;\r
\r
setFiletype(DisplayUtils.convertMIMEtoPrettyPrint(mFile\r
.getMimetype()));\r
setFilesize(mFile.getFileLength());\r
-\r
- // set file preview if available and possible\r
- VideoView videoView = (VideoView) getView()\r
- .findViewById(R.id.videoView1);\r
- videoView.setVisibility(View.INVISIBLE);\r
- if (mFile.getStoragePath() == null) {\r
- ImageView imageView = (ImageView) getView().findViewById(\r
- R.id.imageView2);\r
- imageView.setImageResource(R.drawable.download);\r
- imageView.setOnClickListener(this);\r
- } else {\r
+ \r
+ // Update preview\r
+ if (mFile.getStoragePath() != null) {\r
if (mFile.getMimetype().startsWith("image/")) {\r
- ImageView imageView = (ImageView) getView()\r
- .findViewById(R.id.imageView2);\r
+ ImageView preview = (ImageView) getView().findViewById(\r
+ R.id.fdPreview);\r
Bitmap bmp = BitmapFactory.decodeFile(mFile.getStoragePath());\r
- imageView.setImageBitmap(bmp);\r
- } else if (mFile.getMimetype().startsWith("video/")) {\r
- videoView.setVisibility(View.VISIBLE);\r
- videoView.setVideoPath(mFile.getStoragePath());\r
- videoView.start();\r
+ preview.setImageBitmap(bmp);\r
}\r
}\r
+ \r
+ // Make download button effective\r
+ Button downloadButton = (Button) getView().findViewById(R.id.fdDownloadBtn);\r
+ downloadButton.setOnClickListener(this);\r
}\r
}\r
\r
}\r
\r
private void setFilename(String filename) {\r
- TextView tv = (TextView) getView().findViewById(R.id.textView1);\r
+ TextView tv = (TextView) getView().findViewById(R.id.fdFilename);\r
if (tv != null)\r
tv.setText(filename);\r
}\r
\r
private void setFiletype(String mimetype) {\r
- TextView tv = (TextView) getView().findViewById(R.id.textView2);\r
+ TextView tv = (TextView) getView().findViewById(R.id.fdType);\r
if (tv != null)\r
tv.setText(mimetype);\r
}\r
\r
private void setFilesize(long filesize) {\r
- TextView tv = (TextView) getView().findViewById(R.id.textView3);\r
+ TextView tv = (TextView) getView().findViewById(R.id.fdSize);\r
if (tv != null)\r
tv.setText(DisplayUtils.bitsToHumanReadable(filesize));\r
}\r
Intent i = new Intent(getActivity(), FileDownloader.class);\r
i.putExtra(FileDownloader.EXTRA_ACCOUNT,\r
mIntent.getParcelableExtra(FileDownloader.EXTRA_ACCOUNT));\r
- i.putExtra(FileDownloader.EXTRA_FILE_PATH,\r
- mIntent.getStringExtra(FileDownloader.EXTRA_FILE_PATH));\r
+ i.putExtra(FileDownloader.EXTRA_FILE_PATH, mFile.getPath());\r
getActivity().startService(i);\r
}\r
\r