This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns the difference between the provided date and now. | |
* The difference is in actual calendar days rather than time difference based. | |
* This means 01/Jan/2015 23:50 and 02/Jan/2015 00:01AM has a difference of 1 day. | |
* | |
* @param date The date from which the difference to today has to be calculated. | |
* @return difference in calendar days. | |
*/ | |
public static int getRealDayDifference(Date date) { | |
String timeString = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.text.TextUtils; | |
import android.util.AttributeSet; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewTreeObserver; | |
import android.view.ViewTreeObserver.OnGlobalLayoutListener; | |
import android.widget.FrameLayout; | |
import android.widget.TextView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.util.Log; | |
import android.view.MotionEvent; | |
import android.view.ScaleGestureDetector; | |
import android.view.View; | |
import android.view.ViewConfiguration; | |
public class MainActivity extends AppCompatActivity implements View.OnTouchListener { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Intent; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.view.View; | |
import android.widget.ArrayAdapter; | |
import android.widget.Button; | |
import android.widget.ListView; | |
public class TransitionThemeActivity extends AppCompatActivity implements View.OnClickListener { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.os.Build; | |
import android.util.AttributeSet; | |
import android.view.Gravity; | |
import android.widget.TextView; | |
/** | |
* Simple version used in the article: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.drawable.Drawable; | |
import android.support.v7.widget.AppCompatEditText; | |
import android.util.AttributeSet; | |
import android.util.SparseArray; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CameraMicPermissionHelper extends Fragment { | |
private static final int REQUEST_CAMERA_MIC_PERMISSIONS = 10; | |
public static final String TAG = "CamMicPerm"; | |
private CameraMicPermissionCallback mCallback; | |
private static boolean sCameraMicPermissionDenied; | |
public static CameraMicPermissionHelper newInstance() { | |
return new CameraMicPermissionHelper(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NetworkHelper extends Fragment { | |
public static final String TAG = "NetworkHelper"; | |
public static final String CHECK_INTERNET = "network_connection"; | |
private Activity mActivity; | |
AlertDialog mAlertDialog = null; | |
private BroadcastReceiver onNotice = new BroadcastReceiver() { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.graphics.Rect; | |
import android.graphics.Typeface; | |
import android.util.AttributeSet; | |
import android.view.View; |