android.support.annotation.Nullable Java Examples
The following examples show how to use
android.support.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: X8MainReturnTimeTextView.java From FimiX8-RE with MIT License | 6 votes |
public X8MainReturnTimeTextView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.X8MainReturnTimeTextView, 0, 0); this.photoWidth = typedArray.getDimension(R.styleable.X8MainReturnTimeTextView_width, 0.0f); this.fontSize = typedArray.getDimension(R.styleable.X8MainReturnTimeTextView_fontSize, 0.0f); typedArray.recycle(); this.mPaint = new Paint(); this.mPaint.setColor(getResources().getColor(R.color.x8_main_return_time_bg)); this.mPaint.setStyle(Style.FILL); this.mPaint.setAntiAlias(true); this.mPaintStrock = new Paint(); this.mPaintStrock.setColor(getResources().getColor(R.color.black_70)); this.mPaintStrock.setStrokeWidth(1.0f); this.mPaintStrock.setStyle(Style.STROKE); this.mPaintStrock.setAntiAlias(true); this.mPaint.setAntiAlias(true); this.mPaintText = new Paint(); this.mPaintText.setTextSize(this.fontSize); this.mPaintText.setColor(getResources().getColor(R.color.black_70)); this.mPaintText.setAntiAlias(false); }
Example #2
Source File: Id3Decoder.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private static @Nullable UrlLinkFrame decodeWxxxFrame(ParsableByteArray id3Data, int frameSize) throws UnsupportedEncodingException { if (frameSize < 1) { // Frame is malformed. return null; } int encoding = id3Data.readUnsignedByte(); String charset = getCharsetName(encoding); byte[] data = new byte[frameSize - 1]; id3Data.readBytes(data, 0, frameSize - 1); int descriptionEndIndex = indexOfEos(data, 0, encoding); String description = new String(data, 0, descriptionEndIndex, charset); int urlStartIndex = descriptionEndIndex + delimiterLength(encoding); int urlEndIndex = indexOfZeroByte(data, urlStartIndex); String url = decodeStringIfValid(data, urlStartIndex, urlEndIndex, "ISO-8859-1"); return new UrlLinkFrame("WXXX", description, url); }
Example #3
Source File: LicenseActivity.java From SoloPi with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_license); HeadControlPanel panel = (HeadControlPanel) findViewById(R.id.license_head); panel.setBackIconClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); panel.setMiddleTitle(getString(R.string.activity__license)); final WebView licenseText = (WebView) findViewById(R.id.license_text); licenseText.loadUrl(NOTICE_HTML); }
Example #4
Source File: MetadataUtil.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private static @Nullable TextInformationFrame parseIndexAndCountAttribute( int type, String attributeName, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data && atomSize >= 22) { data.skipBytes(10); // version (1), flags (3), empty (4), empty (2) int index = data.readUnsignedShort(); if (index > 0) { String value = "" + index; int count = data.readUnsignedShort(); if (count > 0) { value += "/" + count; } return new TextInformationFrame(attributeName, /* description= */ null, value); } } Log.w(TAG, "Failed to parse index/count attribute: " + Atom.getAtomTypeString(type)); return null; }
Example #5
Source File: VectorUtils.java From zom-android-matrix with Apache License 2.0 | 6 votes |
/** * Provide a display name for a calling room * * @param context the application context. * @param session the room session. * @param room the room. * @return the calling room display name. */ @Nullable public static void getCallingRoomDisplayName(Context context, final MXSession session, final Room room, final ApiCallback<String> callback) { if ((null == context) || (null == session) || (null == room)) { callback.onSuccess(null); } else if (room.getNumberOfJoinedMembers() == 2) { room.getJoinedMembersAsync(new SimpleApiCallback<List<RoomMember>>(callback) { @Override public void onSuccess(List<RoomMember> members) { if (TextUtils.equals(members.get(0).getUserId(), session.getMyUserId())) { callback.onSuccess(room.getState().getMemberName(members.get(1).getUserId())); } else { callback.onSuccess(room.getState().getMemberName(members.get(0).getUserId())); } } }); } else { callback.onSuccess(room.getRoomDisplayName(context)); } }
Example #6
Source File: HlsMediaPlaylist.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * @param url See {@link #url}. * @param initializationSegment See {@link #initializationSegment}. * @param title See {@link #title}. * @param durationUs See {@link #durationUs}. * @param relativeDiscontinuitySequence See {@link #relativeDiscontinuitySequence}. * @param relativeStartTimeUs See {@link #relativeStartTimeUs}. * @param fullSegmentEncryptionKeyUri See {@link #fullSegmentEncryptionKeyUri}. * @param encryptionIV See {@link #encryptionIV}. * @param byterangeOffset See {@link #byterangeOffset}. * @param byterangeLength See {@link #byterangeLength}. * @param hasGapTag See {@link #hasGapTag}. */ public Segment( String url, @Nullable Segment initializationSegment, String title, long durationUs, int relativeDiscontinuitySequence, long relativeStartTimeUs, @Nullable String fullSegmentEncryptionKeyUri, @Nullable String encryptionIV, long byterangeOffset, long byterangeLength, boolean hasGapTag) { this.url = url; this.initializationSegment = initializationSegment; this.title = title; this.durationUs = durationUs; this.relativeDiscontinuitySequence = relativeDiscontinuitySequence; this.relativeStartTimeUs = relativeStartTimeUs; this.fullSegmentEncryptionKeyUri = fullSegmentEncryptionKeyUri; this.encryptionIV = encryptionIV; this.byterangeOffset = byterangeOffset; this.byterangeLength = byterangeLength; this.hasGapTag = hasGapTag; }
Example #7
Source File: Downloader.java From Android-VMLib with Apache License 2.0 | 6 votes |
/** * Download file of given url. * * @param url the url * @param filePath the file path to save file * @param fileName the file name of downloaded file * @param downloadListener the download state callback */ @RequiresPermission(allOf = {ACCESS_WIFI_STATE, INTERNET, ACCESS_NETWORK_STATE, WRITE_EXTERNAL_STORAGE}) public void download(@NonNull String url, @NonNull String filePath, @Nullable String fileName, @Nullable DownloadListener downloadListener) { this.downloadListener = downloadListener; this.url = url; this.filePath = filePath; if (fileName == null) L.w("The parameter 'fileName' was null, timestamp will be used."); this.fileName = fileName == null ? String.valueOf(System.currentTimeMillis()) : fileName; if (!NetworkUtils.isConnected()) { notifyDownloadError(ERROR_CODE_NETWORK_UNAVAILABLE); } else { if (onlyWifi) { checkWifiAvailable(); } else { doDownload(); } } }
Example #8
Source File: VideoFragment.java From YCScrollPager with Apache License 2.0 | 6 votes |
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); videoPlayer = view.findViewById(R.id.video_player); VideoPlayerController controller = new VideoPlayerController(getActivity()); videoPlayer.setUp(url,null); videoPlayer.setPlayerType(ConstantKeys.IjkPlayerType.TYPE_IJK); videoPlayer.setController(controller); ImageUtils.loadImgByPicasso(getActivity(),image, R.drawable.image_default,controller.imageView()); //不从上一次位置播放,也就是每次从0播放 videoPlayer.continueFromLastPosition(false); videoPlayer.postDelayed(new Runnable() { @Override public void run() { videoPlayer.start(); } },50); }
Example #9
Source File: KeDouFragment.java From v9porn with MIT License | 6 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); unbinder = ButterKnife.bind(this, view); contentView.setOnRefreshListener(this); recyclerViewKeDou.setLayoutManager(new LinearLayoutManager(getContext())); recyclerViewKeDou.setAdapter(keDouAdapter); helper = new LoadViewHelper(recyclerViewKeDou); helper.setListener(() -> loadData(false)); keDouAdapter.setOnItemClickListener((adapter, view1, position) -> { KeDouModel keDouModel = (KeDouModel) adapter.getItem(position); if (keDouModel == null) { return; } Intent intent = new Intent(context, KeDouPlayActivity.class); intent.putExtra(Keys.KEY_INTENT_KEDOUWO_ITEM, keDouModel); startActivityWithAnimation(intent); }); keDouAdapter.setOnLoadMoreListener(() -> loadData(false), recyclerViewKeDou); AppUtils.setColorSchemeColors(context, contentView); }
Example #10
Source File: Format.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public static Format createTextSampleFormat( @Nullable String id, String sampleMimeType, @C.SelectionFlags int selectionFlags, @Nullable String language, @Nullable DrmInitData drmInitData) { return createTextSampleFormat( id, sampleMimeType, /* codecs= */ null, /* bitrate= */ NO_VALUE, selectionFlags, language, NO_VALUE, drmInitData, OFFSET_SAMPLE_RELATIVE, Collections.emptyList()); }
Example #11
Source File: RecyclerViewActivity.java From QRefreshLayout with MIT License | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recyclerview); setTitle("RecyclerView示例"); recyclerView = findViewById(R.id.recyclerView); qRefreshLayout = findViewById(R.id.refreshLayout); qRefreshLayout.setOnRefreshListener(this); qRefreshLayout.setOnLoadListener(this); qRefreshLayout.setRefreshing(true); qRefreshLayout.setIsCanSecondFloor(true); ImageView imageView = new ImageView(this); imageView.setImageResource(R.drawable.img_test); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); qRefreshLayout.setSecondFloorView(imageView); adapter = new RecyclerAdapter(); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setAdapter(adapter); }
Example #12
Source File: MainActivity.java From DataLoader with Apache License 2.0 | 5 votes |
public void testLoadData4(View view) { DataSource<String> dataSource = DataLoader.get(DemoDataSource.class).getData4(COMMON_PARAMS[0]); dataSource.result().observe(this, new Observer<String>() { @Override public void onChanged(@Nullable String s) { Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show(); } }); dataSource.error().observe(this, new Observer<Throwable>() { @Override public void onChanged(@Nullable Throwable throwable) { Toast.makeText(MainActivity.this, throwable.toString(), Toast.LENGTH_SHORT).show(); } }); }
Example #13
Source File: WSEventReporter.java From incubator-weex-playground with Apache License 2.0 | 5 votes |
@Nullable @Override public String firstHeaderValue(String name) { for (Pair<String, String> pair : headerList) { if (pair.first.equals(name)) { return pair.second; } } return null; }
Example #14
Source File: GroupSceneManager.java From scene with Apache License 2.0 | 5 votes |
MoveStateOperation(@NonNull Scene scene, @IdRes int viewId, @Nullable String tag, @NonNull State dstState, boolean forceShow, boolean forceHide, boolean forceRemove) { super(scene, dstState, forceShow, forceHide, forceRemove); if (forceShow && forceHide) { throw new IllegalArgumentException("cant forceShow with forceHide"); } this.viewId = viewId; this.tag = tag; this.dstState = dstState; }
Example #15
Source File: EventLogger.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Creates event logger. * * @param trackSelector The mapping track selector used by the player. May be null if detailed * logging of track mapping is not required. */ public EventLogger(@Nullable MappingTrackSelector trackSelector) { this.trackSelector = trackSelector; window = new Timeline.Window(); period = new Timeline.Period(); startTimeMs = SystemClock.elapsedRealtime(); }
Example #16
Source File: MyRefreshView.java From QRefreshLayout with MIT License | 5 votes |
public MyRefreshView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); viewContent = LayoutInflater.from(context).inflate(R.layout.view_my_refresh, null); addView(viewContent); tvContent = viewContent.findViewById(R.id.tvContent); viewContainer = viewContent.findViewById(R.id.viewContainer); tvHeight = viewContent.findViewById(R.id.tvHeight); progressBar = viewContent.findViewById(R.id.progressBar); viewCover = viewContent.findViewById(R.id.viewCover); btnReturn = viewContent.findViewById(R.id.btnReturn); btnReturn.setOnClickListener(this); }
Example #17
Source File: AndroidFragment.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); TextView tv = view.findViewById(R.id.text); tv.setText(getArguments().getString("myarg")); Button b = view.findViewById(R.id.send_notification); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EditText editArgs = view.findViewById(R.id.edit_args); Bundle args = new Bundle(); args.putString("myarg", editArgs.getText().toString()); PendingIntent deeplink = Navigation.findNavController(v).createDeepLink() .setDestination(R.id.android) .setArguments(args) .createPendingIntent(); NotificationManager notificationManager = (NotificationManager) requireContext().getSystemService(Context.NOTIFICATION_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { notificationManager.createNotificationChannel(new NotificationChannel( "deeplink", "Deep Links", NotificationManager.IMPORTANCE_HIGH)); } NotificationCompat.Builder builder = new NotificationCompat.Builder( requireContext(), "deeplink") .setContentTitle("Navigation") .setContentText("Deep link to Android") .setSmallIcon(R.drawable.ic_android) .setContentIntent(deeplink) .setAutoCancel(true); notificationManager.notify(0, builder.build()); } }); }
Example #18
Source File: HostActivity.java From movienow with GNU General Public License v3.0 | 5 votes |
private void showAdd(@Nullable String text) { final EditText et = new EditText(getContext()); et.setHint("添加多个请用; 隔开(英文分号加空格)"); if(text!=null){ et.setText(text); } new AlertDialog.Builder(getContext()).setTitle("添加拦截网址或者域名") .setView(et) .setCancelable(true) .setPositiveButton("保存", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String input = et.getText().toString(); if (TextUtils.isEmpty(input)) { ToastMgr.toastShortCenter(getContext(), "网址不能为空"); } else { String[] ss = input.split("; "); for (String s : ss) { HostManager.getInstance().addUrl(s); } adapter.notifyDataSetChanged(); ToastMgr.toastShortBottomCenter(getContext(), "已成功添加" + ss.length + "条网址"); } } }) .setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }) .show(); }
Example #19
Source File: PagerSnapHelper.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Nullable @Override public View findSnapView(RecyclerView.LayoutManager layoutManager) { if (layoutManager.canScrollVertically()) { return findCenterView(layoutManager, getVerticalHelper(layoutManager)); } else if (layoutManager.canScrollHorizontally()) { return findCenterView(layoutManager, getHorizontalHelper(layoutManager)); } return null; }
Example #20
Source File: DrmInitData.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } DrmInitData other = (DrmInitData) obj; return Util.areEqual(schemeType, other.schemeType) && Arrays.equals(schemeDatas, other.schemeDatas); }
Example #21
Source File: RecyclerFragment.java From FlowHelper with Apache License 2.0 | 5 votes |
@Override public void onLazyInitView(@Nullable Bundle savedInstanceState) { super.onLazyInitView(savedInstanceState); HttpCreate.getServer().getSystematicDetail(0,mBean.getId()) .compose(RxUtils.<BaseResponse<PageDataInfo<List<ArticleData>>>>rxScheduers()) .subscribe(new Observer<BaseResponse<PageDataInfo<List<ArticleData>>>>() { @Override public void onSubscribe(Disposable d) { } @Override public void onNext(BaseResponse<PageDataInfo<List<ArticleData>>> pageDataInfoBaseResponse) { PageDataInfo<List<ArticleData>> data = pageDataInfoBaseResponse.getData(); List<ArticleData> datas = data.getDatas(); mAdapter.setNewData(datas); } @Override public void onError(Throwable e) { } @Override public void onComplete() { } }); }
Example #22
Source File: DefaultTrackSelector.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } Parameters other = (Parameters) obj; return selectUndeterminedTextLanguage == other.selectUndeterminedTextLanguage && disabledTextTrackSelectionFlags == other.disabledTextTrackSelectionFlags && forceLowestBitrate == other.forceLowestBitrate && allowMixedMimeAdaptiveness == other.allowMixedMimeAdaptiveness && allowNonSeamlessAdaptiveness == other.allowNonSeamlessAdaptiveness && maxVideoWidth == other.maxVideoWidth && maxVideoHeight == other.maxVideoHeight && exceedVideoConstraintsIfNecessary == other.exceedVideoConstraintsIfNecessary && exceedRendererCapabilitiesIfNecessary == other.exceedRendererCapabilitiesIfNecessary && viewportOrientationMayChange == other.viewportOrientationMayChange && viewportWidth == other.viewportWidth && viewportHeight == other.viewportHeight && maxVideoBitrate == other.maxVideoBitrate && tunnelingAudioSessionId == other.tunnelingAudioSessionId && TextUtils.equals(preferredAudioLanguage, other.preferredAudioLanguage) && TextUtils.equals(preferredTextLanguage, other.preferredTextLanguage) && areRendererDisabledFlagsEqual(rendererDisabledFlags, other.rendererDisabledFlags) && areSelectionOverridesEqual(selectionOverrides, other.selectionOverrides); }
Example #23
Source File: ChangeCityActivity.java From BmapLite with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); initView(R.layout.activity_change_city); getData(); }
Example #24
Source File: FfmpegAudioRenderer.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be * null if delivery of events is not required. * @param eventListener A listener of events. May be null if delivery of events is not required. * @param audioSink The sink to which audio will be output. * @param enableFloatOutput Whether to enable 32-bit float audio format, if supported on the * device/build and if the input format may have bit depth higher than 16-bit. When using * 32-bit float output, any audio processing will be disabled, including playback speed/pitch * adjustment. */ public FfmpegAudioRenderer( @Nullable Handler eventHandler, @Nullable AudioRendererEventListener eventListener, AudioSink audioSink, boolean enableFloatOutput) { super( eventHandler, eventListener, /* drmSessionManager= */ null, /* playClearSamplesWithoutKeys= */ false, audioSink); this.enableFloatOutput = enableFloatOutput; }
Example #25
Source File: VideoRecordActivity.java From Tok-Android with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_record); mIntent = getIntent(); mCameraLayout = $(R.id.id_video_gl_view_layout); initCameraGlView(); mVideoView = $(R.id.id_video_view); mRecordIv = $(R.id.id_video_record_view); mRecordIv.setOnTouchListener(new RecordTouchListener()); mProgressView = $(R.id.id_record_progress); mProgressView.setAutoTimeProgress(GlobalParams.MAX_VIDEO_TIME); mProgressView.setProgressListener(this); mFlashIv = $(R.id.id_video_flash_iv); mFlashIv.setOnClickListener(this); mCameraIv = $(R.id.id_video_camera_iv); mCameraIv.setOnClickListener(this); mCloseIv = $(R.id.id_video_close_iv); mCloseIv.setOnClickListener(this); mDropIv = $(R.id.id_video_drop_iv); mDropIv.setOnClickListener(this); mSelectIv = $(R.id.id_video_select_iv); mSelectIv.setOnClickListener(this); checkPermission(); }
Example #26
Source File: BaseHeaderFooterAdapter.java From SimpleAdapterDemo with Apache License 2.0 | 5 votes |
@Nullable public F getFooterAt(int position) { int index = toFooterIndex(position); if (index < 0 || index >= getFooterSize()) return null; return footers.get(index); }
Example #27
Source File: ExampleActivity.java From FastWaiMai with MIT License | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); //取消ActionBar ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.hide(); } Latte.getConfigurator().withActivity(this); }
Example #28
Source File: WeatherFragment.java From OpenWeatherPlus-Android with Apache License 2.0 | 5 votes |
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (getArguments() != null) { isEn = ContentUtil.APP_SETTING_LANG.equals("en") || ContentUtil.APP_SETTING_LANG.equals("sys") && ContentUtil.SYS_LANG.equals("en"); location = getArguments().getString(PARAM); initObserver(); initView(view); initData(location); } }
Example #29
Source File: LifeCycleCompatFragment.java From scene with Apache License 2.0 | 5 votes |
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (this.mSceneContainerLifecycleCallback != null) { this.mSceneContainerLifecycleCallback.onActivityCreated(getActivity(), savedInstanceState); } else { removeSelfWhenNavigationSceneUtilityIsNotInvoked(); } }
Example #30
Source File: FileDataSource.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** @param listener An optional listener. */ public FileDataSource(@Nullable TransferListener listener) { super(/* isNetwork= */ false); if (listener != null) { addTransferListener(listener); } }