Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
<string name="please_wait_refresh_done">Please wait, loading items.</string>
<string name="please_wait_uploading_done">Please wait, uploading item.</string>
<string name="info">Info</string>
<string name="learn_more">Learn More</string>

<!-- Media Gallery Action Bar -->
<string name="media_add_popup_title">Add to media library</string>
Expand Down
4 changes: 3 additions & 1 deletion src/org/wordpress/android/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public class Constants {

public static String wpcomXMLRPCURL = "https://wordpress.com/xmlrpc.php";
public static String wpcomLoginURL = "https://wordpress.com/wp-login.php";


public static String videoPressURL = "http://videopress.com";

public static int QUICK_POST_PHOTO_CAMERA = 0;
public static int QUICK_POST_PHOTO_LIBRARY = 1;
public static int QUICK_POST_VIDEO_CAMERA = 2;
Expand Down
22 changes: 13 additions & 9 deletions src/org/wordpress/android/ui/media/MediaBrowserActivity.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package org.wordpress.android.ui.media;

import java.util.ArrayList;
import java.util.List;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
Expand Down Expand Up @@ -36,9 +33,7 @@
import com.actionbarsherlock.widget.SearchView;
import com.actionbarsherlock.widget.SearchView.OnQueryTextListener;

import org.xmlrpc.android.ApiHelper;
import org.xmlrpc.android.ApiHelper.GetFeatures.Callback;

import org.wordpress.android.Constants;
import org.wordpress.android.R;
import org.wordpress.android.WordPress;
import org.wordpress.android.models.FeatureSet;
Expand All @@ -52,6 +47,11 @@
import org.wordpress.android.util.MediaDeleteService;
import org.wordpress.android.util.Utils;
import org.wordpress.android.util.WPAlertDialogFragment;
import org.xmlrpc.android.ApiHelper;
import org.xmlrpc.android.ApiHelper.GetFeatures.Callback;

import java.util.ArrayList;
import java.util.List;

/**
* The main activity in which the user can browse their media.
Expand Down Expand Up @@ -236,15 +236,19 @@ private void showVideoPressUpgradeDialog() {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
String title = getString(R.string.media_no_video_title);
String message = getString(R.string.media_no_video_message);
WPAlertDialogFragment.newInstance(message, title, false).show(ft, "alert");
};
String infoTitle = getString(R.string.learn_more);
String infoURL = Constants.videoPressURL;

WPAlertDialogFragment.newInstance(message, title, false, infoTitle, infoURL)
.show(ft, "alert");
}

@Override
protected void onResume() {
super.onResume();
startMediaDeleteService();
getFeatureSet();
};
}

/** Get the feature set for a wordpress.com hosted blog **/
private void getFeatureSet() {
Expand Down
82 changes: 46 additions & 36 deletions src/org/wordpress/android/ui/posts/PostsActivity.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
package org.wordpress.android.ui.posts;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Iterator;
import java.util.HashMap;
import java.util.Map;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
Expand All @@ -26,23 +19,30 @@
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;

import org.xmlrpc.android.ApiHelper;
import org.xmlrpc.android.XMLRPCClient;
import org.xmlrpc.android.XMLRPCException;

import org.wordpress.android.R;
import org.wordpress.android.WordPress;
import org.wordpress.passcodelock.AppLockManager;
import org.wordpress.android.models.Post;
import org.wordpress.android.ui.MenuDrawerItem;
import org.wordpress.android.ui.WPActionBarActivity;
import org.wordpress.android.ui.comments.AddCommentActivity;
import org.wordpress.android.ui.posts.ViewPostFragment.OnDetailPostActionListener;
import org.wordpress.android.ui.notifications.NotificationsActivity;
import org.wordpress.android.ui.posts.PostsListFragment.OnPostActionListener;
import org.wordpress.android.ui.posts.PostsListFragment.OnPostSelectedListener;
import org.wordpress.android.ui.posts.PostsListFragment.OnRefreshListener;
import org.wordpress.android.ui.posts.ViewPostFragment.OnDetailPostActionListener;
import org.wordpress.android.util.WPAlertDialogFragment.OnDialogConfirmListener;
import org.wordpress.android.ui.notifications.NotificationsActivity;
import org.wordpress.passcodelock.AppLockManager;
import org.xmlrpc.android.ApiHelper;
import org.xmlrpc.android.XMLRPCClient;
import org.xmlrpc.android.XMLRPCException;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class PostsActivity extends WPActionBarActivity implements OnPostSelectedListener,
OnRefreshListener, OnPostActionListener, OnDetailPostActionListener, OnDialogConfirmListener {
Expand Down Expand Up @@ -75,7 +75,7 @@ public void onCreate(Bundle savedInstanceState) {
startNotificationsActivity(extras);
return;
}

// Restore last selection on app creation
if (WordPress.shouldRestoreSelectedActivity && WordPress.getCurrentBlog() != null
&& !(this instanceof PagesActivity)) {
Expand Down Expand Up @@ -123,9 +123,7 @@ public void onFailure() {

if (extras != null) {
isPage = extras.getBoolean("viewPages");
String errorMessage = extras.getString("errorMessage");
if (errorMessage != null)
showPostUploadErrorAlert(errorMessage);
showErrorDialogIfNeeded(extras);
}

if (isPage)
Expand All @@ -151,20 +149,25 @@ public void OnPostUploaded() {
popPostDetail();
}

private void showPostUploadErrorAlert(String errorMessage) {

AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(
PostsActivity.this);
dialogBuilder.setTitle(getResources().getText(
R.string.error));
private void showPostUploadErrorAlert(String errorMessage, String infoTitle,
final String infoURL) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PostsActivity.this);
dialogBuilder.setTitle(getResources().getText(R.string.error));
dialogBuilder.setMessage(errorMessage);
dialogBuilder.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
public void onClick(DialogInterface dialog, int whichButton) {
// Just close the window.
}
});
if (infoTitle != null && infoURL != null) {
dialogBuilder.setNeutralButton(infoTitle,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(infoURL)));
}
});
}
dialogBuilder.setCancelable(true);
if (!isFinishing())
dialogBuilder.create().show();
Expand All @@ -181,12 +184,19 @@ protected void onNewIntent(Intent intent) {
startNotificationsActivity(extras);
return;
}

String errorMessage = extras.getString("errorMessage");
if (errorMessage != null)
showPostUploadErrorAlert(errorMessage);
}

}

private void showErrorDialogIfNeeded(Bundle extras) {
if (extras == null) {
return ;
}
String errorMessage = extras.getString("errorMessage");
String errorInfoTitle = extras.getString("errorInfoTitle");
String errorInfoLink = extras.getString("errorInfoLink");
if (errorMessage != null) {
showPostUploadErrorAlert(errorMessage, errorInfoTitle, errorInfoLink);
}
}

private void startNotificationsActivity(Bundle extras) {
Expand Down Expand Up @@ -345,7 +355,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (!returnText.equals("CANCEL")) {
// Add comment to the server if user didn't cancel.
final String postID = extras.getString("postID");
new PostsActivity.addCommentTask().execute(postID, returnText);
new addCommentTask().execute(postID, returnText);
}
}
}
Expand Down Expand Up @@ -709,7 +719,7 @@ protected String doInBackground(Post... params) {
}

private void refreshComments() {
new PostsActivity.refreshCommentsTask().execute();
new refreshCommentsTask().execute();
}

private String getShortlinkTagHref(String urlString) {
Expand Down Expand Up @@ -813,7 +823,7 @@ public void onClick(DialogInterface dialog,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
new PostsActivity.deletePostTask().execute(post);
new deletePostTask().execute(post);
}
});
dialogBuilder.setNegativeButton(
Expand All @@ -832,7 +842,7 @@ public void onClick(DialogInterface dialog,

}
} else if (action == POST_SHARE) {
new PostsActivity.shareURLTask().execute(post);
new shareURLTask().execute(post);
} else if (action == POST_CLEAR) {
FragmentManager fm = getSupportFragmentManager();
ViewPostFragment f = (ViewPostFragment) fm
Expand Down
Loading