This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Kind.swift | |
// ExamRealm1 | |
// | |
// Created by Sakura on 2018/01/22. | |
// Copyright © 2018年 Sakura. All rights reserved. | |
// | |
import Foundation | |
import RealmSwift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################## | |
# 入力ファイルから出力ファイルに書き出すRubyのプログラム | |
# 入力ファイルはテキストファイルである | |
# テキストはランダムに改行されている | |
# 文字がn文字を超えていたらn文字で改行する | |
# 実行方法はコマンドラインから次のように打ち込む。Ruby必須 | |
# $ ruby newline2.rb | |
################################################## | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################## | |
# 入力ファイル(Unix系OS Macも含む)から出力ファイル(Windows)に書き出すRubyのプログラム | |
# 入力ファイルはテキストファイルである | |
# テキストはランダムに改行されている | |
# 文字がn文字を超えていたらn文字で改行する | |
# 実行方法はコマンドラインから次のように打ち込む。Ruby必須 | |
# $ ruby newline.rb | |
################################################## | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright 2015-present Yukari Sakurai | |
* <p/> | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* <p/> | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* <p/> | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 環境が日本語ならtrue | |
*/ | |
public static boolean isJapan() { | |
String locale = MyApplication.getContext().getResources().getConfiguration().locale.getLanguage(); | |
Utils.logDebug("locale:" + locale); | |
return locale.equals("ja"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright 2015-present Yukari Sakurai | |
* <p/> | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* <p/> | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* <p/> | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int screenSize = getResources().getConfiguration().screenLayout & | |
Configuration.SCREENLAYOUT_SIZE_MASK; | |
switch (screenSize) { | |
case Configuration.SCREENLAYOUT_SIZE_LARGE: | |
Utils.showToast("Large screen"); | |
break; | |
case Configuration.SCREENLAYOUT_SIZE_NORMAL: | |
Utils.showToast("Normal screen"); | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 認証リクエストがあった場合の挙動 | |
@Override | |
public void onReceivedHttpAuthRequest(WebView view, | |
HttpAuthHandler handler, String host, String realm) { | |
// Android4.0の場合、hostにポート番号が付加されてしまうので、splitでポート番号を排除 | |
String[] up = view.getHttpAuthUsernamePassword( | |
host.split(":")[0], realm); | |
if (up != null && up.length == 2) { | |
handler.proceed(up[0], up[1]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mWebView.setDownloadListener(new DownloadListener() { | |
@Override | |
public void onDownloadStart(String url, String userAgent, | |
String contentDisposition, String mimetype, long contentLength) { | |
Intent intent = new Intent(Intent.ACTION_VIEW); | |
intent.setType(mimetype); | |
intent.setData(Uri.parse(url)); | |
startActivity(intent); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void showTimeDialog() { | |
final Calendar calendar = Calendar.getInstance(); | |
final int hour = calendar.get(Calendar.HOUR_OF_DAY); | |
final int minute = calendar.get(Calendar.MINUTE); | |
final TimePickerDialog timePickerDialog = new TimePickerDialog(this, | |
new TimePickerDialog.OnTimeSetListener() { | |
@Override | |
public void onTimeSet(TimePicker view, int hourOfDay, int minute) { |
NewerOlder