mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-31 15:20:09 -05:00
Remove JBTitleBarWebView because TitleBarWebView handles all versions
This commit is contained in:
parent
a80d7c518a
commit
de6d271d58
@ -1,14 +0,0 @@
|
|||||||
package android.webkit;
|
|
||||||
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trojan class for getting access to a hidden API level 16 interface
|
|
||||||
*/
|
|
||||||
public class WebViewClassic {
|
|
||||||
public interface TitleBarDelegate {
|
|
||||||
int getTitleHeight();
|
|
||||||
|
|
||||||
public void onSetEmbeddedTitleBar(final View title);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
package com.nobu_games.android.view.web;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
|
||||||
import android.webkit.WebViewClassic.TitleBarDelegate;
|
|
||||||
|
|
||||||
public class JBTitleBarWebView extends TitleBarWebView implements
|
|
||||||
TitleBarDelegate {
|
|
||||||
|
|
||||||
public JBTitleBarWebView(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JBTitleBarWebView(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JBTitleBarWebView(Context context, AttributeSet attrs, int defStyle) {
|
|
||||||
super(context, attrs, defStyle);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <i>Makes sure that the title bar view gets touch events</i>
|
|
||||||
* <p>
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
|
||||||
if(mTitleBar != null) {
|
|
||||||
final int sy = getScrollY();
|
|
||||||
final int visTitleHeight = getVisibleTitleHeightCompat();
|
|
||||||
final float x = event.getX();
|
|
||||||
float y = event.getY();
|
|
||||||
|
|
||||||
switch(event.getActionMasked()) {
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
if(y <= visTitleHeight) {
|
|
||||||
mTouchInTitleBar = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MotionEvent.ACTION_MOVE:
|
|
||||||
mTouchMove = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
case MotionEvent.ACTION_CANCEL:
|
|
||||||
mTouchMove = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mTouchInTitleBar) {
|
|
||||||
y += sy;
|
|
||||||
event.setLocation(x, y);
|
|
||||||
|
|
||||||
return mTitleBar.dispatchTouchEvent(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.dispatchTouchEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTitleHeight() {
|
|
||||||
if(mTitleBar != null) return mTitleBar.getHeight();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSetEmbeddedTitleBar(View title) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -3,6 +3,7 @@ package com.nobu_games.android.view.web;
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012 Thomas Werner
|
* Copyright (C) 2012 Thomas Werner
|
||||||
* Portions Copyright (C) 2006 The Android Open Source Project
|
* Portions Copyright (C) 2006 The Android Open Source Project
|
||||||
|
* Portions Copyright (C) 2012 The K-9 Dog Walkers
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -96,20 +97,6 @@ public class TitleBarWebView extends WebView {
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the correct TitleBarWebView instance for the current API level.
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static TitleBarWebView getInstance(Context context) {
|
|
||||||
if(Build.VERSION.SDK_INT >= 16) {
|
|
||||||
return new JBTitleBarWebView(context);
|
|
||||||
} else {
|
|
||||||
return new TitleBarWebView(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <i>Corrects the visual displacement caused by the title bar view.</i>
|
* <i>Corrects the visual displacement caused by the title bar view.</i>
|
||||||
* <p>
|
* <p>
|
||||||
|
Loading…
Reference in New Issue
Block a user