mirror of
https://github.com/Tencent/QMUI_Android.git
synced 2026-10-29 03:26:44 +08:00
@@ -40,7 +40,7 @@ import javax.tools.Diagnostic;
|
||||
@AutoService(Processor.class)
|
||||
public class WidgetProcessor extends AbstractProcessor {
|
||||
private Filer mFiler; //文件相关的辅助类
|
||||
private Elements mElementUtils; //元素相关的辅助类
|
||||
@SuppressWarnings("FieldCanBeLocal") private Elements mElementUtils; //元素相关的辅助类
|
||||
private Messager mMessager; //日志相关的辅助类
|
||||
private boolean mIsFileCreated = false;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# suppress inspection "UnusedProperty" for whole file
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
|
||||
@@ -8,4 +8,5 @@
|
||||
<issue id="Deprecated" severity="warning">
|
||||
<ignore regexp="singleLine"/>
|
||||
</issue>
|
||||
<issue id="RtlSymmetry" severity="ignore"/>
|
||||
</lint>
|
||||
|
||||
@@ -246,6 +246,10 @@ public class QMUIStatusBarHelper {
|
||||
* @return boolean 成功执行返回true
|
||||
*/
|
||||
public static boolean FlymeSetStatusBarLightMode(Window window, boolean dark) {
|
||||
|
||||
// flyme 在 6.2.0.0A 支持了 Android 官方的实现方案,旧的方案失效
|
||||
Android6SetStatusBarLightMode(window, dark);
|
||||
|
||||
boolean result = false;
|
||||
if (window != null) {
|
||||
try {
|
||||
|
||||
+4
-4
@@ -104,7 +104,7 @@ public class QMUIPullRefreshLayout extends ViewGroup implements NestedScrollingP
|
||||
private float mInitialDownX;
|
||||
@SuppressWarnings("FieldCanBeLocal") private float mInitialMotionY;
|
||||
private float mLastMotionY;
|
||||
private float mDragRate = 0.65f;
|
||||
@SuppressWarnings("FieldCanBeLocal") private float mDragRate = 0.65f;
|
||||
private RefreshOffsetCalculator mRefreshOffsetCalculator;
|
||||
private VelocityTracker mVelocityTracker;
|
||||
private float mMaxVelocity;
|
||||
@@ -405,12 +405,12 @@ public class QMUIPullRefreshLayout extends ViewGroup implements NestedScrollingP
|
||||
startDragging(x, y);
|
||||
|
||||
if (mIsDragging) {
|
||||
float dy = y - mLastMotionY;
|
||||
float dy = (y - mLastMotionY) * mDragRate;
|
||||
if (dy >= 0) {
|
||||
moveTargetView(dy, true);
|
||||
} else {
|
||||
int move = moveTargetView(dy, true);
|
||||
float delta = Math.abs(dy * mDragRate) - Math.abs(move);
|
||||
float delta = Math.abs(dy) - Math.abs(move);
|
||||
if (delta > 0) {
|
||||
// 重新dispatch一次down事件,使得列表可以继续滚动
|
||||
ev.setAction(MotionEvent.ACTION_DOWN);
|
||||
@@ -719,7 +719,7 @@ public class QMUIPullRefreshLayout extends ViewGroup implements NestedScrollingP
|
||||
}
|
||||
|
||||
private int moveTargetView(float dy, boolean isDragging) {
|
||||
int target = (int) (mTargetCurrentOffset + dy * mDragRate);
|
||||
int target = (int) (mTargetCurrentOffset + dy);
|
||||
return moveTargetViewTo(target, isDragging);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 216 B |
@@ -57,7 +57,7 @@ configurations.all {
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile project(':qmuilint')
|
||||
// compile 'com.qmuiteam:qmuilint:0.0.2'
|
||||
// compile 'com.qmuiteam:qmuilint:1.0.0'
|
||||
compile "com.android.support:appcompat-v7:$supportVersion"
|
||||
compile 'com.jakewharton:butterknife:8.4.0'
|
||||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
|
||||
|
||||
@@ -49,6 +49,12 @@ public abstract class BaseFragment extends Fragment {
|
||||
return !isRemoving() && mBaseView != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
mBaseView = null;
|
||||
}
|
||||
|
||||
protected void startFragment(BaseFragment fragment) {
|
||||
BaseFragmentActivity baseFragmentActivity = this.getBaseFragmentActivity();
|
||||
if (baseFragmentActivity != null) {
|
||||
@@ -109,6 +115,7 @@ public abstract class BaseFragment extends Fragment {
|
||||
if (mBaseView.getParent() != null) {
|
||||
((ViewGroup) mBaseView.getParent()).removeView(mBaseView);
|
||||
}
|
||||
getBaseFragmentActivity().clearDisappearInfo(mBaseView);
|
||||
return mBaseView;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,23 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 基础的 Activity,配合 {@link BaseFragment} 使用。
|
||||
* Created by cgspine on 15/9/14.
|
||||
*/
|
||||
public abstract class BaseFragmentActivity extends AppCompatActivity {
|
||||
private static final String TAG = "BaseFragmentActivity";
|
||||
private FrameLayout mFragmentContainer;
|
||||
|
||||
@SuppressWarnings("SameReturnValue")
|
||||
protected abstract int getContextViewId();
|
||||
@@ -21,14 +29,39 @@ public abstract class BaseFragmentActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
QMUIStatusBarHelper.translucent(this);
|
||||
FrameLayout layout = new FrameLayout(this);
|
||||
layout.setId(getContextViewId());
|
||||
setContentView(layout);
|
||||
mFragmentContainer = new FrameLayout(this);
|
||||
mFragmentContainer.setId(getContextViewId());
|
||||
setContentView(mFragmentContainer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
popBackStack();
|
||||
BaseFragment fragment = getCurrentFragment();
|
||||
if (fragment != null) {
|
||||
popBackStack();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("TryWithIdenticalCatches")
|
||||
public void clearDisappearInfo(View view) {
|
||||
if (view != null) {
|
||||
try {
|
||||
Field field = ViewGroup.class.getDeclaredField("mDisappearingChildren");
|
||||
field.setAccessible(true);
|
||||
Object o = field.get(mFragmentContainer);
|
||||
if(o != null && o instanceof ArrayList){
|
||||
ArrayList disappearingChildren = (ArrayList) o;
|
||||
if (disappearingChildren.contains(view)) {
|
||||
Log.i(TAG, "ViewGroup.mDisappearingChildren contain the targetView");
|
||||
disappearingChildren.remove(view);
|
||||
}
|
||||
}
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,6 +72,7 @@ public abstract class BaseFragmentActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
public void startFragment(BaseFragment fragment) {
|
||||
Log.i(TAG, "startFragment");
|
||||
BaseFragment.TransitionConfig transitionConfig = fragment.onFetchTransitionConfig();
|
||||
String tagName = fragment.getClass().getSimpleName();
|
||||
getSupportFragmentManager()
|
||||
@@ -53,6 +87,7 @@ public abstract class BaseFragmentActivity extends AppCompatActivity {
|
||||
* 退出当前的 Fragment。
|
||||
*/
|
||||
public void popBackStack() {
|
||||
Log.i(TAG, "popBackStack: getSupportFragmentManager().getBackStackEntryCount() = " + getSupportFragmentManager().getBackStackEntryCount());
|
||||
if (getSupportFragmentManager().getBackStackEntryCount() <= 1) {
|
||||
BaseFragment fragment = getCurrentFragment();
|
||||
if (fragment == null) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.qmuiteam.qmui.QMUILog;
|
||||
import com.qmuiteam.qmui.util.QMUIPackageHelper;
|
||||
import com.qmuiteam.qmui.widget.QMUITopBar;
|
||||
import com.qmuiteam.qmui.widget.grouplist.QMUIGroupListView;
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ public class QDProgressBarFragment extends BaseFragment {
|
||||
private WeakReference<QMUIProgressBar> weakRectProgressBar;
|
||||
private WeakReference<QMUIProgressBar> weakCircleProgressBar;
|
||||
|
||||
public void setProgressBar(QMUIProgressBar rectProgressBar, QMUIProgressBar circleProgressBar) {
|
||||
void setProgressBar(QMUIProgressBar rectProgressBar, QMUIProgressBar circleProgressBar) {
|
||||
weakRectProgressBar = new WeakReference<>(rectProgressBar);
|
||||
weakCircleProgressBar = new WeakReference<>(circleProgressBar);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
group = 'com.qmuiteam'
|
||||
version = "0.0.2" // QMUI Lint 发布到 bintray 的版本号
|
||||
version = "1.0.0" // QMUI Lint 发布到 bintray 的版本号
|
||||
|
||||
android {
|
||||
compileSdkVersion project.ext.compileSdkVersion
|
||||
|
||||
@@ -4,7 +4,7 @@ project.name=qmuilint
|
||||
project.groupId=group
|
||||
project.artifactId=qmuilint
|
||||
project.packaging=aar
|
||||
project.repo=qmuilintrepo
|
||||
project.repo=qmuirepo
|
||||
project.siteUrl=http://qmuiteam.com/android/page/index.html
|
||||
project.gitUrl=https://github.com/QMUI/QMUI_Android
|
||||
|
||||
|
||||
Reference in New Issue
Block a user