/*
LogMyNight - Android app for logging night activities.
Copyright (c) 2010 Michael Greifeneder <mikegr@gmx.net>, Oliver Selinger <oliver.selinger@gmail.com>
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.autburst.picture.facebook;
import com.autburst.picture.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
public class FacebookActivity extends Activity {
private static final String TAG = FacebookActivity.class.getName();
public static final int POSTED = 463453;
public static final int PROBLEM = 76343;
private String[] permissions = new String[] { "publish_stream" };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Dispatcher dispatcher = new Dispatcher(this);
dispatcher.addHandler("login", LoginHandler.class);
dispatcher.addHandler("publish", PublishHandler.class);
/*
SharedPreferences prefs = getPreferences(MODE_PRIVATE);
Editor editor = prefs.edit();
editor.putString("message", message);
editor.commit();
*/
Session session = Session.restore(this);
if (session != null) {
dispatcher.runHandler("publish");
} else {
dispatcher.runHandler("login");
}
}
protected Dialog onCreateDialog(int id) {
Dialog dialog = null;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Facebook");
if (id == POSTED) {
builder.setMessage(R.string.message_posted);
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
finish();
}
});
dialog = builder.create();
}
if (id == PROBLEM) {
builder.setMessage(R.string.transfer_problem);
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
finish();
}
});
dialog = builder.create();
}
return dialog;
}
}