Skip to content

Instantly share code, notes, and snippets.


Dmitry TheLester

View GitHub Profile
View Camera Preview Surface
public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
private SurfaceHolder mHolder;
private Camera mCamera;
private List<Camera.Size> mSupportedPreviewSizes;
private Camera.Size mPreviewSize;
private int mCameraId;
public CameraPreview(Context context) {
mHolder = getHolder();
View UnauthorizedErrorInterceptor
final Interceptor unauthorizedErrorInterceptor = new Interceptor() {
@Override public Response intercept(Interceptor.Chain chain) throws IOException {
Request request = chain.request();
Response response = chain.proceed(request);
boolean unAuthorized = (response.code() == 401);
if (unAuthorized) {
EventBus.getDefault().post(new EventsHolder.RequestWithInvalidTokenEvent());
return response;
TheLester / activity
Created Oct 5, 2015
Abstract Activity
View activity
public abstract class EffectiveActivity extends AppCompatActivity {
private ViewGroup mainFrame;
private ScreenContainer screenContainer;
protected void onCreate(Bundle savedInstanceState) {
screenContainer = createScreenContainer();
mainFrame = screenContainer.bind(this);
getLayoutInflater().inflate(getLayout(), mainFrame);
TheLester / .gitignore
Created Oct 2, 2015
Gitignore template
View .gitignore
You can’t perform that action at this time.