336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | //Interface 설정 public interface JsInterface { @JavascriptInterface void setGeoState(boolean state); @JavascriptInterface boolean getGeoState(); @JavascriptInterface double getGeoLat(); @JavascriptInterface double getGeoLng(); @JavascriptInterface void startGeoLatLng(); @JavascriptInterface void finishGeoLatLng(); @JavascriptInterface void photoMapStart(); @JavascriptInterface void goDetail(String path); @JavascriptInterface void onFinish(String type); @JavascriptInterface void goLocal(String localUrl); @JavascriptInterface void matchItemResult(String message); @JavascriptInterface void pageMoveWithMessage(String path, String message); @JavascriptInterface void getImage(); @JavascriptInterface void uploadImage(String uploadType, String itemType, String itemNo); @JavascriptInterface void progressStart(); @JavascriptInterface void progressEnd(); @JavascriptInterface void resetImage(); } //Interface 오버라이드 mWebView.addJavascriptInterface(new JsInterface() { @Override @JavascriptInterface public void setGeoState(boolean state) { Log.i("Home", "SetGeoState => "+state); isGeoState = state; } @Override @JavascriptInterface public boolean getGeoState() { Log.i("Home", "getGeoState => "+isGeoState); return isGeoState; } @Override @JavascriptInterface public double getGeoLat() { Log.i("Home", "getGeoLat => "+mGeoLat); return mGeoLat; } @Override @JavascriptInterface public double getGeoLng() { Log.i("Home", "getGeoLng => "+mGeoLng); return mGeoLng; } @Override @JavascriptInterface public void startGeoLatLng() { Log.i("GPS", "startGeoLatLng"); startLocationService(); } @Override @JavascriptInterface public void finishGeoLatLng() { Log.i("GPS", "finishGeoLng"); if(ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){ return; } mLocationManager.removeUpdates(HomeActivity.this); } @Override @JavascriptInterface public void photoMapStart() { Log.i("Home", "photoMapStart"); onPhotomapClick(null); } @Override @JavascriptInterface public void goDetail(String path) { Log.i("Home", "goDetail / Path => "+path); Intent cIntent = new Intent(HomeActivity.this, ListDetailActivity.class); cIntent.putExtra("path", Cvalue.MainDomain+path); startActivityForResult(cIntent, Cvalue.WEB_VIEW_GO_DETAIL); } @Override @JavascriptInterface public void onFinish(String type) { Log.i("Home", "onFinish"); if(type == null){ HomeActivity.this.runOnUiThread(new Runnable() { @Override public void run() { mWebView.loadUrl(Cvalue.MainDomain, Cutil.getHeader()); } }); } } @Override @JavascriptInterface public void goLocal(String localUrl) { Log.i("Home", "goLocal"); String mUrl = Cvalue.MainDomain+localUrl; Intent cIntent = new Intent(HomeActivity.this, ListDetailActivity.class); cIntent.putExtra("path", mUrl); startActivity(cIntent); } @JavascriptInterface @Override public void matchItemResult(String message) { Log.i("Home", "matchItemResult"); Toast.makeText(HomeActivity.this, message, Toast.LENGTH_SHORT).show(); } @Override @JavascriptInterface public void pageMoveWithMessage(String path, String message) { } @Override @JavascriptInterface public void getImage() { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){ if(ActivityCompat.checkSelfPermission(act, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(act, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED){ ActivityCompat.requestPermissions(act, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1001); }else{ Intent cIntent = new Intent(HomeActivity.this, CustomPhotoGalleryActivity.class); cIntent.putStringArrayListExtra("images", itemImages); startActivityForResult(cIntent, Cvalue.GET_IMAGE_REQUEST); } } } @Override @JavascriptInterface public void uploadImage(String uploadType, String itemType, String itemNo) { uploadToImage(uploadType, itemType, itemNo, itemImages); } @Override @JavascriptInterface public void progressStart() { Log.i("TEST", "Start"); mProgress = new MyProgress(act); mProgress.show(); } @Override @JavascriptInterface public void progressEnd() { Log.e("TEST", "END"); mProgress.dismiss(); } @Override @JavascriptInterface public void resetImage() { Log.v("TEST", "Reset"); itemImages = null; itemImages = new ArrayList<String>(); } }, "android"); //Script선언 var _Android = _Android || {}; _Android.data = {}; _Android.func = {}; _Android.data.app = window.android; _Android.data.playGeoLatLng = null; _Android.data.playNum = 1; _Android.func.getImage = function () { _Android.data.app.getImage(); }; _Android.func.uploadImage = function (uploadType, itemType, itemNo) { _Android.data.app.uploadImage(uploadType, itemType, itemNo); }; _Android.func.progressStart = function () { _Android.data.app.progressStart(); }; _Android.func.progressEnd = function () { _Android.data.app.progressEnd(); }; _Android.func.resetImage = function () { _Android.data.app.resetImage(); }; //Script 실행 _Android.func.progressStart(); | cs |
'android' 카테고리의 다른 글
[Android]문자열로 resource ID값 가져오기 (0) | 2017.11.22 |
---|---|
[android] 초간단 기기 해상도 구하기 (0) | 2016.08.24 |
[Android] EditText 특수문자 제한, 한글만 입력 (0) | 2016.05.11 |
[Android] AsycTask사용하기 (0) | 2016.02.26 |
[Android] HttpUrlConnection 사용하기 (0) | 2016.02.24 |