Skip to content

Instantly share code, notes, and snippets.

@iurysza
iurysza / detekt.gradle
Last active April 28, 2024 12:58
Gradle task that runs detekt only over changed files
configurations { detekt }
dependencies { detekt "io.gitlab.arturbosch.detekt:detekt-cli:$detektVersion" }
task detektCi(type: JavaExec, group: "verification") {
description = "Run Kotlin static analysis on changed files."
group = "CI"
main = "io.gitlab.arturbosch.detekt.cli.Main"
classpath = configurations.detekt
doFirst {
@ygrenzinger
ygrenzinger / CleanArchitecture.md
Last active March 31, 2024 13:57
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

package com.example.android.waitlist;
import android.content.Context;
import android.database.Cursor;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
@talhahasanzia
talhahasanzia / drop_shadow.xml
Created June 16, 2017 08:00
Drop shadow effect for all android versions
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<gradient
android:angle="360"
android:centerColor="#dcdcdc"
android:endColor="#e7e7e7"
android:gradientRadius="360"
@JosiasSena
JosiasSena / DeCryptor.java
Last active September 12, 2023 12:40
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
@wojteklu
wojteklu / clean_code.md
Last active May 3, 2024 08:55
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f0f0f0">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:padding="30dp"
android:clipChildren="false"
@vgonda
vgonda / MainActivityTest.java
Created June 11, 2015 13:51
Example of how to use espresso-intents in Android tests
package com.collectiveidea.example;
import android.content.Intent;
import android.support.test.espresso.intent.Intents;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import com.collectiveidea.example.ui.LoginActivity;
import com.collectiveidea.example.ui.MainActivity;
import com.collectiveidea.example.util.AccountUtility;
@cesco89
cesco89 / FragmentPageAdapter
Last active January 11, 2022 02:56
Add Fragments dynamically to ViewPager
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
public class MyFragmentPageAdapter extends FragmentPagerAdapter {