summaryrefslogtreecommitdiffstats
path: root/src/org/cyanogenmod/audiofx/audiofx/fragment/AudioFxBaseFragment.java
blob: d487ff0e7fe722485d277ade1bcef16febb7ba44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.cyngn.audiofx.fragment;

import android.animation.Animator;
import android.app.Fragment;
import android.os.Bundle;
import android.widget.CompoundButton;
import com.cyngn.audiofx.activity.ActivityMusic;
import com.cyngn.audiofx.activity.MasterConfigControl;

public class AudioFxBaseFragment extends Fragment {

    MasterConfigControl mConfig;

    AudioFxFragment mFrag;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mFrag = (AudioFxFragment) getParentFragment();

        mConfig = MasterConfigControl.getInstance(getActivity());
    }

    public int getDisabledColor() {
        return mFrag.getDisabledColor();
    }

    public int getCurrentBackgroundColor() {
        return mFrag.mCurrentBackgroundColor;
    }

    public void animateBackgroundColorTo(Integer colorTo, Animator.AnimatorListener listener,
                                         AudioFxFragment.ColorUpdateListener updateListener) {
        if (mFrag != null) {
            mFrag.animateBackgroundColorTo(colorTo, listener, updateListener);
        }
    }

    /**
     * Call to change the color and propogate it up to the activity, which will call
     * {@link #updateFragmentBackgroundColors(int)}
     *
     * @param color
     */
    public void setBackgroundColor(int color, boolean cancelAnimated) {
        if (mFrag != null) {
            mFrag.updateBackgroundColors(color, cancelAnimated);
        }
    }

    /**
     * For sub class fragments to override and apply the color
     *
     * @param color the new color to apply to any colored elements
     */
    public void updateFragmentBackgroundColors(int color) {
    }

    /**
     * For sub class fragments to override when they might need to update their enabled states
     */
    public void updateEnabledState() {

    }
}