Skip to content

Instantly share code, notes, and snippets.

File path = new File("path\to\your\folder");
File file= new File(path,".nomedia");
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
@kostovtd
kostovtd / TabsMargin.java
Created November 2, 2016 19:00
A way to add margins between the tabs of a TabLayout
for(int i=0; i < mTabLayout.getTabCount(); i++) {
View tab = ((ViewGroup) mTabLayout.getChildAt(0)).getChildAt(i);
ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) tab.getLayoutParams();
p.setMargins(0, 0, 50, 0);
tab.requestLayout();
}
@kostovtd
kostovtd / Activity.java
Last active October 30, 2016 10:13
Code Template - Activity & RecyclerViewAdapter
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
#parse("File Header.java")
public class ${NAME} extends AppCompatActivity {
private static final String TAG = ${NAME}.class.getSimpleName();
/**
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
#parse("File Header.java")
public class ${NAME} extends AppCompatActivity {
private static final String TAG = ${NAME}.class.getSimpleName();
/**
/**
* Created by todor.kostov on 6/25/2016.
*/
public interface AsyncResponse {
void processFinish(String output);
}
/***
* USAGE:
* DataManager.getInstance().setItemsList(itemsList);
*
* Item item = DataManager.getInstance().getItemByIdx(5);
*
* Please, notice that the getItemByIdx() function my throw an exception!!!
*/
public class DataManager {
private static DataManager ourInstance = new DataManager();