신기성

pushing test done

......@@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/NoActionBar">
<activity android:name=".DetailActivity"></activity>
<activity android:name=".PushingActivity"></activity>
<activity android:name=".DetailActivity" />
<activity android:name=".InfoActivity" />
<activity android:name=".FavoritesActivity" />
<activity android:name=".RecommendActivity" />
......@@ -27,6 +28,8 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
......
package com.example.vip
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ImageView
import android.widget.RatingBar
import android.widget.TextView
import kotlinx.android.synthetic.main.activity_info.*
class InfoActivity : AppCompatActivity() {
......@@ -22,5 +24,13 @@ class InfoActivity : AppCompatActivity() {
profilImage.setImageResource(R.drawable.image01)
//temp
//pushing test start
InfoButtonSettings.setOnClickListener {
var intent = Intent(this, PushingActivity::class.java)
startActivity(intent)
}
//pushing test end
}
}
......
package com.example.vip
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import com.google.firebase.messaging.FirebaseMessaging
import kotlinx.android.synthetic.main.activity_pushing.*
class PushingActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_pushing)
subscribeButton.setOnClickListener {
Log.d(TAG, "Subscribing to weather topic")
// [START subscribe_topics]
FirebaseMessaging.getInstance().subscribeToTopic("news")
.addOnCompleteListener { task ->
var msg = getString(R.string.msg_subscribed)
if (!task.isSuccessful) {
msg = getString(R.string.msg_subscribe_failed)
}
Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
}
// [END subscribe_topics]
}
}
companion object {
private const val TAG = "PushingActivity"
}
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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=".PushingActivity">
<Button
android:id="@+id/subscribeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="134dp"
android:layout_marginTop="332dp"
android:layout_marginEnd="189dp"
android:layout_marginBottom="351dp"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -19,5 +19,7 @@
<string name="msg_token_fmt" translatable="false">InstanceID Token: %s</string>
<string name="msg_subscribed" translatable="false">success!</string>
<string name="msg_subscribe_failed" translatable="false">fail!</string>
</resources>
......