private final static char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
public static String toHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int i = 0; i < bytes.length; i++) {
int byteValue = bytes[i] & 0xFF;
hexChars[i * 2] = HEX_ARRAY[byteValue >>> 4];
hexChars[i * 2 + 1] = HEX_ARRAY[byteValue & 0x0F];
}
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<style name="Toolbar" /> | |
<style name="Toolbar.Theme" parent="ThemeOverlay.AppCompat.Light"> | |
<item name="actionMenuTextColor">@android:color/white</item> | |
<item name="actionMenuTextAppearance">@style/Toolbar.MenuTextAppearance</item> | |
<item name="android:actionOverflowButtonStyle">@style/Toolbar.OverflowButtonStyle</item> | |
</style> |
apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.easyway.rx_iim_app"
minSdkVersion 19
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 NetworkUtil { | |
public static boolean isConnected(Context context) { | |
ConnectivityManager connectManager = | |
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
NetworkInfo mobileNetwork = connectManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); | |
NetworkInfo wifiNetwork = connectManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); | |
NetworkInfo activeNetwork = connectManager.getActiveNetworkInfo(); | |
return (activeNetwork != null && activeNetwork.isConnected()) | |
|| mobileNetwork.isConnected() |
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
private Drawable mDivider;
public DividerItemDecoration(Context context) {
mDivider = context.getDrawable(R.drawable.divider);
}
@Override
Copyright 2017 FoxIvan
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
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 DensityUtil { | |
public static int dp2px(Context context, float dpVal) { | |
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, | |
dpVal, context.getResources().getDisplayMetrics()); | |
} | |
public static int sp2px(Context context, float spVal) { | |
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, | |
spVal, context.getResources().getDisplayMetrics()); |
Date dNow = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(dNow);
calendar.add(Calendar.MONTH, -2);
calendar.add(Calendar.DAYOFMONTH, -2);
Date dBefore = calendar.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String startDate = sdf.format(dBefore);