Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
Happy Coding...

Muhammad Nouman chnouman

😎
Happy Coding...
View GitHub Profile
@chnouman
chnouman / Gradle.properties
Created Sep 26, 2018
Increase The Speed of Build Process of Android
View Gradle.properties
#Enable daemon
org.gradle.daemon=true
# Try and findout the best heap size for your project build.
org.gradle.jvmargs=-Xmx3096m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# Modularise your project and enable parallel build
org.gradle.parallel=true
# Enable configure on demand.
View DialogCustom.java
package com.dixeam.millionarequotes.dialogBoxes;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.ProgressDialog;
import android.content.Context;
View SignInDialog
package com.dixeam.millionarequotes.dialogBoxes;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.ProgressDialog;
import android.content.Context;
View Spaning for Grid View
// Create a custom SpanSizeLookup where the first item spans both columns
/*layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if (position == 0) {
return 1;
}
if (StoriesFragment.dataList.get(position) instanceof NativeAdView)
return 2;
else if (StoriesFragment.dataList.get(position) instanceof ModelForDailyandRecent)
View Pagination.java
package com.dixeam.millionarequotes.Fragments;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TabLayout;
View TakePictureForNougat.java
public void take(){
Intent callCameraApplicationIntent = new Intent();
callCameraApplicationIntent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException e) {
e.printStackTrace();
View ClearCache.java
public long getDirSize(File dir){
long size = 0;
for (File file : dir.listFiles()) {
if (file != null && file.isDirectory()) {
size += getDirSize(file);
} else if (file != null && file.isFile()) {
size += file.length();
}
}