f6adfec81a4d53268166907a3dc2e3ecefc971a0
[pub/Android/ownCloud.git] / src / eu / alefzero / owncloud / ui / fragment / FileDetail.java
1 /* ownCloud Android client application
2 * Copyright (C) 2011 Bartek Przybylski
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18 package eu.alefzero.owncloud.ui.fragment;
19
20 import eu.alefzero.owncloud.R;
21 import eu.alefzero.owncloud.R.id;
22 import eu.alefzero.owncloud.R.layout;
23 import android.content.Intent;
24 import android.os.Bundle;
25 import android.support.v4.app.Fragment;
26 import android.util.Log;
27 import android.view.LayoutInflater;
28 import android.view.View;
29 import android.view.ViewGroup;
30 import android.widget.TextView;
31 import android.widget.Toast;
32
33 /**
34 * This Fragment is used to display the details about a file.
35 * @author Bartek Przybylski
36 *
37 */
38 public class FileDetail extends Fragment {
39
40 public Intent mIntent;
41
42 public void setStuff(Intent intent) {
43 setStuff(intent, getView());
44 }
45
46 private void setStuff(Intent intent, View view) {
47 String filename = intent.getStringExtra("FILE_NAME");
48 String filepath = intent.getStringExtra("FILE_PATH");
49 setFilename(filename, view);
50 }
51
52 @Override
53 public void onCreate(Bundle savedInstanceState) {
54 // TODO Auto-generated method stub
55 super.onCreate(savedInstanceState);
56 }
57
58 @Override
59 public View onCreateView(LayoutInflater inflater, ViewGroup container,
60 Bundle savedInstanceState) {
61 View v = inflater.inflate(R.layout.file_details, container, false);
62
63 if (getActivity().getIntent() != null) setStuff(getActivity().getIntent(), v);
64 return v;
65 }
66
67 private void setFilename(String filename, View target_view) {
68 TextView tv = (TextView) target_view.findViewById(R.id.textView1);
69 if (tv != null) tv.setText(filename);
70 }
71
72 public void setFilename(String filename) {
73 setFilename(filename, getView());
74 }
75 }