//package com.basic.security.utils;
|
//
|
//import org.apache.commons.io.IOUtils;
|
//import org.jsoup.Jsoup;
|
//import org.jsoup.nodes.Document;
|
//import org.jsoup.nodes.Element;
|
//import org.jsoup.select.Elements;
|
//import org.xutils.common.util.IOUtil;
|
//
|
//import java.io.File;
|
//import java.io.FileInputStream;
|
//import java.util.HashMap;
|
//import java.util.List;
|
//import java.util.Map;
|
//import java.util.TreeMap;
|
//
|
//public class XY {
|
//
|
// public static Map<Double, String> pixelToX = new TreeMap<>();
|
// public static Map<Double, String> pixelToY = new TreeMap<>();
|
//
|
// public static void main(String[] args) throws Exception {
|
// String lay_x = IOUtils.toString(new FileInputStream("C:\\workspace\\Security\\app\\src\\main\\res\\values-2560x1440\\lay_x.xml"));
|
// Document document = Jsoup.parse(lay_x);
|
// // Using Elements to get the class data
|
// Elements elements = document.select("dimen");
|
// for (Element element : elements) {
|
// String name = element.attr("name");
|
// String text = element.text().replace("px","");
|
// pixelToX.put(Double.parseDouble(text), name);
|
// }
|
// String lay_y = IOUtils.toString(new FileInputStream("C:\\workspace\\Security\\app\\src\\main\\res\\values-2560x1440\\lay_y.xml"));
|
// Document documenty = Jsoup.parse(lay_y);
|
// // Using Elements to get the class data
|
// Elements elementsy = documenty.select("dimen");
|
// for (Element elementy : elementsy) {
|
// String name = elementy.attr("name");
|
// String text = elementy.text().replace("px","");
|
// pixelToY.put(Double.parseDouble(text), name);
|
// }
|
//
|
// findX(240);
|
// findY(40);
|
// }
|
//
|
//
|
//
|
// public static void findX(double x) {
|
// double x1 = x*1.0/2048*2560;
|
// for (double key : pixelToX.keySet()) {
|
// if (key > x1) {
|
//// System.out.println(x1+", 找到缩放的 " + key + " " + pixelToX.get(key));
|
// break;
|
// }
|
// }
|
// for (double key : pixelToX.keySet()) {
|
// if (key > x) {
|
//// System.out.println(x+", 找到未缩放的 " + key + " " + pixelToX.get(key));
|
// break;
|
// }
|
// }
|
// }
|
//
|
// public static void findY(int y) {
|
//// System.out.println("x--------------------------------");
|
// double x1 = y*1.0/1536*1440;
|
// for (double key : pixelToY.keySet()) {
|
// if (key > x1) {
|
//// System.out.println(x1+", 找到缩放的 " + key + " " + pixelToY.get(key));
|
// break;
|
// }
|
// }
|
// for (double key : pixelToY.keySet()) {
|
// if (key > y) {
|
//// System.out.println(y+", 找到未缩放的 " + key + " " + pixelToY.get(key));
|
// break;
|
// }
|
// }
|
// }
|
//
|
//}
|