mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-16 11:41:21 +01:00
bug fixes
This commit is contained in:
parent
21acf7aa5d
commit
4b6d698132
@ -27,6 +27,7 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import org.mariotaku.microblog.library.twitter.model.User;
|
||||
import org.mariotaku.sqliteqb.library.Expression;
|
||||
@ -195,6 +196,7 @@ public class UserColorNameManager implements TwidereConstants {
|
||||
return mColorPreferences.getInt(userId, Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getUserNickname(@NonNull final UserKey userKey) {
|
||||
final String userKeyString = userKey.toString();
|
||||
if (mNicknamePreferences.contains(userKey.getId())) {
|
||||
@ -208,11 +210,13 @@ public class UserColorNameManager implements TwidereConstants {
|
||||
return mNicknamePreferences.getString(userKeyString, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getUserNickname(@NonNull final UserKey userId, final String name) {
|
||||
final String nick = getUserNickname(userId);
|
||||
return decideNickname(nick, name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getUserNickname(@NonNull final String userId, final String name) {
|
||||
final String nick = getUserNicknameInternal(userId);
|
||||
return decideNickname(nick, name);
|
||||
|
@ -104,8 +104,8 @@ class DataExportActivity : BaseActivity(), DataExportImportTypeSelectorDialogFra
|
||||
activity.executeAfterFragmentResumed {
|
||||
val activity = it as DataExportActivity
|
||||
val fm = activity.supportFragmentManager
|
||||
val f = fm.findFragmentByTag(FRAGMENT_TAG) as DialogFragment
|
||||
f.dismiss()
|
||||
val f = fm.findFragmentByTag(FRAGMENT_TAG) as? DialogFragment
|
||||
f?.dismiss()
|
||||
}
|
||||
if (result != null && result) {
|
||||
activity.setResult(Activity.RESULT_OK)
|
||||
|
@ -110,8 +110,8 @@ class DataImportActivity : BaseActivity(), DataExportImportTypeSelectorDialogFra
|
||||
activity.executeAfterFragmentResumed {
|
||||
val activity = it as DataImportActivity
|
||||
val fm = activity.supportFragmentManager
|
||||
val f = fm.findFragmentByTag(FRAGMENT_TAG) as DialogFragment
|
||||
f.dismiss()
|
||||
val f = fm.findFragmentByTag(FRAGMENT_TAG) as? DialogFragment
|
||||
f?.dismiss()
|
||||
}
|
||||
if (result != null && result) {
|
||||
activity.setResult(RESULT_OK)
|
||||
@ -152,8 +152,8 @@ class DataImportActivity : BaseActivity(), DataExportImportTypeSelectorDialogFra
|
||||
activity.executeAfterFragmentResumed {
|
||||
val activity = it as DataImportActivity
|
||||
val fm = activity.supportFragmentManager
|
||||
val f = fm.findFragmentByTag(FRAGMENT_TAG) as DialogFragment
|
||||
f.dismiss()
|
||||
val f = fm.findFragmentByTag(FRAGMENT_TAG) as? DialogFragment
|
||||
f?.dismiss()
|
||||
}
|
||||
val df = DataExportImportTypeSelectorDialogFragment()
|
||||
val args = Bundle()
|
||||
|
@ -154,7 +154,7 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||
return f.triggerRefresh()
|
||||
}
|
||||
|
||||
val leftDrawerFragment: Fragment
|
||||
val leftDrawerFragment: Fragment?
|
||||
get() = supportFragmentManager.findFragmentById(R.id.leftDrawer)
|
||||
|
||||
override fun getSystemWindowsInsets(insets: Rect): Boolean {
|
||||
|
@ -355,8 +355,8 @@ class MediaViewerActivity : BaseActivity(), IExtendedActivity, ATEToolbarCustomi
|
||||
val activity = context as IExtendedActivity
|
||||
activity.executeAfterFragmentResumed { activity ->
|
||||
val fm = (activity as FragmentActivity).supportFragmentManager
|
||||
val fragment = fm.findFragmentByTag(PROGRESS_FRAGMENT_TAG) as DialogFragment
|
||||
fragment.dismiss()
|
||||
val fragment = fm.findFragmentByTag(PROGRESS_FRAGMENT_TAG) as? DialogFragment
|
||||
fragment?.dismiss()
|
||||
Unit
|
||||
}
|
||||
}
|
||||
|
@ -513,8 +513,8 @@ class SettingsWizardActivity : BaseActivity() {
|
||||
activity.executeAfterFragmentResumed {
|
||||
val activity = it as SettingsWizardActivity
|
||||
val fm = activity.supportFragmentManager
|
||||
val f = fm.findFragmentByTag(FRAGMENT_TAG) as DialogFragment
|
||||
f.dismiss()
|
||||
val f = fm.findFragmentByTag(FRAGMENT_TAG) as? DialogFragment
|
||||
f?.dismiss()
|
||||
}
|
||||
nextStep()
|
||||
}
|
||||
|
@ -223,15 +223,16 @@ class APIEditorActivity : BaseActivity(), OnCheckedChangeListener, OnClickListen
|
||||
editConsumerSecret.setText(apiConfig.consumerSecret)
|
||||
}
|
||||
|
||||
class LoadDefaultsChooserDialogFragment : BaseDialogFragment(), DialogInterface.OnClickListener, LoaderManager.LoaderCallbacks<List<CustomAPIConfig>> {
|
||||
private var mAdapter: ArrayAdapter<CustomAPIConfig>? = null
|
||||
class LoadDefaultsChooserDialogFragment : BaseDialogFragment(), DialogInterface.OnClickListener,
|
||||
LoaderManager.LoaderCallbacks<List<CustomAPIConfig>?> {
|
||||
private lateinit var adapter: ArrayAdapter<CustomAPIConfig>
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val context = context
|
||||
val configs = CustomAPIConfig.listDefault(context)
|
||||
mAdapter = CustomAPIConfigArrayAdapter(context, configs)
|
||||
adapter = CustomAPIConfigArrayAdapter(context, configs)
|
||||
val builder = AlertDialog.Builder(context)
|
||||
builder.setAdapter(mAdapter, this)
|
||||
builder.setAdapter(adapter, this)
|
||||
if (!BuildConfig.DEBUG) {
|
||||
loaderManager.initLoader(0, null, this)
|
||||
}
|
||||
@ -239,26 +240,26 @@ class APIEditorActivity : BaseActivity(), OnCheckedChangeListener, OnClickListen
|
||||
}
|
||||
|
||||
override fun onClick(dialog: DialogInterface, which: Int) {
|
||||
(activity as APIEditorActivity).setAPIConfig(mAdapter!!.getItem(which))
|
||||
(activity as APIEditorActivity).setAPIConfig(adapter.getItem(which))
|
||||
dismiss()
|
||||
}
|
||||
|
||||
override fun onCreateLoader(id: Int, args: Bundle): Loader<List<CustomAPIConfig>> {
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<List<CustomAPIConfig>?> {
|
||||
return DefaultAPIConfigLoader(context)
|
||||
}
|
||||
|
||||
override fun onLoadFinished(loader: Loader<List<CustomAPIConfig>>, data: List<CustomAPIConfig>?) {
|
||||
override fun onLoadFinished(loader: Loader<List<CustomAPIConfig>?>, data: List<CustomAPIConfig>?) {
|
||||
if (data != null) {
|
||||
mAdapter!!.clear()
|
||||
mAdapter!!.addAll(data)
|
||||
adapter.clear()
|
||||
adapter.addAll(data)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLoaderReset(loader: Loader<List<CustomAPIConfig>>) {
|
||||
override fun onLoaderReset(loader: Loader<List<CustomAPIConfig>?>) {
|
||||
|
||||
}
|
||||
|
||||
class DefaultAPIConfigLoader(context: Context) : AsyncTaskLoader<List<CustomAPIConfig>>(context) {
|
||||
class DefaultAPIConfigLoader(context: Context) : AsyncTaskLoader<List<CustomAPIConfig>?>(context) {
|
||||
@Inject
|
||||
lateinit var client: RestHttpClient
|
||||
|
||||
|
@ -56,7 +56,7 @@ class SetUserNicknameDialogFragment : BaseDialogFragment(), OnClickListener {
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val args = arguments
|
||||
val nick = args.getString(EXTRA_NAME)
|
||||
val nick: String? = args.getString(EXTRA_NAME)
|
||||
val context = activity
|
||||
val builder = AlertDialog.Builder(context)
|
||||
builder.setTitle(R.string.set_nickname)
|
||||
@ -73,7 +73,7 @@ class SetUserNicknameDialogFragment : BaseDialogFragment(), OnClickListener {
|
||||
|
||||
private val FRAGMENT_TAG_SET_USER_NICKNAME = "set_user_nickname"
|
||||
|
||||
fun show(fm: FragmentManager, userKey: UserKey, nickname: String): SetUserNicknameDialogFragment {
|
||||
fun show(fm: FragmentManager, userKey: UserKey, nickname: String?): SetUserNicknameDialogFragment {
|
||||
val f = SetUserNicknameDialogFragment()
|
||||
val args = Bundle()
|
||||
args.putParcelable(EXTRA_USER_KEY, userKey)
|
||||
|
@ -1010,6 +1010,7 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
|
||||
itemView.translateResult.setTextIsSelectable(true)
|
||||
|
||||
itemView.text.movementMethod = LinkMovementMethod.getInstance()
|
||||
itemView.quotedText.movementMethod = null
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
|
@ -99,7 +99,7 @@ class BackgroundOperationService : IntentService("background_operation"), Consta
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
super.onStartCommand(intent, flags, startId)
|
||||
return Service.START_STICKY
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ abstract class ProgressSaveFileTask(
|
||||
override fun dismissProgress() {
|
||||
(context as IExtendedActivity).executeAfterFragmentResumed { activity ->
|
||||
val fm = (activity as FragmentActivity).supportFragmentManager
|
||||
val fragment = fm.findFragmentByTag(PROGRESS_FRAGMENT_TAG) as DialogFragment?
|
||||
val fragment = fm.findFragmentByTag(PROGRESS_FRAGMENT_TAG) as? DialogFragment
|
||||
fragment?.dismiss()
|
||||
}
|
||||
}
|
||||
|
@ -336,6 +336,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="4"
|
||||
android:singleLine="false"
|
||||
android:tag="font_family|user"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
|
Loading…
x
Reference in New Issue
Block a user