--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources>
+ <style name="Theme.GalleryBase" parent="android:Theme.Holo.NoActionBar.Fullscreen">
+ <item name="listPreferredItemHeightSmall">?android:attr/listPreferredItemHeightSmall</item>
+ <item name="switchStyle">@android:style/Widget.CompoundButton</item>
+ </style>
+ <style name="ActionBarTwoLineItem">
+ <item name="android:background">?android:attr/activatedBackgroundIndicator</item>
+ </style>
+</resources>
package com.android.gallery3d.app;
import android.app.Dialog;
-import android.content.AsyncQueryHandler;
import android.content.ContentResolver;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
-import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
-import android.provider.OpenableColumns;
+import android.view.InputDevice;
+import android.view.MotionEvent;
+import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
mVersionCheckDialog = null;
}
}
+
+ @Override
+ public boolean onGenericMotionEvent(MotionEvent event) {
+ final boolean isTouchPad = (event.getSource()
+ & InputDevice.SOURCE_CLASS_POSITION) != 0;
+ if (isTouchPad) {
+ float maxX = event.getDevice().getMotionRange(MotionEvent.AXIS_X).getMax();
+ float maxY = event.getDevice().getMotionRange(MotionEvent.AXIS_Y).getMax();
+ View decor = getWindow().getDecorView();
+ float scaleX = decor.getWidth() / maxX;
+ float scaleY = decor.getHeight() / maxY;
+ float x = event.getX() * scaleX;
+ //x = decor.getWidth() - x; // invert x
+ float y = event.getY() * scaleY;
+ //y = decor.getHeight() - y; // invert y
+ MotionEvent touchEvent = MotionEvent.obtain(event.getDownTime(),
+ event.getEventTime(), event.getAction(), x, y, event.getMetaState());
+ return dispatchTouchEvent(touchEvent);
+ }
+ return super.onGenericMotionEvent(event);
+ }
}
private void initializeActionBar(Intent intent) {
mUri = intent.getData();
final ActionBar actionBar = getActionBar();
+ if (actionBar == null) {
+ return;
+ }
setActionBarLogoFromIntent(intent);
actionBar.setDisplayOptions(
ActionBar.DISPLAY_HOME_AS_UP,
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.content.res.Configuration;
import android.graphics.Rect;
import android.net.Uri;
import android.nfc.NfcAdapter;
// No bars if it's not allowed.
if (!mActionBarAllowed) return false;
+ Configuration config = mActivity.getResources().getConfiguration();
+ if (config.touchscreen == Configuration.TOUCHSCREEN_NOTOUCH) {
+ return false;
+ }
+
return true;
}
// listener is automatically removed when there is no other reference to
// the listener.
public void addContentListener(ContentListener listener) {
- if (mListeners.containsKey(listener)) {
- throw new IllegalArgumentException();
- }
mListeners.put(listener, null);
}
public void removeContentListener(ContentListener listener) {
- if (!mListeners.containsKey(listener)) {
- throw new IllegalArgumentException();
- }
mListeners.remove(listener);
}