Search in sources :

Example 11 with Nullable

use of android.support.annotation.Nullable in project SeriesGuide by UweTrottmann.

the class PurchaseDataSource method getLatestEntitlementRecordBySku.

/**
     * Return the entitlement for given user and sku.
     */
@Nullable
public PurchaseRecord getLatestEntitlementRecordBySku(String userId, String sku) {
    Timber.d("getEntitlementRecordBySku: userId (%s), sku (%s)", userId, sku);
    final String where = AmazonBillingSQLiteHelper.COLUMN_USER_ID + " = ? and " + AmazonBillingSQLiteHelper.COLUMN_SKU + " = ?";
    final Cursor cursor = database.query(AmazonBillingSQLiteHelper.TABLE_PURCHASES, allColumns, where, new String[] { userId, sku }, null, null, AmazonBillingSQLiteHelper.COLUMN_DATE_FROM + " desc ");
    final PurchaseRecord result;
    cursor.moveToFirst();
    if (cursor.isAfterLast()) {
        result = null;
        Timber.d("getEntitlementRecordBySku: no record found ");
    } else {
        result = cursorToPurchaseRecord(cursor);
        Timber.d("getEntitlementRecordBySku: found ");
    }
    cursor.close();
    return result;
}
Also used : Cursor(android.database.Cursor) Nullable(android.support.annotation.Nullable)

Example 12 with Nullable

use of android.support.annotation.Nullable in project SeriesGuide by UweTrottmann.

the class HexagonTools method buildAccountService.

/**
     * Creates and returns a new instance for this hexagon service or null if not signed in.
     */
@Nullable
public synchronized Account buildAccountService() {
    GoogleAccountCredential credential = getAccountCredential(true);
    if (credential.getSelectedAccount() == null) {
        return null;
    }
    Account.Builder builder = new Account.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential);
    return CloudEndpointUtils.updateBuilder(app, builder).build();
}
Also used : GoogleSignInAccount(com.google.android.gms.auth.api.signin.GoogleSignInAccount) Account(com.uwetrottmann.seriesguide.backend.account.Account) GoogleAccountCredential(com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential) Nullable(android.support.annotation.Nullable)

Example 13 with Nullable

use of android.support.annotation.Nullable in project SeriesGuide by UweTrottmann.

the class TvdbTools method searchSeries.

@Nullable
public List<SearchResult> searchSeries(@NonNull String query, @Nullable final String language) throws TvdbException {
    retrofit2.Response<SeriesResultsResponse> response;
    try {
        response = tvdbSearch.get().series(query, null, null, language).execute();
    } catch (IOException e) {
        throw new TvdbException("searchSeries: " + e.getMessage(), e);
    }
    if (response.code() == 404) {
        // API returns 404 if there are no search results
        return null;
    }
    ensureSuccessfulResponse(response.raw(), "searchSeries: ");
    List<Series> tvdbResults = response.body().data;
    if (tvdbResults == null || tvdbResults.size() == 0) {
        // no results from tvdb
        return null;
    }
    // parse into our data format
    List<SearchResult> results = new ArrayList<>(tvdbResults.size());
    for (Series tvdbResult : tvdbResults) {
        SearchResult result = new SearchResult();
        result.tvdbid = tvdbResult.id;
        result.title = tvdbResult.seriesName;
        result.overview = tvdbResult.overview;
        result.language = language;
        results.add(result);
    }
    return results;
}
Also used : TheTvdbSeries(com.uwetrottmann.thetvdb.services.TheTvdbSeries) Series(com.uwetrottmann.thetvdb.entities.Series) SeriesResultsResponse(com.uwetrottmann.thetvdb.entities.SeriesResultsResponse) ArrayList(java.util.ArrayList) SearchResult(com.battlelancer.seriesguide.items.SearchResult) IOException(java.io.IOException) Nullable(android.support.annotation.Nullable)

Example 14 with Nullable

use of android.support.annotation.Nullable in project SeriesGuide by UweTrottmann.

the class AboutSettingsFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_about, container, false);
    unbinder = ButterKnife.bind(this, v);
    // display version number and database version
    textVersion.setText(Utils.getVersionString(getActivity()));
    buttonWebsite.setOnClickListener(urlButtonClickListener);
    buttonTvdbTerms.setOnClickListener(urlButtonClickListener);
    buttonCreativeCommons.setOnClickListener(urlButtonClickListener);
    buttonTmdbTerms.setOnClickListener(urlButtonClickListener);
    buttonTmdbApiTerms.setOnClickListener(urlButtonClickListener);
    buttonTraktTerms.setOnClickListener(urlButtonClickListener);
    buttonCredits.setOnClickListener(urlButtonClickListener);
    return v;
}
Also used : BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 15 with Nullable

use of android.support.annotation.Nullable in project SeriesGuide by UweTrottmann.

the class LanguageTools method getMovieLanguageData.

/**
     * Returns the string representation and index of the given two letter ISO 639-1 language code
     * plus an extra ISO-3166-1 region tag used by TMDB currently set by {@link
     * DisplaySettings#getMoviesLanguage(Context)}.
     */
@Nullable
public static LanguageData getMovieLanguageData(Context context) {
    String languageCodeCurrent = DisplaySettings.getMoviesLanguage(context);
    String[] languageCodes = context.getResources().getStringArray(R.array.languageCodesMovies);
    for (int i = 0; i < languageCodes.length; i++) {
        String languageCode = languageCodes[i];
        if (languageCode.equals(languageCodeCurrent)) {
            String languageDisplayName = new Locale(languageCode.substring(0, 2), languageCode.substring(3)).getDisplayName();
            return new LanguageData(i, languageCode, languageDisplayName);
        }
    }
    return null;
}
Also used : Locale(java.util.Locale) Nullable(android.support.annotation.Nullable)

Aggregations

Nullable (android.support.annotation.Nullable)477 View (android.view.View)266 TextView (android.widget.TextView)131 RecyclerView (android.support.v7.widget.RecyclerView)70 ImageView (android.widget.ImageView)41 IOException (java.io.IOException)32 Intent (android.content.Intent)30 Bundle (android.os.Bundle)30 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)28 ViewGroup (android.view.ViewGroup)27 Uri (android.net.Uri)25 BindView (butterknife.BindView)25 ArrayList (java.util.ArrayList)25 Cursor (android.database.Cursor)23 File (java.io.File)22 AdapterView (android.widget.AdapterView)16 Bitmap (android.graphics.Bitmap)15 Context (android.content.Context)14 Drawable (android.graphics.drawable.Drawable)13 EditText (android.widget.EditText)13