android.support.annotation.CallSuper Java Examples

The following examples show how to use android.support.annotation.CallSuper. 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 Project: connectivity-samples   Author: android   File: ConnectionsActivity.java    License: Apache License 2.0 6 votes vote down vote up
/** Called when the user has accepted (or denied) our permission request. */
@CallSuper
@Override
public void onRequestPermissionsResult(
    int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
  if (requestCode == REQUEST_CODE_REQUIRED_PERMISSIONS) {
    for (int grantResult : grantResults) {
      if (grantResult == PackageManager.PERMISSION_DENIED) {
        Toast.makeText(this, R.string.error_missing_permissions, Toast.LENGTH_LONG).show();
        finish();
        return;
      }
    }
    recreate();
  }
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
 
Example #2
Source Project: SimpleAdapterDemo   Author: JustinRoom   File: BaseHeaderFooterAdapter.java    License: Apache License 2.0 6 votes vote down vote up
@CallSuper
@Override
public void onBindViewHolder(@NonNull VH holder, int position) {
    holder.addOnItemClickListener(onItemClickListener == null ? null : getDefaultItemClickListener());
    holder.addOnItemLongClickListener(onItemLongClickListener == null ? null : getDefaultItemLongClickListener());
    switch (getItemViewType(position)) {
        case TYPE_HEADER:
            onBindHeaderViewHolder(holder, position, getHeaderAt(position));
            break;
        case TYPE_DATA:
            onBindDataViewHolder(holder, position, getDataAt(position));
            break;
        case TYPE_FOOTER:
            onBindFooterViewHolder(holder, position, getFooterAt(position));
            break;
        case TYPE_EMPTY:
            onBindEmptyViewHolder(holder, position, getEmptyAt(position));
            break;
        case UNKNOWN:
            break;
    }
}
 
Example #3
Source Project: TelePlus-Android   Author: TelePlusDev   File: MediaCodecVideoRenderer.java    License: GNU General Public License v2.0 6 votes vote down vote up
@CallSuper
@Override
protected void releaseCodec() {
  try {
    super.releaseCodec();
  } finally {
    buffersInCodecCount = 0;
    if (dummySurface != null) {
      if (surface == dummySurface) {
        surface = null;
      }
      dummySurface.release();
      dummySurface = null;
    }
  }
}
 
Example #4
Source Project: TelePlus-Android   Author: TelePlusDev   File: MediaCodecVideoRenderer.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called when an output buffer is successfully processed.
 *
 * @param presentationTimeUs The timestamp associated with the output buffer.
 */
@CallSuper
@Override
protected void onProcessedOutputBuffer(long presentationTimeUs) {
  buffersInCodecCount--;
  while (pendingOutputStreamOffsetCount != 0
      && presentationTimeUs >= pendingOutputStreamSwitchTimesUs[0]) {
    outputStreamOffsetUs = pendingOutputStreamOffsetsUs[0];
    pendingOutputStreamOffsetCount--;
    System.arraycopy(
        pendingOutputStreamOffsetsUs,
        /* srcPos= */ 1,
        pendingOutputStreamOffsetsUs,
        /* destPos= */ 0,
        pendingOutputStreamOffsetCount);
    System.arraycopy(
        pendingOutputStreamSwitchTimesUs,
        /* srcPos= */ 1,
        pendingOutputStreamSwitchTimesUs,
        /* destPos= */ 0,
        pendingOutputStreamOffsetCount);
  }
}
 
Example #5
Source Project: FloatWindow   Author: SunJenry   File: AbsFloatBase.java    License: Apache License 2.0 6 votes vote down vote up
@CallSuper
    public synchronized void show() {
        if (mInflate == null)
            throw new IllegalStateException("FloatView can not be null");

        if (mAdded) {
            mInflate.setVisibility(View.VISIBLE);
            return;
        }

        getLayoutParam(mViewMode);

        mInflate.setVisibility(View.VISIBLE);

        try {
            mWindowManager.addView(mInflate, mLayoutParams);
            mAdded = true;
        } catch (Exception e) {
            Log.e(TAG, "添加悬浮窗失败!!!!!!请检查悬浮窗权限");
//            Toast.makeText(mContext, "添加悬浮窗失败!!!!!!请检查悬浮窗权限", Toast.LENGTH_SHORT).show();
            onAddWindowFailed(e);
        }
    }
 
Example #6
Source Project: MvpRoute   Author: TLocation   File: BaseActivity.java    License: Apache License 2.0 6 votes vote down vote up
@CallSuper
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setStatusBar();
	setContentView();
	initPaddingTop();
	Bundle extras = getIntent().getExtras();
	activity = this;
	presenter = createPresenter();
	if (presenter != null) {
		presenter.register(this);
	}
	AppManager.getAppManager().addActivity(this);
	Bundle bundle = getIntent().getExtras();
	// 设置bundle传值注入
	if (bundle != null) {
		new BundleUtils().setBundleField(this, bundle);
	}
	initView(savedInstanceState);
	loadData();
}
 
Example #7
Source Project: qrcode_android   Author: LiuhangZhang   File: BaseWebActivity.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
@CallSuper
@Override
protected void onDestroy() {
    // 避免WebView引起内存泄漏
    if (mWebView != null) {
        /* WebView中包含一个ZoomButtonsController,当使用web.getSettings().setBuiltInZoomControls(true);
        启用该设置后,用户一旦触摸屏幕,就会出现缩放控制图标,这个图标过上几秒会自动消失.
        但在3.0系统以上上,如果图标自动消失前退出当前Activity的话,就会发生ZoomButton找不到依附的Window而造成程序崩溃,
        解决办法很简单就是在Activity的ondestory方法中调用web.setVisibility(View.GONE);方法,手动将其隐藏,就不会崩溃了。
        在3.0一下系统上不会出现该崩溃问题 */
        mWebView.setVisibility(View.GONE);
        mWebView.stopLoading();
        mWebView.clearHistory();
        ViewGroup webParent = (ViewGroup) mWebView.getParent();
        if (webParent != null) {
            webParent.removeView(mWebView);
        }
        mWebView.removeAllViews();
        mWebView.destroy();
        mWebView = null;
    }
    super.onDestroy();
}
 
Example #8
Source Project: TelePlus-Android   Author: TelePlusDev   File: MediaCodecVideoRenderer.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called when an output buffer is successfully processed.
 *
 * @param presentationTimeUs The timestamp associated with the output buffer.
 */
@CallSuper
@Override
protected void onProcessedOutputBuffer(long presentationTimeUs) {
  buffersInCodecCount--;
  while (pendingOutputStreamOffsetCount != 0
      && presentationTimeUs >= pendingOutputStreamSwitchTimesUs[0]) {
    outputStreamOffsetUs = pendingOutputStreamOffsetsUs[0];
    pendingOutputStreamOffsetCount--;
    System.arraycopy(
        pendingOutputStreamOffsetsUs,
        /* srcPos= */ 1,
        pendingOutputStreamOffsetsUs,
        /* destPos= */ 0,
        pendingOutputStreamOffsetCount);
    System.arraycopy(
        pendingOutputStreamSwitchTimesUs,
        /* srcPos= */ 1,
        pendingOutputStreamSwitchTimesUs,
        /* destPos= */ 0,
        pendingOutputStreamOffsetCount);
  }
}
 
Example #9
Source Project: FloatWindow   Author: SunJenry   File: AbsFloatBase.java    License: Apache License 2.0 6 votes vote down vote up
@CallSuper
    public synchronized void show() {
        if (mInflate == null)
            throw new IllegalStateException("FloatView can not be null");

        if (mAdded) {
            mInflate.setVisibility(View.VISIBLE);
            return;
        }

        getLayoutParam(mViewMode);

        mInflate.setVisibility(View.VISIBLE);

        try {
            mWindowManager.addView(mInflate, mLayoutParams);
            mAdded = true;
        } catch (Exception e) {
            Log.e(TAG, "添加悬浮窗失败!!!!!!请检查悬浮窗权限");
//            Toast.makeText(mContext, "添加悬浮窗失败!!!!!!请检查悬浮窗权限", Toast.LENGTH_SHORT).show();
            onAddWindowFailed(e);
        }
    }
 
Example #10
Source Project: incubator-weex-playground   Author: apache   File: AbstractWeexActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@CallSuper
public void onRenderSuccess(WXSDKInstance instance, int width, int height) {
  if(mWxAnalyzerDelegate  != null){
    mWxAnalyzerDelegate.onWeexRenderSuccess(instance);
  }
}
 
Example #11
Source Project: incubator-weex-playground   Author: apache   File: AbstractWeexActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@CallSuper
public void onException(WXSDKInstance instance, String errCode, String msg) {
  if(mWxAnalyzerDelegate != null){
    mWxAnalyzerDelegate.onException(instance,errCode,msg);
  }
}
 
Example #12
Source Project: scene   Author: bytedance   File: SceneTransition.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
public void captureValue(@NonNull View fromView, @NonNull View toView, @NonNull View animationView) {
    if (animationView == null) {
        throw new IllegalArgumentException("animationView cant be null");
    }
    this.mFromView = fromView;
    this.mToView = toView;
    this.mAnimationView = animationView;
}
 
Example #13
Source Project: scene   Author: bytedance   File: SceneVisibilityTransition.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
public void captureValue(@NonNull View view, @NonNull ViewGroup rootView) {
    this.mView = view;
    this.mRootView = rootView;
    if (this.mPropagation != null) {
        this.mTransitionPropagationResult = mPropagation.captureValues(view, rootView);
    }
}
 
Example #14
Source Project: FloatWindow   Author: SunJenry   File: AbsFloatBase.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
public void remove() {
    if (mInflate != null && mWindowManager != null) {
        if (mInflate.isAttachedToWindow()) {
            mWindowManager.removeView(mInflate);
        }
        mAdded = false;
    }

    if (mHandler != null) {
        mHandler.removeCallbacksAndMessages(null);
    }
}
 
Example #15
Source Project: TelePlus-Android   Author: TelePlusDev   File: CompositeMediaSource.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
@CallSuper
public void prepareSourceInternal(
    ExoPlayer player,
    boolean isTopLevelSource,
    @Nullable TransferListener mediaTransferListener) {
  this.player = player;
  this.mediaTransferListener = mediaTransferListener;
  eventHandler = new Handler();
}
 
Example #16
Source Project: TelePlus-Android   Author: TelePlusDev   File: CompositeMediaSource.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
@CallSuper
public void maybeThrowSourceInfoRefreshError() throws IOException {
  for (MediaSourceAndListener childSource : childSources.values()) {
    childSource.mediaSource.maybeThrowSourceInfoRefreshError();
  }
}
 
Example #17
Source Project: TelePlus-Android   Author: TelePlusDev   File: CompositeMediaSource.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
@CallSuper
public void releaseSourceInternal() {
  for (MediaSourceAndListener childSource : childSources.values()) {
    childSource.mediaSource.releaseSource(childSource.listener);
    childSource.mediaSource.removeEventListener(childSource.eventListener);
  }
  childSources.clear();
  player = null;
}
 
Example #18
Source Project: TelePlus-Android   Author: TelePlusDev   File: MediaCodecVideoRenderer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called immediately before an input buffer is queued into the codec.
 *
 * @param buffer The buffer to be queued.
 */
@CallSuper
@Override
protected void onQueueInputBuffer(DecoderInputBuffer buffer) {
  buffersInCodecCount++;
  lastInputTimeUs = Math.max(buffer.timeUs, lastInputTimeUs);
  if (Util.SDK_INT < 23 && tunneling) {
    maybeNotifyRenderedFirstFrame();
  }
}
 
Example #19
Source Project: FloatWindow   Author: SunJenry   File: AbsFloatBase.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
public void remove() {
    if (mInflate != null && mWindowManager != null) {
        if (mInflate.isAttachedToWindow()) {
            mWindowManager.removeView(mInflate);
        }
        mAdded = false;
    }

    if (mHandler != null) {
        mHandler.removeCallbacksAndMessages(null);
    }
}
 
Example #20
Source Project: java-n-IDE-for-Android   Author: shenghuntianlang   File: JavaProjectFolder.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
public void mkdirs() {
    if (!dirRoot.exists()) dirRoot.mkdirs();
    if (!dirProject.exists()) dirProject.mkdirs();
    if (!dirLibs.exists()) dirLibs.mkdirs();
    if (!dirSrcMain.exists()) dirSrcMain.mkdirs();
    if (!dirJava.exists()) dirJava.mkdirs();
    if (!dirBuildClasses.exists()) dirBuildClasses.mkdirs();
    if (!dirGenerated.exists()) dirGenerated.mkdirs();
    if (!dirGeneratedSource.exists()) dirGeneratedSource.mkdirs();
}
 
Example #21
Source Project: java-n-IDE-for-Android   Author: shenghuntianlang   File: JavaProjectFolder.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
public void clean() {
    try {
        com.android.utils.FileUtils.emptyFolder(dirBuildClasses);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
Example #22
Source Project: MvpRoute   Author: TLocation   File: BaseActivity.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
@Override
protected void onDestroy() {
	super.onDestroy();
	if (presenter != null) {
		presenter.unRegister();
	}
	AppManager.getAppManager().finishActivity(this);
}
 
Example #23
Source Project: MvpRoute   Author: TLocation   File: BaseFragment.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
	presenter = createPresenter();
	if (presenter != null) {
		presenter.register(this);
	}
	return inflater.inflate(getLayout(), container, false);
}
 
Example #24
Source Project: MvpRoute   Author: TLocation   File: BaseFragment.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
	super.onViewCreated(view, savedInstanceState);
	this.rootView = view;
	initHideBoard(view);
	if (getArguments() != null) {
		getBundle(getArguments());
		new BundleUtils().setBundleField(this,getArguments());
	}
	initView(savedInstanceState);
	loadData();
}
 
Example #25
Source Project: MvpRoute   Author: TLocation   File: BaseFragment.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
@Override
public void onDestroyView() {
	super.onDestroyView();
	if (presenter != null) {
		presenter.unRegister();
	}
}
 
Example #26
Source Project: MvpRoute   Author: TLocation   File: BaseFragment.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
@Override
public void onHiddenChanged(boolean hidden) {
	super.onHiddenChanged(hidden);
	if (hidden) {
		onHide();
	} else {
		onShow();
	}
}
 
Example #27
Source Project: MvpRoute   Author: TLocation   File: BaseAdapter.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
@Override
public int getItemCount() {
	if (emptyModle == EMPTY_MODLE_NOMAL) {
		if (data.isEmpty() && data.size() == 0 && emptyView != null && headerList.isEmpty() && footerList.isEmpty()) {
			return 1;
		}
	} else {
		if (data.isEmpty() && data.size() == 0 && emptyView != null) {
			return 1;
		}
	}

	return data.size() + getHeaderCount() + getFooterCount();
}
 
Example #28
Source Project: MvpRoute   Author: TLocation   File: BaseToActivity.java    License: Apache License 2.0 5 votes vote down vote up
@CallSuper
@Override
protected void initView(@Nullable Bundle savedInstanceState) {
	titleView = findViewById(R.id.toobar_title);
	if (titleView != null && !TextUtils.isEmpty(getTooBarTitle())) {
		titleView.setText(getTooBarTitle());
		findViewById(R.id.bar_back).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				finish();
			}
		});
	}
}
 
Example #29
Source Project: jndcrash   Author: ivanarh   File: NDCrashService.java    License: Apache License 2.0 5 votes vote down vote up
@Override @CallSuper
public void onDestroy() {
    if (mDaemonStarted) {
        mDaemonStarted = false;
        final boolean stoppedSuccessfully = NDCrash.stopOutOfProcessDaemon();
        Log.i(TAG, "Out-of-process daemon " + (stoppedSuccessfully ? "is successfully stopped." : "failed to stop."));
    }
    super.onDestroy();
}
 
Example #30
Source Project: qrcode_android   Author: LiuhangZhang   File: BaseWebActivity.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@CallSuper
@Override
public void onPause() {
    super.onPause();
    if (mWebView != null) {
        mWebView.onPause();
    }
}