Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

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) {
super(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
TheLester / activity
Created Oct 5, 2015
Abstract Activity
View activity
public abstract class EffectiveActivity extends AppCompatActivity {
private ViewGroup mainFrame;
private ScreenContainer screenContainer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
screenContainer = createScreenContainer();
mainFrame = screenContainer.bind(this);
getLayoutInflater().inflate(getLayout(), mainFrame);
@TheLester
TheLester / .gitignore
Created Oct 2, 2015
Gitignore template
View .gitignore
.gradle/
.gradle
gradle/
.idea/
build/
*.iml
*.orig
*.txt
You can’t perform that action at this time.