Fixed welcome screen issues

This commit is contained in:
Moez Bhatti
2016-01-06 10:59:53 -05:00
parent bc619f9634
commit eb3e1321c8
3 changed files with 12 additions and 18 deletions
@@ -1,12 +1,14 @@
package com.moez.QKSMS.ui.welcome;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.View;
import com.moez.QKSMS.ui.base.QKFragment;
public class BaseWelcomeFragment extends QKFragment {
public interface WelcomeScrollListener {
public void onScrollOffsetChanged(WelcomeActivity activity, float offset);
void onScrollOffsetChanged(WelcomeActivity activity, float offset);
}
protected static ViewPager mPager;
@@ -20,4 +22,8 @@ public class BaseWelcomeFragment extends QKFragment {
mContext = context;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
// Do nothing
}
}
@@ -1,7 +1,5 @@
package com.moez.QKSMS.ui.welcome;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.app.Fragment;
import android.content.SharedPreferences;
import android.graphics.PorterDuff;
@@ -9,9 +7,10 @@ import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import com.moez.QKSMS.R;
import com.moez.QKSMS.common.LiveViewManager;
import com.moez.QKSMS.common.preferences.QKPreference;
import com.moez.QKSMS.ui.ThemeManager;
import com.moez.QKSMS.ui.base.QKActivity;
import com.moez.QKSMS.ui.settings.SettingsFragment;
@@ -60,21 +59,10 @@ public class WelcomeActivity extends QKActivity implements ViewPager.OnPageChang
BaseWelcomeFragment.setContext(this);
mPager.setOnPageChangeListener(this);
mPager.setAdapter(new WelcomePagerAdapter(getFragmentManager()));
}
public void setColor(int color) {
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), ThemeManager.getColor(), color);
colorAnimation.setDuration(ThemeManager.TRANSITION_LENGTH);
colorAnimation.setInterpolator(new DecelerateInterpolator());
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mBackground.setBackgroundColor((Integer) animation.getAnimatedValue());
}
LiveViewManager.registerView(QKPreference.THEME, this, key -> {
mBackground.setBackgroundColor(ThemeManager.getColor());
});
colorAnimation.start();
ThemeManager.setColor(this, color);
}
public void setColorBackground(int color) {
@@ -28,7 +28,7 @@ public class WelcomeThemeFragment extends BaseWelcomeFragment implements ColorPi
@Override
public void onColorSelected(int color) {
((WelcomeActivity) getActivity()).setColor(color);
ThemeManager.setColor(mContext, color);
mPallette.drawPalette(ThemeManager.PALETTE, color);
}