use of org.wordpress.android.widgets.WPAlertDialogFragment in project WordPress-Android by wordpress-mobile.
the class ThemeBrowserActivity method searchThemes.
public void searchThemes(String searchTerm) {
mFetchingThemes = true;
int page = 1;
if (mThemeSearchFragment != null) {
page = mThemeSearchFragment.getPage();
}
WordPress.getRestClientUtilsV1_2().getFreeSearchThemes(mSite.getSiteId(), THEME_FETCH_MAX, page, searchTerm, new Listener() {
@Override
public void onResponse(JSONObject response) {
new FetchThemesTask().execute(response);
}
}, new ErrorListener() {
@Override
public void onErrorResponse(VolleyError response) {
if (response.toString().equals(AuthFailureError.class.getName())) {
String errorTitle = getString(R.string.theme_auth_error_title);
String errorMsg = getString(R.string.theme_auth_error_message);
if (mIsRunning) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
WPAlertDialogFragment fragment = WPAlertDialogFragment.newAlertDialog(errorMsg, errorTitle);
ft.add(fragment, ALERT_TAB);
ft.commitAllowingStateLoss();
}
AppLog.d(T.THEMES, getString(R.string.theme_auth_error_authenticate));
}
mFetchingThemes = false;
}
});
}
use of org.wordpress.android.widgets.WPAlertDialogFragment in project WordPress-Android by wordpress-mobile.
the class ThemeBrowserActivity method fetchThemes.
public void fetchThemes() {
if (mFetchingThemes) {
return;
}
mFetchingThemes = true;
int page = 1;
if (mThemeBrowserFragment != null) {
page = mThemeBrowserFragment.getPage();
}
WordPress.getRestClientUtilsV1_2().getFreeThemes(mSite.getSiteId(), THEME_FETCH_MAX, page, new Listener() {
@Override
public void onResponse(JSONObject response) {
new FetchThemesTask().execute(response);
}
}, new ErrorListener() {
@Override
public void onErrorResponse(VolleyError response) {
if (response.toString().equals(AuthFailureError.class.getName())) {
String errorTitle = getString(R.string.theme_auth_error_title);
String errorMsg = getString(R.string.theme_auth_error_message);
if (mIsRunning) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
WPAlertDialogFragment fragment = WPAlertDialogFragment.newAlertDialog(errorMsg, errorTitle);
ft.add(fragment, ALERT_TAB);
ft.commitAllowingStateLoss();
}
AppLog.d(T.THEMES, getString(R.string.theme_auth_error_authenticate));
} else {
Toast.makeText(ThemeBrowserActivity.this, R.string.theme_fetch_failed, Toast.LENGTH_LONG).show();
AppLog.d(T.THEMES, getString(R.string.theme_fetch_failed) + ": " + response.toString());
}
mFetchingThemes = false;
}
});
}
Aggregations