// Path: app/src/main/java/jp/sblo/pandora/jota/ApiWrapper.java
// public class ApiWrapper {
//     static public int getSourceOfEvent( MotionEvent event )
//     {
//         return event.getSource();
//     }
// 
//     static public float getAxisValue ( MotionEvent event , int axis)
//     {
//         return event.getAxisValue(axis);
//     }
//     static void scanFile(Context context, String []paths , String []mimeTypes )
//     {
//         MediaScannerConnection.scanFile(context, paths, mimeTypes, null);
//     }
// 
// }


import jp.sblo.pandora.jota.ApiWrapper;
import android.text.Spannable;
import android.text.method.MetaKeyKeyListener;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
/*
 * Copyright (C) 2010 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 jp.sblo.pandora.jota.text;


/**
 * Base classes for movement methods.
 */
abstract public class BaseMovementMethod implements MovementMethod {


    @Override
    public boolean onGenericMotionEvent(TextView widget, Spannable text, MotionEvent event) {
        if ((ApiWrapper.getSourceOfEvent(event) & InputDevice.SOURCE_CLASS_POINTER) != 0) {
            switch (event.getAction()) {
                case MotionEvent.ACTION_SCROLL: {
                    final float vscroll;
                    final float hscroll;
                    if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) {
                        vscroll = 0;
                        hscroll = ApiWrapper.getAxisValue(event,MotionEvent.AXIS_VSCROLL);
                    } else {
                        vscroll = -ApiWrapper.getAxisValue(event,MotionEvent.AXIS_VSCROLL);
// Path: app/src/main/java/jp/sblo/pandora/jota/ApiWrapper.java
// public class ApiWrapper {
//     static public int getSourceOfEvent( MotionEvent event )
//     {
//         return event.getSource();
//     }
// 
//     static public float getAxisValue ( MotionEvent event , int axis)
//     {
//         return event.getAxisValue(axis);
//     }
//     static void scanFile(Context context, String []paths , String []mimeTypes )
//     {
//         MediaScannerConnection.scanFile(context, paths, mimeTypes, null);
//     }
// 
// }


// Path: app/src/main/java/jp/sblo/pandora/jota/text/BaseMovementMethod.java
import jp.sblo.pandora.jota.ApiWrapper;
import android.text.Spannable;
import android.text.method.MetaKeyKeyListener;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;

/*
 * Copyright (C) 2010 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 jp.sblo.pandora.jota.text;


/**
 * Base classes for movement methods.
 */
abstract public class BaseMovementMethod implements MovementMethod {


    @Override
    public boolean onGenericMotionEvent(TextView widget, Spannable text, MotionEvent event) {
        if ((ApiWrapper.getSourceOfEvent(event) & InputDevice.SOURCE_CLASS_POINTER) != 0) {
            switch (event.getAction()) {
                case MotionEvent.ACTION_SCROLL: {
                    final float vscroll;
                    final float hscroll;
                    if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) {
                        vscroll = 0;
                        hscroll = ApiWrapper.getAxisValue(event,MotionEvent.AXIS_VSCROLL);
                    } else {
                        vscroll = -ApiWrapper.getAxisValue(event,MotionEvent.AXIS_VSCROLL);
                        hscroll = ApiWrapper.getAxisValue(event,MotionEvent.AXIS_HSCROLL);