@Override public void didDismissContent( PHPublisherContentRequest request, PHPublisherContentRequest.PHDismissType type) { String message = String.format("User dismissed request: %s of type: %s", request, type.toString()); super.addMessage(message); }
@Override public void onCreate(Bundle savedInstance) { // setup list adapter, etc. super.onCreate(savedInstance); setTitle("Open Request"); }
@Override public void onCreate(Bundle savedInstance) { super.onCreate(savedInstance); mPurchaseHelper = new PurchaseHelper(this); setTitle("Content Request"); }
/////////////////////////////////////////////////////////////// ////////////////////////// Delegate Methods /////////////////// public void requestSucceeded(PHAPIRequest request, JSONObject responseData) { try { String formattedJson = responseData.toString(2); super.addMessage(String.format("Success with response: %s", formattedJson)); } catch (JSONException e) { e.printStackTrace(); } }
@Override public void startRequest() { super.startRequest(); request = new PHPublisherOpenRequest(this, this); request.send(); }
@Override public void startRequest() { super.startRequest(); // testing the badge PHNotificationView notifyView = new PHNotificationView(this, placementTxt.getText().toString()); notifyView.setBackgroundColor(0xFF020AFF); notifyView.refresh(); super.addMessage("Notification View: ", notifyView); if (!preloaded) { // pass ourselves as the delegate AND the context request = new PHPublisherContentRequest(this, placementTxt.getText().toString()); request.setOnPurchaseListener(this); } request.send(); preloaded = false; }
@Override public void onResume() { super.onResume(); if (PHPublisherContentRequest.didDismissContentWithin( 2000)) { // can actually be less than 2 seconds, all we want is enough time for onResume to // be called PHStringUtil.log("Resumed after displaying content"); return; } PHStringUtil.log("Resumed PHPublisherView regularly"); }
@Override protected void addTopbarItems(LinearLayout topbar) { LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.HORIZONTAL); placementTxt = new EditText(this); placementTxt.setLayoutParams( new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, .9f)); // smaller weight means bigger? placementTxt.setHint(R.string.default_placement); placementTxt.setContentDescription("placementTxt"); layout.addView(placementTxt); layout.addView(createPreloadButton()); topbar.addView(layout); super.addTopbarItems(topbar); // will add start button on the right }
@Override public void contentDidFail(PHPublisherContentRequest request, Exception e) { String message = String.format(" Content failed with error; %s", e); super.addMessage(message); }
public void requestFailed(PHAPIRequest request, Exception e) { super.addMessage(String.format("Failed with error: %s", e.toString())); }
@Override public void onDestroy() { super.onDestroy(); mPurchaseHelper.unbindService(); }
@Override public void didFail(PHPublisherContentRequest request, String error) { String message = String.format(" Failed with error: %s", error); super.addMessage(message); }
@Override public void didDisplayContent(PHPublisherContentRequest request, PHContent content) { String message = String.format("Displayed Content: %s", content); super.addMessage(message); }
@Override public void willDisplayContent(PHPublisherContentRequest request, PHContent content) { String message = String.format("Recieved content: %s. \n-------\npreparing for display", content); super.addMessage(message); }
@Override public void willGetContent(PHPublisherContentRequest request) { PHStringUtil.log("Will get content..."); super.addMessage("Starting content request..."); }
@Override public void onStop() { super.onStop(); mPurchaseHelper.unbindPurchaseObserver(); }
@Override public void onStart() { super.onStart(); mPurchaseHelper.bindPurchaseObserver(); }