finished sautoscrolling

This commit is contained in:
Senad Uka
2014-01-18 07:38:12 +01:00
parent 084d3cfac3
commit 8037c7007e
5 changed files with 54 additions and 374 deletions

View File

@@ -3,10 +3,13 @@ package com.mhalka.qurantranslationdisplay;
import android.app.Activity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.util.DisplayMetrics;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.TextView;
import com.mhalka.qurantranslationdisplay.util.SystemUiHider;
/**
* An example full-screen activity that shows and hides the system UI (i.e.
@@ -15,6 +18,8 @@ import com.mhalka.qurantranslationdisplay.util.SystemUiHider;
* @see SystemUiHider
*/
public class ShowAyah extends Activity {
private VerticalMarqueeTextView ayah;
@Override
@@ -22,8 +27,25 @@ public class ShowAyah extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_ayah);
final TextView ayah = (TextView) findViewById(R.id.ayah);
ayah = (VerticalMarqueeTextView) findViewById(R.id.ayah);
ayah.setMovementMethod(new ScrollingMovementMethod());
ayah.pauseMarquee();
ayah.setDuration(150);
ayah.setPixelYOffSet(10);
//
// DisplayMetrics dm = getResources().getDisplayMetrics();
//
// TranslateAnimation m_ta = new TranslateAnimation(0f,0f, dm.heightPixels, -1 * (dm.heightPixels));
//
// m_ta.setDuration(10000);
// m_ta.setInterpolator(new LinearInterpolator());
// m_ta.setRepeatCount(Animation.INFINITE);
//
//
// ayah.startAnimation(m_ta);
// Example of use of QuranReader
// AssetManager assetManager = getAssets();
@@ -31,4 +53,30 @@ public class ShowAyah extends Activity {
// reader.setChapter(2);
// String verseText = reader.getVerse(16);
}
@Override
protected void onResume() {
// Start or restart the Marquee if paused.
if (ayah.isPaused()) {
ayah.resumeMarquee();
}
super.onResume();
}
@Override
protected void onPause() {
// Pause the Marquee when the Activity pauses.
ayah.pauseMarquee();
super.onPause();
}
@Override
protected void onDestroy() {
ayah.stopMarquee();
super.onDestroy();
}
}