apps-android-commons/app/src/main/java/fr/free/nrw/commons/WelcomeActivity.java
Mansi Agarwal 430bf90310 Added CDATA tag (#1836)
* Fix issue#1772

Add the CDATA tag to welcome_help_button_text string. Set the text of the corresponding textview using Html.fromHtml() function.

* Fix issue#1772

Add the CDATA tag to nominated_see_more string. Set the text of the corresponding textview using Html.fromHtml() function.
2018-08-31 11:44:36 +03:00

74 lines
2.1 KiB
Java

package fr.free.nrw.commons;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import com.viewpagerindicator.CirclePageIndicator;
import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.quiz.QuizActivity;
import fr.free.nrw.commons.theme.BaseActivity;
public class WelcomeActivity extends BaseActivity {
@BindView(R.id.welcomePager) ViewPager pager;
@BindView(R.id.welcomePagerIndicator) CirclePageIndicator indicator;
private WelcomePagerAdapter adapter = new WelcomePagerAdapter();
private boolean isQuiz;
static String moreInformation;
/**
* Initialises exiting fields and dependencies
*
* @param savedInstanceState WelcomeActivity bundled data
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
moreInformation = this.getString(R.string.welcome_help_button_text);
if(getIntent() != null) {
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
isQuiz = bundle.getBoolean("isQuiz");
}
} else{
isQuiz = false;
}
ButterKnife.bind(this);
pager.setAdapter(adapter);
indicator.setViewPager(pager);
adapter.setCallback(this::finish);
}
/**
* References WelcomePageAdapter to null before the activity is destroyed
*/
@Override
public void onDestroy() {
if(isQuiz){
Intent i = new Intent(WelcomeActivity.this, QuizActivity.class);
startActivity(i);
}
adapter.setCallback(null);
super.onDestroy();
}
/**
* Creates a way to change current activity to WelcomeActivity
*
* @param context Activity context
*/
public static void startYourself(Context context) {
Intent welcomeIntent = new Intent(context, WelcomeActivity.class);
context.startActivity(welcomeIntent);
}
}