This file contains hidden or 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
| /* | |
| * Copyright 2015 Realm Inc. | |
| * | |
| * 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 |
This file contains hidden or 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
| package com.brucetoo.realmdemo.realmmigration; | |
| import android.app.Application; | |
| import android.util.Log; | |
| import io.realm.Realm; | |
| import io.realm.RealmConfiguration; | |
| import io.realm.RealmMigration; | |
| import io.realm.RealmObject; | |
| import io.realm.internal.ColumnType; |
This file contains hidden or 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
| private int dp2px(float dpVal) { | |
| return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, | |
| dpVal, getResources().getDisplayMetrics()); | |
| } | |
| private int sp2px(float dpVal) { | |
| return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, | |
| dpVal, getResources().getDisplayMetrics()); | |
| } |
This file contains hidden or 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
| package com.netease.cc.widget.pulltorefresh; | |
| /** | |
| * Created by N1007-tuyong | |
| * On 9/7/15 | |
| * At 14:42 | |
| */ | |
| import android.content.Context; | |
| import android.support.v7.widget.GridLayoutManager; | |
| import android.support.v7.widget.LinearLayoutManager; |
This file contains hidden or 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
| /* | |
| * Copyright (C) 2014 Freddie (Musenkishi) Lust-Hed | |
| * | |
| * 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 |
This file contains hidden or 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
| package com.bruce.materialapp.activity; | |
| import android.os.Bundle; | |
| import android.os.Handler; | |
| import android.os.Message; | |
| import android.support.v4.app.FragmentActivity; | |
| import android.widget.TextView; | |
| import java.lang.ref.WeakReference; |
This file contains hidden or 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
| package com.do1.flowersapp.common; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.view.ViewGroup; | |
| /** | |
| * Created by TuYong N1007 | |
| * On 2015/9/11 | |
| * At 15:08 | |
| * RecyclerView支持Footer和Header |
This file contains hidden or 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
| 特别是在定义了 PageTransformer 来实现Page之间的切换动画 | |
| 会调用到ViewPaper#setScrollState() -> 然后再调用 ViewPager#enableLayers() | |
| 默认就开启了硬件加速,因此在动画执行过程中,会预先执行硬件加速,可能就导致了View动画执行的时候掉帧 | |
| 可以开启 Show HardWare layers updates 来锁定开启硬件加速的View | |
| //以下是解决办法 | |
| @Override | |
| public void onPageScrollStateChanged(int scrollState) { | |
| // A small hack to remove the HW layer that the viewpager add to each page when scrolling. | |
| if (scrollState != ViewPager.SCROLL_STATE_IDLE) { |
This file contains hidden or 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
| 硬件加速分四个等级 | |
| Application Level:<application android:hardwareAccelerated="true" ...> | |
| Activity Level:<application android:hardwareAccelerated="true"> | |
| <activity ... /> | |
| <activity android:hardwareAccelerated="false" /> | |
| </application> | |
| 即使在Application层开启了硬件加速,也可以对单个的Activity选择是否开启硬件加速 | |
| Window Level: getWindow().setFlags( | |
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, | |
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); |
This file contains hidden or 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 org.json.JSONException; | |
| import org.json.JSONObject; | |
| import java.io.File; | |
| import java.io.FileInputStream; | |
| import java.io.FileNotFoundException; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.io.InvalidClassException; |