Skip to content

Commit

Permalink
added observer, status bar calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Moskowite committed Mar 2, 2012
1 parent ecf234e commit 779a066
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -240,6 +240,8 @@ public class PhoneStatusBar extends StatusBar {
int mSystemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE;

DisplayMetrics mDisplayMetrics = new DisplayMetrics();
// boolean to check for enableing the date to calender clicky
private boolean enableDateOpensCalendar;

private class ExpandedDialog extends Dialog {
ExpandedDialog(Context context) {
Expand Down Expand Up @@ -346,8 +348,7 @@ protected View makeStatusBarView() {
mClearButton.setAlpha(0f);
mClearButton.setEnabled(false);
mDateView = (DateView) expanded.findViewById(R.id.date);
if (Settings.System.getInt(mContext.getContentResolver(),
Settings.System.DATE_OPENS_CALENDAR, 0) == 1)
if (enableDateOpensCalendar)
mDateView.setOnClickListener(mCalendarButtonListener);
mSettingsButton = expanded.findViewById(R.id.settings_button);
mSettingsButton.setOnClickListener(mSettingsButtonListener);
Expand Down Expand Up @@ -406,10 +407,15 @@ public SettingsObserver(Handler handler) {

public void observe() {
ContentResolver resolver = mContext.getContentResolver();
resolver.registerContentObserver(
Settings.System.getUriFor(Settings.System.DATE_OPENS_CALENDAR), false, this);
}

@Override
public void onChange(boolean selfChange) {
enableDateOpensCalendar = Settings.System.getInt(
mContext.getContentResolver(),
Settings.System.DATE_OPENS_CALENDAR, 0) == 1;
prepareNavigationBarView();
}
}
Expand Down

0 comments on commit 779a066

Please sign in to comment.