Revision c16dc9e7

b/src/com/rackspace/cloud/files/api/client/ContainerObjectManager.java
43 43
		this.context = context;
44 44
	}
45 45

  
46
	public ArrayList<ContainerObjects> createList(boolean detail, String passName) throws CloudServersException {
46
	public ArrayList<ContainerObjects> createList(boolean detail, String passName, String path) throws CloudServersException {
47 47
		
48 48
		CustomHttpClient httpclient = new CustomHttpClient(context);
49
		HttpGet get = new HttpGet(Account.getAccount().getStorageUrl()+"/"+passName+"?format=xml");
49
		Log.d("Request", "captin the request is : " + Account.getAccount().getStorageUrl()+"/"+passName+"?path=" + path + "&format=xml");
50
		HttpGet get = new HttpGet(Account.getAccount().getStorageUrl()+"/"+passName+"?path=" + path + "&format=xml");
50 51
		ArrayList<ContainerObjects> files = new ArrayList<ContainerObjects>();
51 52
		
52 53
		
b/src/com/rackspacecloud/android/ContainerObjectsActivity.java
60 60
	public int bConver = 1048576;
61 61
	public int kbConver = 1024;
62 62
	private Context context;
63
	private String currentPath;
63 64

  
64 65
	@Override
65 66
	public void onCreate(Bundle savedInstanceState) {
......
72 73
		} else {
73 74
			cdnEnabledIs = "false";
74 75
		}
76
		getPath();
75 77
		restoreState(savedInstanceState);
76 78
	}
77

  
79
	
78 80
	@Override
79 81
	protected void onSaveInstanceState(Bundle outState) {
80 82
		super.onSaveInstanceState(outState);
81 83
		outState.putSerializable("container", files);
84
		outState.putString("path", currentPath);
82 85
	}
83 86

  
84 87
	private void restoreState(Bundle state) {
......
89 92
			} else {
90 93
				getListView().setDividerHeight(1); // restore divider lines
91 94
				setListAdapter(new FileAdapter());
92

  
93 95
			}
94
		} else {
96
		} 
97
		else {
95 98
			loadFiles();
96

  
97 99
		}
98 100
	}
99 101

  
100 102
	protected void onListItemClick(ListView l, View v, int position, long id) {
101 103
		if (files != null && files.length > 0) {
102
			Intent viewIntent = new Intent(this, ContainerObjectDetails.class);
103
			viewIntent.putExtra("container", files[position]);
104
			viewIntent.putExtra("cdnUrl", container.getCdnUrl());
105
			viewIntent.putExtra("containerNames", container.getName());
106
			viewIntent.putExtra("isCdnEnabled", cdnEnabledIs);
107
			startActivityForResult(viewIntent, 55); // arbitrary number; never
108
													// used again
104

  
105
			Intent viewIntent;
106

  
107
			if(files[position].getContentType().equals("application/directory")){
108
				viewIntent = new Intent(this, ContainerObjectsActivity.class);
109
				viewIntent.putExtra("container", container);
110
				viewIntent.putExtra("cdnUrl", container.getCdnUrl());
111
				viewIntent.putExtra("containerNames", container.getName());
112
				viewIntent.putExtra("isCdnEnabled", cdnEnabledIs);
113
				viewIntent.putExtra("path", files[position].getCName());
114
				Log.d("the path name is: ","captin " + files[position].getCName());
115
				startActivity(viewIntent);
116
			}
117

  
118

  
119
			else{
120
				viewIntent = new Intent(this, ContainerObjectDetails.class);
121
				viewIntent.putExtra("container", files[position]);
122
				viewIntent.putExtra("cdnUrl", container.getCdnUrl());
123
				viewIntent.putExtra("containerNames", container.getName());
124
				viewIntent.putExtra("isCdnEnabled", cdnEnabledIs);
125
				startActivityForResult(viewIntent, 55); // arbitrary number; never
126
				// used again
127
			}
109 128
		}
110 129
	}
111 130

  
131

  
132
	private void getPath(){
133
		if(this.getIntent().getExtras().containsKey("path")){
134
			Log.d("contained path", "captin: " +  (String)this.getIntent().getExtras().get("path"));
135
			currentPath = (String)this.getIntent().getExtras().get("path");
136
		}
137
		else{
138
			Log.d("contained path", "captin no path");
139
			currentPath = "";
140
		}
141
		
142
	}
143

  
112 144
	private void loadFiles() {
113 145
		displayLoadingCell();
114
		new LoadFilesTask().execute((Void[]) null);
146
		new LoadFilesTask().execute(currentPath);
115 147

  
116 148
	}
117 149

  
......
180 212
	}
181 213

  
182 214
	private class LoadFilesTask extends
183
			AsyncTask<Void, Void, ArrayList<ContainerObjects>> {
215
			AsyncTask<String, Void, ArrayList<ContainerObjects>> {
184 216

  
185 217
		private CloudServersException exception;
186 218

  
187 219
		@Override
188
		protected ArrayList<ContainerObjects> doInBackground(Void... arg0) {
220
		protected ArrayList<ContainerObjects> doInBackground(String... path) {
189 221
			ArrayList<ContainerObjects> files = null;
190 222
			try {
191 223
				files = (new ContainerObjectManager(context)).createList(true,
192
						container.getName());
224
						container.getName(), path[0]);
193 225
			} catch (CloudServersException e) {
194 226
				exception = e;
195 227
				e.printStackTrace();
......
220 252
					parent, false);
221 253

  
222 254
			TextView label = (TextView) row.findViewById(R.id.label);
223
			label.setText(file.getCName());
255
			//label.setText(file.getCName());
256
			label.setText(getShortName(file.getCName()));
224 257

  
225 258
			if (file.getBytes() >= bConver) {
226 259
				megaBytes = Math.abs(file.getBytes() / bConver + 0.2);
......
238 271
			return (row);
239 272
		}
240 273
	}
274
	
275
	/* just get the last part of the filename
276
	 * so the entire file path does not show
277
	*/
278
	private String getShortName(String longName){
279
		String s = longName;
280
		if(!s.contains("/")){
281
			return s;
282
		}
283
		else {
284
			return s.substring(s.lastIndexOf('/')+1);
285
		}
286
	}
241 287

  
242 288
	// Create the Menu options
243 289
	@Override

Also available in: Unified diff