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 File: AbsFloatBase.java    From FloatWindow with 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 #2
Source File: BaseHeaderFooterAdapter.java    From SimpleAdapterDemo with 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 File: ConnectionsActivity.java    From connectivity-samples with 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 #4
Source File: MediaCodecVideoRenderer.java    From TelePlus-Android with 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 File: BaseWebActivity.java    From qrcode_android with 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 #6
Source File: BaseActivity.java    From MvpRoute with 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 File: MediaCodecVideoRenderer.java    From TelePlus-Android with 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 #8
Source File: MediaCodecVideoRenderer.java    From TelePlus-Android with 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 #9
Source File: AbsFloatBase.java    From FloatWindow with 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 File: MediaCodecVideoRenderer.java    From TelePlus-Android with 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 #11
Source File: AbstractWeexActivity.java    From incubator-weex-playground with 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 File: CartAdapter.java    From CartLayout with Apache License 2.0 5 votes vote down vote up
@Override
@CallSuper
public void onBindViewHolder(@NonNull final VH holder, final int position) {
    holder.bindData(mDatas.get(position));
    if (holder.mCheckBox != null) {
        holder.mCheckBox.setOnClickListener(new OnCheckBoxClickListener(position,
                mDatas.get(position).getItemType()));
        if (holder.mCheckBox.isChecked() != mDatas.get(position).isChecked()) {
            holder.mCheckBox.setChecked(mDatas.get(position).isChecked());
        }
    }
}
 
Example #13
Source File: DebugFragment.java    From LifecycleFragment with Apache License 2.0 5 votes vote down vote up
@CallSuper
@Override
protected void onInvisible() {
    if (onVisibleListener != null) {
        onVisibleListener.onInvisible(this);
    }
}
 
Example #14
Source File: AbstractWeexActivity.java    From incubator-weex-playground with 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 #15
Source File: AbsFloatBase.java    From FloatWindow with 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 #16
Source File: DebugFragment.java    From LifecycleFragment with Apache License 2.0 5 votes vote down vote up
@CallSuper
@Override
protected void onVisible(boolean firstVisible) {
    if (onVisibleListener != null) {
        onVisibleListener.onVisible(this, firstVisible);
    }
}
 
Example #17
Source File: RmWidget.java    From relight with Apache License 2.0 5 votes vote down vote up
@CallSuper
protected void onStatusChanged(RmStatus status) {
    switch (status) {
        case Refreshing:
        case LoadingMore:
            setStateAsync(loadingTask);
            break;
    }
}
 
Example #18
Source File: SnapPageScrollListener.java    From RecyclerPager with Apache License 2.0 5 votes vote down vote up
@CallSuper @Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
    super.onScrollStateChanged(recyclerView, newState);
    if (currentPosition == RecyclerView.NO_POSITION) {
        return;
    }

    if (newState == RecyclerView.SCROLL_STATE_IDLE) {
        onPageScrolled(currentPosition, 0, 0);
    }
}
 
Example #19
Source File: JavaProjectFolder.java    From java-n-IDE-for-Android with 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 #20
Source File: JavaProjectFolder.java    From java-n-IDE-for-Android with 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 #21
Source File: BaseFragment.java    From PageRecyclerView with Apache License 2.0 5 votes vote down vote up
@CallSuper
@Override
public void onResume() {
	super.onResume();
	if (getUserVisibleHint()) {
		onVisible();
	}
}
 
Example #22
Source File: BaseActivity.java    From MvpRoute with 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 File: BaseFragment.java    From MvpRoute with 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 File: BaseWebActivity.java    From qrcode_android with 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();
    }
}
 
Example #25
Source File: BaseFragment.java    From MvpRoute with 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 #26
Source File: BaseFragment.java    From MvpRoute with Apache License 2.0 5 votes vote down vote up
@CallSuper
@Override
public void onDestroyView() {
	super.onDestroyView();
	if (presenter != null) {
		presenter.unRegister();
	}
}
 
Example #27
Source File: BaseFragment.java    From MvpRoute with 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 #28
Source File: BaseAdapter.java    From MvpRoute with 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 #29
Source File: BaseToActivity.java    From MvpRoute with 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 #30
Source File: NDCrashService.java    From jndcrash with 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();
}