No Description

GatherInfoPopup.java 4.8KB

    package ai.pai.client.views; import android.app.Activity; import android.content.Intent; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.animation.Animation; import android.widget.ImageView; import android.widget.TextView; import com.android.common.utils.TimeUtils; import com.android.views.popup.BasePopupWindow; import ai.pai.client.R; import ai.pai.client.db.Preferences; import ai.pai.client.utils.PhotoLoader; public class GatherInfoPopup extends BasePopupWindow { private View popupView; private ImageView gatherMap; private TextView gatherInfoText; private Activity context; public GatherInfoPopup(Activity context) { super(context); this.context = context; init(); } @Override protected Animation getShowAnimation() { return getDefaultScaleAnimation(); } @Override protected View getClickToDismissView() { return popupView.findViewById(R.id.click_to_dismiss); } @Override public View getPopupView() { popupView = LayoutInflater.from(mContext).inflate(R.layout.pop_gather_info, null); gatherInfoText = (TextView) popupView.findViewById(R.id.tv_gather_info); gatherMap = (ImageView) popupView.findViewById(R.id.iv_gather_map); return popupView; } private void init() { String time = TimeUtils.getGatherTimeStr(Preferences.getInstance(context).getGatherTime() - 30 * 60 * 1000); if (time.length() == 0) { time = context.getString(R.string.gather_no_time); } String location = Preferences.getInstance(context).getTourGatherLocation(); if (location.length() == 0) { location = context.getString(R.string.gather_no_location); } gatherInfoText.setText(context.getString(R.string.gather_info, time, location)); if (!TextUtils.isEmpty(Preferences.getInstance(context).getGatherMap())) { PhotoLoader.getInstance(context).displayImage(Preferences.getInstance(context).getGatherMap(), gatherMap); gatherMap.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String lat = Preferences.getInstance(context).getTourGatherLat(); String lon = Preferences.getInstance(context).getTourGatherLon(); if (TextUtils.isEmpty(lat) || TextUtils.isEmpty(lon) || !callThirdPartyMap(lat, lon)) { new FullScreenImgPopup(context, Preferences.getInstance(context).getGatherMap()).showPopupWindow(); } } }); } else { gatherMap.setVisibility(View.GONE); } } private boolean callThirdPartyMap(String lat, String lon) { if (isAppExist("com.autonavi.minimap")) { try { Intent intent = Intent.getIntent("androidamap://viewMap?sourceApplication=paiai&lat=" + lat + "&lon=" + lon + "&dev=0"); context.startActivity(intent); return true; } catch (Exception e) { e.printStackTrace(); } } else if (isAppExist("com.baidu.BaiduMap")) { double latd = Double.parseDouble(lat); double lond = Double.parseDouble(lon); Double[] loc = GCJ02ToBD09(latd, lond); latd = loc[0]; lond = loc[1]; try { Intent intent = Intent.getIntent("intent://map/marker?location=" + String.valueOf(latd) + "," + String.valueOf(lond) + "&title=集合位置&src=paiai#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end"); context.startActivity(intent); return true; } catch (Exception e) { e.printStackTrace(); } } return false; } private boolean isAppExist(String packageName) { if (TextUtils.isEmpty(packageName)) return false; try { context.getPackageManager().getPackageInfo(packageName, 0); return true; } catch (Exception e) { return false; } } private static double x_PI = 3.14159265358979324 * 3000.0 / 180.0; public static Double[] GCJ02ToBD09(Double gcj_lon, Double gcj_lat) { double z = Math.sqrt(gcj_lon * gcj_lon + gcj_lat * gcj_lat) + 0.00002 * Math.sin(gcj_lat * x_PI); double theta = Math.atan2(gcj_lat, gcj_lon) + 0.000003 * Math.cos(gcj_lon * x_PI); Double[] arr = new Double[2]; arr[0] = z * Math.cos(theta) + 0.0065; arr[1] = z * Math.sin(theta) + 0.006; return arr; } @Override public View getAnimaView() { return popupView.findViewById(R.id.popup_anima); } }
adminSystem - Gogs: Go Git Service

Няма описание

FFIB: 11e3a9652a first преди 8 години
..
LICENSE 11e3a9652a first преди 8 години
README.md 11e3a9652a first преди 8 години
index.js 11e3a9652a first преди 8 години
package.json 11e3a9652a first преди 8 години

README.md

is-extglob NPM version NPM downloads Build Status

Returns true if a string has an extglob.

Install

Install with npm:

$ npm install --save is-extglob

Usage

var isExtglob = require('is-extglob');

True

isExtglob('?(abc)');
isExtglob('@(abc)');
isExtglob('!(abc)');
isExtglob('*(abc)');
isExtglob('+(abc)');

False

Escaped extglobs:

isExtglob('\\?(abc)');
isExtglob('\\@(abc)');
isExtglob('\\!(abc)');
isExtglob('\\*(abc)');
isExtglob('\\+(abc)');

Everything else...

isExtglob('foo.js');
isExtglob('!foo.js');
isExtglob('*.js');
isExtglob('**/abc.js');
isExtglob('abc/*.js');
isExtglob('abc/(aaa|bbb).js');
isExtglob('abc/[a-z].js');
isExtglob('abc/{a,b}.js');
isExtglob('abc/?.js');
isExtglob('abc.js');
isExtglob('abc/def/ghi.js');

History

v2.0

Adds support for escaping. Escaped exglobs no longer return true.

About

Related projects

  • has-glob: Returns true if an array has a glob pattern. | homepage
  • is-glob: Returns true if the given string looks like a glob pattern or an extglob pattern… more | homepage
  • micromatch: Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb-generate-readme, v0.1.31, on October 12, 2016.