게시판 답변

10 글 보임 - 21 에서 30 까지 (총 54 중에서)
  • 글쓴이
  • mimoon
    키 마스터

      Activity Default는 스택이 쌓이지 않음. 그러므로 Layout에서도 history true 기본이 적용되지 않음.
      다음 코드를 넣어야 함

      
      @Override
          public boolean onKeyDown(int keyCode, KeyEvent event) {
              WebView view = (WebView) findViewById(R.id.crawl_wvLayout);
              if ((keyCode == KeyEvent.KEYCODE_BACK) && view.canGoBack()) {
                  view.goBack();
                  return true;
              }
              return super.onKeyDown(keyCode, event);
          }
      
      mimoon
      키 마스터

        activity_crawl_main의 디폴트
        activity_main과 manifest와의 상관 관계
        균형 깨지면 error

        
        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:context=".CrawlActivity">
        
            <FrameLayout
                android:id="@+id/fl_activity_main"
                android:layout_width="match_parent"
                android:layout_height="match_parent">
            <WebView
                android:id="@+id/crawl_wvLayout"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                tools:ignore="MissingConstraints" />
            </FrameLayout>
        
        </RelativeLayout>
        
        mimoon
        키 마스터

          이상적인 Jsoup

          
           // 2021-4-31 Jsoup through Thread
              // 2021-04-30
              // 2nd
              // URL Address
          
              String url = "https://www.biblegateway.com/verse/en/exodus%203%3A16";
              //String url = "https://mimoonchurch.net/myday.html";
          
              Title AsyncTask;
              // 2021-04-30
              //@Override
              private class Title extends android.os.AsyncTask<Void, Void, Void> {
                  String title;
                  String element;
                  @Override
                  protected Void doInBackground(Void... voids) {
                      try {
                          // Connect to the web site
                          Document document = Jsoup.connect(url).get();
                          // Get the html document title
                          // point line
                           title = document.title();
                          // document.body();
                          // Elements status = document.select("#status"); //h1.id Exporting good
                          // title = status.text(); // h1.id Exporting good
                          //Elements Title = document.select("title");
                          //title = document.select("h1");
                          // 2021-4-31 gateway
                         // Elements pList = document.select("div.singleverse > div.singleverse-text");
                         // String tmp="";
                         // for (Element li : pList) {
                         //     tmp = tmp + li.text()+"\n";
                         //     Log.i("test","ok:"+ tmp);
                             // System.out.printIn(
                              //        e.select("span.item_num").get(0).html() +
                              //                e.select("span.item_title").get(0).html()
                              //);
                          //}
                      } catch (IOException e) {
                          e.printStackTrace();
                      }
                      return null;
                  }
                  protected void onPreExecute() {
                      super.onPreExecute();
                      mProgressDialog = new ProgressDialog(CrawlActivity.this);
                      mProgressDialog.setTitle("Power Bible engine 3.5c1");
                      mProgressDialog.setMessage(url);
                      mProgressDialog.setIndeterminate(false);
                      mProgressDialog.show();
                  }
                  @Override
                  protected void onPostExecute(Void result) {
                      // Set title into TextView
                      TextView txttitle = (TextView) findViewById(R.id.text_blank);
                      txttitle.setText(title);
                      // txttitle.setText(title);
                      mProgressDialog.dismiss();
                  }
              }
          
          
          mimoon
          키 마스터

            창 전환 효과 부분:

            
              ProgressDialog mProgressDialog;
            
                private class HelloWebViewClient extends WebViewClient {
                    @Override
                    public boolean shouldOverrideUrlLoading(WebView view, String url) {
                        view.setVisibility(View.GONE);
                        mProgressDialog.setTitle("Loading");
                        mProgressDialog.show();
                        mProgressDialog.setMessage("페이지를 불러옵니다");
                        return false;
                    }
            
                    @Override
                    public void onPageFinished(WebView view, String url) {
                        mProgressDialog.dismiss();
                        animate(view);
                        view.setVisibility(View.VISIBLE);
                        super.onPageFinished(view,url);
                    }
                }
            
                private void animate(final WebView view) {
                    Animation anim = AnimationUtils.loadAnimation(getBaseContext(),
                            android.R.anim.slide_in_left);
                    view.startAnimation(anim);
                }
            
            
            mimoon
            키 마스터
              mimoon
              키 마스터

                이상적 소스 (그러나 느림)
                activity_main.xml 내용

                
                <?xml version="1.0" encoding="utf-8"?>
                <androidx.constraintlayout.widget.ConstraintLayout
                    xmlns:android="http://schemas.android.com/apk/res/android"
                    xmlns:tools="http://schemas.android.com/tools"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" tools:context=".MainActivity">
                
                    <WebView
                        android:id="@+id/wvLayout"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        tools:ignore="MissingConstraints" />
                </androidx.constraintlayout.widget.ConstraintLayout>
                
                

                AndroidManifest.xml

                
                <?xml version="1.0" encoding="utf-8"?>
                <manifest xmlns:android="http://schemas.android.com/apk/res/android"
                    package="com.mimoonchurch.powerbible">
                    <uses-permission android:name="android.permission.INTERNET"/>
                    <application
                        android:allowBackup="true"
                        android:icon="@mipmap/ic_launcher"
                        android:label="@string/app_name"
                        android:roundIcon="@mipmap/ic_launcher_round"
                        android:supportsRtl="true"
                        android:theme="@style/Theme.Powerbible">
                        <activity android:name=".MainActivity">
                            <intent-filter>
                                <action android:name="android.intent.action.MAIN" />
                
                                <category android:name="android.intent.category.LAUNCHER" />
                            </intent-filter>
                        </activity>
                    </application>
                
                </manifest>
                

                strings.xml 내용에:

                
                <resources>
                    <string name="app_name">파워바이블</string>
                </resources>
                

                themes.xml 내용에:

                
                <resources xmlns:tools="http://schemas.android.com/tools">
                    <!-- Base application theme. -->
                    <style name="Theme.Powerbible" parent="Theme.AppCompat.Light.NoActionBar">
                        <!-- Primary brand color. -->
                        <item name="colorPrimary">@color/purple_500</item>
                        <item name="colorPrimaryVariant">@color/purple_700</item>
                        <item name="colorOnPrimary">@color/white</item>
                        <!-- Secondary brand color. -->
                        <item name="colorSecondary">@color/teal_200</item>
                        <item name="colorSecondaryVariant">@color/teal_700</item>
                        <item name="colorOnSecondary">@color/black</item>
                        <!-- Status bar color. -->
                        <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
                        <!-- Customize your theme here. -->
                    </style>
                </resources>
                

                MainActivity.java 내용에

                
                package com.mimoonchurch.powerbible;
                import android.app.Activity;
                import android.app.ProgressDialog;
                import android.os.Bundle;
                import android.view.KeyEvent;
                import android.view.View;
                import android.view.animation.Animation;
                import android.view.animation.AnimationUtils;
                import android.webkit.WebView;
                import android.webkit.WebViewClient;
                
                public class MainActivity extends Activity {
                    ProgressDialog mProgressDialog;
                
                    private class HelloWebViewClient extends WebViewClient {
                        @Override
                        public boolean shouldOverrideUrlLoading(WebView view, String url) {
                            view.setVisibility(View.GONE);
                            mProgressDialog.setTitle("Loading");
                            mProgressDialog.show();
                            mProgressDialog.setMessage("Loading " + url);
                            return false;
                        }
                
                        @Override
                        public void onPageFinished(WebView view, String url) {
                            mProgressDialog.dismiss();
                            animate(view);
                            view.setVisibility(View.VISIBLE);
                            super.onPageFinished(view, url);
                        }
                    }
                
                    private void animate(final WebView view) {
                        Animation anim = AnimationUtils.loadAnimation(getBaseContext(),
                                android.R.anim.slide_in_left);
                        view.startAnimation(anim);
                    }
                
                    @Override
                    public boolean onKeyDown(int keyCode, KeyEvent event) {
                        WebView view = (WebView) findViewById(R.id.wvLayout);
                        if ((keyCode == KeyEvent.KEYCODE_BACK) && view.canGoBack()) {
                            view.goBack();
                            return true;
                        }
                        return super.onKeyDown(keyCode, event);
                    }
                
                    /** Called when the activity is first created. */
                    @Override
                    public void onCreate(Bundle savedInstanceState) {
                        super.onCreate(savedInstanceState);
                        setContentView(R.layout.activity_main);
                        mProgressDialog = new ProgressDialog(this);
                        WebView webView = (WebView) findViewById(R.id.wvLayout);
                        webView.setVerticalScrollBarEnabled(false);
                        webView.setHorizontalScrollBarEnabled(false);
                        webView.getSettings().setJavaScriptEnabled(true);
                        webView.loadUrl("https://mimoonchurch.net/");
                        webView.setWebViewClient(new HelloWebViewClient());
                    }
                }
                
                mimoon
                키 마스터

                  기능하지 않았던 원인:

                  web.loadUrl로 선언 된 WebView와 일치를 안 시켰기 때문.

                  아래 코드의 경우

                  
                  public void onBackPressed() {
                  if (webView.canGoBack()) webView.goBack();
                  else finish();
                  }
                  

                  webView로는 작동을 안 하지만(다른 개체로 인식되므로)
                  아래와 같이 web으로 인식되는 것은 web.loadUrl으로 선언된 url과 일치하기 때문
                  상기의 다양한 코드를 사용할 수 있음

                  
                          public void onBackPressed() {
                          if (web.canGoBack()) web.goBack();
                          else finish();
                      }
                  
                  mimoon
                  키 마스터

                    간단하게(기능하지 않음)

                    
                        private WebView mWebView;
                    
                        public void onBackPressed() {
                            if(mWebView.canGoBack()){
                                mWebView.goBack();
                            }else{
                                super.onBackPressed();
                            }
                        }
                    
                    mimoon
                    키 마스터

                      일반적인

                      
                      import * as React from 'react';
                      import { WebView } from 'react-native-webview';
                      
                      export default class App extends React.Component {
                        render() {
                          return <WebView source={{ uri: 'https://mimoonchurch.net' }} style={{ marginTop: 20 }} />;
                        }
                      }
                      
                      답변: 비공개: [css] astra 최종 css #14086
                      mimoon
                      키 마스터

                        비 사용 코드(주로 Content View Code)

                        
                        /* intro page-daily montage---
                        h4.pt-cv-title a {
                        color: #777;
                        margin-top: 20px;
                        margin-bottom: 20px;
                        	font-size: 24px;
                        }
                        div.pt-cv-wrapper p {
                        	margin: 0 0 1em 0;
                          line-height: 2em;
                           font-size: 18px;
                            color: #777;
                        	text-align: justify;
                        		text-justify: inter-character;
                        	//word-break: normal;
                        word-wrap: break-word;
                          word-break: keep-all;
                        	padding-left:15px;
                        	padding-right:15px;
                        }
                        #pt-cv-view-b300c7drtp div.pt-cv-content {
                           color: #777;
                        }
                        */
                        
                        /*-----
                        .breadcrumbs  span[property=\"name\"] {
                            max-width: 270px;
                            display: inline-block;
                            padding: 0;
                            margin-top: -3px;
                            vertical-align: middle;
                            white-space: nowrap;
                            overflow: hidden;
                            text-overflow: ellipsis;
                        }
                        
                        -----
                        -----
                        .breadcrumb span[property=\"name\"] {
                            display:none;
                        }
                        -----*/
                        
                        /* forum 내 freshness 수정*/
                        /* freshness name-avatar 세로*/
                        /* except forum description info 고려*/
                        /*li.bbp-forum-freshness a.bbp-author-name, a.bbp-author-avatar, span.bbp-topic-freshness-author {
                        	display: block;
                        	margin: 0;
                        	padding:0;
                        }*/
                        
                        /**** #bbpress-forums ul.bbp-forums span.floatleft {
                        float: center;
                        }***/
                        /****
                        div.bbp-topic-meta {
                        float: left;
                        line-height: 100%
                        display:inline-block;
                        vertical-align:left;
                        }****/
                        
                        /*
                        .pt-cv-view h4.pt-cv-title{
                        font-family: 'Nanum Myeongjo',serif;
                        	//font-style: normal;
                        }
                        
                        .pt-cv-view h4.pt-cv-title{
                        font-family: 'PT Sans';
                        unicode-range: U+0370-03FF;
                        }
                        */
                        
                        
                      10 글 보임 - 21 에서 30 까지 (총 54 중에서)