Search in sources :

Example 1 with FeaturesWebViewAdapter

use of com.owncloud.android.ui.adapter.FeaturesWebViewAdapter in project android by nextcloud.

the class WhatsNewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.whats_new_activity);
    int fontColor = getResources().getColor(R.color.login_text_color);
    mProgress = findViewById(R.id.progressIndicator);
    mPager = findViewById(R.id.contentPanel);
    String[] urls = getResources().getStringArray(R.array.whatsnew_urls);
    boolean showWebView = urls.length > 0;
    if (showWebView) {
        FeaturesWebViewAdapter featuresWebViewAdapter = new FeaturesWebViewAdapter(getSupportFragmentManager(), urls);
        mProgress.setNumberOfSteps(featuresWebViewAdapter.getCount());
        mPager.setAdapter(featuresWebViewAdapter);
    } else {
        FeaturesViewAdapter featuresViewAdapter = new FeaturesViewAdapter(getSupportFragmentManager(), onboarding.getWhatsNew());
        mProgress.setNumberOfSteps(featuresViewAdapter.getCount());
        mPager.setAdapter(featuresViewAdapter);
    }
    mPager.addOnPageChangeListener(this);
    mForwardFinishButton = findViewById(R.id.forward);
    ThemeButtonUtils.colorImageButton(mForwardFinishButton, fontColor);
    mForwardFinishButton.setOnClickListener(view -> {
        if (mProgress.hasNextStep()) {
            mPager.setCurrentItem(mPager.getCurrentItem() + 1, true);
            mProgress.animateToStep(mPager.getCurrentItem() + 1);
        } else {
            onFinish();
            finish();
        }
        updateNextButtonIfNeeded();
    });
    mForwardFinishButton.setBackground(null);
    mSkipButton = findViewById(R.id.skip);
    mSkipButton.setTextColor(fontColor);
    mSkipButton.setOnClickListener(view -> {
        onFinish();
        finish();
    });
    TextView tv = findViewById(R.id.welcomeText);
    if (showWebView) {
        tv.setText(R.string.app_name);
    } else {
        tv.setText(String.format(getString(R.string.whats_new_title), appInfo.getVersionName()));
    }
    updateNextButtonIfNeeded();
}
Also used : FeaturesViewAdapter(com.owncloud.android.ui.adapter.FeaturesViewAdapter) FeaturesWebViewAdapter(com.owncloud.android.ui.adapter.FeaturesWebViewAdapter) TextView(android.widget.TextView)

Aggregations

TextView (android.widget.TextView)1 FeaturesViewAdapter (com.owncloud.android.ui.adapter.FeaturesViewAdapter)1 FeaturesWebViewAdapter (com.owncloud.android.ui.adapter.FeaturesWebViewAdapter)1