mirror of https://github.com/ThmmyNoLife/mTHMMY
Ezerous
5 years ago
21 changed files with 288 additions and 21 deletions
@ -0,0 +1,146 @@ |
|||||
|
<html> |
||||
|
<head> |
||||
|
<style> |
||||
|
body { |
||||
|
font-family: sans-serif; |
||||
|
background-color: #333333; |
||||
|
} |
||||
|
|
||||
|
pre { |
||||
|
background-color: #3C3C3C; |
||||
|
color: #757575; |
||||
|
padding: 1em; |
||||
|
margin-left: 1em; |
||||
|
margin-right: 1em; |
||||
|
white-space: pre-wrap; |
||||
|
} |
||||
|
|
||||
|
h4, |
||||
|
h5 { |
||||
|
display: inline; |
||||
|
padding: 1em; |
||||
|
} |
||||
|
|
||||
|
a, |
||||
|
h4, |
||||
|
h5 { |
||||
|
color: #26A69A; |
||||
|
word-wrap: break-word; |
||||
|
} |
||||
|
|
||||
|
li { |
||||
|
color: #26A69A; |
||||
|
} |
||||
|
|
||||
|
</style> |
||||
|
</head> |
||||
|
|
||||
|
<body> |
||||
|
<ul> |
||||
|
<li> |
||||
|
<h5><a href="https://github.com/bumptech/glide">Glide</a> v4.11.0</h5> |
||||
|
</li> |
||||
|
</ul> |
||||
|
|
||||
|
|
||||
|
<br/> |
||||
|
<h4>Glide License</h4> |
||||
|
<pre> |
||||
|
License for everything not in third_party and not otherwise marked: |
||||
|
|
||||
|
Copyright 2014 Google, Inc. All rights reserved. |
||||
|
|
||||
|
Redistribution and use in source and binary forms, with or without modification, are |
||||
|
permitted provided that the following conditions are met: |
||||
|
|
||||
|
1. Redistributions of source code must retain the above copyright notice, this list of |
||||
|
conditions and the following disclaimer. |
||||
|
|
||||
|
2. Redistributions in binary form must reproduce the above copyright notice, this list |
||||
|
of conditions and the following disclaimer in the documentation and/or other materials |
||||
|
provided with the distribution. |
||||
|
|
||||
|
THIS SOFTWARE IS PROVIDED BY GOOGLE, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED |
||||
|
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
||||
|
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE, INC. OR |
||||
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
||||
|
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
|
||||
|
The views and conclusions contained in the software and documentation are those of the |
||||
|
authors and should not be interpreted as representing official policies, either expressed |
||||
|
or implied, of Google, Inc. |
||||
|
--------------------------------------------------------------------------------------------- |
||||
|
License for third_party/disklrucache: |
||||
|
|
||||
|
Copyright 2012 Jake Wharton |
||||
|
Copyright 2011 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. |
||||
|
--------------------------------------------------------------------------------------------- |
||||
|
License for third_party/gif_decoder: |
||||
|
|
||||
|
Copyright (c) 2013 Xcellent Creations, Inc. |
||||
|
|
||||
|
Permission is hereby granted, free of charge, to any person obtaining |
||||
|
a copy of this software and associated documentation files (the |
||||
|
"Software"), to deal in the Software without restriction, including |
||||
|
without limitation the rights to use, copy, modify, merge, publish, |
||||
|
distribute, sublicense, and/or sell copies of the Software, and to |
||||
|
permit persons to whom the Software is furnished to do so, subject to |
||||
|
the following conditions: |
||||
|
|
||||
|
The above copyright notice and this permission notice shall be |
||||
|
included in all copies or substantial portions of the Software. |
||||
|
|
||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||||
|
--------------------------------------------------------------------------------------------- |
||||
|
License for third_party/gif_encoder/AnimatedGifEncoder.java and |
||||
|
third_party/gif_encoder/LZWEncoder.java: |
||||
|
|
||||
|
No copyright asserted on the source code of this class. May be used for any |
||||
|
purpose, however, refer to the Unisys LZW patent for restrictions on use of |
||||
|
the associated LZWEncoder class. Please forward any corrections to |
||||
|
kweiner@fmsware.com. |
||||
|
|
||||
|
----------------------------------------------------------------------------- |
||||
|
License for third_party/gif_encoder/NeuQuant.java |
||||
|
|
||||
|
Copyright (c) 1994 Anthony Dekker |
||||
|
|
||||
|
NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See |
||||
|
"Kohonen neural networks for optimal colour quantization" in "Network: |
||||
|
Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of |
||||
|
the algorithm. |
||||
|
|
||||
|
Any party obtaining a copy of these files from the author, directly or |
||||
|
indirectly, is granted, free of charge, a full and unrestricted irrevocable, |
||||
|
world-wide, paid up, royalty-free, nonexclusive right and license to deal in |
||||
|
this software and documentation files (the "Software"), including without |
||||
|
limitation the rights to use, copy, modify, merge, publish, distribute, |
||||
|
sublicense, and/or sell copies of the Software, and to permit persons who |
||||
|
receive copies from any such party to do so, with the only requirement being |
||||
|
that this copyright notice remain intact. |
||||
|
</pre> |
||||
|
</body> |
||||
|
|
||||
|
</html> |
@ -0,0 +1,79 @@ |
|||||
|
package gr.thmmy.mthmmy.utils; |
||||
|
|
||||
|
import android.annotation.SuppressLint; |
||||
|
import android.app.Dialog; |
||||
|
import android.content.Context; |
||||
|
import android.graphics.drawable.ColorDrawable; |
||||
|
import android.view.MotionEvent; |
||||
|
import android.view.View; |
||||
|
import android.view.ViewGroup; |
||||
|
import android.view.ViewGroup.LayoutParams; |
||||
|
import android.view.Window; |
||||
|
import android.webkit.WebView; |
||||
|
|
||||
|
import com.bumptech.glide.Glide; |
||||
|
import com.github.chrisbanes.photoview.PhotoView; |
||||
|
|
||||
|
import gr.thmmy.mthmmy.base.BaseApplication; |
||||
|
|
||||
|
/** |
||||
|
* Workaround for WebView's inability to send onClick events (sends only onLongClickEvents) |
||||
|
* If an image is find when clicking it will be inflated as a zoomed/zoomable/pinchable PhotoView |
||||
|
*/ |
||||
|
public class WebViewOnTouchClickListener implements View.OnTouchListener { |
||||
|
private final static int screenWidth = BaseApplication.getInstance().getWidthInPixels(); |
||||
|
private final static int screenHeight = BaseApplication.getInstance().getHeightInPixels(); |
||||
|
|
||||
|
private final static long MAX_TOUCH_DURATION = 100; |
||||
|
private final Context context; |
||||
|
private long downTime; |
||||
|
|
||||
|
public WebViewOnTouchClickListener(Context context){ |
||||
|
this.context = context; |
||||
|
} |
||||
|
|
||||
|
@SuppressLint("ClickableViewAccessibility") |
||||
|
@Override |
||||
|
public boolean onTouch(View v, MotionEvent event) { |
||||
|
switch (event.getAction()) { |
||||
|
case MotionEvent.ACTION_DOWN: |
||||
|
downTime = event.getEventTime(); |
||||
|
break; |
||||
|
case MotionEvent.ACTION_UP: |
||||
|
if(event.getEventTime() - downTime <= MAX_TOUCH_DURATION) |
||||
|
onClick((WebView) v); |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
private void onClick(WebView webView){ |
||||
|
WebView.HitTestResult result = webView.getHitTestResult(); |
||||
|
if(result.getType() == WebView.HitTestResult.IMAGE_TYPE){ |
||||
|
String imageURL = result.getExtra(); |
||||
|
showImage(imageURL); |
||||
|
} |
||||
|
webView.performClick(); |
||||
|
} |
||||
|
|
||||
|
private void showImage(String url) { |
||||
|
Dialog builder = new Dialog(context); |
||||
|
builder.requestWindowFeature(Window.FEATURE_NO_TITLE); |
||||
|
builder.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); |
||||
|
builder.getWindow().setBackgroundDrawable( |
||||
|
new ColorDrawable(android.graphics.Color.TRANSPARENT)); |
||||
|
|
||||
|
PhotoView photoView = new PhotoView(context); |
||||
|
photoView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); |
||||
|
photoView.getLayoutParams().width = screenWidth; |
||||
|
photoView.getLayoutParams().height = screenHeight; |
||||
|
|
||||
|
Glide.with(context).load(url).fitCenter().into(photoView); |
||||
|
builder.addContentView(photoView, new ViewGroup.LayoutParams( |
||||
|
ViewGroup.LayoutParams.MATCH_PARENT, |
||||
|
ViewGroup.LayoutParams.MATCH_PARENT)); |
||||
|
builder.show(); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue