parent
1173b67049
commit
c78297d6b4
|
@ -7,13 +7,12 @@ dependencies {
|
|||
compile 'com.android.support:support-v4:21.0.2'
|
||||
compile 'com.android.support:appcompat-v7:21.0.2'
|
||||
compile 'org.apache.commons:commons-lang3:3.3.2'
|
||||
compile('org.shredzone.flattr4j:flattr4j-core:2.10') {
|
||||
compile('org.shredzone.flattr4j:flattr4j-core:2.11') {
|
||||
exclude group: 'org.apache.httpcomponents', module: 'httpcore'
|
||||
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
|
||||
exclude group: 'org.json', module: 'json'
|
||||
}
|
||||
compile 'commons-io:commons-io:2.4'
|
||||
compile 'com.nineoldandroids:library:2.4.0'
|
||||
compile project('dslv:library')
|
||||
compile 'com.jayway.android.robotium:robotium-solo:5.2.1'
|
||||
compile 'org.jsoup:jsoup:1.7.3'
|
||||
|
|
|
@ -49,9 +49,6 @@
|
|||
</div>
|
||||
<h1>Used libraries</h1>
|
||||
|
||||
<h2>NineOldAndroids <a href="http://nineoldandroids.com">(Link)</a></h2>
|
||||
by Jake Wharton, licensed under the Apache 2.0 license <a href="LICENSE_NINE_OLD_ANDROIDS.txt">(View)</a>
|
||||
|
||||
<h2>Apache Commons <a href="http://commons.apache.org/">(Link)</a></h2>
|
||||
by The Apache Software Foundation, licensed under the Apache 2.0 license <a
|
||||
href="LICENSE_APACHE_COMMONS.txt">(View)</a>
|
||||
|
@ -65,12 +62,9 @@ licensed under the Apache 2.0 license <a href="LICENSE_DSLV.txt">(View)</a>
|
|||
<h2>Presto Client <a href="http://www.aocate.com/presto/">(Link)</a></h2>
|
||||
licensed under the Apache 2.0 license <a href="LICENSE_PRESTO.txt">(View)</a>
|
||||
|
||||
<h2>Better Pickers <a href="https://github.com/derekbrameyer/android-betterpickers">(Link)</a></h2>
|
||||
licensed under the Apache 2.0 license <a href="LICENSE_BETTERPICKERS.txt">(View)</a>
|
||||
|
||||
<h2>jsoup <a href="http://jsoup.org/">(Link)</a></h2>
|
||||
licensed under the MIT license <a href="LICENSE_JSOUP.txt">(View)</a>
|
||||
</body>
|
||||
|
||||
<h2>Picasso <a href="https://github.com/square/picasso">(Link)</a></h2>
|
||||
licensed under the Apache 2.0 license <a href="LICENSE_PICASSO.txt">(View)</a>
|
||||
|
||||
|
@ -83,4 +77,5 @@ licensed under the Apache 2.0 license <a href="LICENSE_OKIO.txt">(View)</a>
|
|||
<h2>Material Design Icons <a href="https://github.com/google/material-design-icons">(Link)</a></h2>
|
||||
by Google, licensed under an Attribution-ShareAlike 4.0 International license <a href="LICENSE_MATERIAL_DESIGN_ICONS.txt">(View)</a>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.0.0-rc1'
|
||||
classpath 'com.android.tools.build:gradle:1.0.0-rc4'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
|
@ -34,13 +34,12 @@ dependencies {
|
|||
compile 'com.android.support:appcompat-v7:21.0.2'
|
||||
compile 'com.android.support:support-v4:21.0.2'
|
||||
compile 'org.apache.commons:commons-lang3:3.3.2'
|
||||
compile ('org.shredzone.flattr4j:flattr4j-core:2.10') {
|
||||
compile ('org.shredzone.flattr4j:flattr4j-core:2.11') {
|
||||
exclude group: 'org.apache.httpcomponents', module: 'httpcore'
|
||||
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
|
||||
exclude group: 'org.json', module: 'json'
|
||||
}
|
||||
compile 'commons-io:commons-io:2.4'
|
||||
compile 'com.nineoldandroids:library:2.4.0'
|
||||
compile 'com.jayway.android.robotium:robotium-solo:5.2.1'
|
||||
compile 'org.jsoup:jsoup:1.7.3'
|
||||
compile 'com.squareup.picasso:picasso:2.4.0'
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012 Roman Nurik
|
||||
*
|
||||
* 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,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package de.danoeh.antennapod.core.util;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.AnimatorListenerAdapter;
|
||||
import com.nineoldandroids.view.ViewHelper;
|
||||
import com.nineoldandroids.view.ViewPropertyAnimator;
|
||||
import de.danoeh.antennapod.core.R;
|
||||
|
||||
import static com.nineoldandroids.view.ViewPropertyAnimator.animate;
|
||||
|
||||
public class UndoBarController {
|
||||
private View mBarView;
|
||||
private TextView mMessageView;
|
||||
private ViewPropertyAnimator mBarAnimator;
|
||||
private Handler mHideHandler = new Handler();
|
||||
|
||||
private UndoListener mUndoListener;
|
||||
|
||||
// State objects
|
||||
private Parcelable mUndoToken;
|
||||
private CharSequence mUndoMessage;
|
||||
|
||||
public interface UndoListener {
|
||||
void onUndo(Parcelable token);
|
||||
}
|
||||
|
||||
public UndoBarController(View undoBarView, UndoListener undoListener) {
|
||||
mBarView = undoBarView;
|
||||
mBarAnimator = animate(mBarView);
|
||||
mUndoListener = undoListener;
|
||||
|
||||
mMessageView = (TextView) mBarView.findViewById(R.id.undobar_message);
|
||||
mBarView.findViewById(R.id.undobar_button)
|
||||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
hideUndoBar(false);
|
||||
mUndoListener.onUndo(mUndoToken);
|
||||
}
|
||||
});
|
||||
|
||||
hideUndoBar(true);
|
||||
}
|
||||
|
||||
public void showUndoBar(boolean immediate, CharSequence message, Parcelable undoToken) {
|
||||
mUndoToken = undoToken;
|
||||
mUndoMessage = message;
|
||||
mMessageView.setText(mUndoMessage);
|
||||
|
||||
mHideHandler.removeCallbacks(mHideRunnable);
|
||||
mHideHandler.postDelayed(mHideRunnable,
|
||||
mBarView.getResources().getInteger(R.integer.undobar_hide_delay));
|
||||
|
||||
mBarView.setVisibility(View.VISIBLE);
|
||||
if (immediate) {
|
||||
ViewHelper.setAlpha(mBarView, 1);
|
||||
} else {
|
||||
mBarAnimator.cancel();
|
||||
mBarAnimator
|
||||
.alpha(1)
|
||||
.setDuration(
|
||||
mBarView.getResources()
|
||||
.getInteger(android.R.integer.config_shortAnimTime))
|
||||
.setListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void hideUndoBar(boolean immediate) {
|
||||
mHideHandler.removeCallbacks(mHideRunnable);
|
||||
if (immediate) {
|
||||
mBarView.setVisibility(View.GONE);
|
||||
ViewHelper.setAlpha(mBarView, 0);
|
||||
mUndoMessage = null;
|
||||
mUndoToken = null;
|
||||
|
||||
} else {
|
||||
mBarAnimator.cancel();
|
||||
mBarAnimator
|
||||
.alpha(0)
|
||||
.setDuration(mBarView.getResources()
|
||||
.getInteger(android.R.integer.config_shortAnimTime))
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mBarView.setVisibility(View.GONE);
|
||||
mUndoMessage = null;
|
||||
mUndoToken = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
outState.putCharSequence("undo_message", mUndoMessage);
|
||||
outState.putParcelable("undo_token", mUndoToken);
|
||||
}
|
||||
|
||||
public void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
if (savedInstanceState != null) {
|
||||
mUndoMessage = savedInstanceState.getCharSequence("undo_message");
|
||||
mUndoToken = savedInstanceState.getParcelable("undo_token");
|
||||
|
||||
if (mUndoToken != null || !TextUtils.isEmpty(mUndoMessage)) {
|
||||
showUndoBar(true, mUndoMessage, mUndoToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Runnable mHideRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
hideUndoBar(false);
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue