" +
- "
/*
" +
- " * The MIT License (MIT)
" +
- " *
" +
- " * Copyright (c) 2014 Pkmmte Xeleon
" +
- " *
" +
- " * Permission is hereby granted, free of charge, to any person obtaining a copy
" +
- " * of this software and associated documentation files (the \"Software\"), to deal
" +
- " * in the Software without restriction, including without limitation the rights
" +
- " * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
" +
- " * copies of the Software, and to permit persons to whom the Software is
" +
- " * furnished to do so, subject to the following conditions:" +
- " *
" +
- " * The above copyright notice and this permission notice shall be included in
" +
- " * all copies or substantial portions of the Software.
" +
- " * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" +
- " * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" +
- " * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" +
- " * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" +
- " * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
" +
- " * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
" +
- " * THE SOFTWARE.
" +
- " */ " +
- "
" +
@@ -268,12 +264,37 @@ public boolean onPreferenceClick(Preference arg0) {
" */ " +
"
" +
+ "
/*
" +
+ " * This file is part of the RootTools Project: http://code.google.com/p/roottools/
" +
+ " *
" +
+ " * Copyright (c) 2012 Stephen Erickson, Chris Ravenscroft, Dominik Schuermann, Adam Shanks
" +
+ " *
" +
+ " * This code is dual-licensed under the terms of the Apache License Version 2.0 and
" +
+ " * the terms of the General Public License (GPL) Version 2.
" +
+ " * You may use this code according to either of these licenses as is most appropriate
" +
+ " * for your project on a case-by-case basis.
" +
+ " *
" +
+ " * The terms of each license can be found in the root directory of this project's repository as well as at:
" +
+ " *
" +
+ " * http://www.apache.org/licenses/LICENSE-2.0
" +
+ " * http://www.gnu.org/licenses/gpl-2.0.txt
" +
+ " *
" +
+ " * Unless required by applicable law or agreed to in writing, software
" +
+ " * distributed under these Licenses is distributed on an \"AS IS\" BASIS,
" +
+ " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
" +
+ " * See each License for the specific language governing permissions and
" +
+ " * limitations under that License.
" +
+ " */ " +
+ "
" +
"
/*
" +
" * The MIT License (MIT)
" +
" *
" +
- " * Copyright (c) 2014 Faiz Malkani
" +
+ " * Copyright (c) 2014 Pkmmte Xeleon
" +
" *
" +
" * Permission is hereby granted, free of charge, to any person obtaining a copy
" +
" * of this software and associated documentation files (the \"Software\"), to deal
" +
@@ -293,11 +314,11 @@ public boolean onPreferenceClick(Preference arg0) {
" * THE SOFTWARE.
" +
" */ " +
"
" +
"
/*
" +
- " * Copyright 2013 Flavien Laurent
" +
+ " * Copyright 2014 Jerzy Chalupski
" +
" *
" +
" * Licensed under the Apache License, Version 2.0 (the \"License\");
" +
" * you may not use this file except in compliance with the License.
" +
diff --git a/src/com/fourmob/poppyview/NotifyingScrollView.java b/src/com/fourmob/poppyview/NotifyingScrollView.java
deleted file mode 100644
index 46bbd8bec8..0000000000
--- a/src/com/fourmob/poppyview/NotifyingScrollView.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.fourmob.poppyview;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.widget.ScrollView;
-
-/**
- * @author Cyril Mottier
- */
-public class NotifyingScrollView extends ScrollView {
-
- /**
- * @author Cyril Mottier
- */
- public interface OnScrollChangedListener {
- void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt);
- }
-
- private OnScrollChangedListener mOnScrollChangedListener;
-
- public NotifyingScrollView(Context context) {
- super(context);
- }
-
- public NotifyingScrollView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public NotifyingScrollView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- @Override
- protected void onScrollChanged(int l, int t, int oldl, int oldt) {
- super.onScrollChanged(l, t, oldl, oldt);
- if (mOnScrollChangedListener != null) {
- mOnScrollChangedListener.onScrollChanged(this, l, t, oldl, oldt);
- }
- }
-
- public void setOnScrollChangedListener(OnScrollChangedListener listener) {
- mOnScrollChangedListener = listener;
- }
-
-}
\ No newline at end of file
diff --git a/src/com/fourmob/poppyview/PoppyViewHelper.java b/src/com/fourmob/poppyview/PoppyViewHelper.java
deleted file mode 100644
index 783449d4fe..0000000000
--- a/src/com/fourmob/poppyview/PoppyViewHelper.java
+++ /dev/null
@@ -1,237 +0,0 @@
-package com.fourmob.poppyview;
-
-import android.app.Activity;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewGroup.LayoutParams;
-import android.view.ViewParent;
-import android.widget.AbsListView;
-import android.widget.AbsListView.OnScrollListener;
-import android.widget.FrameLayout;
-import android.widget.GridView;
-import android.widget.ListView;
-import android.widget.ScrollView;
-
-import com.nineoldandroids.view.ViewPropertyAnimator;
-
-
-public class PoppyViewHelper {
-
- public enum PoppyViewPosition {
- TOP, BOTTOM
- };
-
- private static final int SCROLL_TO_TOP = - 1;
-
- private static final int SCROLL_TO_BOTTOM = 1;
-
- private static final int SCROLL_DIRECTION_CHANGE_THRESHOLD = 5;
-
- private Activity mActivity;
-
- private LayoutInflater mLayoutInflater;
-
- private View mPoppyView;
-
- private int mScrollDirection = 0;
-
- private int mPoppyViewHeight = - 1;
-
- private PoppyViewPosition mPoppyViewPosition;
-
- public PoppyViewHelper(Activity activity, PoppyViewPosition position) {
- mActivity = activity;
- mLayoutInflater = LayoutInflater.from(activity);
- mPoppyViewPosition = position;
- }
-
- public PoppyViewHelper(Activity activity) {
- this(activity, PoppyViewPosition.BOTTOM);
- }
-
- // for scrollview
-
- public View createPoppyViewOnScrollView(int scrollViewId, int poppyViewResId) {
- mPoppyView = mLayoutInflater.inflate(poppyViewResId, null);
- final NotifyingScrollView scrollView = (NotifyingScrollView)mActivity.findViewById(scrollViewId);
- initPoppyViewOnScrollView(scrollView);
- return mPoppyView;
- }
-
-
- // for ListView
-
- public View createPoppyViewOnGridView(int listViewId, int poppyViewResId, OnScrollListener onScrollListener) {
- final GridView listView = (GridView)mActivity.findViewById(listViewId);
-
- mPoppyView = mLayoutInflater.inflate(poppyViewResId, null);
- initPoppyViewOnGridView(listView, onScrollListener);
- return mPoppyView;
- }
- public View createPoppyViewOnListView(int listViewId, int poppyViewResId, OnScrollListener onScrollListener) {
- final ListView listView = (ListView)mActivity.findViewById(listViewId);
- if(listView.getHeaderViewsCount() != 0) {
- throw new IllegalArgumentException("use createPoppyViewOnListView with headerResId parameter");
- }
- if(listView.getFooterViewsCount() != 0) {
- throw new IllegalArgumentException("poppyview library doesn't support listview with footer");
- }
- mPoppyView = mLayoutInflater.inflate(poppyViewResId, null);
- initPoppyViewOnListView(listView, onScrollListener);
- return mPoppyView;
- }
-
- public View createPoppyViewOnListView(int listViewId, int poppyViewResId) {
- return createPoppyViewOnListView(listViewId, poppyViewResId, null);
- }
-
-
- // common
-
- private void setPoppyViewOnView(View view) {
- LayoutParams lp = view.getLayoutParams();
- ViewParent parent = view.getParent();
- ViewGroup group = (ViewGroup)parent;
- int index = group.indexOfChild(view);
- final FrameLayout newContainer = new FrameLayout(mActivity);
- group.removeView(view);
- group.addView(newContainer, index, lp);
- newContainer.addView(view);
- final FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
- layoutParams.gravity = mPoppyViewPosition == PoppyViewPosition.BOTTOM ? Gravity.BOTTOM : Gravity.TOP;
- newContainer.addView(mPoppyView, layoutParams);
- group.invalidate();
- }
-
- private void onScrollPositionChanged(int oldScrollPosition, int newScrollPosition) {
- int newScrollDirection;
-
- // System.out.println(oldScrollPosition + " ->" + newScrollPosition);
-
- if(newScrollPosition < oldScrollPosition) {
- newScrollDirection = SCROLL_TO_TOP;
- } else {
- newScrollDirection = SCROLL_TO_BOTTOM;
- }
-
- if(newScrollDirection != mScrollDirection) {
- mScrollDirection = newScrollDirection;
- translateYPoppyView();
- }
- }
-
- private void translateYPoppyView() {
- mPoppyView.post(new Runnable() {
-
- @Override
- public void run() {
- if(mPoppyViewHeight <= 0) {
- mPoppyViewHeight = mPoppyView.getHeight();
- }
-
- int translationY = 0;
- switch (mPoppyViewPosition) {
- case BOTTOM:
- translationY = mScrollDirection == SCROLL_TO_TOP ? 0 : mPoppyViewHeight;
- break;
- case TOP:
- translationY = mScrollDirection == SCROLL_TO_BOTTOM ? -mPoppyViewHeight : 0;
- break;
- }
-
- ViewPropertyAnimator.animate(mPoppyView).setDuration(300).translationY(translationY);
- }
- });
- }
-
- // for ScrollView
-
- private void initPoppyViewOnScrollView(NotifyingScrollView scrollView) {
- setPoppyViewOnView(scrollView);
- scrollView.setOnScrollChangedListener(new NotifyingScrollView.OnScrollChangedListener() {
-
- int mScrollPosition;
-
- public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) {
- if(Math.abs(t - mScrollPosition) >= SCROLL_DIRECTION_CHANGE_THRESHOLD) {
- onScrollPositionChanged(mScrollPosition, t);
- }
-
- mScrollPosition = t;
- }
- });
- }
-
- // for ListView
- private void initPoppyViewOnGridView(GridView listView, final OnScrollListener onScrollListener) {
- setPoppyViewOnView(listView);
- listView.setOnScrollListener(new OnScrollListener() {
-
- int mScrollPosition;
-
- @Override
- public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
- if(onScrollListener != null) {
- onScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
- }
- View topChild = view.getChildAt(0);
-
- int newScrollPosition = 0;
- if(topChild == null) {
- newScrollPosition = 0;
- } else {
- newScrollPosition = - topChild.getTop() + view.getFirstVisiblePosition() * topChild.getHeight();
- }
-
- if(Math.abs(newScrollPosition - mScrollPosition) >= SCROLL_DIRECTION_CHANGE_THRESHOLD) {
- onScrollPositionChanged(mScrollPosition, newScrollPosition);
- }
-
- mScrollPosition = newScrollPosition;
- }
- @Override
- public void onScrollStateChanged(AbsListView view, int scrollState) {
- if(onScrollListener != null) {
- onScrollListener.onScrollStateChanged(view, scrollState);
- }
- }
- });
- }
- private void initPoppyViewOnListView(ListView listView, final OnScrollListener onScrollListener) {
- setPoppyViewOnView(listView);
- listView.setOnScrollListener(new OnScrollListener() {
-
- int mScrollPosition;
-
- @Override
- public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
- if(onScrollListener != null) {
- onScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
- }
- View topChild = view.getChildAt(0);
-
- int newScrollPosition = 0;
- if(topChild == null) {
- newScrollPosition = 0;
- } else {
- newScrollPosition = - topChild.getTop() + view.getFirstVisiblePosition() * topChild.getHeight();
- }
-
- if(Math.abs(newScrollPosition - mScrollPosition) >= SCROLL_DIRECTION_CHANGE_THRESHOLD) {
- onScrollPositionChanged(mScrollPosition, newScrollPosition);
- }
-
- mScrollPosition = newScrollPosition;
- }
-
- @Override
- public void onScrollStateChanged(AbsListView view, int scrollState) {
- if(onScrollListener != null) {
- onScrollListener.onScrollStateChanged(view, scrollState);
- }
- }
- });
- }
-}