ヤフオクをつくろう 機能要件

まず必要な機能とDBのテーブル

ユーザー(ユーザー名、住所、連絡先、)
出品(商品名、説明文、最低価格、即決価格)
入札(入札者、入札価格)
落札(落札者、落札価格)
評価(評価対象者、評価)

ユーザー登録、出品、評価はいつものパターンですが、問題は入札のところですね。
順番につくっていきましょう。
まずは、残り時間からつくっていきます。

iOSでtopに戻る

ViewController.swift

class ViewController: UIViewController {
    
    @IBAction func unwindToTop(seque: UIStoryboardSegue){
        
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

Main.storyboard
control でexitにもっていき、unwindToTopを設定する

google search consoleでrobots.txtとsitemap.xmlを管理

まずsitemap.xmlを作る
changefreqで更新頻度
lastmodifyを動的に出したいが、ここではなし

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<!--  created with free sitemap generation system www.sitemapxml.jp  --> 
<url>
  <loc>http://online-shopping.cloud/</loc>
  <priority>1.0</priority>
  <changefreq>always</changefreq>
</url>
<url>
  <loc>http://online-shopping.cloud/ranking.php</loc>
  <priority>0.9</priority>
  <changefreq>daily</changefreq>
</url>
<url>
  <loc>http://online-shopping.cloud/tweet.php</loc>
  <priority>0.8</priority>
  <changefreq>always</changefreq>
</url>
<url>
  <loc>http://online-shopping.cloud/model.php</loc>
  <priority>0.5</priority>
  <changefreq>hourly</changefreq>
</url>
</urlset>

次にrobots.txtでsitemap.xmlを知らせる

User-agent: *Sitemap: http://online-shopping.cloud/sitemap.xml

google search console
ダッシュボードのクロール -> robots.txt テスター

タイトルとurlを表示する

private WebView myWebView;
    private EditText urlText;

    private static final String INITIAL_WEBSITE = "http://hpscript.com/blog/";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myWebView = (WebView) findViewById(R.id.myWebView);
        urlText = (EditText) findViewById(R.id.urlText);

        myWebView.getSettings().setJavaScriptEnabled(true);
        myWebView.setWebViewClient(new WebViewClient(){
            @Override
            public void onPageFinished(WebView view, String url){
                getSupportActionBar().setSubtitle(view.getTitle());
                urlText.setText(url);
            }
        });
        myWebView.loadUrl(INITIAL_WEBSITE);
    }

webViewを表示する

webViewにブログを表示させます。

public class MainActivity extends AppCompatActivity {

    private WebView myWebView;

    private static final String INITIAL_WEBSITE = "http://hpscript.com/blog/";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myWebView = (WebView) findViewById(R.id.myWebView);

        myWebView.loadUrl(INITIAL_WEBSITE);
    }
}

WebViewとは?

oracle:https://docs.oracle.com/javase/jp/8/javafx/api/javafx/scene/web/WebView.html
———–
WebViewは、WebEngineを管理し、その内容を表示するNodeです。関連するWebEngineは構築時に自動的に作成され、後で変更できません。WebViewにより、マウス・イベントと一部のキーボード・イベントが処理されて、スクロールが自動的に管理されるため、それをScrollPaneに配置する必要はありません。
WebViewオブジェクトは、FXスレッドからのみ作成およびアクセスする必要があります。

Android Browser

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <EditText
            android:layout_weight="1"
            android:id="@+id/urlText"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            />
        <Button
            android:text="Browse"
            android:onClick="showWebsite"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />

    </LinearLayout>

    <WebView
        android:layout_weight="1"
        android:id="@+id/myWebView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        ></WebView>

</LinearLayout>

Handlerの使い方

new Handler().postDelayed(<Runnable object>,<m seconds>);
private final Runnable func= new Runnable(){
	@Override
	public void run(){
		
	}
};
private Handler mHandler = new Handler();
private Runnable updateText;

@Override
protected void onCreate(Bundle savedInstanceState){
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);

	updateText = new Runnable(){
		public void run(){
			TextView text = (TextView) findViewById(R.id.count);
			Integer count = Integer.valueOf(text.getText().toString());
			count += 1;
			text.setText(count.toString());
			mHandler.removeCallbacks(updateText);
			mHandler.postDelayed(updateText, 1000);
		}
	};
	mHandler.postDelayed(updateText, 1000);
}