Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18158465 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Revert "Make the settings menu accessible on every tab"" into cm-10.1

parents 75da93c3 4709976b
Loading
Loading
Loading
Loading
+0 −30
Original line number Diff line number Diff line
@@ -80,34 +80,4 @@
        android:layout_weight="2"
        android:layout_width="match_parent"
        android:layout_height="0dip" />

    <FrameLayout
        android:id="@+id/stopwatch_footer"
        android:background="@drawable/footer_bg"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <View
            android:layout_width="match_parent"
            android:layout_height="1dip"
            android:background="#28ffffff" />
        <LinearLayout
            android:id="@+id/stopwatch_buttons"
            android:gravity="bottom"
            android:layout_width="match_parent"
            android:layout_height="@dimen/button_footer_height" >
            <Space
                android:layout_height="match_parent"
                android:layout_width="0dip"
                android:layout_weight="1"/>
            <ImageButton
                android:id="@+id/menu_button"
                android:contentDescription="@string/button_menu"
                style="?android:attr/actionOverflowButtonStyle"
                android:background="@drawable/item_background"
                android:onClick="clockButtonsOnClick"
                android:layout_gravity="right"
                android:layout_width="64dip"
                android:layout_height="match_parent" />
         </LinearLayout>
    </FrameLayout>
</com.android.deskclock.CircleButtonsLinearLayout>
 No newline at end of file
+2 −15
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@
               <Button
                    android:id="@+id/timer_cancel"
                    android:text="@string/timer_cancel"
                    android:layout_width="wrap_content"
                    android:layout_width="match_parent"
                    style="@style/button"
                    android:layout_weight="1"
                    android:background="@drawable/item_background"
@@ -93,24 +93,11 @@
               <Button
                    android:id="@+id/timer_start"
                    android:text="@string/timer_start"
                    android:layout_width="wrap_content"
                    android:layout_width="match_parent"
                    style="@style/button"
                    android:layout_weight="1"
                    android:background="@drawable/item_background"
                    android:layout_height="wrap_content" />
               <Space
                   android:layout_height="match_parent"
                   android:layout_width="0dip"
                   android:layout_weight="1"/>
               <ImageButton
                   android:id="@+id/menu_button"
                   android:contentDescription="@string/button_menu"
                   style="?android:attr/actionOverflowButtonStyle"
                   android:background="@drawable/item_background"
                   android:onClick="clockButtonsOnClick"
                   android:layout_gravity="right"
                   android:layout_width="64dip"
                   android:layout_height="match_parent" />
              </LinearLayout>
           </FrameLayout>
    </LinearLayout>
+7 −35
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.graphics.drawable.TransitionDrawable;
import android.os.Bundle;
import android.os.Handler;
@@ -86,15 +85,6 @@ public class DeskClock extends Activity implements LabelDialogFragment.TimerLabe

    private int mSelectedTab;

    private OnSharedPreferenceChangeListener preferenceChangeListener = new OnSharedPreferenceChangeListener() {
        @Override
        public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
            if (SettingsActivity.KEY_KEEP_DISPLAY_ON_STOPWATCH.equals(key)) {
                refreshKeepScreenOn();
            }
        }
    };

    @Override
    public void onNewIntent(Intent newIntent) {
        super.onNewIntent(newIntent);
@@ -113,16 +103,6 @@ public class DeskClock extends Activity implements LabelDialogFragment.TimerLabe
        }
    }

    private void refreshKeepScreenOn() {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        if (mTabsAdapter.mPager.getCurrentItem() == STOPWATCH_TAB_INDEX
                && prefs.getBoolean(SettingsActivity.KEY_KEEP_DISPLAY_ON_STOPWATCH, true)) {
            getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
        } else {
            getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
        }
    }

    private void initViews() {

        if (mTabsAdapter == null) {
@@ -177,9 +157,6 @@ public class DeskClock extends Activity implements LabelDialogFragment.TimerLabe
        }
        initViews();
        setHomeTimeZone();

        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        prefs.registerOnSharedPreferenceChangeListener(preferenceChangeListener);
    }

    @Override
@@ -215,13 +192,6 @@ public class DeskClock extends Activity implements LabelDialogFragment.TimerLabe
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        prefs.unregisterOnSharedPreferenceChangeListener(preferenceChangeListener);
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
@@ -280,10 +250,6 @@ public class DeskClock extends Activity implements LabelDialogFragment.TimerLabe
        if (help != null) {
            Utils.prepareHelpMenuItem(this, help);
        }
        MenuItem nightMode = menu.findItem(R.id.menu_item_night_mode);
        if (nightMode != null) {
            nightMode.setVisible(mTabsAdapter.mPager.getCurrentItem() == CLOCK_TAB_INDEX);
        }
        popupMenu.show();
    }

@@ -391,7 +357,13 @@ public class DeskClock extends Activity implements LabelDialogFragment.TimerLabe
        public void onTabSelected(Tab tab, FragmentTransaction ft) {
            TabInfo info = (TabInfo)tab.getTag();
            mPager.setCurrentItem(info.getPosition());
            refreshKeepScreenOn();
            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
            if (info.getPosition() == STOPWATCH_TAB_INDEX
                    && prefs.getBoolean(SettingsActivity.KEY_KEEP_DISPLAY_ON_STOPWATCH, true)) {
                getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
            } else {
                getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
            }
        }

        @Override