updated sync code

improving analyzer
This commit is contained in:
Mariotaku Lee 2017-01-03 19:59:38 +08:00
parent 2995759d9a
commit cb7c69caae
61 changed files with 561 additions and 223 deletions

View File

@ -1,8 +0,0 @@
package org.mariotaku.twidere
import org.mariotaku.kpreferences.KNullableStringKey
/**
* Created by mariotaku on 2016/12/28.
*/
val dropboxAuthTokenKey = KNullableStringKey("dropbox_auth_token", null)

View File

@ -4,25 +4,35 @@ import android.os.Bundle
import com.dropbox.core.android.Auth
import org.mariotaku.kpreferences.set
import org.mariotaku.twidere.Constants.DROPBOX_APP_KEY
import org.mariotaku.twidere.dropboxAuthTokenKey
import org.mariotaku.twidere.constant.dataSyncProviderInfoKey
import org.mariotaku.twidere.model.sync.DropboxSyncProviderInfo
/**
* Created by mariotaku on 2016/12/7.
*/
class DropboxAuthStarterActivity : BaseActivity() {
private var shouldGetAuthResult: Boolean = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Auth.startOAuth2Authentication(this, DROPBOX_APP_KEY)
}
override fun onResume() {
super.onResume()
val oauthToken = Auth.getOAuth2Token()
if (oauthToken != null) {
preferences[dropboxAuthTokenKey] = oauthToken
if (shouldGetAuthResult) {
val oauthToken = Auth.getOAuth2Token()
if (oauthToken != null) {
preferences[dataSyncProviderInfoKey] = DropboxSyncProviderInfo(oauthToken)
}
finish()
shouldGetAuthResult = false
}
finish()
}
override fun onPause() {
super.onPause()
shouldGetAuthResult = true
}
}

View File

@ -1,56 +0,0 @@
package org.mariotaku.twidere.fragment.premium
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import kotlinx.android.synthetic.google.fragment_extra_features_sync_status_play_store.*
import org.mariotaku.kpreferences.get
import org.mariotaku.twidere.R
import org.mariotaku.twidere.activity.DropboxAuthStarterActivity
import org.mariotaku.twidere.dropboxAuthTokenKey
import org.mariotaku.twidere.fragment.BaseSupportFragment
import org.mariotaku.twidere.service.DropboxDataSyncService
/**
* Created by mariotaku on 2016/12/28.
*/
class PlayStoreExtraFeaturesSyncStatusFragment : BaseSupportFragment() {
private val REQUEST_DROPBOX_AUTH: Int = 201
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
updateButtons()
connectStorageService.setOnClickListener {
startActivityForResult(Intent(context, DropboxAuthStarterActivity::class.java), REQUEST_DROPBOX_AUTH)
}
performSync.setOnClickListener {
context.startService(Intent(context, DropboxDataSyncService::class.java))
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
when (requestCode) {
REQUEST_DROPBOX_AUTH -> {
updateButtons()
}
}
}
private fun updateButtons() {
if (preferences[dropboxAuthTokenKey] == null) {
connectStorageService.visibility = View.VISIBLE
performSync.visibility = View.GONE
} else {
connectStorageService.visibility = View.GONE
performSync.visibility = View.VISIBLE
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_extra_features_sync_status_play_store, container, false)
}
}

View File

@ -0,0 +1,25 @@
package org.mariotaku.twidere.model.sync
import android.content.SharedPreferences
/**
* Created by mariotaku on 2017/1/2.
*/
class DropboxSyncProviderInfo(val authToken: String) : SyncProviderInfo(DropboxSyncProviderInfo.TYPE) {
override fun writeToPreferences(editor: SharedPreferences.Editor) {
editor.putString(KEY_DROPBOX_AUTH_TOKEN, authToken)
}
companion object {
const val TYPE = "dropbox"
private const val KEY_DROPBOX_AUTH_TOKEN = "dropbox_auth_token"
fun newInstance(preferences: SharedPreferences): DropboxSyncProviderInfo? {
val authToken = preferences.getString(KEY_DROPBOX_AUTH_TOKEN, null) ?: return null
return DropboxSyncProviderInfo(authToken)
}
}
}

View File

@ -15,10 +15,11 @@ import com.dropbox.core.v2.files.*
import org.mariotaku.kpreferences.get
import org.mariotaku.twidere.BuildConfig
import org.mariotaku.twidere.R
import org.mariotaku.twidere.dropboxAuthTokenKey
import org.mariotaku.twidere.constant.dataSyncProviderInfoKey
import org.mariotaku.twidere.extension.model.*
import org.mariotaku.twidere.model.Draft
import org.mariotaku.twidere.model.FiltersData
import org.mariotaku.twidere.model.sync.DropboxSyncProviderInfo
import org.mariotaku.twidere.util.sync.*
import org.xmlpull.v1.XmlPullParser
import org.xmlpull.v1.XmlSerializer
@ -33,7 +34,7 @@ class DropboxDataSyncService : BaseIntentService("dropbox_data_sync") {
private val NOTIFICATION_ID_SYNC_DATA = 302
override fun onHandleIntent(intent: Intent?) {
val authToken = preferences[dropboxAuthTokenKey] ?: return
val syncInfo = preferences[dataSyncProviderInfoKey] as? DropboxSyncProviderInfo ?: return
val nb = NotificationCompat.Builder(this)
nb.setSmallIcon(R.drawable.ic_stat_refresh)
nb.setOngoing(true)
@ -43,7 +44,7 @@ class DropboxDataSyncService : BaseIntentService("dropbox_data_sync") {
nm.notify(NOTIFICATION_ID_SYNC_DATA, nb.build())
val requestConfig = DbxRequestConfig.newBuilder("twidere-android/${BuildConfig.VERSION_NAME}")
.build()
val client = DbxClientV2(requestConfig, authToken)
val client = DbxClientV2(requestConfig, syncInfo.authToken)
arrayOf(
DropboxDraftsSyncHelper(this, client),
DropboxFiltersDataSyncHelper(this, client),

View File

@ -111,7 +111,7 @@ class FabricAnalyzer : Analyzer(), Constants {
private fun AnswersEvent<*>.putAttributes(event: Analyzer.Event) {
if (event.accountType != null) {
putCustomAttribute("Account type", event.accountType ?: "unknown")
putCustomAttribute("Account type", event.accountType)
}
if (event.accountHost != null) {
putCustomAttribute("Account host", event.accountHost)

View File

@ -0,0 +1,31 @@
package org.mariotaku.twidere.util.sync
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import org.mariotaku.twidere.R
import org.mariotaku.twidere.activity.DropboxAuthStarterActivity
import org.mariotaku.twidere.model.sync.DropboxSyncProviderInfo
import org.mariotaku.twidere.model.sync.SyncProviderEntry
import org.mariotaku.twidere.model.sync.SyncProviderInfo
/**
* Created by mariotaku on 2017/1/2.
*/
class NonFreeSyncProviderInfoFactory : SyncProviderInfoFactory() {
override fun getInfoForType(type: String, preferences: SharedPreferences): SyncProviderInfo? {
return when (type) {
DropboxSyncProviderInfo.TYPE -> DropboxSyncProviderInfo.newInstance(preferences)
else -> null
}
}
override fun getSupportedProviders(context: Context): List<SyncProviderEntry> {
return listOf(
SyncProviderEntry(DropboxSyncProviderInfo.TYPE,
context.getString(R.string.sync_provider_name_dropbox),
Intent(context, DropboxAuthStarterActivity::class.java))
)
}
}

View File

@ -9,8 +9,8 @@
<fragment
android:id="@+id/extra_features_sync_status"
class="org.mariotaku.twidere.fragment.premium.PlayStoreExtraFeaturesSyncStatusFragment"
class="org.mariotaku.twidere.fragment.premium.ExtraFeaturesSyncStatusFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/fragment_extra_features_sync_status_play_store"/>
tools:layout="@layout/fragment_extra_features_sync_status"/>
</android.support.v7.widget.CardView>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/element_spacing_normal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/element_spacing_normal"
android:text="@string/title_sync"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="?android:textColorPrimary"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/statusText"
android:layout_margin="@dimen/element_spacing_normal"
android:textAppearance="?android:textAppearanceMedium"
android:textSize="16sp"
tools:text="@string/message_sync_data_synced_with_name"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end">
<Space
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:id="@+id/connectButton"
style="?borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/action_sync_connect_to_storage"
android:textAllCaps="true"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?colorAccent"
android:textStyle="bold"/>
<Button
android:id="@+id/settingsButton"
style="?borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/action_sync_settings"
android:textAllCaps="true"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?colorAccent"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/element_spacing_normal">
<Button
android:id="@+id/connectStorageService"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Connect to Dropbox"/>
<Button
android:id="@+id/performSync"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Perform sync"/>
</LinearLayout>

View File

@ -0,0 +1,2 @@
org.mariotaku.twidere.util.sync.NonFreeSyncProviderInfoFactory
org.mariotaku.twidere.util.sync.OpenSourceSyncProviderInfoFactory

View File

@ -464,10 +464,22 @@
<activity
android:name=".activity.InvalidAccountAlertActivity"
android:theme="@style/Theme.Twidere.NoDisplay"/>
<activity
android:name=".activity.FragmentContentActivity"
android:theme="@style/Theme.Twidere">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.HomeActivity"/>
</activity>
<activity
android:name=".activity.PremiumDashboardActivity"
android:label="@string/title_premium_features_name"
android:theme="@style/Theme.Twidere"/>
android:theme="@style/Theme.Twidere">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.HomeActivity"/>
</activity>
<service
android:name=".service.RefreshService"

View File

@ -87,8 +87,8 @@ public final class DataExportImportTypeSelectorDialogFragment extends BaseDialog
mAdapter = new TypeAdapter(context, flags);
mListView = new ListView(context);
mAdapter.add(new Type(R.string.settings, DataImportExportUtils.FLAG_PREFERENCES));
mAdapter.add(new Type(R.string.nicknames, DataImportExportUtils.FLAG_NICKNAMES));
mAdapter.add(new Type(R.string.user_colors, DataImportExportUtils.FLAG_USER_COLORS));
mAdapter.add(new Type(R.string.title_nicknames, DataImportExportUtils.FLAG_NICKNAMES));
mAdapter.add(new Type(R.string.title_user_colors, DataImportExportUtils.FLAG_USER_COLORS));
mAdapter.add(new Type(R.string.custom_host_mapping, DataImportExportUtils.FLAG_HOST_MAPPING));
mAdapter.add(new Type(R.string.keyboard_shortcuts, DataImportExportUtils.FLAG_KEYBOARD_SHORTCUTS));
mAdapter.add(new Type(R.string.title_filters, DataImportExportUtils.FLAG_FILTERS));

View File

@ -1,49 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.preference;
import android.content.Context;
import android.util.AttributeSet;
import org.mariotaku.twidere.R;
import static org.mariotaku.twidere.constant.IntentConstants.INTENT_ACTION_EXTENSION_SYNC_TIMELINE;
public class TimelineSyncPreference extends ServicePickerPreference {
public TimelineSyncPreference(final Context context) {
this(context, null);
}
public TimelineSyncPreference(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
@Override
protected String getIntentAction() {
return INTENT_ACTION_EXTENSION_SYNC_TIMELINE;
}
@Override
protected String getNoneEntry() {
return getContext().getString(R.string.none);
}
}

View File

@ -0,0 +1,26 @@
package org.mariotaku.twidere.activity
import android.os.Bundle
import android.support.v4.app.Fragment
/**
* Created by mariotaku on 2017/1/3.
*/
class FragmentContentActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
title = intent.getStringExtra(EXTRA_TITLE)
val fragment = Fragment.instantiate(this, intent.getStringExtra(EXTRA_FRAGMENT),
intent.getBundleExtra(EXTRA_FRAGMENT_ARGUMENTS))
val ft = supportFragmentManager.beginTransaction()
ft.replace(android.R.id.content, fragment)
ft.commit()
}
companion object {
const val EXTRA_FRAGMENT = "FCA:fragment"
const val EXTRA_TITLE = "FCA:title"
const val EXTRA_FRAGMENT_ARGUMENTS = "FCA:fragment_arguments"
}
}

View File

@ -28,8 +28,7 @@ class PremiumDashboardActivity : BaseActivity() {
setContentView(R.layout.activity_premium_dashboard)
if (extraFeaturesService.isSupported()) {
if (extraFeaturesService.isEnabled()) {
extraFeaturesService.dashboardLayouts.forEach {
layout ->
extraFeaturesService.dashboardLayouts.forEach { layout ->
View.inflate(this, layout, cardsContainer)
}
} else {

View File

@ -27,6 +27,7 @@ import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
import android.os.AsyncTask
import android.support.multidex.MultiDex
import android.support.v7.app.AppCompatDelegate
import android.util.Log
import nl.komponents.kovenant.android.startKovenant
import nl.komponents.kovenant.android.stopKovenant
@ -47,6 +48,7 @@ import org.mariotaku.twidere.activity.MainHondaJOJOActivity
import org.mariotaku.twidere.constant.apiLastChangeKey
import org.mariotaku.twidere.constant.bugReportsKey
import org.mariotaku.twidere.constant.defaultFeatureLastUpdated
import org.mariotaku.twidere.constant.nightModeKey
import org.mariotaku.twidere.model.DefaultFeatures
import org.mariotaku.twidere.util.*
import org.mariotaku.twidere.util.content.TwidereSQLiteOpenHelper
@ -97,6 +99,7 @@ class TwidereApplication : Application(), Constants, OnSharedPreferenceChangeLis
StrictModeUtils.detectAllVmPolicy()
}
super.onCreate()
AppCompatDelegate.setDefaultNightMode(sharedPreferences[nightModeKey])
startKovenant()
initializeAsyncTask()
initDebugMode()
@ -231,6 +234,9 @@ class TwidereApplication : Application(), Constants, OnSharedPreferenceChangeLis
KEY_SAME_OAUTH_SIGNING_URL, KEY_THUMBOR_ENABLED, KEY_THUMBOR_ADDRESS, KEY_THUMBOR_SECURITY_KEY -> {
preferences[apiLastChangeKey] = System.currentTimeMillis()
}
KEY_THEME -> {
AppCompatDelegate.setDefaultNightMode(preferences[nightModeKey])
}
KEY_EMOJI_SUPPORT -> {
externalThemeManager.reloadEmojiPreferences()
}

View File

@ -14,6 +14,8 @@ import org.mariotaku.twidere.constant.SharedPreferenceConstants.KEY_THEME
import org.mariotaku.twidere.extension.getNonEmptyString
import org.mariotaku.twidere.model.CustomAPIConfig
import org.mariotaku.twidere.model.account.cred.Credentials
import org.mariotaku.twidere.model.sync.SyncProviderInfo
import org.mariotaku.twidere.util.sync.SyncProviderInfoFactory
import org.mariotaku.twidere.view.ProfileImageView
/**
@ -132,4 +134,28 @@ object defaultAPIConfigKey : KPreferenceKey<CustomAPIConfig> {
return true
}
}
object dataSyncProviderInfoKey : KPreferenceKey<SyncProviderInfo?> {
private const val PROVIDER_TYPE_KEY = "sync_provider_type"
override fun contains(preferences: SharedPreferences): Boolean {
return read(preferences) != null
}
override fun read(preferences: SharedPreferences): SyncProviderInfo? {
val type = preferences.getString(PROVIDER_TYPE_KEY, null) ?: return null
return SyncProviderInfoFactory.getInfoForType(type, preferences)
}
override fun write(editor: SharedPreferences.Editor, value: SyncProviderInfo?): Boolean {
if (value == null) {
editor.remove(PROVIDER_TYPE_KEY)
} else {
editor.putString(PROVIDER_TYPE_KEY, value.type)
value.writeToPreferences(editor)
}
return true
}
}

View File

@ -30,7 +30,6 @@ import org.mariotaku.twidere.util.Utils
class SettingsDetailsFragment : BasePreferenceFragment(), OnSharedPreferenceChangeListener {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
val preferenceManager = preferenceManager
preferenceManager.sharedPreferencesName = SHARED_PREFERENCES_NAME
val defaultScreen = preferenceScreen
val preferenceScreen: PreferenceScreen

View File

@ -0,0 +1,84 @@
package org.mariotaku.twidere.fragment.premium
import android.app.Dialog
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import kotlinx.android.synthetic.google.fragment_extra_features_sync_status.*
import org.mariotaku.kpreferences.get
import org.mariotaku.twidere.R
import org.mariotaku.twidere.activity.FragmentContentActivity
import org.mariotaku.twidere.constant.dataSyncProviderInfoKey
import org.mariotaku.twidere.fragment.BaseDialogFragment
import org.mariotaku.twidere.fragment.BaseSupportFragment
import org.mariotaku.twidere.fragment.sync.SyncSettingsFragment
import org.mariotaku.twidere.util.sync.SyncProviderInfoFactory
/**
* Created by mariotaku on 2016/12/28.
*/
class ExtraFeaturesSyncStatusFragment : BaseSupportFragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
updateButtons()
connectButton.setOnClickListener {
val df = ConnectNetworkStorageSelectionDialogFragment()
df.show(childFragmentManager, "connect_to_storage")
}
settingsButton.setOnClickListener {
val intent = Intent(context, FragmentContentActivity::class.java)
intent.putExtra(FragmentContentActivity.EXTRA_FRAGMENT, SyncSettingsFragment::class.java.name)
intent.putExtra(FragmentContentActivity.EXTRA_TITLE, getString(R.string.title_sync_settings))
startActivity(intent)
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
when (requestCode) {
REQUEST_CONNECT_NETWORK_STORAGE -> {
updateButtons()
}
}
}
private fun updateButtons() {
if (preferences[dataSyncProviderInfoKey] == null) {
statusText.text = getText(R.string.message_sync_data_connect_hint)
connectButton.visibility = View.VISIBLE
settingsButton.visibility = View.GONE
} else {
statusText.text = getString(R.string.message_sync_data_synced_with_name, "Dropbox")
connectButton.visibility = View.GONE
settingsButton.visibility = View.VISIBLE
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_extra_features_sync_status, container, false)
}
class ConnectNetworkStorageSelectionDialogFragment : BaseDialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val providers = SyncProviderInfoFactory.getSupportedProviders(context)
val itemNames = providers.map { it.name }.toTypedArray()
val builder = AlertDialog.Builder(context)
builder.setTitle(R.string.title_dialog_sync_connect_to)
builder.setItems(itemNames) { dialog, which ->
activity.startActivityForResult(providers[which].authIntent, REQUEST_CONNECT_NETWORK_STORAGE)
}
return builder.create()
}
}
companion object {
private val REQUEST_CONNECT_NETWORK_STORAGE: Int = 201
}
}

View File

@ -0,0 +1,28 @@
package org.mariotaku.twidere.fragment.sync
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import org.mariotaku.twidere.Constants.SHARED_PREFERENCES_NAME
import org.mariotaku.twidere.R
import org.mariotaku.twidere.fragment.BasePreferenceFragment
/**
* Created by mariotaku on 2017/1/3.
*/
class SyncSettingsFragment : BasePreferenceFragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
setHasOptionsMenu(true)
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
preferenceManager.sharedPreferencesName = SHARED_PREFERENCES_NAME
addPreferencesFromResource(R.xml.preferences_sync)
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.menu_sync_settings, menu)
}
}

View File

@ -1,6 +1,8 @@
package org.mariotaku.twidere.model.analyzer
import org.mariotaku.twidere.annotation.AccountType
import org.mariotaku.twidere.model.Draft
import org.mariotaku.twidere.model.ParcelableMedia
import org.mariotaku.twidere.util.Analyzer
/**
@ -8,7 +10,49 @@ import org.mariotaku.twidere.util.Analyzer
*/
data class UpdateStatus(
@AccountType override val accountType: String? = null
@AccountType override val accountType: String? = null,
@Draft.Action val actionType: String?,
@ParcelableMedia.Type val mediaType: Int,
val hasLocation: Boolean,
val preciseLocation: Boolean,
val success: Boolean
) : Analyzer.Event {
private val locationType: String get() = if (!hasLocation) {
"none"
} else if (preciseLocation) {
"coordinate"
} else {
"place"
}
override val name: String
get() = "Tweet"
override fun forEachValues(action: (String, String?) -> Unit) {
action("Status Type", actionTypeString(actionType))
action("Media Type", mediaTypeString(mediaType))
action("Location Type", locationType)
action("Success", success.toString())
}
fun actionTypeString(@Draft.Action action: String?): String {
return when (action) {
Draft.Action.QUOTE -> "quote"
Draft.Action.REPLY -> "reply"
else -> "tweet"
}
}
fun mediaTypeString(@ParcelableMedia.Type type: Int): String {
return when (type) {
ParcelableMedia.Type.IMAGE -> "image"
ParcelableMedia.Type.VIDEO -> "video"
ParcelableMedia.Type.ANIMATED_GIF -> "gif"
ParcelableMedia.Type.CARD_ANIMATED_GIF -> "gif"
ParcelableMedia.Type.EXTERNAL_PLAYER -> "external"
ParcelableMedia.Type.VARIABLE_TYPE -> "variable"
else -> "unknown"
}
}
}

View File

@ -0,0 +1,9 @@
package org.mariotaku.twidere.model.sync
import android.content.Intent
/**
* Created by mariotaku on 2017/1/2.
*/
data class SyncProviderEntry(val type: String, val name: String, val authIntent: Intent)

View File

@ -0,0 +1,11 @@
package org.mariotaku.twidere.model.sync
import android.content.SharedPreferences
/**
* Created by mariotaku on 2017/1/2.
*/
abstract class SyncProviderInfo(val type: String) {
abstract fun writeToPreferences(editor: SharedPreferences.Editor)
}

View File

@ -32,6 +32,7 @@ import org.mariotaku.twidere.annotation.AccountType
import org.mariotaku.twidere.app.TwidereApplication
import org.mariotaku.twidere.extension.model.newMicroBlogInstance
import org.mariotaku.twidere.model.*
import org.mariotaku.twidere.model.analyzer.UpdateStatus
import org.mariotaku.twidere.model.draft.UpdateStatusActionExtras
import org.mariotaku.twidere.model.util.ParcelableLocationUtils
import org.mariotaku.twidere.model.util.ParcelableStatusUtils
@ -84,6 +85,17 @@ class UpdateStatusTask(
override fun afterExecute(handler: Any?, result: UpdateStatusResult) {
stateCallback.afterExecute(result)
if (params != null) {
logUpdateStatus(params.first, params.second, result)
}
}
private fun logUpdateStatus(actionType: String, statusUpdate: ParcelableStatusUpdate, result: UpdateStatusResult) {
val mediaType = statusUpdate.media?.firstOrNull()?.type ?: ParcelableMedia.Type.UNKNOWN
val hasLocation = statusUpdate.location != null
val preciseLocation = statusUpdate.display_coordinates
Analyzer.log(UpdateStatus(result.accountTypes.firstOrNull(), actionType, mediaType,
hasLocation, preciseLocation, result.succeed))
}
@Throws(UpdateStatusException::class)
@ -227,11 +239,11 @@ class UpdateStatusTask(
stateCallback.onUpdatingStatus()
val result = UpdateStatusResult(arrayOfNulls<ParcelableStatus>(pendingUpdate.length),
arrayOfNulls<MicroBlogException>(pendingUpdate.length), draftId)
val result = UpdateStatusResult(pendingUpdate.length, draftId)
for (i in 0 until pendingUpdate.length) {
val account = statusUpdate.accounts[i]
result.accountTypes[i] = account.type
val microBlog = MicroBlogAPIFactory.getInstance(context, account.key)
var bodyAndSize: Pair<Body, Point>? = null
try {
@ -567,23 +579,26 @@ class UpdateStatusTask(
class UpdateStatusResult {
val statuses: Array<ParcelableStatus?>
val exceptions: Array<MicroBlogException?>
val accountTypes: Array<String?>
val exception: UpdateStatusException?
val draftId: Long
val succeed: Boolean get() = !statuses.contains(null)
constructor(statuses: Array<ParcelableStatus?>, exceptions: Array<MicroBlogException?>, draftId: Long) {
this.statuses = statuses
this.exceptions = exceptions
constructor(count: Int, draftId: Long) {
this.statuses = arrayOfNulls(count)
this.exceptions = arrayOfNulls(count)
this.accountTypes = arrayOfNulls(count)
this.exception = null
this.draftId = draftId
}
constructor(exception: UpdateStatusException, draftId: Long) {
this.exception = exception
this.statuses = arrayOfNulls<ParcelableStatus>(0)
this.exceptions = arrayOfNulls<MicroBlogException>(0)
this.statuses = arrayOfNulls(0)
this.exceptions = arrayOfNulls(0)
this.accountTypes = arrayOfNulls(0)
this.draftId = draftId
}
}

View File

@ -0,0 +1,21 @@
package org.mariotaku.twidere.util.sync
import android.content.Context
import android.content.SharedPreferences
import org.mariotaku.twidere.model.sync.SyncProviderEntry
import org.mariotaku.twidere.model.sync.SyncProviderInfo
/**
* Created by mariotaku on 2017/1/2.
*/
class OpenSourceSyncProviderInfoFactory : SyncProviderInfoFactory() {
override fun getInfoForType(type: String, preferences: SharedPreferences): SyncProviderInfo? {
return null
}
override fun getSupportedProviders(context: Context): List<SyncProviderEntry> {
return emptyList()
}
}

View File

@ -0,0 +1,35 @@
package org.mariotaku.twidere.util.sync
import android.content.Context
import android.content.SharedPreferences
import org.mariotaku.twidere.model.sync.SyncProviderEntry
import org.mariotaku.twidere.model.sync.SyncProviderInfo
import java.util.*
/**
* Created by mariotaku on 2017/1/2.
*/
abstract class SyncProviderInfoFactory {
abstract fun getInfoForType(type: String, preferences: SharedPreferences): SyncProviderInfo?
abstract fun getSupportedProviders(context: Context): List<SyncProviderEntry>
companion object {
fun getInfoForType(type: String, preferences: SharedPreferences): SyncProviderInfo? {
ServiceLoader.load(SyncProviderInfoFactory::class.java).forEach { factory ->
val info = factory.getInfoForType(type, preferences)
if (info != null) return info
}
return null
}
fun getSupportedProviders(context: Context): List<SyncProviderEntry> {
val result = ArrayList<SyncProviderEntry>()
ServiceLoader.load(SyncProviderInfoFactory::class.java).forEach { factory ->
result.addAll(factory.getSupportedProviders(context))
}
return result
}
}
}

View File

@ -535,8 +535,8 @@
<string name="export_settings">تصدير الإعدادات</string>
<string name="export_settings_type_dialog_title">تصدير الإعدادات&#8230;</string>
<string name="import_settings_type_dialog_title">استيراد الإعدادات&#8230;</string>
<string name="nicknames">أسماء مستعارة</string>
<string name="user_colors">ألوان المستخدم</string>
<string name="title_nicknames">أسماء مستعارة</string>
<string name="title_user_colors">ألوان المستخدم</string>
<string name="progress">التقدم</string>
<string name="hidden_settings">إعدادات مخفية</string>
<string name="hidden_settings_warning_title">تحذير: هذه الإعدادات قد تسبب ضررا!</string>

View File

@ -546,8 +546,8 @@
<string name="export_settings">Esportar axustes</string>
<string name="export_settings_type_dialog_title">Esportar axustes&#8230;</string>
<string name="import_settings_type_dialog_title">Importar axustes...</string>
<string name="nicknames">Nomatos</string>
<string name="user_colors">Colores d\'usuariu</string>
<string name="title_nicknames">Nomatos</string>
<string name="title_user_colors">Colores d\'usuariu</string>
<string name="progress">Progresu</string>
<string name="hidden_settings">Axustes anubríos</string>
<string name="hidden_settings_warning_title">AVISU: ¡Estos axustes puen firite!</string>

View File

@ -540,8 +540,8 @@
<string name="export_settings">Exporta els paràmetres</string>
<string name="export_settings_type_dialog_title">Exporta els paràmetres&#8230;</string>
<string name="import_settings_type_dialog_title">Importa paràmetres&#8230;</string>
<string name="nicknames">Sobrenoms</string>
<string name="user_colors">Colors de l\'usuari</string>
<string name="title_nicknames">Sobrenoms</string>
<string name="title_user_colors">Colors de l\'usuari</string>
<string name="progress">Progrés</string>
<string name="hidden_settings">Paràmetres ocults</string>
<string name="hidden_settings_warning_title">ATENCIÓ: Aquests paràmetres són perillosos!</string>

View File

@ -294,8 +294,8 @@
<string name="back">Zpět</string>
<string name="accept">Přijmout</string>
<string name="deny">Odmítnout</string>
<string name="nicknames">Přezdívky</string>
<string name="user_colors">Uživatelské barvy</string>
<string name="title_nicknames">Přezdívky</string>
<string name="title_user_colors">Uživatelské barvy</string>
<string name="progress">Průběh</string>
<string name="hidden_settings">Skrytá nastavení</string>
<string name="compose_now">Vytvořit hned</string>

View File

@ -547,8 +547,8 @@
<string name="export_settings">Einstellungen exportieren</string>
<string name="export_settings_type_dialog_title">Einstellungen exportieren&#8230;</string>
<string name="import_settings_type_dialog_title">Einstellungen importieren&#8230;</string>
<string name="nicknames">Spitznamen</string>
<string name="user_colors">Benutzerfarben</string>
<string name="title_nicknames">Spitznamen</string>
<string name="title_user_colors">Benutzerfarben</string>
<string name="progress">Fortschritt</string>
<string name="hidden_settings">Versteckte Einstellungen</string>
<string name="hidden_settings_warning_title">ACHTUNG: Diese Einstellungen können Schaden anrichten!</string>

View File

@ -109,7 +109,7 @@
<!-- Previous item (tweet, user etc.) -->
<!-- Next item (tweet, user etc.) -->
<string name="center">Centre</string>
<string name="user_colors">User colours</string>
<string name="title_user_colors">User colours</string>
<string name="color">Colour</string>
<string name="profile_text_color">Text colour</string>
<string name="profile_background_color">Background colour</string>

View File

@ -547,8 +547,8 @@
<string name="export_settings">Exportar ajustes</string>
<string name="export_settings_type_dialog_title">Exportar ajustes&#8230;</string>
<string name="import_settings_type_dialog_title">Importar ajustes&#8230;</string>
<string name="nicknames">Apodos</string>
<string name="user_colors">Colores de usuario</string>
<string name="title_nicknames">Apodos</string>
<string name="title_user_colors">Colores de usuario</string>
<string name="progress">Progreso</string>
<string name="hidden_settings">Configuraciones ocultas</string>
<string name="hidden_settings_warning_title">PRECAUCIÓN: ¡Estos ajustes pueden ser perjudiciales!</string>

View File

@ -547,8 +547,8 @@
<string name="export_settings">صادر کردن تنظیمات</string>
<string name="export_settings_type_dialog_title">صادر کردن تنظیمات&#8230;</string>
<string name="import_settings_type_dialog_title">وارد کردن تنظیمات&#8230;</string>
<string name="nicknames">نام‌های مستعار</string>
<string name="user_colors">رنگ‌های کاربر</string>
<string name="title_nicknames">نام‌های مستعار</string>
<string name="title_user_colors">رنگ‌های کاربر</string>
<string name="progress">پیشرفت</string>
<string name="hidden_settings">تنظیمات پنهان</string>
<string name="hidden_settings_warning_title">هشدار: این تنظمیمات ممکن است صدمه بزنند!</string>

View File

@ -546,8 +546,8 @@
<string name="export_settings">Vie asetukset</string>
<string name="export_settings_type_dialog_title">Vie asetukset&#8230;</string>
<string name="import_settings_type_dialog_title">Tuo asetukset&#8230;</string>
<string name="nicknames">Kutsumanimet</string>
<string name="user_colors">Käyttäjän värit</string>
<string name="title_nicknames">Kutsumanimet</string>
<string name="title_user_colors">Käyttäjän värit</string>
<string name="progress">Edistyminen</string>
<string name="hidden_settings">Piilotetut asetukset</string>
<string name="hidden_settings_warning_title">VAROITUS: Nämä asetukset voivat olla haitallisia!</string>

View File

@ -547,8 +547,8 @@
<string name="export_settings">Exportation des paramètres</string>
<string name="export_settings_type_dialog_title">Exportation des paramètres&#8230;</string>
<string name="import_settings_type_dialog_title">Importation des paramètres&#8230;</string>
<string name="nicknames">Surnoms</string>
<string name="user_colors">Couleurs utilisateur</string>
<string name="title_nicknames">Surnoms</string>
<string name="title_user_colors">Couleurs utilisateur</string>
<string name="progress">Avancement</string>
<string name="hidden_settings">Paramètres cachés</string>
<string name="hidden_settings_warning_title">ATTENTION : Ces paramètres peuvent faire mal !</string>

View File

@ -540,8 +540,8 @@
<string name="export_settings">Exportar configuración</string>
<string name="export_settings_type_dialog_title">Exportar configuración&#8230;</string>
<string name="import_settings_type_dialog_title">Importar configuración&#8230;</string>
<string name="nicknames">Alcumes</string>
<string name="user_colors">Cores do usuario</string>
<string name="title_nicknames">Alcumes</string>
<string name="title_user_colors">Cores do usuario</string>
<string name="progress">Progreso</string>
<string name="hidden_settings">Agochar configuración</string>
<string name="hidden_settings_warning_title">AVISO: Esta configuración pode producir danos!</string>

View File

@ -499,8 +499,8 @@
<string name="export_settings">Izvezi postavke</string>
<string name="export_settings_type_dialog_title">Izvezi postavke&#8230;</string>
<string name="import_settings_type_dialog_title">Uvezi postavke&#8230;</string>
<string name="nicknames">Nadimci</string>
<string name="user_colors">Korisničke boje</string>
<string name="title_nicknames">Nadimci</string>
<string name="title_user_colors">Korisničke boje</string>
<string name="progress">Napredak</string>
<string name="hidden_settings">Skrivene postavke</string>
<string name="hidden_settings_warning_title">UPOZORENJE: Ovo postavke mogu vas ugristi!</string>

View File

@ -535,8 +535,8 @@
<string name="export_settings">Beállítások exportálása</string>
<string name="export_settings_type_dialog_title">Beállítások exportálása&#8230;</string>
<string name="import_settings_type_dialog_title">Beállítások importálása&#8230;</string>
<string name="nicknames">Becenevek</string>
<string name="user_colors">Felhasználói színek</string>
<string name="title_nicknames">Becenevek</string>
<string name="title_user_colors">Felhasználói színek</string>
<string name="progress">Folyamat</string>
<string name="hidden_settings">Rejtett beállítások</string>
<string name="hidden_settings_warning_title">FIGYELMEZTETÉS: Ezek a beállítások kárt okozhatnak!</string>

View File

@ -543,8 +543,8 @@
<string name="export_settings">Ekspor pengaturan</string>
<string name="export_settings_type_dialog_title">Ekspor pengaturan&#8230;</string>
<string name="import_settings_type_dialog_title">Impor pengaturan&#8230;</string>
<string name="nicknames">Nama panggilan</string>
<string name="user_colors">Warna pengguna</string>
<string name="title_nicknames">Nama panggilan</string>
<string name="title_user_colors">Warna pengguna</string>
<string name="progress">Progres</string>
<string name="hidden_settings">Pengaturan tersembunyi</string>
<string name="hidden_settings_warning_title">PERINGATAN: Pengaturan ini dapat merusak!</string>

View File

@ -542,8 +542,8 @@
<string name="export_settings">Esporta impostazioni</string>
<string name="export_settings_type_dialog_title">Esporta impostazioni&#8230;</string>
<string name="import_settings_type_dialog_title">Importa impostazioni&#8230;</string>
<string name="nicknames">Nickname</string>
<string name="user_colors">Colori personalizzati</string>
<string name="title_nicknames">Nickname</string>
<string name="title_user_colors">Colori personalizzati</string>
<string name="progress">Avanzamento</string>
<string name="hidden_settings">Impostazioni nascoste</string>
<string name="hidden_settings_warning_title">ATTENZIONE: queste opzioni possono far male!</string>

View File

@ -398,7 +398,7 @@
<string name="export_settings">ייצא הגדרות</string>
<string name="export_settings_type_dialog_title">ייצוא הגדרות&#8230;</string>
<string name="import_settings_type_dialog_title">ייבוא הגדרות&#8230;</string>
<string name="nicknames">כינויים</string>
<string name="title_nicknames">כינויים</string>
<string name="hidden_settings">הגדרות מוסתרות</string>
<string name="hidden_settings_warning_title">אזהרה: הגדרות אלו עלולות לפגוע!</string>
<string name="hidden_settings_warning_message">לעולם אל תשנה/י את ההגדרות האלו אם את/ה לא יודע/ת מה הן, אחרת הן:\n * יהרגו את החתול שלך\n * ישגרו טילים גרעיניים מצפון קוריאה\n * יהפכו את כל ה-Mahou Shoujo ל-Majo\n * יהרסו את היקום</string>

View File

@ -544,8 +544,8 @@
<string name="export_settings">設定のエクスポート</string>
<string name="export_settings_type_dialog_title">設定をエクスポート中&#8230;</string>
<string name="import_settings_type_dialog_title">設定のインポート&#8230;</string>
<string name="nicknames">ニックネーム</string>
<string name="user_colors">ユーザー色</string>
<string name="title_nicknames">ニックネーム</string>
<string name="title_user_colors">ユーザー色</string>
<string name="progress">進捗</string>
<string name="hidden_settings">隠し設定</string>
<string name="hidden_settings_warning_title">警告: これらの設定は危なっかしいかも!</string>

View File

@ -541,8 +541,8 @@
<string name="export_settings">설정 내보내기</string>
<string name="export_settings_type_dialog_title">설정을 내보내는 중...</string>
<string name="import_settings_type_dialog_title">설정을 가져오는 중...</string>
<string name="nicknames">별명</string>
<string name="user_colors">사용자 색상</string>
<string name="title_nicknames">별명</string>
<string name="title_user_colors">사용자 색상</string>
<string name="progress">진행</string>
<string name="hidden_settings">숨겨진 설정</string>
<string name="hidden_settings_warning_title">경고: 이 설정은 위험할 수 있습니다!</string>

View File

@ -538,8 +538,8 @@
<string name="export_settings">Exporteer instellingen</string>
<string name="export_settings_type_dialog_title">Exporteer instellingen&#8230;</string>
<string name="import_settings_type_dialog_title">Importeer instellingen&#8230;</string>
<string name="nicknames">Bijnamen</string>
<string name="user_colors">Gebruikerskleuren</string>
<string name="title_nicknames">Bijnamen</string>
<string name="title_user_colors">Gebruikerskleuren</string>
<string name="progress">vooruitgang</string>
<string name="hidden_settings">verborgen instellingen</string>
<string name="hidden_settings_warning_title">OPGELET: Deze instellingen kunnen schade toebrengen!</string>

View File

@ -520,8 +520,8 @@
<string name="export_settings">Eksporter innstillinger</string>
<string name="export_settings_type_dialog_title">Eksporter innstillinger&#8230;</string>
<string name="import_settings_type_dialog_title">Importer innstillinger&#8230;</string>
<string name="nicknames">Kallenavn</string>
<string name="user_colors">Brukerfarger</string>
<string name="title_nicknames">Kallenavn</string>
<string name="title_user_colors">Brukerfarger</string>
<string name="progress">Fremdrift</string>
<string name="hidden_settings">Skjulte innstillinger</string>
<string name="hidden_settings_warning_title">ADVARSEL: Disse innstillingene kan være skadelige!</string>

View File

@ -486,8 +486,8 @@
<string name="export_settings">Eksportuj ustawienia</string>
<string name="export_settings_type_dialog_title">Eksportowanie ustawień&#8230;</string>
<string name="import_settings_type_dialog_title">Importowanie ustawień&#8230;</string>
<string name="nicknames">Pseudonimy</string>
<string name="user_colors">Kolory użytkownika</string>
<string name="title_nicknames">Pseudonimy</string>
<string name="title_user_colors">Kolory użytkownika</string>
<string name="progress">Postęp</string>
<string name="hidden_settings">Ukryte ustawienia</string>
<string name="hidden_settings_warning_title">UWAGA: Ustawienia te mogą szkodzić!</string>

View File

@ -546,8 +546,8 @@
<string name="export_settings">Exportar configurações</string>
<string name="export_settings_type_dialog_title">Exportar configurações...</string>
<string name="import_settings_type_dialog_title">Importar configurações...</string>
<string name="nicknames">Apelidos</string>
<string name="user_colors">Cores de usuários</string>
<string name="title_nicknames">Apelidos</string>
<string name="title_user_colors">Cores de usuários</string>
<string name="progress">Progresso</string>
<string name="hidden_settings">Configurações ocultas</string>
<string name="hidden_settings_warning_title">AVISO: Estas configurações podem causar encrencas!</string>

View File

@ -540,8 +540,8 @@
<string name="export_settings">Экспортировать параметры</string>
<string name="export_settings_type_dialog_title">Экспорт настроек&#8230;</string>
<string name="import_settings_type_dialog_title">Импорт настроек&#8230;</string>
<string name="nicknames">Имена</string>
<string name="user_colors">Пользовательские цвета</string>
<string name="title_nicknames">Имена</string>
<string name="title_user_colors">Пользовательские цвета</string>
<string name="progress">Прогресс</string>
<string name="hidden_settings">Скрытые настройки</string>
<string name="hidden_settings_warning_title">ОСТОРОЖНО: Изменение этих настроек может повлечь за собой последствия!</string>

View File

@ -542,8 +542,8 @@
<string name="export_settings">ส่งออกการตั้งค่า</string>
<string name="export_settings_type_dialog_title">ส่งออกการตั้งค่า...</string>
<string name="import_settings_type_dialog_title">นำเข้าการตั้งค่า...</string>
<string name="nicknames">ชื่อเล่น</string>
<string name="user_colors">สีของผู้ใช้</string>
<string name="title_nicknames">ชื่อเล่น</string>
<string name="title_user_colors">สีของผู้ใช้</string>
<string name="progress">การดำเนินการ</string>
<string name="hidden_settings">การตั้งค่าเพิ่มเติม</string>
<string name="hidden_settings_warning_title">คำเตือน: การตั้งค่าเหล่านี้อาจทำมือถือคุณระเบิดได้</string>

View File

@ -541,8 +541,8 @@
<string name="export_settings">Ayarları dışa aktar</string>
<string name="export_settings_type_dialog_title">Ayarları dışa aktar&#8230;</string>
<string name="import_settings_type_dialog_title">Ayarları içe aktar&#8230;</string>
<string name="nicknames">Lakaplar</string>
<string name="user_colors">Kullanıcı renkleri</string>
<string name="title_nicknames">Lakaplar</string>
<string name="title_user_colors">Kullanıcı renkleri</string>
<string name="progress">İlerleme</string>
<string name="hidden_settings">Gizli ayarlar</string>
<string name="hidden_settings_warning_title">UYARI: Bu ayarları değiştirmek uygulamaya zarar verebilir!</string>

View File

@ -542,8 +542,8 @@
<string name="export_settings">Експорт налаштувань</string>
<string name="export_settings_type_dialog_title">Експорт налаштувань&#8230;</string>
<string name="import_settings_type_dialog_title">Імпорт налаштувань&#8230;</string>
<string name="nicknames">Псевдо</string>
<string name="user_colors">Кольори користувача</string>
<string name="title_nicknames">Псевдо</string>
<string name="title_user_colors">Кольори користувача</string>
<string name="progress">Перебіг</string>
<string name="hidden_settings">Приховані налаштування</string>
<string name="hidden_settings_warning_title">УВАГА: Ці параметри можуть зашкодити!</string>

View File

@ -547,8 +547,8 @@
<string name="export_settings">导出设定</string>
<string name="export_settings_type_dialog_title">导出设定&#8230;</string>
<string name="import_settings_type_dialog_title">导入设定&#8230;</string>
<string name="nicknames">昵称</string>
<string name="user_colors">用户颜色标签</string>
<string name="title_nicknames">昵称</string>
<string name="title_user_colors">用户颜色标签</string>
<string name="progress">进度</string>
<string name="hidden_settings">隐藏设定</string>
<string name="hidden_settings_warning_title">警告:这些设定受结界保护!</string>

View File

@ -546,8 +546,8 @@
<string name="export_settings">匯出設定</string>
<string name="export_settings_type_dialog_title">匯出設定⋯</string>
<string name="import_settings_type_dialog_title">匯入設定⋯</string>
<string name="nicknames">暱稱</string>
<string name="user_colors">用戶顏色標籤</string>
<string name="title_nicknames">暱稱</string>
<string name="title_user_colors">用戶顏色標籤</string>
<string name="progress">進度</string>
<string name="hidden_settings">隱藏設定</string>
<string name="hidden_settings_warning_title">警告:這些設定受結界保護!</string>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu 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"
tools:ignore="AppCompatResource">
<item
android:id="@+id/disconnect"
android:showAsAction="never"
android:title="@string/action_sync_disconnect"
app:showAsAction="never"/>
</menu>

View File

@ -53,8 +53,8 @@
<item>@string/settings</item>
<item>@string/tabs</item>
<item>@string/title_filters</item>
<item>@string/nicknames</item>
<item>@string/user_colors</item>
<item>@string/title_nicknames</item>
<item>@string/title_user_colors</item>
<item>@string/custom_host_mapping</item>
</string-array>
<string-array name="entries_compose_now_action">

View File

@ -550,8 +550,8 @@
<string name="export_settings">Export settings</string>
<string name="export_settings_type_dialog_title">Export settings…</string>
<string name="import_settings_type_dialog_title">Import settings…</string>
<string name="nicknames">Nicknames</string>
<string name="user_colors">User colors</string>
<string name="title_nicknames">Nicknames</string>
<string name="title_user_colors">User colors</string>
<string name="progress">Progress</string>
<string name="hidden_settings">Hidden settings</string>
<string name="hidden_settings_warning_title">WARNING: These settings may harm!</string>
@ -874,4 +874,15 @@
<string name="title_manage_filter_subscriptions">Filter subscriptions</string>
<!-- Toast message for enhanced (paid) features not purchased while trying to restore purchase -->
<string name="message_extra_features_not_purchased">Enhanced features not purchased</string>
<!-- [verb] Connect to network storage like Dropbox and Google Drive etc -->
<string name="action_sync_connect_to_storage">Connect</string>
<string name="title_dialog_sync_connect_to">Connect to…</string>
<string name="action_sync_settings">Settings</string>
<string name="message_sync_data_connect_hint">Connect Twidere with network storage to sync data</string>
<string name="message_sync_data_synced_with_name">Twidere is now synced with <xliff:g example="ownCloud" id="name">%s</xliff:g></string>
<string name="title_sync">Data sync</string>
<string name="sync_provider_name_dropbox">Dropbox</string>
<!-- [verb] Disconnect from network storage -->
<string name="action_sync_disconnect">Disconnect</string>
<string name="title_sync_settings">Sync settings</string>
</resources>

View File

@ -64,12 +64,6 @@
android:summary="%s"
android:title="@string/media_uploader"/>
<org.mariotaku.twidere.preference.TimelineSyncPreference
android:defaultValue=""
android:key="timeline_sync_service"
android:summary="%s"
android:title="@string/timeline_sync_service"/>
<SwitchPreferenceCompat
android:defaultValue="true"
android:enabled="@bool/support_new_document_intent"

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--suppress AndroidElementNotAllowed -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreferenceCompat android:title="@string/title_drafts"/>
<SwitchPreferenceCompat android:title="@string/title_filters"/>
<SwitchPreferenceCompat android:title="@string/title_nicknames"/>
<SwitchPreferenceCompat android:title="@string/title_user_colors"/>
</PreferenceScreen>

View File

@ -0,0 +1 @@
org.mariotaku.twidere.util.sync.OpenSourceSyncProviderInfoFactory