androidx.annotation.Nullable Java Examples

The following examples show how to use androidx.annotation.Nullable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TwaLauncher.java    From android-browser-helper with Apache License 2.0 6 votes vote down vote up
/**
 * Same as above, but also accepts a session id. This allows to launch multiple TWAs in the same
 * task.
 */
public TwaLauncher(Context context, @Nullable String providerPackage, int sessionId,
                   TokenStore tokenStore) {
    mContext = context;
    mSessionId = sessionId;
    mTokenStore = tokenStore;
    if (providerPackage == null) {
        TwaProviderPicker.Action action =
                TwaProviderPicker.pickProvider(context.getPackageManager());
        mProviderPackage = action.provider;
        mLaunchMode = action.launchMode;
    } else {
        mProviderPackage = providerPackage;
        mLaunchMode = TwaProviderPicker.LaunchMode.TRUSTED_WEB_ACTIVITY;
    }
}
 
Example #2
Source File: SimpleDecoderVideoRenderer.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Sets output buffer renderer.
 *
 * @param outputBufferRenderer Output buffer renderer.
 */
protected final void setOutputBufferRenderer(
    @Nullable VideoDecoderOutputBufferRenderer outputBufferRenderer) {
  if (this.outputBufferRenderer != outputBufferRenderer) {
    // The output has changed.
    this.outputBufferRenderer = outputBufferRenderer;
    if (outputBufferRenderer != null) {
      surface = null;
      outputMode = C.VIDEO_OUTPUT_MODE_YUV;
      if (decoder != null) {
        setDecoderOutputMode(outputMode);
      }
      onOutputChanged();
    } else {
      // The output has been removed. We leave the outputMode of the underlying decoder unchanged
      // in anticipation that a subsequent output will likely be of the same type.
      outputMode = C.VIDEO_OUTPUT_MODE_NONE;
      onOutputRemoved();
    }
  } else if (outputBufferRenderer != null) {
    // The output is unchanged and non-null.
    onOutputReset();
  }
}
 
Example #3
Source File: DownloadManager.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private void onDownloadTaskStopped(Download download, @Nullable Throwable finalError) {
  download =
      new Download(
          download.request,
          finalError == null ? STATE_COMPLETED : STATE_FAILED,
          download.startTimeMs,
          /* updateTimeMs= */ System.currentTimeMillis(),
          download.contentLength,
          download.stopReason,
          finalError == null ? FAILURE_REASON_NONE : FAILURE_REASON_UNKNOWN,
          download.progress);
  // The download is now in a terminal state, so should not be in the downloads list.
  downloads.remove(getDownloadIndex(download.request.id));
  // We still need to update the download index and main thread.
  try {
    downloadIndex.putDownload(download);
  } catch (IOException e) {
    Log.e(TAG, "Failed to update index.", e);
  }
  DownloadUpdate update =
      new DownloadUpdate(download, /* isRemove= */ false, new ArrayList<>(downloads));
  mainHandler.obtainMessage(MSG_DOWNLOAD_UPDATE, update).sendToTarget();
}
 
Example #4
Source File: SceneActionSelectionFragment.java    From arcusandroid with Apache License 2.0 6 votes vote down vote up
/**
 *
 * Updates, or adds, the provided context to the list of context variables for this template.
 * Returns a list of remaining settings to set on the scene model and commit to the platform.
 *
 * If the provided list is null, it will remove it from the context.
 *
 * @return
 */
private List<Map<String, Object>> updateActions(@Nullable Map<String, Map<String, Object>> context) {
    SceneModel model = getController().getSceneModel();
    if (model == null) {
        return new ArrayList<>();
    }

    List<Map<String, Object>> newValues = new LinkedList<>();
    if (context != null && !context.isEmpty()) { // Still have stuff to save?
        Action action = new Action();
        action.setTemplate(getController().getActionTemplate().getId());
        action.setName(getController().getActionTemplate().getName());
        action.setContext(context);
        newValues.add(action.toMap());
    }

    for (Map<String, Object> actionsModel : model.getActions()) { // Rebuild save list
        Action actionName = new Action(actionsModel);
        if (!getController().getActionTemplate().getId().equals(actionName.getTemplate())) {
            newValues.add(actionName.toMap());
        }
    }

    return newValues;
}
 
Example #5
Source File: Contact.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
PostalAddress(@JsonProperty("type")         @NonNull  Type   type,
              @JsonProperty("label")        @Nullable String label,
              @JsonProperty("street")       @Nullable String street,
              @JsonProperty("poBox")        @Nullable String poBox,
              @JsonProperty("neighborhood") @Nullable String neighborhood,
              @JsonProperty("city")         @Nullable String city,
              @JsonProperty("region")       @Nullable String region,
              @JsonProperty("postalCode")   @Nullable String postalCode,
              @JsonProperty("country")      @Nullable String country)
{
  this.type         = type;
  this.label        = label;
  this.street       = street;
  this.poBox        = poBox;
  this.neighborhood = neighborhood;
  this.city         = city;
  this.region       = region;
  this.postalCode   = postalCode;
  this.country      = country;
  this.selected     = true;
}
 
Example #6
Source File: HoursMinutePickerFragment.java    From arcusandroid with Apache License 2.0 6 votes vote down vote up
@NonNull
public static HoursMinutePickerFragment newInstance(String modelID, String title, String zone,
                                                    List<StringPair> selections, @Nullable String selected) {
    HoursMinutePickerFragment fragment = new HoursMinutePickerFragment();

    ArrayList<StringPair> values;
    if (selections == null) {
        values = new ArrayList<>();
    }
    else {
        values = new ArrayList<>(selections);
    }
    Bundle data = new Bundle(5);
    data.putString(MODEL_ADDR, modelID);
    data.putString(TITLE, title);
    data.putString(ZONE, zone);
    data.putSerializable(SELECTIONS, values);
    data.putString(SELECTED, selected);
    fragment.setArguments(data);

    return fragment;
}
 
Example #7
Source File: VideoTutorialsActivity.java    From BaldPhone with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_help);
    final RecyclerView recycler_view = findViewById(R.id.recycler_view);
    final DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(recycler_view.getContext(), DividerItemDecoration.VERTICAL);
    dividerItemDecoration.setDrawable(getDrawable(R.drawable.ll_divider));
    recycler_view.addItemDecoration(dividerItemDecoration);
    final Resources resources = getResources();
    recycler_view.setAdapter(
            new HelpRecyclerViewAdapter(
                    this,
                    S.typedArrayToResArray(resources, R.array.yt_texts),
                    S.typedArrayToResArray(resources, R.array.yt_logos)));
}
 
Example #8
Source File: OneTimePreKeyDatabase.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
public @Nullable PreKeyRecord getPreKey(int keyId) {
  SQLiteDatabase database = databaseHelper.getReadableDatabase();

  try (Cursor cursor = database.query(TABLE_NAME, null, KEY_ID + " = ?",
                                      new String[] {String.valueOf(keyId)},
                                      null, null, null))
  {
    if (cursor != null && cursor.moveToFirst()) {
      try {
        ECPublicKey  publicKey  = Curve.decodePoint(Base64.decode(cursor.getString(cursor.getColumnIndexOrThrow(PUBLIC_KEY))), 0);
        ECPrivateKey privateKey = Curve.decodePrivatePoint(Base64.decode(cursor.getString(cursor.getColumnIndexOrThrow(PRIVATE_KEY))));

        return new PreKeyRecord(keyId, new ECKeyPair(publicKey, privateKey));
      } catch (InvalidKeyException | IOException e) {
        Log.w(TAG, e);
      }
    }
  }

  return null;
}
 
Example #9
Source File: SmsDatabase.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
public @Nullable RecipientId getOldestGroupUpdateSender(long threadId, long minimumDateReceived) {
  SQLiteDatabase db = databaseHelper.getReadableDatabase();

  String[] columns = new String[]{RECIPIENT_ID};
  String   query   = THREAD_ID + " = ? AND " + TYPE + " & ? AND " + DATE_RECEIVED + " >= ?";
  long     type    = Types.SECURE_MESSAGE_BIT | Types.PUSH_MESSAGE_BIT | Types.GROUP_UPDATE_BIT | Types.BASE_INBOX_TYPE;
  String[] args    = new String[]{String.valueOf(threadId), String.valueOf(type), String.valueOf(minimumDateReceived)};
  String   limit   = "1";

  try (Cursor cursor = db.query(TABLE_NAME, columns, query, args, null, null, limit)) {
    if (cursor.moveToFirst()) {
      return RecipientId.from(cursor.getLong(cursor.getColumnIndex(RECIPIENT_ID)));
    }
  }

  return null;
}
 
Example #10
Source File: CacheUtil.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Queries the cache to obtain the request length and the number of bytes already cached for a
 * given {@link DataSpec}.
 *
 * @param dataSpec Defines the data to be checked.
 * @param cache A {@link Cache} which has the data.
 * @param cacheKeyFactory An optional factory for cache keys.
 * @return A pair containing the request length and the number of bytes that are already cached.
 */
public static Pair<Long, Long> getCached(
    DataSpec dataSpec, Cache cache, @Nullable CacheKeyFactory cacheKeyFactory) {
  String key = buildCacheKey(dataSpec, cacheKeyFactory);
  long position = dataSpec.absoluteStreamPosition;
  long requestLength = getRequestLength(dataSpec, cache, key);
  long bytesAlreadyCached = 0;
  long bytesLeft = requestLength;
  while (bytesLeft != 0) {
    long blockLength =
        cache.getCachedLength(
            key, position, bytesLeft != C.LENGTH_UNSET ? bytesLeft : Long.MAX_VALUE);
    if (blockLength > 0) {
      bytesAlreadyCached += blockLength;
    } else {
      blockLength = -blockLength;
      if (blockLength == Long.MAX_VALUE) {
        break;
      }
    }
    position += blockLength;
    bytesLeft -= bytesLeft == C.LENGTH_UNSET ? 0 : blockLength;
  }
  return Pair.create(requestLength, bytesAlreadyCached);
}
 
Example #11
Source File: SinglePeriodTimeline.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a timeline with one period, and a window of known duration starting at a specified
 * position in the period.
 *
 * @param presentationStartTimeMs The start time of the presentation in milliseconds since the
 *     epoch.
 * @param windowStartTimeMs The window's start time in milliseconds since the epoch.
 * @param periodDurationUs The duration of the period in microseconds.
 * @param windowDurationUs The duration of the window in microseconds.
 * @param windowPositionInPeriodUs The position of the start of the window in the period, in
 *     microseconds.
 * @param windowDefaultStartPositionUs The default position relative to the start of the window at
 *     which to begin playback, in microseconds.
 * @param isSeekable Whether seeking is supported within the window.
 * @param isDynamic Whether the window may change when the timeline is updated.
 * @param isLive Whether the window is live.
 * @param manifest The manifest. May be {@code null}.
 * @param tag A tag used for {@link Timeline.Window#tag}.
 */
public SinglePeriodTimeline(
    long presentationStartTimeMs,
    long windowStartTimeMs,
    long periodDurationUs,
    long windowDurationUs,
    long windowPositionInPeriodUs,
    long windowDefaultStartPositionUs,
    boolean isSeekable,
    boolean isDynamic,
    boolean isLive,
    @Nullable Object manifest,
    @Nullable Object tag) {
  this.presentationStartTimeMs = presentationStartTimeMs;
  this.windowStartTimeMs = windowStartTimeMs;
  this.periodDurationUs = periodDurationUs;
  this.windowDurationUs = windowDurationUs;
  this.windowPositionInPeriodUs = windowPositionInPeriodUs;
  this.windowDefaultStartPositionUs = windowDefaultStartPositionUs;
  this.isSeekable = isSeekable;
  this.isDynamic = isDynamic;
  this.isLive = isLive;
  this.manifest = manifest;
  this.tag = tag;
}
 
Example #12
Source File: MediaCodecRenderer.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * @param trackType The track type that the renderer handles. One of the {@code C.TRACK_TYPE_*}
 *     constants defined in {@link C}.
 * @param mediaCodecSelector A decoder selector.
 * @param drmSessionManager For use with encrypted media. May be null if support for encrypted
 *     media is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *     For example a media file may start with a short clear region so as to allow playback to
 *     begin in parallel with key acquisition. This parameter specifies whether the renderer is
 *     permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *     has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param enableDecoderFallback Whether to enable fallback to lower-priority decoders if decoder
 *     initialization fails. This may result in using a decoder that is less efficient or slower
 *     than the primary decoder.
 * @param assumedMinimumCodecOperatingRate A codec operating rate that all codecs instantiated by
 *     this renderer are assumed to meet implicitly (i.e. without the operating rate being set
 *     explicitly using {@link MediaFormat#KEY_OPERATING_RATE}).
 */
public MediaCodecRenderer(
    int trackType,
    MediaCodecSelector mediaCodecSelector,
    @Nullable DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
    boolean playClearSamplesWithoutKeys,
    boolean enableDecoderFallback,
    float assumedMinimumCodecOperatingRate) {
  super(trackType);
  this.mediaCodecSelector = Assertions.checkNotNull(mediaCodecSelector);
  this.drmSessionManager = drmSessionManager;
  this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
  this.enableDecoderFallback = enableDecoderFallback;
  this.assumedMinimumCodecOperatingRate = assumedMinimumCodecOperatingRate;
  buffer = new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DISABLED);
  flagsOnlyBuffer = DecoderInputBuffer.newFlagsOnlyInstance();
  formatQueue = new TimedValueQueue<>();
  decodeOnlyPresentationTimestamps = new ArrayList<>();
  outputBufferInfo = new MediaCodec.BufferInfo();
  codecReconfigurationState = RECONFIGURATION_STATE_NONE;
  codecDrainState = DRAIN_STATE_NONE;
  codecDrainAction = DRAIN_ACTION_NONE;
  codecOperatingRate = CODEC_OPERATING_RATE_UNSET;
  rendererOperatingRate = 1f;
  renderTimeLimitMs = C.TIME_UNSET;
}
 
Example #13
Source File: ConversationAdapter.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
ConversationAdapter(@NonNull GlideRequests glideRequests,
                    @NonNull Locale locale,
                    @Nullable ItemClickListener clickListener,
                    @NonNull Recipient recipient)
{
  super(new DiffCallback());

  this.glideRequests       = glideRequests;
  this.locale              = locale;
  this.clickListener       = clickListener;
  this.recipient           = recipient;
  this.selected            = new HashSet<>();
  this.fastRecords         = new ArrayList<>();
  this.releasedFastRecords = new HashSet<>();
  this.calendar            = Calendar.getInstance();
  this.digest              = getMessageDigestOrThrow();

  setHasStableIds(true);
}
 
Example #14
Source File: PillTimeSetterActivity.java    From BaldPhone with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reminder_time_setter);
    hour = findViewById(R.id.chooser_hours);
    minute = findViewById(R.id.chooser_minutes);
    multipleSelection = findViewById(R.id.multiple_selection);
    multipleSelection.addSelection(R.string.morning, R.string.afternoon, R.string.evening);
    applyChoosers();

    multipleSelection.setOnItemClickListener(i -> applyChoosers());

    final View.OnClickListener onClickListener =
            v -> BPrefs.setHourAndMinute(
                    this,
                    multipleSelection.getSelection(),
                    hour.getNumber(),
                    minute.getNumber());
    hour.setOnClickListener(onClickListener);
    minute.setOnClickListener(onClickListener);

}
 
Example #15
Source File: SystemBarColorPredictor.java    From android-browser-helper with Apache License 2.0 6 votes vote down vote up
/**
 * Makes a best-effort guess about which navigation bar color will be used when the Trusted Web
 * Activity is launched. Returns null if not possible to predict.
 */
@Nullable
Integer getExpectedNavbarColor(Context context, String providerPackage,
        TrustedWebActivityIntentBuilder builder) {
    Intent intent = builder.buildCustomTabsIntent().intent;
    if (providerSupportsNavBarColorCustomization(context, providerPackage)) {
        if (providerSupportsColorSchemeParams(context, providerPackage)) {
            int colorScheme = getExpectedColorScheme(context, builder);
            CustomTabColorSchemeParams params = CustomTabsIntent.getColorSchemeParams(intent,
                    colorScheme);
            return params.navigationBarColor;
        }
        Bundle extras = intent.getExtras();
        return extras == null ? null :
                (Integer) extras.get(CustomTabsIntent.EXTRA_NAVIGATION_BAR_COLOR);
    }
    if (ChromeLegacyUtils.usesWhiteNavbar(providerPackage)) {
        return Color.WHITE;
    }
    return null;
}
 
Example #16
Source File: UrlHelper.java    From candybar with Apache License 2.0 6 votes vote down vote up
@Nullable
public static Drawable getSocialIcon(@NonNull Context context, @NonNull Type type) {
    int color = ConfigurationHelper.getSocialIconColor(context, CandyBarApplication.getConfiguration().getSocialIconColor());
    switch (type) {
        case EMAIL:
            return getTintedDrawable(context, R.drawable.ic_toolbar_email, color);
        case BEHANCE:
            return getTintedDrawable(context, R.drawable.ic_toolbar_behance, color);
        case DRIBBBLE:
            return getTintedDrawable(context, R.drawable.ic_toolbar_dribbble, color);
        case FACEBOOK:
            return getTintedDrawable(context, R.drawable.ic_toolbar_facebook, color);
        case GITHUB:
            return getTintedDrawable(context, R.drawable.ic_toolbar_github, color);
        case INSTAGRAM:
            return getTintedDrawable(context, R.drawable.ic_toolbar_instagram, color);
        case PINTEREST:
            return getTintedDrawable(context, R.drawable.ic_toolbar_pinterest, color);
        case TWITTER:
            return getTintedDrawable(context, R.drawable.ic_toolbar_twitter, color);
        case TELEGRAM:
            return getTintedDrawable(context, R.drawable.ic_toolbar_telegram, color);
        default:
            return getTintedDrawable(context, R.drawable.ic_toolbar_website, color);
    }
}
 
Example #17
Source File: DashManifestParser.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@C.RoleFlags
protected int parseDashRoleSchemeValue(@Nullable String value) {
  if (value == null) {
    return 0;
  }
  switch (value) {
    case "main":
      return C.ROLE_FLAG_MAIN;
    case "alternate":
      return C.ROLE_FLAG_ALTERNATE;
    case "supplementary":
      return C.ROLE_FLAG_SUPPLEMENTARY;
    case "commentary":
      return C.ROLE_FLAG_COMMENTARY;
    case "dub":
      return C.ROLE_FLAG_DUB;
    case "emergency":
      return C.ROLE_FLAG_EMERGENCY;
    case "caption":
      return C.ROLE_FLAG_CAPTION;
    case "subtitle":
      return C.ROLE_FLAG_SUBTITLE;
    case "sign":
      return C.ROLE_FLAG_SIGN;
    case "description":
      return C.ROLE_FLAG_DESCRIBES_VIDEO;
    case "enhanced-audio-intelligibility":
      return C.ROLE_FLAG_ENHANCED_DIALOG_INTELLIGIBILITY;
    default:
      return 0;
  }
}
 
Example #18
Source File: Call.java    From BaldPhone with Apache License 2.0 5 votes vote down vote up
@Nullable
public MiniContact getMiniContact(Context context) {
    if (isPrivate())
        return null;
    Cursor cursor = null;
    try {
        if (contactUri != null)
            cursor = context.getContentResolver().query(
                    Uri.parse(contactUri),
                    MiniContact.PROJECTION,
                    null,
                    null,
                    null);
        if (cursor == null || cursor.getCount() < 1) {
            if (phoneNumber != null)
                cursor = context.getContentResolver().query(
                        Uri.withAppendedPath(ContactsContract.CommonDataKinds.Phone.CONTENT_FILTER_URI, Uri.encode(phoneNumber)),
                        MiniContact.PROJECTION,
                        null,
                        null,
                        null);
        }
        if (cursor == null || cursor.getCount() < 1) {
            return null;
        }
        cursor.moveToFirst();
        return new MiniContact(
                cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY)),
                cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)),
                cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.PHOTO_URI)),
                cursor.getInt(cursor.getColumnIndex(ContactsContract.Contacts._ID)),
                cursor.getInt(cursor.getColumnIndex(ContactsContract.Contacts.STARRED)) == 1
        );
    } finally {
        if (cursor != null)
            cursor.close();

    }
}
 
Example #19
Source File: PersistentBlobProvider.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
public static @Nullable
Long getFileSize(@NonNull Context context, Uri persistentBlobUri) {
    if (!isAuthority(context, persistentBlobUri)) return null;
    if (isExternalBlobUri(context, persistentBlobUri)) return null;
    if (MATCHER.match(persistentBlobUri) == MATCH_OLD) return null;

    try {
        return Long.valueOf(persistentBlobUri.getPathSegments().get(FILESIZE_PATH_SEGMENT));
    } catch (NumberFormatException e) {
        Log.w(TAG, e);
        return null;
    }
}
 
Example #20
Source File: HlsChunkSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
public EncryptionKeyChunk(
    DataSource dataSource,
    DataSpec dataSpec,
    Format trackFormat,
    int trackSelectionReason,
    @Nullable Object trackSelectionData,
    byte[] scratchSpace) {
  super(dataSource, dataSpec, C.DATA_TYPE_DRM, trackFormat, trackSelectionReason,
      trackSelectionData, scratchSpace);
}
 
Example #21
Source File: AmeGroupMessageDetail.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
public @Nullable Uri getThumbnailPartUri(@Nullable AccountContext accountContext) {
    if (message.getContent() instanceof AmeGroupMessage.ThumbnailContent && MediaUtil.isGif(((AmeGroupMessage.ThumbnailContent) message.getContent()).getMimeType())) {
        return getFilePartUri(accountContext);
    } else if (thumbnailUri == null) {
        // Check thumbnail file and save uri to database. Thumbnail had not saved to DB in previous versions.
        // Since 2.4.0
        if (null == accountContext) {
            return null;
        }

        if (message.getContent() instanceof AmeGroupMessage.ThumbnailContent && ((AmeGroupMessage.ThumbnailContent) message.getContent()).isThumbnailExist(accountContext)) {
            File file = new File(((AmeGroupMessage.ThumbnailContent) message.getContent()).getThumbnailPath(accountContext).getSecond() + File.separator + ((AmeGroupMessage.ThumbnailContent) message.getContent()).getThumbnailExtension());

            AmeDispatcher.INSTANCE.getIo().dispatch(() -> {
                if (accountContext != null) {
                    MessageDataManager.INSTANCE.updateMessageThumbnailUri(accountContext, gid, indexId, new FileInfo(file, file.length(), null, null));
                }
                return Unit.INSTANCE;
            });

            return Uri.fromFile(file);
        }

        return null;
    }
    return PartAuthority.getGroupThumbnailUri(gid, indexId);
}
 
Example #22
Source File: EmailValidator.java    From arcusandroid with Apache License 2.0 5 votes vote down vote up
private void setError(@Nullable String error) {
   if (layout != null) {
      layout.setError(error);
   } else {
      emailTB.setError(error);
   }
}
 
Example #23
Source File: TVFragment.java    From TDTChannels-APP with MIT License 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_main, container, false);

    setHasOptionsMenu(true);
    setUpElements();
    setUpListeners();

    APIController.getInstance().loadChannels(APIController.TypeOfRequest.TV, false, getContext(), this);

    return rootView;
}
 
Example #24
Source File: ConversationListSearchAdapter.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
void bind(@NonNull  Recipient     contactResult,
          @NonNull  GlideRequests glideRequests,
          @NonNull  EventListener eventListener,
          @NonNull  Locale        locale,
          @Nullable String        query)
{
  root.bind(contactResult, glideRequests, locale, query);
  root.setOnClickListener(view -> eventListener.onContactClicked(contactResult));
}
 
Example #25
Source File: InsightsModalDialogFragment.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
  Dialog dialog = super.onCreateDialog(savedInstanceState);
  dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
  return dialog;
}
 
Example #26
Source File: DownloadService.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/** @deprecated Use {@link #DownloadService(int, long, String, int, int)}. */
@Deprecated
protected DownloadService(
    int foregroundNotificationId,
    long foregroundNotificationUpdateInterval,
    @Nullable String channelId,
    @StringRes int channelNameResourceId) {
  this(
      foregroundNotificationId,
      foregroundNotificationUpdateInterval,
      channelId,
      channelNameResourceId,
      /* channelDescriptionResourceId= */ 0);
}
 
Example #27
Source File: SimpleExoPlayer.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public void setVideoTextureView(@Nullable TextureView textureView) {
  verifyApplicationThread();
  removeSurfaceCallbacks();
  if (textureView != null) {
    clearVideoDecoderOutputBufferRenderer();
  }
  this.textureView = textureView;
  if (textureView == null) {
    setVideoSurfaceInternal(/* surface= */ null, /* ownsSurface= */ true);
    maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0);
  } else {
    if (textureView.getSurfaceTextureListener() != null) {
      Log.w(TAG, "Replacing existing SurfaceTextureListener.");
    }
    textureView.setSurfaceTextureListener(componentListener);
    SurfaceTexture surfaceTexture =
        textureView.isAvailable() ? textureView.getSurfaceTexture() : null;
    if (surfaceTexture == null) {
      setVideoSurfaceInternal(/* surface= */ null, /* ownsSurface= */ true);
      maybeNotifySurfaceSizeChanged(/* width= */ 0, /* height= */ 0);
    } else {
      setVideoSurfaceInternal(new Surface(surfaceTexture), /* ownsSurface= */ true);
      maybeNotifySurfaceSizeChanged(textureView.getWidth(), textureView.getHeight());
    }
  }
}
 
Example #28
Source File: IncomingTextMessage.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
protected IncomingTextMessage(@NonNull Address sender, @Nullable Address groupId) {
    this.message = "";
    this.sender = sender;
    this.senderDeviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
    this.protocol = 31338;
    this.serviceCenterAddress = "Outgoing";
    this.replyPathPresent = true;
    this.pseudoSubject = "";
    this.sentTimestampMillis = System.currentTimeMillis();
    this.groupId = groupId;
    this.push = true;
    this.subscriptionId = -1;
    this.expiresInMillis = 0;
}
 
Example #29
Source File: DashMediaSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new factory for {@link DashMediaSource}s.
 *
 * @param chunkSourceFactory A factory for {@link DashChunkSource} instances.
 * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used
 *     to load (and refresh) the manifest. May be {@code null} if the factory will only ever be
 *     used to create create media sources with sideloaded manifests via {@link
 *     #createMediaSource(DashManifest, Handler, MediaSourceEventListener)}.
 */
public Factory(
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable DataSource.Factory manifestDataSourceFactory) {
  this.chunkSourceFactory = Assertions.checkNotNull(chunkSourceFactory);
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  drmSessionManager = DrmSessionManager.getDummyDrmSessionManager();
  loadErrorHandlingPolicy = new DefaultLoadErrorHandlingPolicy();
  livePresentationDelayMs = DEFAULT_LIVE_PRESENTATION_DELAY_MS;
  compositeSequenceableLoaderFactory = new DefaultCompositeSequenceableLoaderFactory();
}
 
Example #30
Source File: CareActivityFragment.java    From arcusandroid with Apache License 2.0 5 votes vote down vote up
@Nullable @Override public View onCreateView(
      LayoutInflater inflater,
      @Nullable ViewGroup container,
      @Nullable Bundle savedInstanceState)
{
    View view = super.onCreateView(inflater, container, savedInstanceState);
    if (view == null) {
        return null;
    }

    filterDetailText = (TextView) view.findViewById(R.id.care_activity_filter_details);

    careFilterContainer = view.findViewById(R.id.care_filter_container);
    if (careFilterContainer != null) {
        careFilterContainer.setOnClickListener(this);
    }

    careSelectedDayTV = (TextView) view.findViewById(R.id.care_activity_current_day);
    if (careSelectedDayTV != null) {
        careSelectedDayTV.setOnClickListener(this);
    }

    careZoomIV = view.findViewById(R.id.care_activity_zoom);
    if (careZoomIV != null) {
        careZoomIV.setOnClickListener(this);
    }

    activityEventView = (ActivityEventView) view.findViewById(R.id.care_half_activity_graph);
    historyView = (ListView) view.findViewById(R.id.care_activity_history);
    return view;
}