Search in sources :

Example 1 with VoteRequest

use of com.ferg.awfulapp.task.VoteRequest in project Awful.apk by Awful.

the class ThreadDisplayFragment method rateThread.

/**
 * Display a thread-rating dialog.
 *
 * This handles the network request to submit the vote, and user feedback.
 */
private void rateThread() {
    final CharSequence[] items = { "1", "2", "3", "4", "5" };
    final Activity activity = this.getActivity();
    new AlertDialog.Builder(activity).setTitle("Rate this thread").setItems(items, (dialog, item) -> queueRequest(new VoteRequest(activity, getThreadId(), item).build(ThreadDisplayFragment.this, new AwfulRequest.AwfulResultCallback<Void>() {

        @Override
        public void success(Void result) {
            getAlertView().setTitle(R.string.vote_succeeded).setSubtitle(R.string.vote_succeeded_sub).setIcon(R.drawable.ic_mood).show();
        }

        @Override
        public void failure(VolleyError error) {
        }
    }))).show();
}
Also used : AlertDialog(android.app.AlertDialog) JavascriptInterface(android.webkit.JavascriptInterface) IgnoreRequest(com.ferg.awfulapp.task.IgnoreRequest) Constants(com.ferg.awfulapp.constants.Constants) SwipyRefreshLayoutDirection(com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayoutDirection) Bundle(android.os.Bundle) AwfulRequest(com.ferg.awfulapp.task.AwfulRequest) RedirectTask(com.ferg.awfulapp.task.RedirectTask) PackageManager(android.content.pm.PackageManager) MarkLastReadRequest(com.ferg.awfulapp.task.MarkLastReadRequest) AwfulURL(com.ferg.awfulapp.thread.AwfulURL) Uri(android.net.Uri) BookmarkRequest(com.ferg.awfulapp.task.BookmarkRequest) CloseOpenRequest(com.ferg.awfulapp.task.CloseOpenRequest) SwipyRefreshLayout(com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout) ThreadDisplay(com.ferg.awfulapp.thread.ThreadDisplay) WebViewJsInterface(com.ferg.awfulapp.webview.WebViewJsInterface) StringUtils(org.apache.commons.lang3.StringUtils) Manifest(android.Manifest) CookieManager(android.webkit.CookieManager) Handler(android.os.Handler) Keys(com.ferg.awfulapp.preferences.Keys) Map(java.util.Map) WebViewClient(android.webkit.WebViewClient) View(android.view.View) CookieSyncManager(android.webkit.CookieSyncManager) WebView(android.webkit.WebView) LoaderManager(android.support.v4.app.LoaderManager) ColorProvider(com.ferg.awfulapp.provider.ColorProvider) FloatingActionButton(android.support.design.widget.FloatingActionButton) AwfulUtils(com.ferg.awfulapp.util.AwfulUtils) AsyncTask(android.os.AsyncTask) AwfulThread(com.ferg.awfulapp.thread.AwfulThread) MenuItemCompat(android.support.v4.view.MenuItemCompat) ContextCompat(android.support.v4.content.ContextCompat) PostContextMenu(com.ferg.awfulapp.popupmenu.PostContextMenu) ViewGroup(android.view.ViewGroup) Timber(timber.log.Timber) ContentObserver(android.database.ContentObserver) AwfulError(com.ferg.awfulapp.util.AwfulError) AlertDialog(android.app.AlertDialog) DownloadManager(android.app.DownloadManager) AwfulPost(com.ferg.awfulapp.thread.AwfulPost) List(java.util.List) TextView(android.widget.TextView) InflateException(android.view.InflateException) FragmentActivity(android.support.v4.app.FragmentActivity) SinglePostRequest(com.ferg.awfulapp.task.SinglePostRequest) ReportRequest(com.ferg.awfulapp.task.ReportRequest) Nullable(android.support.annotation.Nullable) Request(android.app.DownloadManager.Request) AwfulMessage(com.ferg.awfulapp.thread.AwfulMessage) Context(android.content.Context) VoteRequest(com.ferg.awfulapp.task.VoteRequest) AwfulProvider(com.ferg.awfulapp.provider.AwfulProvider) Environment(android.os.Environment) DownloadListener(android.webkit.DownloadListener) Intent(android.content.Intent) CursorLoader(android.support.v4.content.CursorLoader) ShareActionProvider(android.support.v7.widget.ShareActionProvider) HashMap(java.util.HashMap) NonNull(android.support.annotation.NonNull) LoggingWebChromeClient(com.ferg.awfulapp.webview.LoggingWebChromeClient) ProfileRequest(com.ferg.awfulapp.task.ProfileRequest) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) NetworkUtils(com.ferg.awfulapp.network.NetworkUtils) PageBar(com.ferg.awfulapp.widget.PageBar) MenuInflater(android.view.MenuInflater) Toast(android.widget.Toast) Menu(android.view.Menu) Build(android.os.Build) LinkedList(java.util.LinkedList) PostRequest(com.ferg.awfulapp.task.PostRequest) DialogInterface(android.content.DialogInterface) Cursor(android.database.Cursor) Formatter(android.text.format.Formatter) UrlContextMenu(com.ferg.awfulapp.popupmenu.UrlContextMenu) Loader(android.support.v4.content.Loader) AwfulTheme(com.ferg.awfulapp.provider.AwfulTheme) LayoutInflater(android.view.LayoutInflater) AwfulPreferences(com.ferg.awfulapp.preferences.AwfulPreferences) AwfulPagedItem(com.ferg.awfulapp.thread.AwfulPagedItem) TYPE(com.ferg.awfulapp.thread.AwfulURL.TYPE) TextUtils(android.text.TextUtils) VolleyError(com.android.volley.VolleyError) ResolveInfo(android.content.pm.ResolveInfo) Color(android.graphics.Color) PagePicker(com.ferg.awfulapp.widget.PagePicker) FragmentManager(android.support.v4.app.FragmentManager) Crashlytics(com.crashlytics.android.Crashlytics) AwfulWebView(com.ferg.awfulapp.webview.AwfulWebView) ImageSizeRequest(com.ferg.awfulapp.task.ImageSizeRequest) Activity(android.app.Activity) EditText(android.widget.EditText) ContentUris(android.content.ContentUris) VolleyError(com.android.volley.VolleyError) FragmentActivity(android.support.v4.app.FragmentActivity) Activity(android.app.Activity) VoteRequest(com.ferg.awfulapp.task.VoteRequest)

Aggregations

Manifest (android.Manifest)1 Activity (android.app.Activity)1 AlertDialog (android.app.AlertDialog)1 DownloadManager (android.app.DownloadManager)1 Request (android.app.DownloadManager.Request)1 ContentUris (android.content.ContentUris)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 PackageManager (android.content.pm.PackageManager)1 ResolveInfo (android.content.pm.ResolveInfo)1 ContentObserver (android.database.ContentObserver)1 Cursor (android.database.Cursor)1 Color (android.graphics.Color)1 Uri (android.net.Uri)1 AsyncTask (android.os.AsyncTask)1 Build (android.os.Build)1 Bundle (android.os.Bundle)1 Environment (android.os.Environment)1 Handler (android.os.Handler)1