'Using on newer Android Studio old library (or apply effect on text in another way) to do "Star Wars" credits style
I have a newer project on Android Studio (Windows 10) that consists in a "Vader Says" inspired in "Simon Says" (Star Wars version). I have a class that manages scores and does a credits effect moving lines from bottom to top. I have been searching a way to apply the Star Wars credits that moves smaller to horizon and I only found "CreditsRoll" that have about 8 years old so it's impossible to upgrade and use lot of deprecated stuff with the actual gradle. You can check the library here:
https://github.com/frakbot/CreditsRoll
If you need something of my code I'll pleasantly share it.
Any idea of how do the effect if this library or project is too old to apply it on my project?
Thanks in advance and sorry for my english.
PS: I searched a lot in Google before asking, even tried another similar post solutions, but upgrading it's impossible as far as I know (tried commands throw cmd to upgrade but failed due too many deprecated things).
Code for the Scoreboard and the Layout
------CLASS-------
package org.proven.dnf_vader_says;
import android.content.Intent;
import android.graphics.Typeface;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.SoundPool;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.method.ScrollingMovementMethod;
import android.text.style.StyleSpan;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
public class ScoreBoard extends AppCompatActivity{
TextView scoreboard, title;
int scoreBoardSound;
private SoundPool soundPool;
private static final String FILENAME = "scoreboard.txt";
MediaPlayer mMediaPlayer = new MediaPlayer();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.scoreboard);
mMediaPlayer = MediaPlayer.create(this, R.raw.thronethemescore);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setLooping(true);
mMediaPlayer.start();
instantiateElements();
setElementsToListener();
readFile();
}
private void setElementsToListener() {
scoreboard.setOnClickListener(listener);
title.setOnClickListener(listener);
}
private void instantiateElements() {
scoreboard = (TextView) findViewById(R.id.pointslist);
scoreboard.setMovementMethod(new ScrollingMovementMethod());
title = (TextView) findViewById(R.id.title);
}
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View v) {
switch(v.getId()) {
case R.id.pointslist:
screenTapped(v);
break;
case R.id.title:
screenTapped(v);
break;
default:
screenTapped(v);
break;
}
}
};
public void screenTapped(View view){
mMediaPlayer.stop();
Intent backmain = new Intent(ScoreBoard.this, VaderSaysActivity.class);
startActivity(backmain);
}
private void readFile(){
FileInputStream fis = null;
try{
fis = openFileInput(FILENAME);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader bufferedReader = new BufferedReader(isr);
String scoreline;
StringBuilder strBuilder = new StringBuilder();
while ((scoreline = bufferedReader.readLine()) != null){
strBuilder.append(scoreline).append("\n");
}
Animation translatebu = AnimationUtils.loadAnimation(this, R.anim.animationfile);
scoreboard.setText(strBuilder);
scoreboard.startAnimation(translatebu);
scoreboard.setText(strBuilder);
Spannable span = new SpannableString(scoreboard.getText());
span.setSpan(new StyleSpan(Typeface.BOLD), 100, 0, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
scoreboard.setText(span);
}catch (Exception e){
e.printStackTrace();
}finally{
if(fis != null){
try{
fis.close();
}catch (Exception e){
e.printStackTrace();
}
}
}
}
}
------LAYOUT-------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bkgrscoreboard"
android:soundEffectsEnabled="false"
android:onClick="screenTapped">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="50dp"
android:fontFamily="@font/jedifont"
android:soundEffectsEnabled="false"
android:textColor="#d5d900"
android:text="tabla de puntuaciones" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:soundEffectsEnabled="false"
android:src="@drawable/linesaber" />
<TextView
android:id="@+id/pointslist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="14dp"
android:soundEffectsEnabled="false"
android:fontFamily="@font/jedifont"
android:textColor="#fffda6"
android:scrollbars="vertical"
android:text="" />
</LinearLayout>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
