-
Notifications
You must be signed in to change notification settings - Fork 966
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #350 from SecUpwN/development
WIP-Release v0.1.25-alpha-build-35
- Loading branch information
Showing
19 changed files
with
772 additions
and
115 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Binary file not shown.
This file contains 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
This file contains 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
133 changes: 133 additions & 0 deletions
133
app/src/main/java/com/SecUpwN/AIMSICD/activities/CreditsRollActivity.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
package com.SecUpwN.AIMSICD.activities; | ||
|
||
/* | ||
* Copyright 2014 Frakbot (Sebastiano Poggi and Francesco Pontillo) | ||
* | ||
* 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.*/ | ||
|
||
/* | ||
Edited by Paul Kinsella paulkinsella29@yahoo.ie | ||
*/ | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.view.animation.LinearInterpolator; | ||
import android.widget.SeekBar; | ||
import android.widget.Toast; | ||
|
||
import com.SecUpwN.AIMSICD.R; | ||
import com.SecUpwN.AIMSICD.fragments.CreditsRollView; | ||
import com.SecUpwN.AIMSICD.utils.MiscUtils; | ||
import com.nineoldandroids.animation.Animator; | ||
import com.nineoldandroids.animation.ObjectAnimator; | ||
import com.nineoldandroids.animation.ValueAnimator; | ||
|
||
//import android.animation.Animator; | ||
//import android.animation.ObjectAnimator; | ||
//import android.animation.ValueAnimator; | ||
|
||
|
||
public class CreditsRollActivity extends Activity implements SeekBar.OnSeekBarChangeListener { | ||
|
||
private static final float SCROLL_ANIM_DURATION = 20000; // [ms] = 30 s | ||
|
||
private CreditsRollView mCreditsRollView; | ||
private boolean mScrolling; | ||
private SeekBar mSeekBar; | ||
private ValueAnimator mScrollAnimator; | ||
|
||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.creditroll); | ||
|
||
mSeekBar = (SeekBar) findViewById(R.id.seekbar); | ||
mSeekBar.setOnSeekBarChangeListener(this); | ||
|
||
mCreditsRollView = (CreditsRollView) findViewById(R.id.creditsroll); | ||
mCreditsRollView.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
if (!mScrolling) { | ||
mCreditsRollView.setText(MiscUtils.setAssetsString(getApplicationContext())); | ||
animateScroll(); | ||
} | ||
else { | ||
stopScrollAnimation(); | ||
} | ||
} | ||
}); | ||
|
||
if (!mScrolling) { | ||
mCreditsRollView.setText(MiscUtils.setAssetsString(getApplicationContext())); | ||
animateScroll(); | ||
} | ||
} | ||
|
||
@Override | ||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { | ||
mCreditsRollView.setScrollPosition(progress / 100000f); // We have increments of 1/100000 % | ||
} | ||
|
||
@Override | ||
public void onStartTrackingTouch(SeekBar seekBar) { | ||
if (mScrolling) { | ||
stopScrollAnimation(); | ||
} | ||
} | ||
|
||
@Override | ||
public void onStopTrackingTouch(SeekBar seekBar) { | ||
// Don't care | ||
} | ||
|
||
private void animateScroll() { | ||
mScrolling = true; | ||
mScrollAnimator = ObjectAnimator.ofInt(mSeekBar, "progress", mSeekBar.getProgress(), mSeekBar.getMax()); | ||
mScrollAnimator.setDuration( | ||
(long) (SCROLL_ANIM_DURATION * (4 - (float) mSeekBar.getProgress() / mSeekBar.getMax()))); | ||
mScrollAnimator.setInterpolator(new LinearInterpolator()); | ||
mScrollAnimator.addListener(new Animator.AnimatorListener() { | ||
@Override | ||
public void onAnimationStart(Animator animation) { | ||
// Don't care | ||
} | ||
|
||
@Override | ||
public void onAnimationEnd(Animator animation) { | ||
mScrolling = false; | ||
} | ||
|
||
@Override | ||
public void onAnimationCancel(Animator animation) { | ||
// Don't care | ||
} | ||
|
||
@Override | ||
public void onAnimationRepeat(Animator animation) { | ||
// Don't care | ||
} | ||
}); | ||
mScrollAnimator.start(); | ||
} | ||
|
||
private void stopScrollAnimation() { | ||
if (mScrollAnimator != null) { | ||
mScrollAnimator.cancel(); | ||
mScrollAnimator = null; | ||
} | ||
} | ||
} | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.