마스터욱
Toggle navigation
  • 회원가입 | 정보찾기
ICON NAVIGATION
정보수정 쪽지함 주변맛집 익명채팅
공지사항 채팅 개발문의 방명록
  • MAIN NAVIGATION
  • 메인
  • 마스터욱 공간
    • 마스터욱 소개
    • 개발 리스트
    • 공지사항
    • 방명록
  • 마스터욱 외부자료
    • 네이버
    • 티스토리
    • 깃허브(github)
  • 개인 프로젝트
    • 랜덤 이성 채팅
    • Auto 크롤링
    • Javascript 카카오 채팅
    • 파이썬 뉴스매매
    • C# 키움 주식 자동매매
    • C# 키움 주식 패턴 분석
    • PHP 욱보드
    • 업비트 자동매매 개발
    • 업비트 자동매매 일지
  • 개발 의뢰
    • 개발 문의
    • 개발 견적
    • 개발 피드백
    • FAQ
  • 개발 경험 Tip
    • PHP
    • JSP
    • HTML
    • Javascript
    • Android
    • C#
    • MySQL
    • Linux
    • Python
    • NodeJS
    • React
    • Vue.js
    • Flutter
    • 정규식
    • 기타
  • 커뮤니티
    • 자유게시판
    • 추천사이트
    • 영화
    • 여행
    • 유머
    • Overseas News
  • 맛집&즐길 거리 탐방
    • 맛집 정보
    • 즐길 거리 정보
    • 내 주위 맛집&즐길 거리
  • 공유 사진
    • 음식
    • 여행
    • 캐릭터
    • 배경
    • 기타
    • 이모티콘
    • 일러스트
  • 놀이터
    • 블록뽀시기
    • 트레이딩뷰
    • 로또 시뮬레이션
    • 쳇쳇 익명 채팅
    • 랜덤 이성 채팅
    • AI 채팅
    • 미니 채팅
    • 바이너리 테스트
    • 마번호 생성기
    • 바카라 시뮬레이션
    • 홀짝점수 테스트
    • 로또 분석기
SITE STATISTICS
  • - 명 현재 접속자
  • 186 명 오늘 방문자
  • 1,673 명 어제 방문자
  • 5,192 명 최대 방문자
  • 695,661 명 전체 방문자
  • 2,570 개 전체 게시물
  • 496 개 전체 댓글수
Facebook Twitter GooglePlus KakaoStory NaverBand
  1. 홈
  2. 랜덤 이성 채팅
목록으로

웹뷰 작업시작

마스터욱 0 202 0 0 2017-02-10 16:15:28

 웹뷰 작업시작

 

 웹뷰 작업시작 

 

헤헤 "랜덤 이성 채팅" 그럴싸한가?

아이콘이 기본이라서 좀 없어 보이긴 하지만... 아이콘은 이걸 쓸 예정이다.

웹뷰 작업시작

어디서 많이 본거 같다... 그렇다... 어디서 많이 본거에서 색깔만 바꿨다... 나 지급 급해...

 

아래소스는 웹뷰에서 뒤로가기, 파일업로드 까지 되도록 모두 구현된 것이다.

 

MainActivity.java

 

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
package com.example.wook.myapplication;
 
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
 
public class MainActivity extends AppCompatActivity {
 
    private static final int FILECHOOSER_RESULTCODE   = 1;
    private final static int FILECHOOSER_LOLLIPOP_REQ_CODE = 2;
    private ValueCallback<Uri> mUploadMessage = null;
    private ValueCallback<Uri[]> filePathCallbackLollipop;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

//타이틀바 없애기
//requestWindowFeature(Window.FEATURE_NO_TITLE); //setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);

        setContentView(R.layout.activity_main);
        WebView WebView01 = (WebView) findViewById(R.id.webView01);
 
        WebView01.setWebChromeClient(new WebChromeClient(){
            // For Android 3.0-
            @SuppressWarnings("unused")
            public void openFileChooser(ValueCallback<Uri> uploadMsg) {
                mUploadMessage = uploadMsg;
                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                i.addCategory(Intent.CATEGORY_OPENABLE);
                //i.setType("image/*");
                i.setType("*/*");
                startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
            }
 
            // For Android 3.0+
            @SuppressWarnings("unused")
            public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {
                mUploadMessage = uploadMsg;
                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                i.addCategory(Intent.CATEGORY_OPENABLE);
                i.setType("*/*");
                startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
            }
 
            // For Android 4.1+
            @SuppressWarnings("unused")
            public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
                mUploadMessage = uploadMsg;
                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                i.addCategory(Intent.CATEGORY_OPENABLE);
                //i.setType("image/*");
                i.setType("*/*");
                startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
            }
 
            // For Android 5.0+
            public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
                                             WebChromeClient.FileChooserParams fileChooserParams) {
                Log.d("MainActivity", "5.0+");
                if (filePathCallbackLollipop != null) {
                    filePathCallbackLollipop.onReceiveValue(null);
                    filePathCallbackLollipop = null;
                }
                filePathCallbackLollipop = filePathCallback;
                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                i.addCategory(Intent.CATEGORY_OPENABLE);
                i.setType("image/*");
                startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_LOLLIPOP_REQ_CODE);
 
                return true;
            }
        });
 
 
 
        WebView01.setWebViewClient(new WebViewClient());
 
        WebSettings webSettings = WebView01.getSettings();
        webSettings.setJavaScriptEnabled(true);
 
        WebView01.loadUrl("http://story84.com/art/chating");
    }
 
//파일첨부
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
        if (requestCode == FILECHOOSER_RESULTCODE) {
            if (null == mUploadMessage)
                return;
            Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
            mUploadMessage.onReceiveValue(result);
            mUploadMessage = null;
        } else if (requestCode == FILECHOOSER_LOLLIPOP_REQ_CODE) {
            if (filePathCallbackLollipop == null) return ;
            filePathCallbackLollipop.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
            filePathCallbackLollipop = null;
        }
    }

public class BackPressCloseHandler { private long backKeyPressedTime = 0; private Toast toast; private Activity activity; public BackPressCloseHandler(Activity context) { this.activity = context; } public void onBackPressed() { if (System.currentTimeMillis() > backKeyPressedTime + 2000) { backKeyPressedTime = System.currentTimeMillis(); showGuide(); return; } if (System.currentTimeMillis() <= backKeyPressedTime + 2000) { activity.finish(); toast.cancel(); } } public void showGuide() { toast = Toast.makeText(activity, "뒤로 버튼을 한번 더 누르시면 종료됩니다.", Toast.LENGTH_SHORT); toast.show(); } } //뒤로가기 기능 BackPressCloseHandler backPressCloseHandler = new BackPressCloseHandler(this); @Override public void onBackPressed() { WebView WebView01 = (WebView) findViewById(R.id.webView01); //Log.d("wook", WebView01.getOriginalUrl()) if (WebView01.getOriginalUrl().equalsIgnoreCase(WebUrl)) { backPressCloseHandler.onBackPressed(); }else if(WebView01.canGoBack()){ WebView01.goBack(); }else{ backPressCloseHandler.onBackPressed(); } }
}
 
Colored by Color Scripter
cs


 

manifasts >  AndroidManifast.xml

퍼미션 두줄 추가~

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3.    package="com.jai.wook.jai">
  4.  
  5.     <uses-permission android:name="android.permission.INTERNET"></uses-permission>
  6.     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
  7.  
  8.  
  9.     <application
  10.        android:allowBackup="true"
  11.        android:icon="@mipmap/ic_launcher"
  12.        android:label="@string/app_name"
  13.        android:roundIcon="@mipmap/ic_launcher_round"
  14.        android:supportsRtl="true"
  15.        android:theme="@style/AppTheme">
  16.         <activity android:name=".MainActivity">
  17.             <intent-filter>
  18.                 <action android:name="android.intent.action.MAIN" />
  19.  
  20.                 <category android:name="android.intent.category.LAUNCHER" />
  21.             </intent-filter>
  22.         </activity>
  23.     </application>
  24.  
  25. </manifest>

 

 

res > layout > Activity_main.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:app="http://schemas.android.com/apk/res-auto"
  4. xmlns:tools="http://schemas.android.com/tools"
  5. android:layout_width="match_parent"
  6. android:layout_height="match_parent"
  7. tools:context=".MainActivity">
  8.  
  9. <WebView
  10.    android:layout_width="match_parent"
  11.    android:layout_height="match_parent"
  12.    android:id="@+id/webView01"
  13.    >
  14.  
  15.  
  16. </WebView>
  17.  
  18. </LinearLayout>

 

 

res > values > styles.xml

 

  1. <resources>
  2.  
  3.     <!-- Base application theme. -->
  4.     <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
  5.         <!-- Customize your theme here. -->
  6.         <item name="colorPrimary">@color/colorPrimary</item>
  7.         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
  8.         <item name="colorAccent">@color/colorAccent</item>
  9.  
  10.         <item name="windowActionBar">false</item>
  11.         <item name="windowNoTitle">true</item>
  12.     </style>
  13.  
  14. </resources>
  15.  
0
0

목록

Facebook Twitter GooglePlus KakaoStory NaverBand
0 Comments

비밀번호 확인

확인
댓글은 자신을 나타내는 '얼굴'입니다. *^^*
등록
자동등록방지 숫자를 순서대로 입력하세요.

댓글수정


번호 제목 이름 날짜 조회
  • 11
    [2] 랜덤 이성 채팅! 플레이 스토어 오픈! [2]
    마스터욱
    조회수 192   17-02-13 16:53
    마스터욱
    17-02-13 16:53
    192
  • 10
    플레이 스토어에 등록완료
    마스터욱
    조회수 220   17-02-11 01:12
    마스터욱
    17-02-11 01:12
    220
  • 9
    apk 배포 ㄱㄱ
    마스터욱
    조회수 162   17-02-10 21:48
    마스터욱
    17-02-10 21:48
    162
  • 8
    웹뷰 작업시작
    마스터욱
    조회수 203   17-02-10 16:15
    마스터욱
    17-02-10 16:15
    203
  • 7
    [1] 게시판 개발 [1]
    마스터욱
    조회수 189   17-02-10 00:25
    마스터욱
    17-02-10 00:25
    189
  • 6
    사진 첨부까지 완료
    마스터욱
    조회수 150   17-02-09 16:43
    마스터욱
    17-02-09 16:43
    150
  • 5
    대화 프로그램 개발
    마스터욱
    조회수 202   17-02-09 02:31
    마스터욱
    17-02-09 02:31
    202
  • 4
    본격적인 채팅 프로그램 개발 GOGO
    마스터욱
    조회수 209   17-02-08 06:35
    마스터욱
    17-02-08 06:35
    209
  • 3
    로그인 , 로그아웃, 정보수정 작업완료
    마스터욱
    조회수 143   17-02-08 05:56
    마스터욱
    17-02-08 05:56
    143
  • 2
    회원가입 페이지
    마스터욱
    조회수 150   17-02-07 18:28
    마스터욱
    17-02-07 18:28
    150
  • 1
    채팅 어플리케이션 개발시작 - 로그인 페이지
    마스터욱
    조회수 199   17-02-07 04:22
    마스터욱
    17-02-07 04:22
    199

Search

개인정보처리방침
마스터욱. All rights reserved.

Close

0 명 접속중
Time Loading...