Skip to content

Instantly share code, notes, and snippets.

View afiqiqmal's full-sized avatar
👻
I may be slow to respond.

Hafiq afiqiqmal

👻
I may be slow to respond.
View GitHub Profile
@afiqiqmal
afiqiqmal / CircularRevealingFragment.java
Created October 29, 2017 11:13 — forked from ferdy182/CircularRevealingFragment.java
Make circular reveal animations on a fragment
/**
* Our demo fragment
*/
public static class CircularRevealingFragment extends Fragment {
OnFragmentTouched listener;
public CircularRevealingFragment() {
}
@afiqiqmal
afiqiqmal / ZipHelper.php
Last active July 22, 2020 15:48
This is a sample of Zip Helper using ZipArchive for Laravel
<?php
namespace App\Library;
use Carbon\Carbon;
use Illuminate\Support\Facades\Storage;
use ZipArchive;
class ZipHelper
{
@afiqiqmal
afiqiqmal / Utils.php
Created November 1, 2017 16:49
This is a sample of renaming file in PHP
<?php
namespace App\Library;
use Carbon\Carbon;
class Utils
{
public static function getFile($file, $add_time = true, $replace_space = false)
{
@afiqiqmal
afiqiqmal / Message.php
Created November 1, 2017 16:51
This is a sample static class for returning json
<?php
namespace App\Library;
class Message
{
public static function error($msg = 'Something went wrong', $code = 400, $reference = null)
{
return response()->json(
[
@afiqiqmal
afiqiqmal / CronDecriptor.php
Created November 1, 2017 16:54
This is sample of cron descriptor which turn cron star into readable word
<?php
namespace App\Library;
// @codingStandardsIgnoreStart
/*
* Plugin: StreamlineFoundation
*
* Class: Schedule
*
* Description: Provides scheduling mechanics including creating a schedule, testing if a specific moment is part of the schedule, moving back
@afiqiqmal
afiqiqmal / ErrorUtils.java
Created November 1, 2017 17:01
This is a sample class utils for handling errors message
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import com.crashlytics.android.Crashlytics;
import com.google.firebase.crash.FirebaseCrash;
import com.google.gson.Gson;
import com.iteractive.bepunct.R;
import com.iteractive.bepunct.client.Constant;
import com.iteractive.bepunct.client.entity.response.ErrorResponse;
@afiqiqmal
afiqiqmal / BlockPager.java
Created November 1, 2017 17:03
This is for to block swipe of viewpager
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
* @author : hafiq on 07/02/2017.
*/
public class BlockPager extends ViewPager {
@afiqiqmal
afiqiqmal / WrapContentViewPager.java
Last active April 8, 2018 15:04
This Viewpager wrap your content according to size of your view content
public class WrapContentViewPager extends ViewPager {
public WrapContentViewPager(Context context)
{
super(context);
}
public WrapContentViewPager(Context context, AttributeSet attrs)
{
super(context, attrs);
}
@afiqiqmal
afiqiqmal / SampleActivity.java
Created November 1, 2017 17:08
This code able to convert the whole view in scrollview to images. It been tested and successfully working.
@BindView(R.id.native_resit)
protected ScrollView native_resit;
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
....
....
@afiqiqmal
afiqiqmal / OnFragmentFinishLoad.java
Last active November 1, 2017 17:11
Android Viewpager Wait Fragment Finish Load. After several attempt on how to wait all the fragment in view pager is loaded, i came out a solution where i create interface class to communicate between activity and the fragment.
public interface OnFragmentFinishLoad {
public void onFinish(String tag,boolean state);
}