diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2019-03-24 03:41:44 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2019-03-24 03:41:44 +0900 |
commit | f783d6ab9afa579c91e73305ffdd66df60ce5efa (patch) | |
tree | 461b32a57322b4c4206c12233a8091cdb0341011 /app/src | |
parent | 271adf8b8e1535d2af0b137c55a24fae0d252cb7 (diff) | |
download | SmileEssence-f783d6ab9afa579c91e73305ffdd66df60ce5efa.tar.gz |
appcompat
Diffstat (limited to 'app/src')
31 files changed, 88 insertions, 88 deletions
diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.kt b/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.kt index 58125024..9659d59f 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.kt +++ b/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.kt @@ -18,7 +18,6 @@ import net.lacolaco.smileessence.World import net.lacolaco.smileessence.data.PageInfo import net.lacolaco.smileessence.entity.Tweet import net.lacolaco.smileessence.entity.User -import net.lacolaco.smileessence.twitter.TwitterTaskException import net.lacolaco.smileessence.twitter.getTweetAsync import net.lacolaco.smileessence.twitter.getUserAsync import net.lacolaco.smileessence.util.bg @@ -212,7 +211,7 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) setSupportActionBar(toolbar) - pagerAdapter = MainFragmentPagerAdapter(world, view_pager, fragmentManager) + pagerAdapter = MainFragmentPagerAdapter(world, view_pager, supportFragmentManager) view_pager.offscreenPageLimit = pagerAdapter.count view_pager.adapter = pagerAdapter view_pager.setCurrentItem(world.pages.indexOfFirst { it is PageInfo.TweetsPageInfo }, false) diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/OAuthActivity.kt b/app/src/main/java/net/lacolaco/smileessence/activity/OAuthActivity.kt index c9d9ba1a..ecffaa0b 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/OAuthActivity.kt +++ b/app/src/main/java/net/lacolaco/smileessence/activity/OAuthActivity.kt @@ -1,11 +1,10 @@ package net.lacolaco.smileessence.activity import android.annotation.SuppressLint -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import android.content.Intent import android.os.Bundle import android.os.Parcelable -import androidx.appcompat.app.AppCompatActivity import android.text.Editable import android.text.TextWatcher import android.widget.Toast @@ -38,7 +37,7 @@ class OAuthActivity : AppCompatActivity() { Toast.makeText(this@OAuthActivity, "Could not get a request token (${e.message})", Toast.LENGTH_LONG).show() - setResult(Activity.RESULT_CANCELED) + setResult(AppCompatActivity.RESULT_CANCELED) finish() } } @@ -69,7 +68,7 @@ class OAuthActivity : AppCompatActivity() { Toast.makeText(this@OAuthActivity, "Could not get an access token (${e.message})", Toast.LENGTH_LONG).show() - setResult(Activity.RESULT_CANCELED) + setResult(AppCompatActivity.RESULT_CANCELED) finish() return@launchUi } diff --git a/app/src/main/java/net/lacolaco/smileessence/util/IntentHelper.kt b/app/src/main/java/net/lacolaco/smileessence/util/IntentHelper.kt index 53045d1f..b334f717 100644 --- a/app/src/main/java/net/lacolaco/smileessence/util/IntentHelper.kt +++ b/app/src/main/java/net/lacolaco/smileessence/util/IntentHelper.kt @@ -1,6 +1,6 @@ package net.lacolaco.smileessence.util -import android.app.Fragment +import androidx.fragment.app.Fragment import android.content.ActivityNotFoundException import android.content.Context import android.content.Intent @@ -18,6 +18,6 @@ fun Context.browse(uri: Uri, type: String? = null) { fun Context.browse(uri: String, type: String? = null) = browse(Uri.parse(uri), type) -fun Fragment.browse(uri: Uri, type: String? = null) = activity.browse(uri, type) +fun Fragment.browse(uri: Uri, type: String? = null) = activity!!.browse(uri, type) -fun Fragment.browse(uri: String, type: String? = null) = activity.browse(uri, type) +fun Fragment.browse(uri: String, type: String? = null) = activity!!.browse(uri, type) diff --git a/app/src/main/java/net/lacolaco/smileessence/util/SystemServiceHelper.kt b/app/src/main/java/net/lacolaco/smileessence/util/SystemServiceHelper.kt index 3fb0ac4d..765aec58 100644 --- a/app/src/main/java/net/lacolaco/smileessence/util/SystemServiceHelper.kt +++ b/app/src/main/java/net/lacolaco/smileessence/util/SystemServiceHelper.kt @@ -1,6 +1,6 @@ package net.lacolaco.smileessence.util -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import android.content.ClipData import android.content.ClipboardManager import android.content.Context @@ -19,7 +19,7 @@ object SystemServiceHelper { } fun copyToClipboard(context: Context, label: String, text: String) { - val manager = context.getSystemService(Activity.CLIPBOARD_SERVICE) as ClipboardManager + val manager = context.getSystemService(AppCompatActivity.CLIPBOARD_SERVICE) as ClipboardManager manager.primaryClip = ClipData.newPlainText(label, text) } } diff --git a/app/src/main/java/net/lacolaco/smileessence/view/Confirmation.kt b/app/src/main/java/net/lacolaco/smileessence/view/Confirmation.kt index 587e471c..91c71264 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/Confirmation.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/Confirmation.kt @@ -1,6 +1,6 @@ package net.lacolaco.smileessence.view -import android.app.Fragment +import androidx.fragment.app.Fragment import android.content.Context import androidx.appcompat.app.AlertDialog import net.lacolaco.smileessence.R @@ -18,7 +18,7 @@ fun Context.confirm(resId: Int, vararg rest: Any, onOk: () -> Unit) = confirm(getString(resId, *rest), onOk) fun Fragment.confirm(resId: Int, vararg rest: Any, onOk: () -> Unit) = - activity.confirm(resId, rest = *rest, onOk = onOk) + activity!!.confirm(resId, rest = *rest, onOk = onOk) fun Fragment.confirm(text: String, onOk: () -> Unit) = - activity.confirm(text, onOk = onOk) + activity!!.confirm(text, onOk = onOk) diff --git a/app/src/main/java/net/lacolaco/smileessence/view/DialogHelper.kt b/app/src/main/java/net/lacolaco/smileessence/view/DialogHelper.kt index 75dc48df..4ee66473 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/DialogHelper.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/DialogHelper.kt @@ -1,6 +1,6 @@ package net.lacolaco.smileessence.view -import android.app.Activity +import androidx.fragment.app.FragmentActivity import net.lacolaco.smileessence.view.dialog.StackableDialogFragment import java.util.* @@ -8,8 +8,8 @@ object DialogHelper { /** * Show a dialog (DialogFragment) on the Activity with a random tag so that dialogs stack. */ - fun showDialog(activity: Activity, dialogFragment: StackableDialogFragment) { + fun showDialog(activity: FragmentActivity, dialogFragment: StackableDialogFragment) { val tag = "stackingDialog:" + dialogFragment.javaClass.simpleName + ":" + UUID.randomUUID() - dialogFragment.show(activity.fragmentManager, tag) + dialogFragment.show(activity.supportFragmentManager, tag) } } diff --git a/app/src/main/java/net/lacolaco/smileessence/view/MainFragmentPagerAdapter.kt b/app/src/main/java/net/lacolaco/smileessence/view/MainFragmentPagerAdapter.kt index 14a9fc14..0b10063e 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/MainFragmentPagerAdapter.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/MainFragmentPagerAdapter.kt @@ -1,11 +1,11 @@ package net.lacolaco.smileessence.view -import android.app.Fragment -import android.app.FragmentManager +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentManager import android.os.Bundle -import androidx.legacy.app.FragmentPagerAdapter import androidx.viewpager.widget.ViewPager import android.view.ViewGroup +import androidx.fragment.app.FragmentPagerAdapter import net.lacolaco.smileessence.World import net.lacolaco.smileessence.data.PageInfo import net.lacolaco.smileessence.view.page.PageFragment diff --git a/app/src/main/java/net/lacolaco/smileessence/view/Partials.kt b/app/src/main/java/net/lacolaco/smileessence/view/Partials.kt index 61a3e641..92dd7a91 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/Partials.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/Partials.kt @@ -1,9 +1,9 @@ package net.lacolaco.smileessence.view -import android.app.Activity import android.text.Html import android.view.LayoutInflater import android.view.View +import androidx.fragment.app.FragmentActivity import com.bumptech.glide.Glide import kotlinx.android.synthetic.main.item_status_base.view.* import net.lacolaco.smileessence.R @@ -17,7 +17,7 @@ import net.lacolaco.smileessence.view.dialog.StatusDetailDialogFragment import net.lacolaco.smileessence.view.dialog.UserDetailDialogFragment object Partials { - fun getTweetView(tweet: Tweet, world: World, activity: Activity, view: View, + fun getTweetView(tweet: Tweet, world: World, activity: FragmentActivity, view: View, maxRecursion: Int = 2): View { view.setOnClickListener { DialogHelper.showDialog(activity, StatusDetailDialogFragment.newInstance(tweet)) diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/AppInfoDialogFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/dialog/AppInfoDialogFragment.kt index 247a8cc3..1a1d45d3 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/AppInfoDialogFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/AppInfoDialogFragment.kt @@ -14,7 +14,7 @@ class AppInfoDialogFragment : StackableDialogFragment() { return inflater.inflate(R.layout.dialog_app_info, container, false) } - override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) app_version.text = "${BuildConfig.VERSION_NAME} (revision ${BuildConfig.VERSION_CODE})" web_view.loadUrl("file:///android_asset/licenses.html") diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/EditTweetsPageDialogFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/dialog/EditTweetsPageDialogFragment.kt index 7210a228..cec053c5 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/EditTweetsPageDialogFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/EditTweetsPageDialogFragment.kt @@ -1,6 +1,5 @@ package net.lacolaco.smileessence.view.dialog -import android.app.DialogFragment import android.os.Bundle import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager @@ -8,6 +7,7 @@ import androidx.recyclerview.widget.RecyclerView import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.fragment.app.DialogFragment import com.beust.klaxon.JsonObject import com.beust.klaxon.Parser import kotlinx.android.synthetic.main.dialog_edit_tweets_page.* @@ -19,7 +19,7 @@ import net.lacolaco.smileessence.view.confirm class EditTweetsPageDialogFragment : DialogFragment() { private val pageInfo by lazy { - PageInfo.fromJsonObject(Parser.default().parse(arguments.getString(KEY_PAGE_INFO)) as JsonObject) as + PageInfo.fromJsonObject(Parser.default().parse(arguments!!.getString(KEY_PAGE_INFO)) as JsonObject) as PageInfo.TweetsPageInfo } private val patterns: MutableList<String> by lazy { @@ -31,7 +31,7 @@ class EditTweetsPageDialogFragment : DialogFragment() { return inflater.inflate(R.layout.dialog_edit_tweets_page, container, false) } - override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) recycler_view.addItemDecoration(DividerItemDecoration(activity, DividerItemDecoration.VERTICAL)) recycler_view.layoutManager = LinearLayoutManager(activity) diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/StackableDialogFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/dialog/StackableDialogFragment.kt index 1989a2cb..03e8b2b3 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/StackableDialogFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/StackableDialogFragment.kt @@ -1,10 +1,10 @@ package net.lacolaco.smileessence.view.dialog import android.app.Dialog -import android.app.DialogFragment import android.os.Bundle import androidx.appcompat.app.AppCompatDialog import android.view.Window +import androidx.fragment.app.DialogFragment import net.lacolaco.smileessence.World import net.lacolaco.smileessence.activity.MainActivity diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt index 733c7c9c..1f38817d 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt @@ -20,7 +20,7 @@ class StatusDetailDialogFragment : StackableDialogFragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val id = arguments.getLong(KEY_STATUS_ID) + val id = arguments!!.getLong(KEY_STATUS_ID) val found = Tweet.cached(id) if (found == null) { world.notifyError("Tweet id=$id not found") @@ -35,7 +35,7 @@ class StatusDetailDialogFragment : StackableDialogFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { val view = inflater.inflate(R.layout.dialog_status_detail, container, false) - val statusHeader = Partials.getTweetView(tweet, world, activity, view.detail_current_status) + val statusHeader = Partials.getTweetView(tweet, world, activity!!, view.detail_current_status) statusHeader.isClickable = false // XXX @@ -49,13 +49,13 @@ class StatusDetailDialogFragment : StackableDialogFragment() { view.detail_dialog_divider_top.visibility = View.VISIBLE val cached = Tweet.cached(tweet.inReplyToStatusId!!) if (cached != null) - Partials.getTweetView(cached, world, activity, view.tweet_in_reply_to) + Partials.getTweetView(cached, world, activity!!, view.tweet_in_reply_to) else { - Partials.getTweetView(Tweet.placeHolder, world, activity, view.tweet_in_reply_to) + Partials.getTweetView(Tweet.placeHolder, world, activity!!, view.tweet_in_reply_to) launchUi { try { val tweet = world.getTweetAsync(tweet.inReplyToStatusId!!, false).await() - Partials.getTweetView(tweet, world, activity, view.tweet_in_reply_to) + Partials.getTweetView(tweet, world, activity!!, view.tweet_in_reply_to) } catch (e: TwitterTaskException) { } } @@ -145,7 +145,7 @@ class StatusDetailDialogFragment : StackableDialogFragment() { } } view.button_status_detail_menu.setOnClickListener { - val popup = PopupMenu(activity, view.button_status_detail_menu) + val popup = PopupMenu(activity!!, view.button_status_detail_menu) popup.add(R.string.command_status_add_to_reply) { val text = String.format("@%s ", tweet.originalTweet.user.screenName) (activity as MainActivity).openPostPageAndAppendText(text) @@ -155,11 +155,11 @@ class StatusDetailDialogFragment : StackableDialogFragment() { browse("https://twitter.com/${tweet.originalTweet.user.screenName}/status/${tweet.originalTweet.id}") } popup.add(R.string.command_status_copy_text_to_clipboard) { - SystemServiceHelper.copyToClipboard(activity, "tweet text", tweet.originalTweet.text) + SystemServiceHelper.copyToClipboard(activity!!, "tweet text", tweet.originalTweet.text) world.notify(R.string.notice_copy_clipboard) } popup.add(R.string.command_status_copy_url_to_clipboard) { - SystemServiceHelper.copyToClipboard(activity, "tweet url", "https://twitter.com/${tweet.originalTweet.user.screenName}/status/${tweet.originalTweet.id}") + SystemServiceHelper.copyToClipboard(activity!!, "tweet url", "https://twitter.com/${tweet.originalTweet.user.screenName}/status/${tweet.originalTweet.id}") world.notify(R.string.notice_copy_clipboard) } popup.show() @@ -191,11 +191,11 @@ class StatusDetailDialogFragment : StackableDialogFragment() { } for (url in tweet.entities.urlsExpanded) view.embedded_menu_items.add(url, "URL") { - activity.browse(url) + activity!!.browse(url) } for (url in tweet.entities.mediaUrls) view.embedded_menu_items.add(url, "Media") { - activity.browse(url) + activity!!.browse(url) } if (view.embedded_menu_items.childCount == 0) { view.detail_dialog_divider_bottom.visibility = View.GONE diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/UserDetailDialogFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/dialog/UserDetailDialogFragment.kt index 0ae6b049..de916aec 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/UserDetailDialogFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/UserDetailDialogFragment.kt @@ -31,7 +31,7 @@ class UserDetailDialogFragment : StackableDialogFragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val found = User.cached(arguments.getLong(KEY_USER_ID)) + val found = User.cached(arguments!!.getLong(KEY_USER_ID)) if (found == null) { world.notify(R.string.notice_error_show_user) dismiss() @@ -137,7 +137,7 @@ class UserDetailDialogFragment : StackableDialogFragment() { } private fun showPopupMenu() { - val popup = PopupMenu(activity, imageview_user_detail_menu) + val popup = PopupMenu(activity!!, imageview_user_detail_menu) popup.add(R.string.command_user_add_to_reply) { (activity as MainActivity).openPostPageAndReplyTo(user) world.notify(R.string.notice_add_to_reply) @@ -246,7 +246,7 @@ class UserDetailDialogFragment : StackableDialogFragment() { ) override fun onBindViewHolder(holder: ViewHolder, position: Int) { - Partials.getTweetView(sortedList[position], world, activity, holder.itemView) + Partials.getTweetView(sortedList[position], world, activity!!, holder.itemView) } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { diff --git a/app/src/main/java/net/lacolaco/smileessence/view/page/ComposePageFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/page/ComposePageFragment.kt index 43836482..525bd9a0 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/page/ComposePageFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/page/ComposePageFragment.kt @@ -1,7 +1,7 @@ package net.lacolaco.smileessence.view.page import android.annotation.SuppressLint -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import android.content.Intent import android.net.Uri import android.os.Bundle @@ -39,7 +39,7 @@ class ComposePageFragment : PageFragment<PageInfo.ComposePageInfo>(), TextWatche fun setMediaFile(uri: Uri) { launchUi { val mediaId = try { - activity.contentResolver.openInputStream(uri).use { world.uploadMedia(it).await() } + activity!!.contentResolver.openInputStream(uri).use { world.uploadMedia(it).await() } } catch (e: TwitterTaskException) { world.notifyError("Failed to upload media (${e.message}") return@launchUi @@ -88,7 +88,7 @@ class ComposePageFragment : PageFragment<PageInfo.ComposePageInfo>(), TextWatche if (postState.inReplyTo != null) { layout_post_reply_status.visibility = View.VISIBLE button_post_reply_delete.visibility = View.VISIBLE - val header = Partials.getTweetView(postState.inReplyTo!!, world, activity, + val header = Partials.getTweetView(postState.inReplyTo!!, world, activity!!, layout_post_reply_status) header.isClickable = false } else { @@ -125,7 +125,7 @@ class ComposePageFragment : PageFragment<PageInfo.ComposePageInfo>(), TextWatche override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { super.onCreateOptionsMenu(menu, inflater) - SystemServiceHelper.showIM(activity, post_edit_text) + SystemServiceHelper.showIM(activity!!, post_edit_text) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, @@ -133,14 +133,14 @@ class ComposePageFragment : PageFragment<PageInfo.ComposePageInfo>(), TextWatche return inflater.inflate(R.layout.page_fragment_compose, container, false) } - override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) post_edit_text.addTextChangedListener(this) post_edit_text.setOnFocusChangeListener { _, hasFocus -> if (hasFocus) - SystemServiceHelper.showIM(activity, post_edit_text) + SystemServiceHelper.showIM(activity!!, post_edit_text) else - SystemServiceHelper.hideIM(activity, post_edit_text) + SystemServiceHelper.hideIM(activity!!, post_edit_text) } post_edit_text.movementMethod = object : ArrowKeyMovementMethod() { override fun left(widget: TextView, buffer: Spannable): Boolean { @@ -152,7 +152,7 @@ class ComposePageFragment : PageFragment<PageInfo.ComposePageInfo>(), TextWatche } } button_post_tweet.setOnClickListener { - SystemServiceHelper.hideIM(activity, post_edit_text) + SystemServiceHelper.hideIM(activity!!, post_edit_text) launchUi { try { world.createTweetAsync(postState.text, postState.inReplyTo?.id, @@ -193,7 +193,7 @@ class ComposePageFragment : PageFragment<PageInfo.ComposePageInfo>(), TextWatche override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { when (requestCode) { REQUEST_OPEN_DOCUMENT -> { - if (resultCode != Activity.RESULT_OK) + if (resultCode != AppCompatActivity.RESULT_OK) return setMediaFile(data!!.data!!) } diff --git a/app/src/main/java/net/lacolaco/smileessence/view/page/EventsPageFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/page/EventsPageFragment.kt index 4913348d..fe25863c 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/page/EventsPageFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/page/EventsPageFragment.kt @@ -22,14 +22,14 @@ class EventsPageFragment : TimelinePageFragment<Event, PageInfo.EventsPageInfo>( } override fun onBindItemView(item: Event, itemView: View) { - Glide.with(view).load(item.source?.profileImageUrl ?: User.DEFAULT_PROFILE_IMAGE_URL) + Glide.with(view!!).load(item.source?.profileImageUrl ?: User.DEFAULT_PROFILE_IMAGE_URL) .into(itemView.imageview_status_icon) itemView.textview_status_header_username.text = item.title itemView.textview_status_text.text = item.body itemView.textview_status_footer.text = item.createdAt.toCompactString() itemView.setOnClickListener { if (item.source != null) - DialogHelper.showDialog(activity, + DialogHelper.showDialog(activity!!, UserDetailDialogFragment.newInstance(item.source!!)) } } diff --git a/app/src/main/java/net/lacolaco/smileessence/view/page/ListPageFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/page/ListPageFragment.kt index 99652d52..9b7b1708 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/page/ListPageFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/page/ListPageFragment.kt @@ -22,7 +22,7 @@ class ListPageFragment : RefreshableTimelinePageFragment<Tweet, PageInfo.ListPag runRefreshTask(world.getListTimelineAsync(pageInfo.fullName!!)) {} } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle?): View { + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { return inflater.inflate(R.layout.page_fragment_list, container, false) } @@ -35,7 +35,7 @@ class ListPageFragment : RefreshableTimelinePageFragment<Tweet, PageInfo.ListPag world.notifyError("No list subscriptions") return@setOnClickListener } - val popup = PopupMenu(activity, button_userlist_lists) + val popup = PopupMenu(activity!!, button_userlist_lists) for (name in world.listSubscriptions) { popup.add(name) { textview_userlist_name.text = name @@ -67,7 +67,7 @@ class ListPageFragment : RefreshableTimelinePageFragment<Tweet, PageInfo.ListPag } override fun onBindItemView(item: Tweet, itemView: View) { - Partials.getTweetView(item, world, activity, itemView) + Partials.getTweetView(item, world, activity!!, itemView) } override fun onCreateItemView(parent: ViewGroup): View { diff --git a/app/src/main/java/net/lacolaco/smileessence/view/page/PageFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/page/PageFragment.kt index 4f70899f..a0f15bd8 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/page/PageFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/page/PageFragment.kt @@ -1,6 +1,6 @@ package net.lacolaco.smileessence.view.page -import android.app.Fragment +import androidx.fragment.app.Fragment import net.lacolaco.smileessence.World import net.lacolaco.smileessence.activity.MainActivity import net.lacolaco.smileessence.data.PageInfo @@ -10,10 +10,10 @@ import net.lacolaco.smileessence.data.PageInfo */ abstract class PageFragment<out T : PageInfo> : Fragment() { protected val world by lazy { - World[arguments.getLong(KEY_WORLD_USER_ID)] + World[arguments!!.getLong(KEY_WORLD_USER_ID)] } protected val pageInfo by lazy { - val pos = arguments.getInt(KEY_PAGE_POSITION, -2) + val pos = arguments!!.getInt(KEY_PAGE_POSITION, -2) if (pos == -2) throw IllegalStateException("KEY_PAGE_POSITION not specified") @Suppress("UNCHECKED_CAST") diff --git a/app/src/main/java/net/lacolaco/smileessence/view/page/SearchPageFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/page/SearchPageFragment.kt index 3b52185f..32b9a2aa 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/page/SearchPageFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/page/SearchPageFragment.kt @@ -31,7 +31,7 @@ class SearchPageFragment : RefreshableTimelinePageFragment<Tweet, PageInfo.Searc startSearch(pageInfo.query) } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { return inflater.inflate(R.layout.page_fragment_search, container, false) } @@ -45,7 +45,7 @@ class SearchPageFragment : RefreshableTimelinePageFragment<Tweet, PageInfo.Searc world.notifyError("No saved searches") return@setOnClickListener } - val popup = PopupMenu(activity, button_search_queries) + val popup = PopupMenu(activity!!, button_search_queries) val sss = ArrayList(world.savedSearches.values) for (ss in sss) { popup.add(ss.query) { @@ -81,7 +81,7 @@ class SearchPageFragment : RefreshableTimelinePageFragment<Tweet, PageInfo.Searc } edittext_search.setOnFocusChangeListener { _, hasFocus -> if (!hasFocus) - SystemServiceHelper.hideIM(activity, edittext_search) + SystemServiceHelper.hideIM(activity!!, edittext_search) } edittext_search.setText(pageInfo.query) edittext_search.setOnEditorActionListener { _, i, keyEvent -> @@ -125,7 +125,7 @@ class SearchPageFragment : RefreshableTimelinePageFragment<Tweet, PageInfo.Searc } override fun onBindItemView(item: Tweet, itemView: View) { - Partials.getTweetView(item, world, activity, itemView) + Partials.getTweetView(item, world, activity!!, itemView) } override fun onCreateItemView(parent: ViewGroup): View { @@ -146,7 +146,7 @@ class SearchPageFragment : RefreshableTimelinePageFragment<Tweet, PageInfo.Searc private fun search() { startSearch(edittext_search.text.toString()) - SystemServiceHelper.hideIM(activity, edittext_search) + SystemServiceHelper.hideIM(activity!!, edittext_search) } private fun startSearch(queryString: String) { diff --git a/app/src/main/java/net/lacolaco/smileessence/view/page/TimelinePageFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/page/TimelinePageFragment.kt index a18efc03..354f0545 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/page/TimelinePageFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/page/TimelinePageFragment.kt @@ -17,7 +17,7 @@ abstract class TimelinePageFragment<T : IdObject, out PI : PageInfo> : PageFragm protected val adapter = TimelineAdapter() private var adapterDataObserver: RecyclerView.AdapterDataObserver? = null - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { return inflater.inflate(R.layout.page_fragment_timeline, container, false) } @@ -28,7 +28,7 @@ abstract class TimelinePageFragment<T : IdObject, out PI : PageInfo> : PageFragm tweets_recycler_view.addItemDecoration( DividerItemDecoration(activity, DividerItemDecoration.VERTICAL)) val lm = LinearLayoutManager(activity) - lm.orientation = LinearLayoutManager.VERTICAL + lm.orientation = RecyclerView.VERTICAL tweets_recycler_view.layoutManager = lm tweets_recycler_view.adapter = adapter tweets_recycler_view.itemAnimator = null diff --git a/app/src/main/java/net/lacolaco/smileessence/view/page/TweetsPageFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/page/TweetsPageFragment.kt index ea4c1e0d..f2ad1998 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/page/TweetsPageFragment.kt +++ b/app/src/main/java/net/lacolaco/smileessence/view/page/TweetsPageFragment.kt @@ -21,12 +21,12 @@ class TweetsPageFragment : TimelinePageFragment<Tweet, PageInfo.TweetsPageInfo>( } } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle?): View { + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { return inflater.inflate(R.layout.page_fragment_timeline, container, false) } override fun onBindItemView(item: Tweet, itemView: View) { - Partials.getTweetView(item, world, activity, itemView) + Partials.getTweetView(item, world, activity!!, itemView) } override fun onCreateItemView(parent: ViewGroup): View { diff --git a/app/src/main/res/layout/dialog_app_info.xml b/app/src/main/res/layout/dialog_app_info.xml index 637f3440..e7ea9d4c 100644 --- a/app/src/main/res/layout/dialog_app_info.xml +++ b/app/src/main/res/layout/dialog_app_info.xml @@ -11,7 +11,7 @@ android:layout_height="96dp" android:layout_marginStart="16dp" android:layout_marginTop="16dp" - android:src="@mipmap/ic_launcher" + app:srcCompat="@mipmap/ic_launcher" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/dialog_status_detail.xml b/app/src/main/res/layout/dialog_status_detail.xml index 32a65e75..87462f53 100644 --- a/app/src/main/res/layout/dialog_status_detail.xml +++ b/app/src/main/res/layout/dialog_status_detail.xml @@ -1,5 +1,6 @@ <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> @@ -55,7 +56,7 @@ android:layout_marginEnd="8dp" android:layout_marginTop="8dp" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_reply_all_black_24dp" + app:srcCompat="@drawable/ic_reply_all_black_24dp" android:tint="?android:textColorSecondary" /> <ImageButton @@ -66,7 +67,7 @@ android:layout_marginEnd="8dp" android:layout_marginTop="8dp" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_repeat_black_24dp" + app:srcCompat="@drawable/ic_repeat_black_24dp" android:tint="@color/green_activatable" /> <ImageButton @@ -77,7 +78,7 @@ android:layout_marginEnd="8dp" android:layout_marginTop="8dp" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_star_black_24dp" + app:srcCompat="@drawable/ic_star_black_24dp" android:tint="@color/orange_activatable" /> <ImageButton @@ -88,7 +89,7 @@ android:layout_marginEnd="8dp" android:layout_marginTop="8dp" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_delete_forever_black_24dp" + app:srcCompat="@drawable/ic_delete_forever_black_24dp" android:tint="?android:textColorSecondary" /> <ImageButton @@ -99,7 +100,7 @@ android:layout_marginEnd="8dp" android:layout_marginTop="8dp" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_more_vert_black_24dp" + app:srcCompat="@drawable/ic_more_vert_black_24dp" android:tint="?android:textColorSecondary" /> </LinearLayout> diff --git a/app/src/main/res/layout/dialog_user_detail.xml b/app/src/main/res/layout/dialog_user_detail.xml index 68904fee..7f255c29 100644 --- a/app/src/main/res/layout/dialog_user_detail.xml +++ b/app/src/main/res/layout/dialog_user_detail.xml @@ -42,7 +42,7 @@ android:layout_width="16dp" android:layout_height="16dp" android:alpha="0.7" - android:src="@drawable/ic_lock_black_24dp" + app:srcCompat="@drawable/ic_lock_black_24dp" android:tint="@color/app_material_grey_900" app:layout_constraintBottom_toBottomOf="@+id/user_detail_icon" app:layout_constraintEnd_toEndOf="@+id/user_detail_icon" /> @@ -119,7 +119,7 @@ android:layout_marginEnd="8dp" android:layout_marginTop="8dp" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_more_vert_black_24dp" + app:srcCompat="@drawable/ic_more_vert_black_24dp" android:tint="?android:textColorSecondary" app:layout_constraintEnd_toEndOf="@+id/user_detail_banner" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/item_compose_media.xml b/app/src/main/res/layout/item_compose_media.xml index 516ef8c5..ac930c4e 100644 --- a/app/src/main/res/layout/item_compose_media.xml +++ b/app/src/main/res/layout/item_compose_media.xml @@ -1,5 +1,6 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="120dp" android:layout_height="120dp" android:layout_marginBottom="8dp" @@ -16,6 +17,6 @@ android:layout_height="30dp" android:layout_gravity="end|top" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_clear_black_24dp" + app:srcCompat="@drawable/ic_clear_black_24dp" android:tint="?android:textColorSecondary" /> </FrameLayout> diff --git a/app/src/main/res/layout/item_status_base.xml b/app/src/main/res/layout/item_status_base.xml index fb9fa853..25a1129b 100644 --- a/app/src/main/res/layout/item_status_base.xml +++ b/app/src/main/res/layout/item_status_base.xml @@ -21,7 +21,7 @@ android:layout_width="16dp" android:layout_height="16dp" android:alpha="0.7" - android:src="@drawable/ic_lock_black_24dp" + app:srcCompat="@drawable/ic_lock_black_24dp" android:tint="@color/app_material_grey_900" app:layout_constraintBottom_toBottomOf="@+id/imageview_status_icon" app:layout_constraintEnd_toEndOf="@+id/imageview_status_icon" /> @@ -85,7 +85,7 @@ android:layout_width="16dp" android:layout_height="0dp" android:layout_marginEnd="0dp" - android:src="@drawable/ic_repeat_black_24dp" + app:srcCompat="@drawable/ic_repeat_black_24dp" android:tint="@color/green_activatable" app:layout_constraintBottom_toBottomOf="@+id/textview_status_footer" app:layout_constraintEnd_toStartOf="@+id/tweet_retweet_count" @@ -108,7 +108,7 @@ android:layout_width="16dp" android:layout_height="0dp" android:layout_marginEnd="0dp" - android:src="@drawable/ic_star_black_24dp" + app:srcCompat="@drawable/ic_star_black_24dp" android:tint="@color/orange_activatable" app:layout_constraintBottom_toBottomOf="@+id/textview_status_footer" app:layout_constraintEnd_toStartOf="@+id/tweet_favorite_count" diff --git a/app/src/main/res/layout/list_item_event.xml b/app/src/main/res/layout/list_item_event.xml index 69e7039c..5cde5a56 100644 --- a/app/src/main/res/layout/list_item_event.xml +++ b/app/src/main/res/layout/list_item_event.xml @@ -4,7 +4,7 @@ android:layout_height="wrap_content" android:background="?status_item_background" android:descendantFocusability="blocksDescendants" - android:foreground="?android:attr/selectableItemBackground"> + android:foreground="?attr/selectableItemBackground"> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" diff --git a/app/src/main/res/layout/list_item_tweet.xml b/app/src/main/res/layout/list_item_tweet.xml index 9aaa6b29..f7495020 100644 --- a/app/src/main/res/layout/list_item_tweet.xml +++ b/app/src/main/res/layout/list_item_tweet.xml @@ -4,7 +4,7 @@ android:layout_height="wrap_content" android:background="?status_item_background" android:descendantFocusability="blocksDescendants" - android:foreground="?android:attr/selectableItemBackground"> + android:foreground="?attr/selectableItemBackground"> <FrameLayout android:layout_width="2dp" diff --git a/app/src/main/res/layout/menu_item_simple_text.xml b/app/src/main/res/layout/menu_item_simple_text.xml index 8ff0be8f..9a534e4d 100644 --- a/app/src/main/res/layout/menu_item_simple_text.xml +++ b/app/src/main/res/layout/menu_item_simple_text.xml @@ -3,7 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:foreground="?android:selectableItemBackground"> + android:foreground="?attr/selectableItemBackground"> <TextView android:id="@+id/text_view_content" android:layout_width="wrap_content" diff --git a/app/src/main/res/layout/page_fragment_compose.xml b/app/src/main/res/layout/page_fragment_compose.xml index dd4451c0..c8ce1ac6 100644 --- a/app/src/main/res/layout/page_fragment_compose.xml +++ b/app/src/main/res/layout/page_fragment_compose.xml @@ -25,7 +25,7 @@ android:layout_height="20dp" android:background="?selectableItemBackgroundBorderless" android:scaleType="fitCenter" - android:src="@drawable/ic_clear_black_24dp" + app:srcCompat="@drawable/ic_clear_black_24dp" android:tint="?android:textColorSecondary" app:layout_constraintEnd_toEndOf="@+id/layout_post_reply_status" app:layout_constraintTop_toTopOf="@+id/layout_post_reply_status" /> @@ -56,7 +56,7 @@ android:layout_height="30dp" android:background="?selectableItemBackgroundBorderless" android:scaleType="fitCenter" - android:src="@drawable/ic_clear_black_24dp" + app:srcCompat="@drawable/ic_clear_black_24dp" android:tint="?android:textColorSecondary" app:layout_constraintEnd_toEndOf="@id/post_edit_text" app:layout_constraintTop_toTopOf="@id/post_edit_text" /> @@ -88,7 +88,7 @@ android:layout_marginBottom="8dp" android:layout_marginStart="8dp" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_image_black_24dp" + app:srcCompat="@drawable/ic_image_black_24dp" android:tint="?android:textColorSecondary" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" /> diff --git a/app/src/main/res/layout/page_fragment_list.xml b/app/src/main/res/layout/page_fragment_list.xml index 0238dad4..0663f93c 100644 --- a/app/src/main/res/layout/page_fragment_list.xml +++ b/app/src/main/res/layout/page_fragment_list.xml @@ -11,7 +11,7 @@ android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_view_list_black_24dp" + app:srcCompat="@drawable/ic_view_list_black_24dp" android:tint="?android:textColorSecondary" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/page_fragment_search.xml b/app/src/main/res/layout/page_fragment_search.xml index 9f3eeedc..628b594b 100644 --- a/app/src/main/res/layout/page_fragment_search.xml +++ b/app/src/main/res/layout/page_fragment_search.xml @@ -11,7 +11,7 @@ android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_view_list_black_24dp" + app:srcCompat="@drawable/ic_view_list_black_24dp" android:tint="?android:textColorSecondary" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -36,7 +36,7 @@ android:layout_marginEnd="8dp" android:layout_marginTop="8dp" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_search_black_24dp" + app:srcCompat="@drawable/ic_search_black_24dp" android:tint="?android:textColorSecondary" app:layout_constraintEnd_toStartOf="@+id/button_search_save" app:layout_constraintTop_toTopOf="parent" /> @@ -48,7 +48,7 @@ android:layout_marginEnd="8dp" android:layout_marginTop="8dp" android:background="?selectableItemBackgroundBorderless" - android:src="@drawable/ic_save_black_24dp" + app:srcCompat="@drawable/ic_save_black_24dp" android:tint="?android:textColorSecondary" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> |