/*
* DeliciousDroid - http://code.google.com/p/DeliciousDroid/
*
* Copyright (C) 2010 Matt Schmidt
*
* DeliciousDroid is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 3 of the License,
* or (at your option) any later version.
*
* DeliciousDroid is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DeliciousDroid; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
package com.deliciousdroid.activity;
import com.deliciousdroid.Constants;
import com.deliciousdroid.providers.BookmarkContentProvider;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.util.Log;
import android.webkit.WebView;
public class Profile extends Activity {
WebView mWebView;
@Override
public void onCreate(Bundle icicle){
super.onCreate(icicle);
Intent i = getIntent();
Uri contact = Uri.parse(i.getDataString());
// Sets the columns to retrieve for the user profile
String[] projection = new String[] { ContactsContract.Data.DATA1 };
// Retrieves the profile from the Contacts Provider
Cursor c = getContentResolver().query(contact, projection, null, null, null);
int userNameCol = c.getColumnIndex(ContactsContract.Data.DATA1);
String userName = "";
try {
if (c.moveToFirst()) {
userName = c.getString(userNameCol);
Log.d("username", userName);
}
} finally {
if (c != null) {
c.close();
}
}
Intent bookmarkBrowseIntent = new Intent(this, BrowseBookmarks.class);
bookmarkBrowseIntent.setAction(Intent.ACTION_VIEW);
bookmarkBrowseIntent.addCategory(Intent.CATEGORY_DEFAULT);
Uri.Builder data = new Uri.Builder();
data.scheme(Constants.CONTENT_SCHEME);
data.encodedAuthority(userName + "@" + BookmarkContentProvider.AUTHORITY);
data.appendEncodedPath("bookmarks");
bookmarkBrowseIntent.setData(data.build());
Log.d("uri", data.build().toString());
startActivity(bookmarkBrowseIntent);
finish();
}
}