app/src/main/java/io/github/ilya_lebedev/popularmovies/utilities/NetworkUtils.java
/**
     * Builds the URL used to talk to the TMDb server using sort order of a movies list.
     *
     * @param sortOrderPath The path saying to TMDb service in which sort order case
     *                     we want to get movies list
     * @return The Url to use to query TMDb service
     */
Builds the URL used to talk to the TMDb server using sort order of a movies list.
@param sortOrderPath The path saying to TMDb service in which sort order case
we want to get movies list
@return The Url to use to query TMDb service
Builds the URL used to talk to the TMDb server using sort order of a movies list . @param sortOrderPath The path saying to TMDb service in which sort order case we want to get movies list @return The Url to use to query TMDb service
private static URL buildMoviesListUrl(String sortOrderPath, int page) {
        Uri moviesListQueryUri = Uri.parse(MOVIE_DB_BASE_URL).buildUpon()
                .appendPath(MOVIE_PATH)
                .appendPath(sortOrderPath)
                .appendQueryParameter(API_KEY_PARAM, API_KEY)
                .appendQueryParameter(PAGE_PARAM, String.valueOf(page))
                .build();
        try {
            URL moviesListQueryUrl = new URL(moviesListQueryUri.toString());
            Log.v(TAG, "URL: " + moviesListQueryUrl);
            return moviesListQueryUrl;
        } catch (MalformedURLException ex) {
            ex.printStackTrace();
            return null;
        }
    }
private static URL buildMoviesListUrl ( String sortOrderPath , int page ) { Uri moviesListQueryUri = Uri . parse ( MOVIE_DB_BASE_URL ) . buildUpon ( ) . appendPath ( MOVIE_PATH ) . appendPath ( sortOrderPath ) . appendQueryParameter ( API_KEY_PARAM , API_KEY ) . appendQueryParameter ( PAGE_PARAM , String . valueOf ( page ) ) . build ( ) ; try { URL moviesListQueryUrl = new URL ( moviesListQueryUri . toString ( ) ) ; Log . v ( TAG , "URL: " + moviesListQueryUrl ) ; return moviesListQueryUrl ; } catch ( MalformedURLException ex ) { ex . printStackTrace ( ) ; return null ; } }
Builds the URL used to talk to the TMDb server using sort order of a movies list.
Builds the URL used to talk to the TMDb server using sort order of a movies list .