forked from ganadist/AndroidApiDemo
-
Notifications
You must be signed in to change notification settings - Fork 3
Checking out every service of the project #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lynring24
wants to merge
34
commits into
kotlin-korea:next
Choose a base branch
from
lynring24:next
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
18a57d9
convert Marquee java to kt and apply kotlin plugin
lynring24 7132a98
convert text.LogTextBox1 java to kt
lynring24 9d24dc9
convert LogTextBox && Link java to kt
lynring24 92054df
found </a> missing
lynring24 48bfdd1
modified a depreciated Html.fromHtml() by version
lynring24 eb2138c
convert SeekBar java to kt
lynring24 2d22fac
converted AlarmController java to kt
lynring24 4baef90
removed comment
lynring24 01b8e36
used by lazy for t2(textView)
lynring24 b1d8c18
used lazy for t3 (textView)
lynring24 fed790f
used lazy for val t4
lynring24 88ec3ae
used lazy to init var mText and removed !!.apend
lynring24 3793084
use Kotlin synthetic property instead of java calendar.set()
lynring24 f965748
apply plugin: 'kotlin-android-extensions'
lynring24 b3a28ad
used extention code instead of findViewById
lynring24 1ae905e
convert AlarmService to kt
lynring24 aa830bf
FragmentAlertDialog converted to kt
lynring24 294f902
simplify DialogInterface.OnClickListener with Lamda
lynring24 5c595f5
add string resource for Fragment Alert Dialog msg
lynring24 9fd3753
used extention code instead of findViewById
lynring24 957b74d
applied lamda to onClickListener
lynring24 fe87cba
used kotlin properies instead
lynring24 829252c
fixed FragmentAlertDialog::doPositiceClick to (activity as Fragment) …
lynring24 dad4a72
Convert AlarmService_service to kotlin
lynring24 94cabb8
Convert IsolatedService to Kotlin
lynring24 f186edd
Convert IsolatedService2 to Kotlin
lynring24 df13761
Convert LocalService to Kotlin
lynring24 5f54bf2
Import Context
lynring24 45480b8
Convert LocalServiceActivies to Kotlin
lynring24 61d55d8
Convert NotificationBackgroundService to Kotlin
lynring24 a5e599a
changed to extension code
lynring24 c980368
Convert NotifyingController to Kotlin
lynring24 a0398a3
Convert NotifyingService to Kotlin
lynring24 9c90694
Convert ServiceStartArguments to Kotlin
lynring24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
84 changes: 0 additions & 84 deletions
84
mobile/src/main/java/com/example/android/apis/text/Link.java
This file was deleted.
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
mobile/src/main/java/com/example/android/apis/text/Link.kt
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Copyright (C) 2007 The Android Open Source Project | ||
* | ||
* 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.example.android.apis.text | ||
|
||
import com.example.android.apis.R | ||
|
||
import android.app.Activity | ||
import android.graphics.Typeface | ||
import android.os.Bundle | ||
import android.text.Html | ||
import android.text.SpannableString | ||
import android.text.Spanned | ||
import android.text.method.LinkMovementMethod | ||
import android.text.style.StyleSpan | ||
import android.text.style.URLSpan | ||
import android.view.View | ||
import android.widget.TextView | ||
|
||
class Link : Activity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
setContentView(R.layout.link) | ||
|
||
// text1 shows the android:autoLink property, which | ||
// automatically linkifies things like URLs and phone numbers | ||
// found in the text. No java code is needed to make this | ||
// work. | ||
|
||
// text2 has links specified by putting <a> tags in the string | ||
// resource. By default these links will appear but not | ||
// respond to user input. To make them active, you need to | ||
// call setMovementMethod() on the TextView object. | ||
|
||
val t2 = findViewById<View>(R.id.text2) as TextView | ||
t2.movementMethod = LinkMovementMethod.getInstance() | ||
|
||
// text3 shows creating text with links from HTML in the Java | ||
// code, rather than from a string resource. Note that for a | ||
// fixed string, using a (localizable) resource as shown above | ||
// is usually a better way to go; this example is intended to | ||
// illustrate how you might display text that came from a | ||
// dynamic source (eg, the network). | ||
|
||
val t3 = findViewById<View>(R.id.text3) as TextView | ||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { | ||
t3.text = Html.fromHtml( | ||
"<b>text3: Constructed from HTML programmatically.</b> Text with a " + | ||
"<a href=\"http://www.google.com\">link</a> " + | ||
"created in the Java source code using HTML.", Html.FROM_HTML_MODE_LEGACY) | ||
} | ||
else{ | ||
t3.text = Html.fromHtml( | ||
"<b>text3: Constructed from HTML programmatically.</b> Text with a " + | ||
"<a href=\"http://www.google.com\">link</a> " + | ||
"created in the Java source code using HTML.") | ||
} | ||
t3.movementMethod = LinkMovementMethod.getInstance() | ||
|
||
// text4 illustrates constructing a styled string containing a | ||
// link without using HTML at all. Again, for a fixed string | ||
// you should probably be using a string resource, not a | ||
// hardcoded value. | ||
|
||
val ss = SpannableString( | ||
"text4: Manually created spans. Click here to dial the phone.") | ||
|
||
ss.setSpan(StyleSpan(Typeface.BOLD), 0, 30, | ||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) | ||
ss.setSpan(URLSpan("tel:4155551212"), 31 + 6, 31 + 10, | ||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) | ||
|
||
val t4 = findViewById<View>(R.id.text4) as TextView | ||
t4.text = ss | ||
t4.movementMethod = LinkMovementMethod.getInstance() | ||
} | ||
} |
64 changes: 0 additions & 64 deletions
64
mobile/src/main/java/com/example/android/apis/text/LogTextBox.java
This file was deleted.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
mobile/src/main/java/com/example/android/apis/text/LogTextBox.kt
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (C) 2007 The Android Open Source Project | ||
* | ||
* 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.example.android.apis.text | ||
|
||
import android.widget.TextView | ||
import android.content.Context | ||
import android.text.method.ScrollingMovementMethod | ||
import android.text.method.MovementMethod | ||
import android.text.Editable | ||
import android.util.AttributeSet | ||
|
||
/** | ||
* This is a TextView that is Editable and by default scrollable, | ||
* like EditText without a cursor. | ||
|
||
* | ||
* | ||
* **XML attributes** | ||
* | ||
* | ||
* See | ||
* [TextView Attributes][android.R.styleable.TextView], | ||
* [View Attributes][android.R.styleable.View] | ||
*/ | ||
class LogTextBox @JvmOverloads constructor(context: Context, attrs: AttributeSet ?= null, defStyle: Int = android.R.attr.textViewStyle) : TextView(context, attrs, defStyle) { | ||
|
||
override fun getDefaultMovementMethod(): MovementMethod { | ||
return ScrollingMovementMethod.getInstance() | ||
} | ||
|
||
override fun getText(): Editable { | ||
return super.getText() as Editable | ||
} | ||
|
||
override fun setText(text: CharSequence, type: TextView.BufferType) { | ||
super.setText(text, TextView.BufferType.EDITABLE) | ||
} | ||
} |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,23 +28,18 @@ | |
* to which text is appended. | ||
* | ||
*/ | ||
public class LogTextBox1 extends Activity { | ||
|
||
private LogTextBox mText; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
setContentView(R.layout.log_text_box_1); | ||
|
||
mText = (LogTextBox) findViewById(R.id.text); | ||
|
||
Button addButton = (Button) findViewById(R.id.add); | ||
addButton.setOnClickListener(new View.OnClickListener() { | ||
|
||
public void onClick(View v) { | ||
mText.append("This is a test\n"); | ||
} }); | ||
class LogTextBox1 : Activity() { | ||
|
||
private var mText: LogTextBox? = null | ||
|
||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
setContentView(R.layout.log_text_box_1) | ||
|
||
mText = findViewById<View>(R.id.text) as LogTextBox | ||
val addButton = findViewById<View>(R.id.add) as Button | ||
addButton.setOnClickListener { mText!!.append("This is a test\n") } | ||
} | ||
} | ||
|
This file contains hidden or 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
4 changes: 2 additions & 2 deletions
4
mobile/src/main/java/com/example/android/apis/text/_index.html
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<dl> | ||
<dt><a href="Link.html">Linkify</a></dt> | ||
<dd>Demonstrates the <a | ||
<dd>Demonstrates the <a | ||
href="../../../../../../../../../reference/android/text/util/Linkify.html"><code>Linkify</code> | ||
class, which converts URLs in a block of text into hyperlinks. </dd> | ||
class, which converts URLs in a block of text into hyperlinks.</a></dd> | ||
</dl> | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lazy
를 이용해서 findViewById 를 해보는 방법도 추천드려요