mirror of
https://github.com/Etar-Group/Etar-Calendar.git
synced 2024-09-11 10:05:47 +03:00
Adding hook for additional options in the AllInOne menu.
A new 'extensions_src' folder was added to contain skeletons for extensions. Bug:5920207 Change-Id: Icaa377688b7a56a17db34dc954b844b059f07c33
This commit is contained in:
parent
cd1d934fce
commit
19da7825c5
@ -4,12 +4,13 @@ include $(CLEAR_VARS)
|
||||
# Include res dir from chips
|
||||
chips_dir := ../../../frameworks/ex/chips/res
|
||||
res_dirs := $(chips_dir) res
|
||||
src_dirs := src extensions_src
|
||||
|
||||
LOCAL_EMMA_COVERAGE_FILTER := +com.android.calendar.*
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under,src)
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under,$(src_dirs))
|
||||
|
||||
# bundled
|
||||
#LOCAL_STATIC_JAVA_LIBRARIES += \
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2012 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.calendar.extensions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
/*
|
||||
* Skeleton for additional options in the AllInOne menu.
|
||||
*/
|
||||
public class AllInOneMenuExtensions {
|
||||
|
||||
/**
|
||||
* Hook for adding additional options.
|
||||
*/
|
||||
public Integer getExtensionMenuResource(Menu menu) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook for handling selection of the additional options.
|
||||
*/
|
||||
public boolean handleItemSelected(MenuItem item, Context context) {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -76,6 +76,7 @@ import com.android.calendar.CalendarController.EventInfo;
|
||||
import com.android.calendar.CalendarController.EventType;
|
||||
import com.android.calendar.CalendarController.ViewType;
|
||||
import com.android.calendar.agenda.AgendaFragment;
|
||||
import com.android.calendar.extensions.AllInOneMenuExtensions;
|
||||
import com.android.calendar.month.MonthByWeekFragment;
|
||||
import com.android.calendar.selectcalendars.SelectVisibleCalendarsFragment;
|
||||
|
||||
@ -167,6 +168,8 @@ public class AllInOneActivity extends Activity implements EventHandler,
|
||||
private LayoutParams mControlsParams;
|
||||
private LinearLayout.LayoutParams mVerticalControlsParams;
|
||||
|
||||
private AllInOneMenuExtensions mExtensions = new AllInOneMenuExtensions();
|
||||
|
||||
private final AnimatorListener mSlideAnimationDoneListener = new AnimatorListener() {
|
||||
|
||||
@Override
|
||||
@ -730,6 +733,12 @@ public class AllInOneActivity extends Activity implements EventHandler,
|
||||
mOptionsMenu = menu;
|
||||
getMenuInflater().inflate(R.menu.all_in_one_title_bar, menu);
|
||||
|
||||
// Add additional options (if any).
|
||||
Integer extensionMenuRes = mExtensions.getExtensionMenuResource(menu);
|
||||
if (extensionMenuRes != null) {
|
||||
getMenuInflater().inflate(extensionMenuRes, menu);
|
||||
}
|
||||
|
||||
mSearchMenu = menu.findItem(R.id.action_search);
|
||||
mSearchView = (SearchView) mSearchMenu.getActionView();
|
||||
if (mSearchView != null) {
|
||||
@ -822,7 +831,7 @@ public class AllInOneActivity extends Activity implements EventHandler,
|
||||
case R.id.action_search:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
return mExtensions.handleItemSelected(item, this);
|
||||
}
|
||||
mController.sendEvent(this, EventType.GO_TO, t, null, t, -1, viewType, extras, null, null);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user