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
| /** | |
| * Returns a list containing the results of applying the given [transform] function | |
| * to each element in the original collection. | |
| * | |
| * @sample samples.collections.Collections.Transformations.map | |
| */ | |
| public inline fun <T, R> Iterable<T>.map(transform: (T) -> R): List<R> { | |
| return mapTo(ArrayList<R>(collectionSizeOrDefault(10)), transform) | |
| } |
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
| package com.example.composetutorial | |
| import SampleData | |
| import android.content.res.Configuration | |
| import android.os.Bundle | |
| import android.widget.Space | |
| import androidx.activity.ComponentActivity | |
| import androidx.activity.compose.setContent | |
| import androidx.compose.foundation.Image | |
| import androidx.compose.foundation.border |
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
| import android.content.Intent | |
| import android.os.Bundle | |
| import android.os.Handler | |
| import android.os.Looper | |
| import androidx.appcompat.app.AppCompatActivity | |
| class SplashActivity : AppCompatActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) |
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
| https://developer.android.com/training/data-storage/room/index.html#java | |
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
| public class SplashActivity extends AppCompatActivity { | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_splash); | |
| Intent intent = new Intent(SplashActivity.this, SchoolDiaryMainActivity.class); | |
| startActivity(intent); | |
| finish(); |
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
| @Override | |
| public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { | |
| super.onCreateOptionsMenu(menu, inflater); | |
| inflater.inflate(R.menu.menu_quiz, menu); | |
| int positionOfMenuItem = 0; | |
| MenuItem item = menu.getItem(positionOfMenuItem); | |
| SpannableString s = new SpannableString("Submit"); | |
| s.setSpan(new ForegroundColorSpan(Color.BLACK), 0, s.length(), 0); | |
| item.setTitle(s); |
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
| private void bindView(View view) { | |
| recyclerView = view.findViewById(R.id.recyclerview); | |
| mLayoutManager = new LinearLayoutManager(context); | |
| ((LinearLayoutManager) mLayoutManager).setOrientation(LinearLayoutManager.HORIZONTAL); | |
| mAdapter = new QuizQuestionAdap(context, this); | |
| SnapHelper snapHelper = new PagerSnapHelper(); | |
| snapHelper.attachToRecyclerView(recyclerView); | |
| recyclerView.setLayoutManager(mLayoutManager); | |
| recyclerView.setAdapter(mAdapter); |
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
| .addSnapshotListener(new EventListener<QuerySnapshot>() { | |
| @Override | |
| public void onEvent(@Nullable QuerySnapshot value, | |
| @Nullable FirebaseFirestoreException e) { | |
| if (e!= null){ | |
| Log.w(TAG, "listen failed "+e); | |
| return; | |
| } | |
| List<MessageModel> messageList = new ArrayList<>(); | |
| for (DocumentSnapshot doc : value){ |
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
| private void loadRecentWords() { | |
| db.collection("TwordColl") | |
| .orderBy("time", Query.Direction.DESCENDING) | |
| .limit(10) | |
| .addSnapshotListener(new EventListener<QuerySnapshot>() { | |
| @Override | |
| public void onEvent(@Nullable QuerySnapshot value, | |
| @Nullable FirebaseFirestoreException e) { | |
| if (e!= null){ | |
| Log.w(TAG, "listen failed "+e); |
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
| https://stackoverflow.com/questions/37349845/is-it-possible-to-put-a-constraintlayout-inside-a-scrollview |