通知发出的 Intent 设置 Flag:
Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP
重写 Activity 中的 onNewIntent(Intent newintent)
方法
直接用 CheckBox 就好,它妹的本来就可以设置 text 属性。 | |
不要用什么 drawableLeft/drawableStart check 框都不会改变状态 😂😂 |
Process: studio [54843] | |
Path: /Applications/Android Studio.app/Contents/MacOS/studio | |
Identifier: com.google.android.studio | |
Version: 1.4 (AI-141.2288178) | |
Code Type: X86-64 (Native) | |
Parent Process: ??? [1] | |
Responsible: studio [54843] | |
User ID: 501 | |
Date/Time: 2015-10-07 11:28:52.666 +0800 |
public static void copy(Object from, Object to) { | |
Field[] fromFields = from.getClass().getDeclaredFields(); | |
Field[] toFields = to.getClass().getDeclaredFields(); | |
Class toClass = to.getClass(); | |
Set<String> toFieldSet = Stream.of(toFields).map(Field::getName).collect(Collectors.toSet()); | |
for (Field fromField : fromFields) { | |
// 判断来源属性中是否含有目标属性 | |
if (toFieldSet.contains(fromField.getName())) { |
/** | |
* Created by twiceYuan on 8/17/15. | |
* <p> | |
* Log 的简化方法集 | |
* 用途:省略 TAG,默认使用调用该方法的代码所在的类名作为 TAG | |
*/ | |
public final class Logger { | |
private Logger() { | |
} |
通知发出的 Intent 设置 Flag:
Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP
重写 Activity 中的 onNewIntent(Intent newintent)
方法
public class Configs { | |
private static final String sName = "settings"; | |
public enum Key { | |
// 这里放置设置项的 Key | |
} | |
public static Set<String> getSetting(Key key, Set<String> defaultValue) { | |
SharedPreferences preferences = App.getInstance().getSharedPreferences(sName, Context.MODE_PRIVATE); |
//GET | |
+(void) checkLoginWithUsername:(NSString*)username andPassword:(NSString*)password InBackground:(void(^)(BOOL success)) completionHandler{ | |
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; | |
NSDictionary *para = [NSDictionary dictionaryWithObjectsAndKeys:username, @"email", password, @"password", nil]; | |
[manager setRequestSerializer:[AFHTTPRequestSerializer serializer]]; | |
[manager.requestSerializer setAuthorizationHeaderFieldWithUsername:@"admin" password:@"admin"]; | |
manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"]; | |
[manager GET:@"http://lottofy.gleblu.com/ws/login.php" parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
if ([[responseObject objectForKey:@"success"] doubleValue] == 0) { | |
completionHandler(NO); |
/** | |
* 转换 View 为 Bitmap | |
*/ | |
public static Bitmap viewToBitmap(View v) { | |
if (v.getMeasuredHeight() <= 0) { | |
v.measure(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); | |
Bitmap b = Bitmap.createBitmap(v.getMeasuredWidth(), v.getMeasuredHeight(), Bitmap.Config.ARGB_8888); | |
Canvas c = new Canvas(b); | |
v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); | |
v.draw(c); |
这个是拆机后断了电源,导致时间不对,也就是说现在电脑的时间比U盘制作的时间还早,所以有这样的错误提示。
在终端里面修改时间 请参考下面的代码,按回车键确认:
date 062614102014.30 06是月,26是日,14是时,10是分,2014是年,30是秒 注意:一定要修改为现在的时间,误差不超过1分钟
import android.support.v7.widget.RecyclerView; | |
public abstract class OnVerticalScrollListener extends RecyclerView.OnScrollListener { | |
@Override | |
public final void onScrolled(RecyclerView recyclerView, int dx, int dy) { | |
if (!recyclerView.canScrollVertically(1)) { | |
onScrolledToEnd(); | |
} else if (!recyclerView.canScrollVertically(-1)) { | |
onScrolledToTop(); |