Android Open Source - rsmonitor-heartrate Update Status Result Dialog






From Project

Back to project page rsmonitor-heartrate.

License

The source code is released under:

GNU General Public License

If you think the Android project rsmonitor-heartrate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.facebook.android;
/*  w  w  w  .j  a va2s  .  co  m*/
import org.json.JSONException;
import org.json.JSONObject;

import com.renaultsport.heartrate.R;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.os.Handler;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.TextView;

public class UpdateStatusResultDialog extends Dialog {

    private Bundle values;
    private TextView mOutput, mUsefulTip;
    private Button mViewPostButton, mDeletePostButton;
    private Activity activity;
    private Handler mHandler;

    public UpdateStatusResultDialog(Activity activity, String title, Bundle values) {
        super(activity);
        this.activity = activity;
        this.values = values;
        setTitle(title);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mHandler = new Handler();

        setContentView(R.layout.update_post_response);
        LayoutParams params = getWindow().getAttributes();
        params.width = LayoutParams.FILL_PARENT;
        params.height = LayoutParams.FILL_PARENT;
        getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);

        mOutput = (TextView) findViewById(R.id.apiOutput);
        mOutput.setText(values.toString());

        mUsefulTip = (TextView) findViewById(R.id.usefulTip);
        mUsefulTip.setMovementMethod(LinkMovementMethod.getInstance());
        mViewPostButton = (Button) findViewById(R.id.view_post_button);
        mDeletePostButton = (Button) findViewById(R.id.delete_post_button);
        final String postId = values.getString("post_id");

        mViewPostButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                /*
                 * Source tag: view_post_tag
                 */
                Utility.mAsyncRunner.request(postId, new WallPostRequestListener());
            }
        });
        mDeletePostButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                /*
                 * Source tag: delete_post_tag
                 */
                Utility.mAsyncRunner.request(postId, new Bundle(), "DELETE",
                        new WallPostDeleteListener(), null);
            }
        });
    }

    public class WallPostRequestListener extends BaseRequestListener {

        @Override
        public void onComplete(final String response, final Object state) {
            try {
                JSONObject json = new JSONObject(response);
                setText(json.toString(2));
            } catch (JSONException e) {
                setText(activity.getString(R.string.exception) + e.getMessage());
            }
        }

        public void onFacebookError(FacebookError error) {
            setText(activity.getString(R.string.facebook_error) + error.getMessage());
        }
    }

    public class WallPostDeleteListener extends BaseRequestListener {

        @Override
        public void onComplete(final String response, final Object state) {
            if (response.equals("true")) {
                String message = "Wall Post deleted" + "\n";
                message += "Api Response: " + response;
                setText(message);
            } else {
                setText("wall post could not be deleted");
            }
        }

        public void onFacebookError(FacebookError error) {
            setText(activity.getString(R.string.facebook_error) + error.getMessage());
        }
    }

    public void setText(final String txt) {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                mOutput.setText(txt);
            }
        });
    }
}




Java Source Code List

com.facebook.android.AsyncFacebookRunner.java
com.facebook.android.BaseDialogListener.java
com.facebook.android.BaseRequestListener.java
com.facebook.android.DialogError.java
com.facebook.android.FQLQuery.java
com.facebook.android.FacebookError.java
com.facebook.android.FacebookFunctions.java
com.facebook.android.Facebook.java
com.facebook.android.FbDialog.java
com.facebook.android.FieldsConnectionsDialog.java
com.facebook.android.FriendsGetProfilePics.java
com.facebook.android.FriendsList.java
com.facebook.android.GraphExplorer.java
com.facebook.android.IntentUriHandler.java
com.facebook.android.LoginButton.java
com.facebook.android.PermissionsDialog.java
com.facebook.android.Places.java
com.facebook.android.SessionEvents.java
com.facebook.android.SessionStore.java
com.facebook.android.TokenRefreshDialog.java
com.facebook.android.UpdateStatusResultDialog.java
com.facebook.android.UploadPhotoResultDialog.java
com.facebook.android.Util.java
com.facebook.android.Utility.java
com.googlecode.android.widgets.DateSlider.AlternativeDateSlider.java
com.googlecode.android.widgets.DateSlider.CustomDateSlider.java
com.googlecode.android.widgets.DateSlider.DateSlider.java
com.googlecode.android.widgets.DateSlider.DateTimeSlider.java
com.googlecode.android.widgets.DateSlider.DefaultDateSlider.java
com.googlecode.android.widgets.DateSlider.MonthYearDateSlider.java
com.googlecode.android.widgets.DateSlider.ScrollLayout.java
com.googlecode.android.widgets.DateSlider.TimeSlider.java
com.googlecode.android.widgets.DateSlider.TimeView.java
com.renaultsport.heartrate.ActivityMain.java
com.renaultsport.heartrate.ActivityRecord.java
com.renaultsport.heartrate.ActivitySplash.java
com.renaultsport.heartrate.ActivityUpload.java
com.renaultsport.heartrate.ActivityVideoReader.java
com.renaultsport.heartrate.ActivityWarning.java
com.renaultsport.heartrate.MainApplication.java
com.renaultsport.heartrate.utils.CaptureCamera.java
com.renaultsport.heartrate.utils.ClientThread.java
com.renaultsport.heartrate.utils.Constants.java
com.renaultsport.heartrate.utils.RunEncoder.java
team.stride.tabs.TabGroupActivity.java