1
0
Fork 1

rework AppIntro a bit and add skip button

This commit is contained in:
Christian Schneppe 2020-07-10 10:27:18 +02:00
parent 983f0448f6
commit b66bdad078

View file

@ -6,15 +6,15 @@ import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.github.paolorotolo.appintro.AppIntro;
import com.github.paolorotolo.appintro.AppIntroFragment;
import com.github.paolorotolo.appintro.model.SliderPage;
import com.github.appintro.AppIntro2;
import com.github.appintro.AppIntroFragment;
import com.github.appintro.model.SliderPage;
import eu.siacs.conversations.R;
import static eu.siacs.conversations.ui.util.IntroHelper.SaveIntroShown;
public class IntroActivity extends AppIntro {
public class IntroActivity extends AppIntro2 {
public static final String ACTIVITY = "activity";
public static final String MULTICHAT = "multi_chat";
public static final String START_UI = "StartUI";
@ -34,11 +34,10 @@ public class IntroActivity extends AppIntro {
final int barColor = getResources().getColor(R.color.primary);
setBarColor(barColor);
setProgressButtonEnabled(true);
showSkipButton(false);
setBackButtonVisibilityWithDone(true);
setGoBackLock(true);
setFadeAnimation();
setButtonsEnabled(true);
setImmersiveMode();
setSystemBackButtonLocked(true);
setProgressIndicator();
final Intent intent = getIntent();
if (intent != null) {
@ -54,14 +53,14 @@ public class IntroActivity extends AppIntro {
welcome.setTitle(getString(R.string.welcome_header));
welcome.setDescription(getString(R.string.intro_desc_main));
welcome.setImageDrawable(R.drawable.main_logo);
welcome.setBgColor(backgroundColor);
welcome.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(welcome));
SliderPage privacy = new SliderPage();
privacy.setTitle(getString(R.string.intro_privacy));
privacy.setDescription(getString(R.string.intro_desc_privacy));
privacy.setImageDrawable(R.drawable.intro_security_icon);
privacy.setBgColor(backgroundColor);
privacy.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(privacy));
@ -69,28 +68,28 @@ public class IntroActivity extends AppIntro {
xmpp.setTitle(getString(R.string.intro_whats_xmpp));
xmpp.setDescription(getString(R.string.intro_desc_whats_xmpp));
xmpp.setImageDrawable(R.drawable.intro_xmpp_icon);
xmpp.setBgColor(backgroundColor);
xmpp.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(xmpp));
SliderPage permissions = new SliderPage();
permissions.setTitle(getString(R.string.intro_required_permissions));
permissions.setDescription(getString(R.string.intro_desc_required_permissions));
permissions.setImageDrawable(R.drawable.intro_memory_icon);
permissions.setBgColor(backgroundColor);
permissions.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(permissions));
SliderPage permissions2 = new SliderPage();
permissions2.setTitle(getString(R.string.intro_optional_permissions));
permissions2.setDescription(getString(R.string.intro_desc_optional_permissions));
permissions2.setImageDrawable(R.drawable.intro_contacts_icon);
permissions2.setBgColor(backgroundColor);
permissions2.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(permissions2));
SliderPage permissions3 = new SliderPage();
permissions3.setTitle(getString(R.string.intro_optional_permissions));
permissions3.setDescription(getString(R.string.intro_desc_optional_permissions2));
permissions3.setImageDrawable(R.drawable.intro_location_icon);
permissions3.setBgColor(backgroundColor);
permissions3.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(permissions3));
break;
case WELCOME_ACTIVITY:
@ -98,21 +97,21 @@ public class IntroActivity extends AppIntro {
account.setTitle(getString(R.string.intro_account));
account.setDescription(getString(R.string.intro_desc_account));
account.setImageDrawable(R.drawable.intro_account_icon);
account.setBgColor(backgroundColor);
account.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(account));
SliderPage account2 = new SliderPage();
account2.setTitle(getString(R.string.intro_account));
account2.setDescription(getString(R.string.intro_desc_account2));
account2.setImageDrawable(R.drawable.intro_account_icon);
account2.setBgColor(backgroundColor);
account2.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(account2));
SliderPage account3 = new SliderPage();
account3.setTitle(getString(R.string.intro_account));
account3.setDescription(getString(R.string.intro_desc_account3));
account3.setImageDrawable(R.drawable.intro_account_icon);
account3.setBgColor(backgroundColor);
account3.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(account3));
break;
case START_CONVERSATION_ACTIVITY:
@ -120,21 +119,21 @@ public class IntroActivity extends AppIntro {
startChatting.setTitle(getString(R.string.intro_start_chatting));
startChatting.setDescription(getString(R.string.intro_desc_start_chatting));
startChatting.setImageDrawable(R.drawable.intro_start_chat_icon);
startChatting.setBgColor(backgroundColor);
startChatting.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(startChatting));
SliderPage startChatting2 = new SliderPage();
startChatting2.setTitle(getString(R.string.intro_start_chatting));
startChatting2.setDescription(getString(R.string.intro_desc_start_chatting2));
startChatting2.setImageDrawable(R.drawable.intro_start_chat_icon);
startChatting2.setBgColor(backgroundColor);
startChatting2.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(startChatting2));
SliderPage startChatting3 = new SliderPage();
startChatting3.setTitle(getString(R.string.intro_start_chatting));
startChatting3.setDescription(getString(R.string.intro_desc_start_chatting3));
startChatting3.setImageDrawable(R.drawable.intro_start_chat_icon);
startChatting3.setBgColor(backgroundColor);
startChatting3.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(startChatting3));
break;
case CONVERSATIONS_ACTIVITY:
@ -142,14 +141,14 @@ public class IntroActivity extends AppIntro {
openChat.setTitle(getString(R.string.intro_start_chatting));
openChat.setDescription(getString(R.string.intro_desc_open_chat));
openChat.setImageDrawable(R.drawable.intro_start_chat_icon);
openChat.setBgColor(backgroundColor);
openChat.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(openChat));
SliderPage chatDetails = new SliderPage();
chatDetails.setTitle(getString(R.string.intro_chat_details));
chatDetails.setDescription(getString(R.string.intro_desc_chat_details));
chatDetails.setImageDrawable(R.drawable.intro_account_details_icon);
chatDetails.setBgColor(backgroundColor);
chatDetails.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(chatDetails));
if (mode_multi) {
@ -157,7 +156,7 @@ public class IntroActivity extends AppIntro {
highlightUser.setTitle(getString(R.string.intro_highlight_user));
highlightUser.setDescription(getString(R.string.intro_desc_highlight_user));
highlightUser.setImageDrawable(R.drawable.intro_account_details_icon);
highlightUser.setBgColor(backgroundColor);
highlightUser.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(highlightUser));
}
break;
@ -167,7 +166,7 @@ public class IntroActivity extends AppIntro {
openChatDetails.setTitle(getString(R.string.intro_chat_details));
openChatDetails.setDescription(getString(R.string.intro_desc_open_chat_details));
openChatDetails.setImageDrawable(R.drawable.intro_account_details_icon);
openChatDetails.setBgColor(backgroundColor);
openChatDetails.setBackgroundColor(backgroundColor);
addSlide(AppIntroFragment.newInstance(openChatDetails));
}
}