[NO-CI] Migration WIP
This commit is contained in:
parent
d3892354f0
commit
35da54f967
|
@ -75,6 +75,7 @@ dependencies {
|
||||||
|
|
||||||
implementation "com.android.support:support-annotations:${libVersions['SupportLib']}"
|
implementation "com.android.support:support-annotations:${libVersions['SupportLib']}"
|
||||||
implementation "com.bluelinelabs:logansquare:${libVersions['LoganSquare']}"
|
implementation "com.bluelinelabs:logansquare:${libVersions['LoganSquare']}"
|
||||||
|
implementation "com.fasterxml.jackson.core:jackson-core:2.7.4"
|
||||||
implementation "com.github.mariotaku.RestFu:library:${libVersions['RestFu']}"
|
implementation "com.github.mariotaku.RestFu:library:${libVersions['RestFu']}"
|
||||||
implementation "com.github.mariotaku.RestFu:oauth:${libVersions['RestFu']}"
|
implementation "com.github.mariotaku.RestFu:oauth:${libVersions['RestFu']}"
|
||||||
implementation "com.github.mariotaku.RestFu:oauth2:${libVersions['RestFu']}"
|
implementation "com.github.mariotaku.RestFu:oauth2:${libVersions['RestFu']}"
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.mariotaku.twidere.util.JsonSerializer;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +54,7 @@ public abstract class FanfouUserStreamCallback implements RawCallback<MicroBlogE
|
||||||
onException(cause);
|
onException(cause);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final CRLFLineReader reader = new CRLFLineReader(new InputStreamReader(response.getBody().stream(), "UTF-8"));
|
final CRLFLineReader reader = new CRLFLineReader(new InputStreamReader(response.getBody().stream(), StandardCharsets.UTF_8));
|
||||||
try {
|
try {
|
||||||
for (String line; (line = reader.readLine()) != null && !disconnected; ) {
|
for (String line; (line = reader.readLine()) != null && !disconnected; ) {
|
||||||
if (Thread.currentThread().isInterrupted()) {
|
if (Thread.currentThread().isInterrupted()) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.mariotaku.twidere.util.JsonSerializer;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 15/5/26.
|
* Created by mariotaku on 15/5/26.
|
||||||
|
@ -50,7 +51,7 @@ public abstract class MastodonUserStreamCallback implements RawCallback<MicroBlo
|
||||||
onException(cause);
|
onException(cause);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final CRLFLineReader reader = new CRLFLineReader(new InputStreamReader(response.getBody().stream(), "UTF-8"));
|
final CRLFLineReader reader = new CRLFLineReader(new InputStreamReader(response.getBody().stream(), StandardCharsets.UTF_8));
|
||||||
try {
|
try {
|
||||||
String event = null;
|
String event = null;
|
||||||
for (String line; (line = reader.readLine()) != null && !disconnected; ) {
|
for (String line; (line = reader.readLine()) != null && !disconnected; ) {
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.mariotaku.twidere.util.JsonSerializer;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +61,7 @@ public abstract class UserStreamCallback implements RawCallback<MicroBlogExcepti
|
||||||
onException(cause);
|
onException(cause);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final CRLFLineReader reader = new CRLFLineReader(new InputStreamReader(response.getBody().stream(), "UTF-8"));
|
final CRLFLineReader reader = new CRLFLineReader(new InputStreamReader(response.getBody().stream(), StandardCharsets.UTF_8));
|
||||||
try {
|
try {
|
||||||
for (String line; (line = reader.readLine()) != null && !disconnected; ) {
|
for (String line; (line = reader.readLine()) != null && !disconnected; ) {
|
||||||
if (Thread.currentThread().isInterrupted()) {
|
if (Thread.currentThread().isInterrupted()) {
|
||||||
|
|
|
@ -61,9 +61,7 @@ public class GeoLocation implements ValueMap, Parcelable {
|
||||||
final GeoLocation that = (GeoLocation) o;
|
final GeoLocation that = (GeoLocation) o;
|
||||||
|
|
||||||
if (Double.compare(that.getLatitude(), latitude) != 0) return false;
|
if (Double.compare(that.getLatitude(), latitude) != 0) return false;
|
||||||
if (Double.compare(that.getLongitude(), longitude) != 0) return false;
|
return Double.compare(that.getLongitude(), longitude) == 0;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -75,10 +75,7 @@ public final class GeoQuery implements ValueMap {
|
||||||
if (granularity != null ? !granularity.equals(geoQuery.granularity) : geoQuery.granularity != null)
|
if (granularity != null ? !granularity.equals(geoQuery.granularity) : geoQuery.granularity != null)
|
||||||
return false;
|
return false;
|
||||||
if (ip != null ? !ip.equals(geoQuery.ip) : geoQuery.ip != null) return false;
|
if (ip != null ? !ip.equals(geoQuery.ip) : geoQuery.ip != null) return false;
|
||||||
if (location != null ? !location.equals(geoQuery.location) : geoQuery.location != null)
|
return location != null ? location.equals(geoQuery.location) : geoQuery.location == null;
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccuracy() {
|
public String getAccuracy() {
|
||||||
|
|
|
@ -61,9 +61,7 @@ public class ParcelableLocation implements Parcelable {
|
||||||
final ParcelableLocation other = (ParcelableLocation) obj;
|
final ParcelableLocation other = (ParcelableLocation) obj;
|
||||||
if (Double.doubleToLongBits(latitude) != Double.doubleToLongBits(other.latitude))
|
if (Double.doubleToLongBits(latitude) != Double.doubleToLongBits(other.latitude))
|
||||||
return false;
|
return false;
|
||||||
if (Double.doubleToLongBits(longitude) != Double.doubleToLongBits(other.longitude))
|
return Double.doubleToLongBits(longitude) == Double.doubleToLongBits(other.longitude);
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class NyanDaydreamService extends DreamService implements NyanConstants,
|
||||||
@Override
|
@Override
|
||||||
public void onContentChanged() {
|
public void onContentChanged() {
|
||||||
super.onContentChanged();
|
super.onContentChanged();
|
||||||
mNyanDaydreamView = (NyanDaydreamView) findViewById(R.id.nyan);
|
mNyanDaydreamView = findViewById(R.id.nyan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,7 +13,7 @@ buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-android-extensions:${kotlinVersion}"
|
classpath "org.jetbrains.kotlin:kotlin-android-extensions:${kotlinVersion}"
|
||||||
classpath 'com.github.mariotaku:imgenie-plugin:0.0.5'
|
classpath 'com.github.mariotaku:imgenie-plugin:0.2.5'
|
||||||
|
|
||||||
// START Non-FOSS component
|
// START Non-FOSS component
|
||||||
classpath "com.google.gms:google-services:${pluginVersions['PlayServices']}"
|
classpath "com.google.gms:google-services:${pluginVersions['PlayServices']}"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
f433ddba000a1d317924792ba9086194f071f499
|
dfe8e89a81991e4a764bbcff837e28fab3be95ad
|
||||||
|
|
|
@ -39,7 +39,7 @@ class FileExtensionsTest {
|
||||||
random.nextBytes(testData)
|
random.nextBytes(testData)
|
||||||
val compareData = context.cacheDir.tempInputStream { os ->
|
val compareData = context.cacheDir.tempInputStream { os ->
|
||||||
os.write(testData)
|
os.write(testData)
|
||||||
}.use { it.readBytes(1024) }
|
}.use { it.readBytes() }
|
||||||
Assert.assertArrayEquals(testData, compareData)
|
Assert.assertArrayEquals(testData, compareData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ class UrlFiltersSubscriptionProviderTest {
|
||||||
val context = InstrumentationRegistry.getTargetContext()
|
val context = InstrumentationRegistry.getTargetContext()
|
||||||
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||||
|
|
||||||
if (!(cm.activeNetworkInfo?.isConnected ?: false)) return
|
if (cm.activeNetworkInfo?.isConnected != true) return
|
||||||
|
|
||||||
val url = "https://raw.githubusercontent.com/mariotaku/wtb/master/twidere/bots.xml"
|
val url = "https://raw.githubusercontent.com/mariotaku/wtb/master/twidere/bots.xml"
|
||||||
val arguments = UrlFiltersSubscriptionProviderArguments().apply {
|
val arguments = UrlFiltersSubscriptionProviderArguments().apply {
|
||||||
|
|
|
@ -117,7 +117,7 @@ class AccountsDumperPlugin(val context: Context) : DumperPlugin {
|
||||||
protected abstract val options: Options
|
protected abstract val options: Options
|
||||||
protected abstract val syntax: String
|
protected abstract val syntax: String
|
||||||
|
|
||||||
override final fun execute(dumpContext: DumperContext, args: Array<String>) {
|
final override fun execute(dumpContext: DumperContext, args: Array<String>) {
|
||||||
val commandLine = try {
|
val commandLine = try {
|
||||||
GnuParser().parse(options, args)
|
GnuParser().parse(options, args)
|
||||||
} catch (e: ParseException) {
|
} catch (e: ParseException) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
/**
|
/**
|
||||||
* Created by mariotaku on 2017/3/2.
|
* Created by mariotaku on 2017/3/2.
|
||||||
*/
|
*/
|
||||||
@IntDef({ImageShapeStyle.SHAPE_CIRCLE, ImageShapeStyle.SHAPE_RECTANGLE})
|
@IntDef({0, ImageShapeStyle.SHAPE_CIRCLE, ImageShapeStyle.SHAPE_RECTANGLE})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface ImageShapeStyle {
|
public @interface ImageShapeStyle {
|
||||||
int SHAPE_CIRCLE = 0x1;
|
int SHAPE_CIRCLE = 0x1;
|
||||||
|
|
|
@ -387,7 +387,7 @@ public class CronExpression {
|
||||||
}
|
}
|
||||||
final int start = parseNumber(string.substring(0, dashIdx), allowedRange,
|
final int start = parseNumber(string.substring(0, dashIdx), allowedRange,
|
||||||
textRepresentations);
|
textRepresentations);
|
||||||
final int endInclusive = parseNumber(string.substring(dashIdx + 1, string.length()),
|
final int endInclusive = parseNumber(string.substring(dashIdx + 1),
|
||||||
allowedRange, textRepresentations);
|
allowedRange, textRepresentations);
|
||||||
return new Range(start, endInclusive);
|
return new Range(start, endInclusive);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class ListResponse<Data> extends AbstractList<Data> implements Response<L
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <Data> ListResponse<Data> emptyListInstance() {
|
public static <Data> ListResponse<Data> emptyListInstance() {
|
||||||
return new ListResponse<>(Collections.<Data>emptyList(), null);
|
return new ListResponse<>(Collections.emptyList(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <Data> ListResponse<Data> getListInstance(List<Data> list, Exception e) {
|
public static <Data> ListResponse<Data> getListInstance(List<Data> list, Exception e) {
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class LaunchPresentation {
|
||||||
int dashIndex = str.indexOf('-');
|
int dashIndex = str.indexOf('-');
|
||||||
if (dashIndex == -1) return new Locale(str, null);
|
if (dashIndex == -1) return new Locale(str, null);
|
||||||
return new Locale(str.substring(0, dashIndex),
|
return new Locale(str.substring(0, dashIndex),
|
||||||
str.substring(dashIndex + 1, str.length()));
|
str.substring(dashIndex + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ListConverter extends StringBasedListTypeConverter<Locale> {
|
static class ListConverter extends StringBasedListTypeConverter<Locale> {
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class MicroBlogAPIFactory implements TwidereConstants {
|
||||||
final int endOfHost = format.indexOf('/', startOfHost);
|
final int endOfHost = format.indexOf('/', startOfHost);
|
||||||
final String host = endOfHost != -1 ? format.substring(startOfHost, endOfHost) : format.substring(startOfHost);
|
final String host = endOfHost != -1 ? format.substring(startOfHost, endOfHost) : format.substring(startOfHost);
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append(format.substring(0, startOfHost));
|
sb.append(format, 0, startOfHost);
|
||||||
if (host.equalsIgnoreCase("api.twitter.com")) {
|
if (host.equalsIgnoreCase("api.twitter.com")) {
|
||||||
if (domain != null) {
|
if (domain != null) {
|
||||||
sb.append(domain);
|
sb.append(domain);
|
||||||
|
|
|
@ -46,6 +46,6 @@ fun CharArray.indexOf(element: Char, start: Int, len: Int): Int {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
operator inline fun <reified T> Array<T>.minus(array: Array<T>): Array<T> {
|
inline operator fun <reified T> Array<T>.minus(array: Array<T>): Array<T> {
|
||||||
return this.filterNot { it in array }.toTypedArray()
|
return this.filterNot { it in array }.toTypedArray()
|
||||||
}
|
}
|
|
@ -144,11 +144,11 @@ open class BaseActivity : ChameleonActivity(), IBaseActivity<BaseActivity>, IThe
|
||||||
protected val isDialogTheme: Boolean
|
protected val isDialogTheme: Boolean
|
||||||
get() = ThemeUtils.getBooleanFromAttribute(this, R.attr.isDialogTheme)
|
get() = ThemeUtils.getBooleanFromAttribute(this, R.attr.isDialogTheme)
|
||||||
|
|
||||||
override final val currentThemeBackgroundAlpha by lazy {
|
final override val currentThemeBackgroundAlpha by lazy {
|
||||||
themeBackgroundAlpha
|
themeBackgroundAlpha
|
||||||
}
|
}
|
||||||
|
|
||||||
override final val currentThemeBackgroundOption by lazy {
|
final override val currentThemeBackgroundOption by lazy {
|
||||||
themeBackgroundOption
|
themeBackgroundOption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -395,7 +395,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
val src = MediaPickerActivity.getMediaUris(data)
|
val src = MediaPickerActivity.getMediaUris(data)
|
||||||
TaskStarter.execute(AddMediaTask(this, src, null, false, false))
|
TaskStarter.execute(AddMediaTask(this, src, null, false, false))
|
||||||
val extras = data.getBundleExtra(MediaPickerActivity.EXTRA_EXTRAS)
|
val extras = data.getBundleExtra(MediaPickerActivity.EXTRA_EXTRAS)
|
||||||
if (extras?.getBoolean(EXTRA_IS_POSSIBLY_SENSITIVE) ?: false) {
|
if (extras?.getBoolean(EXTRA_IS_POSSIBLY_SENSITIVE) == true) {
|
||||||
possiblySensitive = true
|
possiblySensitive = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -703,11 +703,6 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
return super.handleKeyboardShortcutSingle(handler, keyCode, event, metaState)
|
return super.handleKeyboardShortcutSingle(handler, keyCode, event, metaState)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handleKeyboardShortcutRepeat(handler: KeyboardShortcutsHandler, keyCode: Int,
|
|
||||||
repeatCount: Int, event: KeyEvent, metaState: Int): Boolean {
|
|
||||||
return super.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event, metaState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
REQUEST_ATTACH_LOCATION_PERMISSION -> {
|
REQUEST_ATTACH_LOCATION_PERMISSION -> {
|
||||||
|
|
|
@ -350,10 +350,6 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||||
updateActionsButton()
|
updateActionsButton()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
|
||||||
super.onSaveInstanceState(outState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onClick(v: View) {
|
override fun onClick(v: View) {
|
||||||
when (v) {
|
when (v) {
|
||||||
actionsButton -> {
|
actionsButton -> {
|
||||||
|
|
|
@ -164,10 +164,6 @@ class SettingsActivity : BaseActivity(), OnItemClickListener, OnPreferenceStartF
|
||||||
return ACTION_NAVIGATION_BACK == action
|
return ACTION_NAVIGATION_BACK == action
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handleKeyboardShortcutRepeat(handler: KeyboardShortcutsHandler, keyCode: Int, repeatCount: Int, event: KeyEvent, metaState: Int): Boolean {
|
|
||||||
return super.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event, metaState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSupportNavigateUp(): Boolean {
|
override fun onSupportNavigateUp(): Boolean {
|
||||||
if (notifyUnsavedChange()) {
|
if (notifyUnsavedChange()) {
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -164,10 +164,6 @@ class SignInActivity : BaseActivity(), OnClickListener, TextWatcher,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
super.onCreateOptionsMenu(menu)
|
super.onCreateOptionsMenu(menu)
|
||||||
menuInflater.inflate(R.menu.menu_sign_in, menu)
|
menuInflater.inflate(R.menu.menu_sign_in, menu)
|
||||||
|
@ -1087,7 +1083,7 @@ class SignInActivity : BaseActivity(), OnClickListener, TextWatcher,
|
||||||
|
|
||||||
protected val profileImageSize: String = activity.getString(R.string.profile_image_size)
|
protected val profileImageSize: String = activity.getString(R.string.profile_image_size)
|
||||||
|
|
||||||
override final fun doInBackground(vararg args: Any?): SingleResponse<SignInResponse> {
|
final override fun doInBackground(vararg args: Any?): SingleResponse<SignInResponse> {
|
||||||
try {
|
try {
|
||||||
return SingleResponse.getInstance(performLogin())
|
return SingleResponse.getInstance(performLogin())
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
|
@ -34,11 +34,6 @@ import org.mariotaku.twidere.model.UserKey
|
||||||
*/
|
*/
|
||||||
abstract class AbsUserListRelatedShortcutCreatorActivity : AbsShortcutCreatorActivity() {
|
abstract class AbsUserListRelatedShortcutCreatorActivity : AbsShortcutCreatorActivity() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
REQUEST_SELECT_USER_LIST -> {
|
REQUEST_SELECT_USER_LIST -> {
|
||||||
|
@ -58,7 +53,7 @@ abstract class AbsUserListRelatedShortcutCreatorActivity : AbsShortcutCreatorAct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onAccountSelected(accountKey: UserKey, extras: Bundle?) {
|
final override fun onAccountSelected(accountKey: UserKey, extras: Bundle?) {
|
||||||
val selectUserListIntent = Intent(this, UserListSelectorActivity::class.java)
|
val selectUserListIntent = Intent(this, UserListSelectorActivity::class.java)
|
||||||
selectUserListIntent.putExtra(EXTRA_ACCOUNT_KEY, accountKey)
|
selectUserListIntent.putExtra(EXTRA_ACCOUNT_KEY, accountKey)
|
||||||
selectUserListIntent.putExtra(EXTRA_SHOW_MY_LISTS, true)
|
selectUserListIntent.putExtra(EXTRA_SHOW_MY_LISTS, true)
|
||||||
|
|
|
@ -53,7 +53,7 @@ abstract class AbsUserRelatedShortcutCreatorActivity : AbsShortcutCreatorActivit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onAccountSelected(accountKey: UserKey, extras: Bundle?) {
|
final override fun onAccountSelected(accountKey: UserKey, extras: Bundle?) {
|
||||||
val selectUserIntent = Intent(this, UserSelectorActivity::class.java)
|
val selectUserIntent = Intent(this, UserSelectorActivity::class.java)
|
||||||
selectUserIntent.putExtra(EXTRA_ACCOUNT_KEY, accountKey)
|
selectUserIntent.putExtra(EXTRA_ACCOUNT_KEY, accountKey)
|
||||||
selectUserIntent.putExtra(EXTRA_EXTRAS, Bundle {
|
selectUserIntent.putExtra(EXTRA_EXTRAS, Bundle {
|
||||||
|
|
|
@ -48,12 +48,12 @@ abstract class BaseRecyclerViewAdapter<VH : RecyclerView.ViewHolder>(
|
||||||
) : RecyclerView.Adapter<VH>(), IContentAdapter {
|
) : RecyclerView.Adapter<VH>(), IContentAdapter {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
override final lateinit var twitterWrapper: AsyncTwitterWrapper
|
final override lateinit var twitterWrapper: AsyncTwitterWrapper
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
override final lateinit var userColorNameManager: UserColorNameManager
|
final override lateinit var userColorNameManager: UserColorNameManager
|
||||||
@Inject
|
@Inject
|
||||||
override final lateinit var bidiFormatter: BidiFormatter
|
final override lateinit var bidiFormatter: BidiFormatter
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var preferences: SharedPreferences
|
lateinit var preferences: SharedPreferences
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -63,11 +63,11 @@ abstract class BaseRecyclerViewAdapter<VH : RecyclerView.ViewHolder>(
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var defaultFeatures: DefaultFeatures
|
lateinit var defaultFeatures: DefaultFeatures
|
||||||
|
|
||||||
override final val profileImageSize: String = context.getString(R.string.profile_image_size)
|
final override val profileImageSize: String = context.getString(R.string.profile_image_size)
|
||||||
override final val profileImageStyle: Int
|
final override val profileImageStyle: Int
|
||||||
override final val textSize: Float
|
final override val textSize: Float
|
||||||
override final val profileImageEnabled: Boolean
|
final override val profileImageEnabled: Boolean
|
||||||
override final val showAbsoluteTime: Boolean
|
final override val showAbsoluteTime: Boolean
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
|
|
@ -177,7 +177,7 @@ class SelectableUsersAdapter(
|
||||||
fun setItemChecked(position: Int, value: Boolean) {
|
fun setItemChecked(position: Int, value: Boolean) {
|
||||||
val userKey = getUserKey(position)
|
val userKey = getUserKey(position)
|
||||||
setCheckState(userKey, value)
|
setCheckState(userKey, value)
|
||||||
if (!(itemCheckedListener?.invoke(position, value) ?: true)) {
|
if (itemCheckedListener?.invoke(position, value) == false) {
|
||||||
setCheckState(userKey, !value)
|
setCheckState(userKey, !value)
|
||||||
notifyItemChanged(position)
|
notifyItemChanged(position)
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,10 +97,6 @@ class SupportTabsAdapter(
|
||||||
return fragment
|
return fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun startUpdate(container: ViewGroup) {
|
|
||||||
super.startUpdate(container)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getPageIcon(position: Int): Drawable {
|
override fun getPageIcon(position: Int): Drawable {
|
||||||
return getTabIconDrawable(context, this.tabs[position].icon)
|
return getTabIconDrawable(context, this.tabs[position].icon)
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,33 +87,33 @@ import javax.inject.Inject
|
||||||
class TwidereApplication : Application(), OnSharedPreferenceChangeListener {
|
class TwidereApplication : Application(), OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var activityTracker: ActivityTracker
|
internal lateinit var activityTracker: ActivityTracker
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var restHttpClient: RestHttpClient
|
internal lateinit var restHttpClient: RestHttpClient
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var dns: Dns
|
internal lateinit var dns: Dns
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var mediaDownloader: MediaDownloader
|
internal lateinit var mediaDownloader: MediaDownloader
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var defaultFeatures: DefaultFeatures
|
internal lateinit var defaultFeatures: DefaultFeatures
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var externalThemeManager: ExternalThemeManager
|
internal lateinit var externalThemeManager: ExternalThemeManager
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var kPreferences: KPreferences
|
internal lateinit var kPreferences: KPreferences
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var autoRefreshController: AutoRefreshController
|
internal lateinit var autoRefreshController: AutoRefreshController
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var syncController: SyncController
|
internal lateinit var syncController: SyncController
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var extraFeaturesService: ExtraFeaturesService
|
internal lateinit var extraFeaturesService: ExtraFeaturesService
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var promotionService: PromotionService
|
internal lateinit var promotionService: PromotionService
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var mediaPreloader: MediaPreloader
|
internal lateinit var mediaPreloader: MediaPreloader
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var contentNotificationManager: ContentNotificationManager
|
internal lateinit var contentNotificationManager: ContentNotificationManager
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var thumbor: ThumborWrapper
|
internal lateinit var thumbor: ThumborWrapper
|
||||||
|
|
||||||
val sqLiteDatabase: SQLiteDatabase by lazy {
|
val sqLiteDatabase: SQLiteDatabase by lazy {
|
||||||
StrictModeUtils.checkDiskIO()
|
StrictModeUtils.checkDiskIO()
|
||||||
|
|
|
@ -47,6 +47,6 @@ val ParcelableMedia.aspect_ratio: Double
|
||||||
|
|
||||||
val ParcelableMedia.bannerExtras: PromotionService.BannerExtras?
|
val ParcelableMedia.bannerExtras: PromotionService.BannerExtras?
|
||||||
get() {
|
get() {
|
||||||
val contentUrl = this.page_url ?: this.url ?: return null
|
val contentUrl = this.page_url ?: this.url
|
||||||
return PromotionService.BannerExtras(contentUrl)
|
return PromotionService.BannerExtras(contentUrl)
|
||||||
}
|
}
|
|
@ -32,7 +32,7 @@ fun Extractor.extractMentionsAndNonMentionStartIndex(text: String, mentions: Arr
|
||||||
for (entity in entities) {
|
for (entity in entities) {
|
||||||
if (entity.start != nextExpectedPos) break
|
if (entity.start != nextExpectedPos) break
|
||||||
// Break at first mention not found in `inReplyTo.mentions`
|
// Break at first mention not found in `inReplyTo.mentions`
|
||||||
if (mentions?.none { entity.value.equals(it.screen_name, ignoreCase = true) } ?: false) break
|
if (mentions?.none { entity.value.equals(it.screen_name, ignoreCase = true) } == true) break
|
||||||
nextExpectedPos = (entity.end..text.indices.endInclusive).firstOrNull {
|
nextExpectedPos = (entity.end..text.indices.endInclusive).firstOrNull {
|
||||||
!text[it].isWhitespace()
|
!text[it].isWhitespace()
|
||||||
} ?: text.indices.endInclusive + 1
|
} ?: text.indices.endInclusive + 1
|
||||||
|
|
|
@ -64,7 +64,7 @@ class APIEditorDialogFragment : BaseDialogFragment() {
|
||||||
val dialog = builder.create()
|
val dialog = builder.create()
|
||||||
dialog.onShow {
|
dialog.onShow {
|
||||||
it.applyTheme()
|
it.applyTheme()
|
||||||
if (arguments?.getBoolean(EXTRA_SHOW_LOAD_DEFAULTS) ?: false) {
|
if (arguments?.getBoolean(EXTRA_SHOW_LOAD_DEFAULTS) == true) {
|
||||||
loadDefaults.visibility = View.VISIBLE
|
loadDefaults.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
loadDefaults.visibility = View.GONE
|
loadDefaults.visibility = View.GONE
|
||||||
|
|
|
@ -104,7 +104,7 @@ abstract class AbsContentRecyclerViewFragment<A : LoadMoreSupportAdapter<Recycle
|
||||||
updateRefreshProgressOffset()
|
updateRefreshProgressOffset()
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onRefresh() {
|
final override fun onRefresh() {
|
||||||
if (!triggerRefresh()) {
|
if (!triggerRefresh()) {
|
||||||
refreshing = false
|
refreshing = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ abstract class AbsMediaStatusesFragment : AbsContentRecyclerViewFragment<Stagger
|
||||||
StaggeredGridLayoutManager>(), LoaderCallbacks<List<ParcelableStatus>?>, DrawerCallback,
|
StaggeredGridLayoutManager>(), LoaderCallbacks<List<ParcelableStatus>?>, DrawerCallback,
|
||||||
IStatusViewHolder.StatusClickListener {
|
IStatusViewHolder.StatusClickListener {
|
||||||
|
|
||||||
override final var refreshing: Boolean
|
final override var refreshing: Boolean
|
||||||
get() {
|
get() {
|
||||||
if (context == null || isDetached) return false
|
if (context == null || isDetached) return false
|
||||||
return loaderManager.hasRunningLoadersSafe()
|
return loaderManager.hasRunningLoadersSafe()
|
||||||
|
@ -55,10 +55,10 @@ abstract class AbsMediaStatusesFragment : AbsContentRecyclerViewFragment<Stagger
|
||||||
super.refreshing = value
|
super.refreshing = value
|
||||||
}
|
}
|
||||||
|
|
||||||
override final val reachingEnd: Boolean
|
final override val reachingEnd: Boolean
|
||||||
get() = layoutManager.reachingEnd
|
get() = layoutManager.reachingEnd
|
||||||
|
|
||||||
override final val reachingStart: Boolean
|
final override val reachingStart: Boolean
|
||||||
get() = layoutManager.reachingStart
|
get() = layoutManager.reachingStart
|
||||||
|
|
||||||
protected open val loaderId: Int
|
protected open val loaderId: Int
|
||||||
|
@ -73,15 +73,15 @@ abstract class AbsMediaStatusesFragment : AbsContentRecyclerViewFragment<Stagger
|
||||||
showProgress()
|
showProgress()
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onCreateLayoutManager(context: Context): StaggeredGridLayoutManager {
|
final override fun onCreateLayoutManager(context: Context): StaggeredGridLayoutManager {
|
||||||
return StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)
|
return StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun scrollToPositionWithOffset(position: Int, offset: Int) {
|
final override fun scrollToPositionWithOffset(position: Int, offset: Int) {
|
||||||
layoutManager.scrollToPositionWithOffset(position, offset)
|
layoutManager.scrollToPositionWithOffset(position, offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onCreateAdapter(context: Context, requestManager: RequestManager): StaggeredGridParcelableStatusesAdapter {
|
final override fun onCreateAdapter(context: Context, requestManager: RequestManager): StaggeredGridParcelableStatusesAdapter {
|
||||||
return StaggeredGridParcelableStatusesAdapter(context, requestManager)
|
return StaggeredGridParcelableStatusesAdapter(context, requestManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ abstract class AbsMediaStatusesFragment : AbsContentRecyclerViewFragment<Stagger
|
||||||
return onCreateStatusesLoader(activity, args, fromUser)
|
return onCreateStatusesLoader(activity, args, fromUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onLoadFinished(loader: Loader<List<ParcelableStatus>?>, data: List<ParcelableStatus>?) {
|
final override fun onLoadFinished(loader: Loader<List<ParcelableStatus>?>, data: List<ParcelableStatus>?) {
|
||||||
val changed = adapter.setData(data)
|
val changed = adapter.setData(data)
|
||||||
if ((loader as IExtendedLoader).fromUser) {
|
if ((loader as IExtendedLoader).fromUser) {
|
||||||
adapter.loadMoreSupportedPosition = if (hasMoreData(loader, data, changed)) {
|
adapter.loadMoreSupportedPosition = if (hasMoreData(loader, data, changed)) {
|
||||||
|
@ -106,11 +106,11 @@ abstract class AbsMediaStatusesFragment : AbsContentRecyclerViewFragment<Stagger
|
||||||
setLoadMoreIndicatorPosition(ILoadMoreSupportAdapter.NONE)
|
setLoadMoreIndicatorPosition(ILoadMoreSupportAdapter.NONE)
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onLoaderReset(loader: Loader<List<ParcelableStatus>?>) {
|
final override fun onLoaderReset(loader: Loader<List<ParcelableStatus>?>) {
|
||||||
adapter.setData(null)
|
adapter.setData(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onLoadMoreContents(position: Long) {
|
final override fun onLoadMoreContents(position: Long) {
|
||||||
// Only supports load from end
|
// Only supports load from end
|
||||||
if (ILoadMoreSupportAdapter.END != position) return
|
if (ILoadMoreSupportAdapter.END != position) return
|
||||||
super.onLoadMoreContents(position)
|
super.onLoadMoreContents(position)
|
||||||
|
@ -124,13 +124,13 @@ abstract class AbsMediaStatusesFragment : AbsContentRecyclerViewFragment<Stagger
|
||||||
getStatuses(maxId, null)
|
getStatuses(maxId, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onStatusClick(holder: IStatusViewHolder, position: Int) {
|
final override fun onStatusClick(holder: IStatusViewHolder, position: Int) {
|
||||||
val status = adapter.getStatus(position)
|
val status = adapter.getStatus(position)
|
||||||
IntentUtils.openStatus(context, status, null)
|
IntentUtils.openStatus(context, status, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override final fun onQuotedStatusClick(holder: IStatusViewHolder, position: Int) {
|
final override fun onQuotedStatusClick(holder: IStatusViewHolder, position: Int) {
|
||||||
val status = adapter.getStatus(position)
|
val status = adapter.getStatus(position)
|
||||||
IntentUtils.openStatus(context, status.account_key, status.quoted_id)
|
IntentUtils.openStatus(context, status.account_key, status.quoted_id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,10 +202,6 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||||
updateDefaultAccountState()
|
updateDefaultAccountState()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
|
||||||
super.onStop()
|
|
||||||
}
|
|
||||||
|
|
||||||
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.fragment_accounts_dashboard, container, false)
|
return inflater.inflate(R.layout.fragment_accounts_dashboard, container, false)
|
||||||
}
|
}
|
||||||
|
@ -263,7 +259,7 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||||
|
|
||||||
|
|
||||||
override fun onLoadFinished(loader: Loader<AccountsInfo>, data: AccountsInfo) {
|
override fun onLoadFinished(loader: Loader<AccountsInfo>, data: AccountsInfo) {
|
||||||
if (context == null || isDetached || (activity?.isFinishing ?: true)) return
|
if (context == null || isDetached || (activity?.isFinishing != false)) return
|
||||||
updateAccountProviderData(data)
|
updateAccountProviderData(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,7 +463,7 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||||
private var clickedColors: IntArray? = null
|
private var clickedColors: IntArray? = null
|
||||||
|
|
||||||
override fun onAnimationStart(animation: Animator) {
|
override fun onAnimationStart(animation: Animator) {
|
||||||
if (context == null || isDetached || (activity?.isFinishing ?: true)) return
|
if (context == null || isDetached || (activity?.isFinishing != false)) return
|
||||||
snapshotView.visibility = View.VISIBLE
|
snapshotView.visibility = View.VISIBLE
|
||||||
snapshotView.setImageBitmap(snapshotBitmap)
|
snapshotView.setImageBitmap(snapshotBitmap)
|
||||||
val profileDrawable = profileImageView.drawable
|
val profileDrawable = profileImageView.drawable
|
||||||
|
@ -523,7 +519,7 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displayAccountBanner(account: AccountDetails) {
|
private fun displayAccountBanner(account: AccountDetails) {
|
||||||
if (context == null || isDetached || (activity?.isFinishing ?: true)) return
|
if (context == null || isDetached || (activity?.isFinishing != false)) return
|
||||||
val bannerWidth = accountProfileBanner.width
|
val bannerWidth = accountProfileBanner.width
|
||||||
val res = resources
|
val res = resources
|
||||||
val defWidth = res.displayMetrics.widthPixels
|
val defWidth = res.displayMetrics.widthPixels
|
||||||
|
@ -543,7 +539,7 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displayCurrentAccount(profileImageSnapshot: Drawable?) {
|
private fun displayCurrentAccount(profileImageSnapshot: Drawable?) {
|
||||||
if (context == null || isDetached || (activity?.isFinishing ?: true)) return
|
if (context == null || isDetached || (activity?.isFinishing != false)) return
|
||||||
val account = accountsAdapter.selectedAccount ?: return
|
val account = accountsAdapter.selectedAccount ?: return
|
||||||
accountProfileNameView.spannable = account.user.name
|
accountProfileNameView.spannable = account.user.name
|
||||||
accountProfileScreenNameView.spannable = "@${account.user.screen_name}"
|
accountProfileScreenNameView.spannable = "@${account.user.screen_name}"
|
||||||
|
|
|
@ -202,10 +202,6 @@ class CustomTabsFragment : BaseFragment(), LoaderCallbacks<Cursor?>, MultiChoice
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
|
||||||
super.onStop()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun saveTabPositions() {
|
private fun saveTabPositions() {
|
||||||
val positions = adapter.cursorPositions
|
val positions = adapter.cursorPositions
|
||||||
val c = adapter.cursor
|
val c = adapter.cursor
|
||||||
|
|
|
@ -124,7 +124,7 @@ open class ItemsListFragment : AbsContentListRecyclerViewFragment<VariousItemsAd
|
||||||
return ItemsLoader(context, arguments)
|
return ItemsLoader(context, arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onLoadFinished(loader: Loader<List<Any>?>, data: List<Any>?) {
|
final override fun onLoadFinished(loader: Loader<List<Any>?>, data: List<Any>?) {
|
||||||
adapter.setData(data)
|
adapter.setData(data)
|
||||||
showContent()
|
showContent()
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,10 +68,6 @@ abstract class ParcelableGroupsFragment : AbsContentListRecyclerViewFragment<Par
|
||||||
return ParcelableGroupsAdapter(context, this.requestManager)
|
return ParcelableGroupsAdapter(context, this.requestManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setupRecyclerView(context: Context, recyclerView: RecyclerView) {
|
|
||||||
super.setupRecyclerView(context, recyclerView)
|
|
||||||
}
|
|
||||||
|
|
||||||
protected val accountKey: UserKey?
|
protected val accountKey: UserKey?
|
||||||
get() = arguments.getParcelable<UserKey?>(EXTRA_ACCOUNT_KEY)
|
get() = arguments.getParcelable<UserKey?>(EXTRA_ACCOUNT_KEY)
|
||||||
|
|
||||||
|
|
|
@ -73,10 +73,6 @@ abstract class ParcelableUserListsFragment : AbsContentListRecyclerViewFragment<
|
||||||
return ParcelableUserListsAdapter(context, this.requestManager)
|
return ParcelableUserListsAdapter(context, this.requestManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setupRecyclerView(context: Context, recyclerView: RecyclerView) {
|
|
||||||
super.setupRecyclerView(context, recyclerView)
|
|
||||||
}
|
|
||||||
|
|
||||||
protected fun hasMoreData(data: List<ParcelableUserList>?): Boolean {
|
protected fun hasMoreData(data: List<ParcelableUserList>?): Boolean {
|
||||||
return data == null || !data.isEmpty()
|
return data == null || !data.isEmpty()
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ abstract class ParcelableUsersFragment : AbsContentListRecyclerViewFragment<Parc
|
||||||
if (loader is IExtendedLoader) {
|
if (loader is IExtendedLoader) {
|
||||||
loader.fromUser = false
|
loader.fromUser = false
|
||||||
}
|
}
|
||||||
if (loader is IPaginationLoader && data?.loadSuccess() ?: false) {
|
if (loader is IPaginationLoader && data?.loadSuccess() == true) {
|
||||||
nextPagination = loader.nextPagination
|
nextPagination = loader.nextPagination
|
||||||
prevPagination = loader.prevPagination
|
prevPagination = loader.prevPagination
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||||
loaderManager.restartLoader(LOADER_ID_USER, args, this)
|
loaderManager.restartLoader(LOADER_ID_USER, args, this)
|
||||||
}
|
}
|
||||||
updateOptionsMenuVisibility()
|
updateOptionsMenuVisibility()
|
||||||
} else if (user?.is_cache ?: false) {
|
} else if (user?.is_cache == true) {
|
||||||
cardContent.visibility = View.VISIBLE
|
cardContent.visibility = View.VISIBLE
|
||||||
errorContainer.visibility = View.GONE
|
errorContainer.visibility = View.GONE
|
||||||
progressContainer.visibility = View.GONE
|
progressContainer.visibility = View.GONE
|
||||||
|
|
|
@ -50,6 +50,7 @@ import org.mariotaku.twidere.TwidereConstants.*
|
||||||
import org.mariotaku.twidere.activity.ColorPickerDialogActivity
|
import org.mariotaku.twidere.activity.ColorPickerDialogActivity
|
||||||
import org.mariotaku.twidere.activity.ThemedMediaPickerActivity
|
import org.mariotaku.twidere.activity.ThemedMediaPickerActivity
|
||||||
import org.mariotaku.twidere.annotation.AccountType
|
import org.mariotaku.twidere.annotation.AccountType
|
||||||
|
import org.mariotaku.twidere.annotation.ImageShapeStyle
|
||||||
import org.mariotaku.twidere.extension.loadProfileBanner
|
import org.mariotaku.twidere.extension.loadProfileBanner
|
||||||
import org.mariotaku.twidere.extension.loadProfileImage
|
import org.mariotaku.twidere.extension.loadProfileImage
|
||||||
import org.mariotaku.twidere.extension.model.api.mastodon.toParcelable
|
import org.mariotaku.twidere.extension.model.api.mastodon.toParcelable
|
||||||
|
@ -71,7 +72,7 @@ class UserProfileEditorFragment : BaseFragment(), OnSizeChangedListener,
|
||||||
|
|
||||||
private var currentTask: AbstractTask<*, *, UserProfileEditorFragment>? = null
|
private var currentTask: AbstractTask<*, *, UserProfileEditorFragment>? = null
|
||||||
private val accountKey: UserKey
|
private val accountKey: UserKey
|
||||||
get() = arguments.getParcelable(EXTRA_ACCOUNT_KEY)
|
get() = arguments.getParcelable(EXTRA_ACCOUNT_KEY)!!
|
||||||
private var user: ParcelableUser? = null
|
private var user: ParcelableUser? = null
|
||||||
private var account: AccountDetails? = null
|
private var account: AccountDetails? = null
|
||||||
private var userInfoLoaderInitialized: Boolean = false
|
private var userInfoLoaderInitialized: Boolean = false
|
||||||
|
@ -229,20 +230,20 @@ class UserProfileEditorFragment : BaseFragment(), OnSizeChangedListener,
|
||||||
currentTask = RemoveProfileBannerTaskInternal(context, accountKey)
|
currentTask = RemoveProfileBannerTaskInternal(context, accountKey)
|
||||||
} else {
|
} else {
|
||||||
currentTask = UpdateProfileBannerImageTaskInternal(this, accountKey,
|
currentTask = UpdateProfileBannerImageTaskInternal(this, accountKey,
|
||||||
data.data, true)
|
data.data!!, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
REQUEST_UPLOAD_PROFILE_BACKGROUND_IMAGE -> {
|
REQUEST_UPLOAD_PROFILE_BACKGROUND_IMAGE -> {
|
||||||
val task = currentTask
|
val task = currentTask
|
||||||
if (task != null && !task.isFinished) return
|
if (task != null && !task.isFinished) return
|
||||||
currentTask = UpdateProfileBackgroundImageTaskInternal(this, accountKey,
|
currentTask = UpdateProfileBackgroundImageTaskInternal(this, accountKey,
|
||||||
data.data, false, true)
|
data.data!!, false, true)
|
||||||
}
|
}
|
||||||
REQUEST_UPLOAD_PROFILE_IMAGE -> {
|
REQUEST_UPLOAD_PROFILE_IMAGE -> {
|
||||||
val task = currentTask
|
val task = currentTask
|
||||||
if (task != null && !task.isFinished) return
|
if (task != null && !task.isFinished) return
|
||||||
currentTask = UpdateProfileImageTaskInternal(this, accountKey,
|
currentTask = UpdateProfileImageTaskInternal(this, accountKey,
|
||||||
data.data, true)
|
data.data!!, true)
|
||||||
}
|
}
|
||||||
REQUEST_PICK_LINK_COLOR -> {
|
REQUEST_PICK_LINK_COLOR -> {
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
|
@ -265,7 +266,7 @@ class UserProfileEditorFragment : BaseFragment(), OnSizeChangedListener,
|
||||||
|
|
||||||
private fun displayUser(user: ParcelableUser?, account: AccountDetails?) {
|
private fun displayUser(user: ParcelableUser?, account: AccountDetails?) {
|
||||||
if (!getUserInfoCalled) return
|
if (!getUserInfoCalled) return
|
||||||
if (context == null || isDetached || (activity?.isFinishing ?: true)) return
|
if (context == null || isDetached || (activity?.isFinishing != false)) return
|
||||||
getUserInfoCalled = false
|
getUserInfoCalled = false
|
||||||
this.user = user
|
this.user = user
|
||||||
this.account = account
|
this.account = account
|
||||||
|
|
|
@ -115,7 +115,7 @@ class UserQrDialogFragment : BaseDialogFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadProfileImage(): Promise<GlideDrawable, Exception> {
|
private fun loadProfileImage(): Promise<GlideDrawable, Exception> {
|
||||||
if (context == null || isDetached || dialog == null || (activity?.isFinishing ?: true)) {
|
if (context == null || isDetached || dialog == null || (activity?.isFinishing != false)) {
|
||||||
return Promise.ofFail(InterruptedException())
|
return Promise.ofFail(InterruptedException())
|
||||||
}
|
}
|
||||||
val profileImageSize = getString(R.string.profile_image_size)
|
val profileImageSize = getString(R.string.profile_image_size)
|
||||||
|
|
|
@ -83,7 +83,7 @@ abstract class BaseFiltersFragment : AbsContentListViewFragment<SimpleCursorAdap
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
listView.choiceMode = ListView.CHOICE_MODE_MULTIPLE_MODAL
|
listView.choiceMode = ListView.CHOICE_MODE_MULTIPLE_MODAL
|
||||||
listView.setOnItemClickListener { _, _, pos, _ ->
|
listView.onItemClickListener = { _, _, pos, _ ->
|
||||||
onItemClick(pos)
|
onItemClick(pos)
|
||||||
}
|
}
|
||||||
listView.setMultiChoiceModeListener(this)
|
listView.setMultiChoiceModeListener(this)
|
||||||
|
|
|
@ -60,10 +60,6 @@ class FilteredUsersFragment : BaseFiltersFragment() {
|
||||||
override val sortOrder: String? = "${Filters.Users.SOURCE} >= 0"
|
override val sortOrder: String? = "${Filters.Users.SOURCE} >= 0"
|
||||||
override val supportsEdit: Boolean = false
|
override val supportsEdit: Boolean = false
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
|
||||||
super.onActivityCreated(savedInstanceState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
REQUEST_SELECT_USER -> {
|
REQUEST_SELECT_USER -> {
|
||||||
|
|
|
@ -55,10 +55,6 @@ class ImagePageFragment : SubsampleImageViewerFragment() {
|
||||||
|
|
||||||
private var mediaLoadState: Int = 0
|
private var mediaLoadState: Int = 0
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
|
||||||
super.onActivityCreated(savedInstanceState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
|
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
|
||||||
super.setUserVisibleHint(isVisibleToUser)
|
super.setUserVisibleHint(isVisibleToUser)
|
||||||
if (isVisibleToUser) {
|
if (isVisibleToUser) {
|
||||||
|
|
|
@ -112,10 +112,6 @@ class MessageNewConversationFragment : BaseFragment(), LoaderCallbacks<List<Parc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
|
|
||||||
super.beforeTextChanged(s, start, count, after)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||||
if (s !is Spannable) return
|
if (s !is Spannable) return
|
||||||
s.getSpans(0, s.length, PendingQuerySpan::class.java).forEach { span ->
|
s.getSpans(0, s.length, PendingQuerySpan::class.java).forEach { span ->
|
||||||
|
|
|
@ -487,7 +487,7 @@ class MessagesConversationFragment : AbsContentListRecyclerViewFragment<Messages
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateConversationStatus() {
|
private fun updateConversationStatus() {
|
||||||
if (context == null || isDetached || (activity?.isFinishing ?: true)) return
|
if (context == null || isDetached || (activity?.isFinishing != false)) return
|
||||||
val conversation = adapter.conversation ?: return
|
val conversation = adapter.conversation ?: return
|
||||||
val title = conversation.getTitle(context, userColorNameManager,
|
val title = conversation.getTitle(context, userColorNameManager,
|
||||||
preferences[nameFirstKey]).first
|
preferences[nameFirstKey]).first
|
||||||
|
|
|
@ -37,7 +37,7 @@ abstract class AbsSimpleStatusOperationDialogFragment : BaseDialogFragment(), Di
|
||||||
protected val status: ParcelableStatus
|
protected val status: ParcelableStatus
|
||||||
get() = arguments.getParcelable<ParcelableStatus>(EXTRA_STATUS)
|
get() = arguments.getParcelable<ParcelableStatus>(EXTRA_STATUS)
|
||||||
|
|
||||||
override final fun onClick(dialog: DialogInterface, which: Int) {
|
final override fun onClick(dialog: DialogInterface, which: Int) {
|
||||||
when (which) {
|
when (which) {
|
||||||
DialogInterface.BUTTON_POSITIVE -> {
|
DialogInterface.BUTTON_POSITIVE -> {
|
||||||
onPerformAction(status)
|
onPerformAction(status)
|
||||||
|
@ -45,7 +45,7 @@ abstract class AbsSimpleStatusOperationDialogFragment : BaseDialogFragment(), Di
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
final override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
val builder = AlertDialog.Builder(context)
|
val builder = AlertDialog.Builder(context)
|
||||||
builder.setTitle(title)
|
builder.setTitle(title)
|
||||||
builder.setMessage(message)
|
builder.setMessage(message)
|
||||||
|
|
|
@ -67,7 +67,7 @@ abstract class AbsStatusDialogFragment : BaseDialogFragment() {
|
||||||
|
|
||||||
private lateinit var adapter: DummyItemAdapter
|
private lateinit var adapter: DummyItemAdapter
|
||||||
|
|
||||||
override final fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
final override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
val builder = Builder(context)
|
val builder = Builder(context)
|
||||||
val accountKey = this.accountKey
|
val accountKey = this.accountKey
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,10 @@ abstract class BaseGroupsLoader(
|
||||||
|
|
||||||
override var pagination: Pagination? = null
|
override var pagination: Pagination? = null
|
||||||
|
|
||||||
override final var nextPagination: Pagination? = null
|
final override var nextPagination: Pagination? = null
|
||||||
private set
|
private set
|
||||||
|
|
||||||
override final var prevPagination: Pagination? = null
|
final override var prevPagination: Pagination? = null
|
||||||
private set
|
private set
|
||||||
|
|
||||||
protected val data = NoDuplicatesArrayList<ParcelableGroup>()
|
protected val data = NoDuplicatesArrayList<ParcelableGroup>()
|
||||||
|
|
|
@ -102,7 +102,7 @@ abstract class AbsRequestStatusesLoader(
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
override final fun loadInBackground(): ListResponse<ParcelableStatus> {
|
final override fun loadInBackground(): ListResponse<ParcelableStatus> {
|
||||||
val context = context
|
val context = context
|
||||||
val comparator = this.comparator
|
val comparator = this.comparator
|
||||||
val accountKey = accountKey ?: return ListResponse.getListInstance<ParcelableStatus>(MicroBlogException("No Account"))
|
val accountKey = accountKey ?: return ListResponse.getListInstance<ParcelableStatus>(MicroBlogException("No Account"))
|
||||||
|
@ -183,7 +183,7 @@ abstract class AbsRequestStatusesLoader(
|
||||||
return ListResponse.getListInstance(data)
|
return ListResponse.getListInstance(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onStartLoading() {
|
final override fun onStartLoading() {
|
||||||
exception = null
|
exception = null
|
||||||
super.onStartLoading()
|
super.onStartLoading()
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ open class MediaStatusesSearchLoader(
|
||||||
|
|
||||||
protected open fun processQuery(details: AccountDetails, query: String): String {
|
protected open fun processQuery(details: AccountDetails, query: String): String {
|
||||||
if (details.type == AccountType.TWITTER) {
|
if (details.type == AccountType.TWITTER) {
|
||||||
if (details.extras?.official ?: false) {
|
if (details.extras?.official == true) {
|
||||||
return TweetSearchLoader.smQuery("$query filter:media", pagination)
|
return TweetSearchLoader.smQuery("$query filter:media", pagination)
|
||||||
}
|
}
|
||||||
return "$query filter:media exclude:retweets"
|
return "$query filter:media exclude:retweets"
|
||||||
|
@ -92,7 +92,7 @@ open class MediaStatusesSearchLoader(
|
||||||
val microBlog = account.newMicroBlogInstance(context, MicroBlog::class.java)
|
val microBlog = account.newMicroBlogInstance(context, MicroBlog::class.java)
|
||||||
when (account.type) {
|
when (account.type) {
|
||||||
AccountType.TWITTER -> {
|
AccountType.TWITTER -> {
|
||||||
if (account.extras?.official ?: false) {
|
if (account.extras?.official == true) {
|
||||||
val universalQuery = UniversalSearchQuery(queryText)
|
val universalQuery = UniversalSearchQuery(queryText)
|
||||||
universalQuery.setModules(UniversalSearchQuery.Module.TWEET)
|
universalQuery.setModules(UniversalSearchQuery.Module.TWEET)
|
||||||
universalQuery.setResultType(UniversalSearchQuery.ResultType.RECENT)
|
universalQuery.setResultType(UniversalSearchQuery.ResultType.RECENT)
|
||||||
|
|
|
@ -108,7 +108,7 @@ open class TweetSearchLoader(
|
||||||
val queryText = processQuery(account, query)
|
val queryText = processQuery(account, query)
|
||||||
when (account.type) {
|
when (account.type) {
|
||||||
AccountType.TWITTER -> {
|
AccountType.TWITTER -> {
|
||||||
if (account.extras?.official ?: false) {
|
if (account.extras?.official == true) {
|
||||||
val universalQuery = UniversalSearchQuery(queryText)
|
val universalQuery = UniversalSearchQuery(queryText)
|
||||||
universalQuery.setModules(UniversalSearchQuery.Module.TWEET)
|
universalQuery.setModules(UniversalSearchQuery.Module.TWEET)
|
||||||
universalQuery.setResultType(UniversalSearchQuery.ResultType.RECENT)
|
universalQuery.setResultType(UniversalSearchQuery.ResultType.RECENT)
|
||||||
|
|
|
@ -88,7 +88,7 @@ class StatusFavoritersLoader(
|
||||||
override fun handleOpenElement(elementName: String, attributes: Map<String, String>?,
|
override fun handleOpenElement(elementName: String, attributes: Map<String, String>?,
|
||||||
line: Int, col: Int) {
|
line: Int, col: Int) {
|
||||||
if (elementName == "div" && attributes != null) {
|
if (elementName == "div" && attributes != null) {
|
||||||
if (attributes["class"]?.split(" ")?.contains("account") ?: false) {
|
if (attributes["class"]?.split(" ")?.contains("account") == true) {
|
||||||
attributes["data-user-id"]?.let { userIds.add(it) }
|
attributes["data-user-id"]?.let { userIds.add(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ abstract class UserListRelatedUsersLoader(
|
||||||
) : AbsRequestUsersLoader(context, accountKey, data, fromUser) {
|
) : AbsRequestUsersLoader(context, accountKey, data, fromUser) {
|
||||||
|
|
||||||
@Throws(MicroBlogException::class)
|
@Throws(MicroBlogException::class)
|
||||||
override final fun getUsers(details: AccountDetails, paging: Paging): PaginatedList<ParcelableUser> {
|
final override fun getUsers(details: AccountDetails, paging: Paging): PaginatedList<ParcelableUser> {
|
||||||
when (details.type) {
|
when (details.type) {
|
||||||
AccountType.TWITTER -> return getTwitterUsers(details, paging).mapToPaginated {
|
AccountType.TWITTER -> return getTwitterUsers(details, paging).mapToPaginated {
|
||||||
it.toParcelable(details, profileImageSize = profileImageSize)
|
it.toParcelable(details, profileImageSize = profileImageSize)
|
||||||
|
|
|
@ -37,7 +37,7 @@ abstract class UserRelatedUsersLoader(
|
||||||
) : AbsRequestUsersLoader(context, accountKey, data, fromUser) {
|
) : AbsRequestUsersLoader(context, accountKey, data, fromUser) {
|
||||||
|
|
||||||
@Throws(MicroBlogException::class)
|
@Throws(MicroBlogException::class)
|
||||||
override final fun getUsers(details: AccountDetails, paging: Paging): PaginatedList<ParcelableUser> {
|
final override fun getUsers(details: AccountDetails, paging: Paging): PaginatedList<ParcelableUser> {
|
||||||
return when {
|
return when {
|
||||||
userKey != null -> getUsersByKey(details, paging, userKey)
|
userKey != null -> getUsersByKey(details, paging, userKey)
|
||||||
screenName != null -> getUsersByScreenName(details, paging, screenName)
|
screenName != null -> getUsersByScreenName(details, paging, screenName)
|
||||||
|
|
|
@ -65,7 +65,7 @@ abstract class AccountsListPreference(context: Context, attrs: AttributeSet? = n
|
||||||
addPreference(preference)
|
addPreference(preference)
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onAttachedToHierarchy(preferenceManager: PreferenceManager) {
|
final override fun onAttachedToHierarchy(preferenceManager: PreferenceManager) {
|
||||||
super.onAttachedToHierarchy(preferenceManager)
|
super.onAttachedToHierarchy(preferenceManager)
|
||||||
if (preferenceCount > 0) return
|
if (preferenceCount > 0) return
|
||||||
setAccountsData(AccountUtils.getAllAccountDetails(AccountManager.get(context), true))
|
setAccountsData(AccountUtils.getAllAccountDetails(AccountManager.get(context), true))
|
||||||
|
|
|
@ -28,7 +28,7 @@ class PremiumEntryPreference(context: Context, attrs: AttributeSet) : Preference
|
||||||
val requiredFeature = a.getString(R.styleable.PremiumEntryPreference_requiredFeature)
|
val requiredFeature = a.getString(R.styleable.PremiumEntryPreference_requiredFeature)
|
||||||
a.recycle()
|
a.recycle()
|
||||||
isEnabled = extraFeaturesService.isSupported()
|
isEnabled = extraFeaturesService.isSupported()
|
||||||
setOnPreferenceClickListener {
|
onPreferenceClickListener = {
|
||||||
if (requiredFeature != null && !extraFeaturesService.isEnabled(requiredFeature)) {
|
if (requiredFeature != null && !extraFeaturesService.isEnabled(requiredFeature)) {
|
||||||
val activity = ChameleonUtils.getActivity(context)
|
val activity = ChameleonUtils.getActivity(context)
|
||||||
if (activity is FragmentActivity) {
|
if (activity is FragmentActivity) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ class AccountNotificationChannelsPreference(context: Context, attrs: AttributeSe
|
||||||
val preference = Preference(context)
|
val preference = Preference(context)
|
||||||
preference.title = spec.getName(context)
|
preference.title = spec.getName(context)
|
||||||
preference.summary = spec.getDescription(context)
|
preference.summary = spec.getDescription(context)
|
||||||
preference.setOnPreferenceClickListener lambda@ {
|
preference.onPreferenceClickListener = lambda@ {
|
||||||
val account = this.account ?: return@lambda true
|
val account = this.account ?: return@lambda true
|
||||||
val intent = Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
|
val intent = Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
|
||||||
.putExtra(Settings.EXTRA_APP_PACKAGE, BuildConfig.APPLICATION_ID)
|
.putExtra(Settings.EXTRA_APP_PACKAGE, BuildConfig.APPLICATION_ID)
|
||||||
|
|
|
@ -61,25 +61,25 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class TwidereDataProvider : ContentProvider(), LazyLoadCallback {
|
class TwidereDataProvider : ContentProvider(), LazyLoadCallback {
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var readStateManager: ReadStateManager
|
internal lateinit var readStateManager: ReadStateManager
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var twitterWrapper: AsyncTwitterWrapper
|
internal lateinit var twitterWrapper: AsyncTwitterWrapper
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var notificationManager: NotificationManagerWrapper
|
internal lateinit var notificationManager: NotificationManagerWrapper
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var preferences: SharedPreferences
|
internal lateinit var preferences: SharedPreferences
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var dns: Dns
|
internal lateinit var dns: Dns
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var bus: Bus
|
internal lateinit var bus: Bus
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var userColorNameManager: UserColorNameManager
|
internal lateinit var userColorNameManager: UserColorNameManager
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var bidiFormatter: BidiFormatter
|
internal lateinit var bidiFormatter: BidiFormatter
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var permissionsManager: PermissionsManager
|
internal lateinit var permissionsManager: PermissionsManager
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var contentNotificationManager: ContentNotificationManager
|
internal lateinit var contentNotificationManager: ContentNotificationManager
|
||||||
|
|
||||||
private lateinit var databaseWrapper: SQLiteDatabaseWrapper
|
private lateinit var databaseWrapper: SQLiteDatabaseWrapper
|
||||||
private lateinit var backgroundExecutor: Executor
|
private lateinit var backgroundExecutor: Executor
|
||||||
|
|
|
@ -40,9 +40,9 @@ import org.mariotaku.twidere.task.twitter.UpdateStatusTask
|
||||||
|
|
||||||
abstract class AbsAccountRequestTask<Params, Result, Callback>(context: Context, val accountKey: UserKey?) :
|
abstract class AbsAccountRequestTask<Params, Result, Callback>(context: Context, val accountKey: UserKey?) :
|
||||||
ExceptionHandlingAbstractTask<Params, Result, MicroBlogException, Callback>(context) {
|
ExceptionHandlingAbstractTask<Params, Result, MicroBlogException, Callback>(context) {
|
||||||
override final val exceptionClass = MicroBlogException::class.java
|
final override val exceptionClass = MicroBlogException::class.java
|
||||||
|
|
||||||
override final fun onExecute(params: Params): Result {
|
final override fun onExecute(params: Params): Result {
|
||||||
val am = AccountManager.get(context)
|
val am = AccountManager.get(context)
|
||||||
val account = accountKey?.let { AccountUtils.getAccountDetails(am, it, true) } ?:
|
val account = accountKey?.let { AccountUtils.getAccountDetails(am, it, true) } ?:
|
||||||
throw AccountNotFoundException()
|
throw AccountNotFoundException()
|
||||||
|
|
|
@ -32,7 +32,7 @@ abstract class ExceptionHandlingAbstractTask<Params, Result, TaskException : Exc
|
||||||
|
|
||||||
protected abstract val exceptionClass: Class<TaskException>
|
protected abstract val exceptionClass: Class<TaskException>
|
||||||
|
|
||||||
override final fun afterExecute(callback: Callback?, results: SingleResponse<Result>) {
|
final override fun afterExecute(callback: Callback?, results: SingleResponse<Result>) {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
afterExecute(callback, results.data, results.exception as? TaskException)
|
afterExecute(callback, results.data, results.exception as? TaskException)
|
||||||
if (results.data != null) {
|
if (results.data != null) {
|
||||||
|
@ -47,7 +47,7 @@ abstract class ExceptionHandlingAbstractTask<Params, Result, TaskException : Exc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun doLongOperation(params: Params): SingleResponse<Result> {
|
final override fun doLongOperation(params: Params): SingleResponse<Result> {
|
||||||
try {
|
try {
|
||||||
return SingleResponse(onExecute(params))
|
return SingleResponse(onExecute(params))
|
||||||
} catch (tr: Exception) {
|
} catch (tr: Exception) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ import javax.inject.Inject
|
||||||
class EmojiEditableFactory(textView: TextView) : Editable.Factory() {
|
class EmojiEditableFactory(textView: TextView) : Editable.Factory() {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var externalThemeManager: ExternalThemeManager
|
internal lateinit var externalThemeManager: ExternalThemeManager
|
||||||
|
|
||||||
init {
|
init {
|
||||||
GeneralComponent.get(textView.context).inject(this)
|
GeneralComponent.get(textView.context).inject(this)
|
||||||
|
|
|
@ -33,7 +33,7 @@ import javax.inject.Inject
|
||||||
class EmojiSpannableFactory(textView: TextView) : Spannable.Factory() {
|
class EmojiSpannableFactory(textView: TextView) : Spannable.Factory() {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit internal var externalThemeManager: ExternalThemeManager
|
internal lateinit var externalThemeManager: ExternalThemeManager
|
||||||
|
|
||||||
init {
|
init {
|
||||||
GeneralComponent.get(textView.context).inject(this)
|
GeneralComponent.get(textView.context).inject(this)
|
||||||
|
|
|
@ -63,7 +63,7 @@ object HtmlSpanBuilder {
|
||||||
|
|
||||||
private fun applyTag(sb: SpannableStringBuilder, start: Int, end: Int, info: TagInfo,
|
private fun applyTag(sb: SpannableStringBuilder, start: Int, end: Int, info: TagInfo,
|
||||||
processor: SpanProcessor?) {
|
processor: SpanProcessor?) {
|
||||||
if (processor?.applySpan(sb, start, end, info) ?: false) return
|
if (processor?.applySpan(sb, start, end, info) == true) return
|
||||||
if (info.nameLower == "br") {
|
if (info.nameLower == "br") {
|
||||||
sb.append('\n')
|
sb.append('\n')
|
||||||
} else {
|
} else {
|
||||||
|
@ -152,7 +152,7 @@ object HtmlSpanBuilder {
|
||||||
if (buffer[lineBreakIndex] == '\n') break
|
if (buffer[lineBreakIndex] == '\n') break
|
||||||
lineBreakIndex++
|
lineBreakIndex++
|
||||||
}
|
}
|
||||||
if (!(processor?.appendText(sb, buffer, cur, lineBreakIndex - cur, lastTag) ?: false)) {
|
if (processor?.appendText(sb, buffer, cur, lineBreakIndex - cur, lastTag) != true) {
|
||||||
sb.append(HtmlEscapeHelper.unescape(String(buffer, cur, lineBreakIndex - cur)))
|
sb.append(HtmlEscapeHelper.unescape(String(buffer, cur, lineBreakIndex - cur)))
|
||||||
}
|
}
|
||||||
cur = lineBreakIndex + 1
|
cur = lineBreakIndex + 1
|
||||||
|
|
|
@ -145,7 +145,7 @@ class OAuthPasswordAuthenticator(
|
||||||
@Throws(ParseException::class, IOException::class)
|
@Throws(ParseException::class, IOException::class)
|
||||||
private fun parseAuthorizeRequestData(response: HttpResponse, data: AuthorizeRequestData) {
|
private fun parseAuthorizeRequestData(response: HttpResponse, data: AuthorizeRequestData) {
|
||||||
val handler = object : AbstractSimpleMarkupHandler() {
|
val handler = object : AbstractSimpleMarkupHandler() {
|
||||||
internal var isOAuthFormOpened: Boolean = false
|
var isOAuthFormOpened: Boolean = false
|
||||||
override fun handleStandaloneElement(elementName: String, attributes: MutableMap<String, String>?, minimized: Boolean, line: Int, col: Int) {
|
override fun handleStandaloneElement(elementName: String, attributes: MutableMap<String, String>?, minimized: Boolean, line: Int, col: Int) {
|
||||||
handleOpenElement(elementName, attributes, line, col)
|
handleOpenElement(elementName, attributes, line, col)
|
||||||
handleCloseElement(elementName, line, col)
|
handleCloseElement(elementName, line, col)
|
||||||
|
@ -206,8 +206,8 @@ class OAuthPasswordAuthenticator(
|
||||||
authorizeResultBuilder.headers(requestHeaders)
|
authorizeResultBuilder.headers(requestHeaders)
|
||||||
authorizeResultBuilder.body(authorizationResultBody)
|
authorizeResultBuilder.body(authorizationResultBody)
|
||||||
val handler = object : AbstractSimpleMarkupHandler() {
|
val handler = object : AbstractSimpleMarkupHandler() {
|
||||||
internal var isOAuthPinDivOpened: Boolean = false
|
var isOAuthPinDivOpened: Boolean = false
|
||||||
internal var isChallengeFormOpened: Boolean = false
|
var isChallengeFormOpened: Boolean = false
|
||||||
|
|
||||||
override fun handleStandaloneElement(elementName: String, attributes: MutableMap<String, String>?,
|
override fun handleStandaloneElement(elementName: String, attributes: MutableMap<String, String>?,
|
||||||
minimized: Boolean, line: Int, col: Int) {
|
minimized: Boolean, line: Int, col: Int) {
|
||||||
|
@ -434,7 +434,7 @@ class OAuthPasswordAuthenticator(
|
||||||
@Throws(ParseException::class, IOException::class)
|
@Throws(ParseException::class, IOException::class)
|
||||||
fun readOAuthPINFromHtml(reader: Reader, data: OAuthPinData) {
|
fun readOAuthPINFromHtml(reader: Reader, data: OAuthPinData) {
|
||||||
val handler = object : AbstractSimpleMarkupHandler() {
|
val handler = object : AbstractSimpleMarkupHandler() {
|
||||||
internal var isOAuthPinDivOpened: Boolean = false
|
var isOAuthPinDivOpened: Boolean = false
|
||||||
override fun handleStandaloneElement(elementName: String,
|
override fun handleStandaloneElement(elementName: String,
|
||||||
attributes: MutableMap<String, String>?,
|
attributes: MutableMap<String, String>?,
|
||||||
minimized: Boolean, line: Int, col: Int) {
|
minimized: Boolean, line: Int, col: Int) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ object ContentFiltersUtils {
|
||||||
private fun isFilteredQuery(users: Array<UserKey>?, texts: String?, sources: Array<String>?,
|
private fun isFilteredQuery(users: Array<UserKey>?, texts: String?, sources: Array<String>?,
|
||||||
links: Array<String>?, names: Array<String>?, descriptions: String?,
|
links: Array<String>?, names: Array<String>?, descriptions: String?,
|
||||||
filterRts: Boolean, @FilterScope scope: Int, allowedKeywords: Array<String>? = null): Pair<String, Array<String>> {
|
filterRts: Boolean, @FilterScope scope: Int, allowedKeywords: Array<String>? = null): Pair<String, Array<String>> {
|
||||||
var numExpressions = 0;
|
var numExpressions = 0
|
||||||
val selectionArgs = mutableListOf<String>()
|
val selectionArgs = mutableListOf<String>()
|
||||||
val queryBuilder = StringBuilder("SELECT ")
|
val queryBuilder = StringBuilder("SELECT ")
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ object ContentFiltersUtils {
|
||||||
}
|
}
|
||||||
extraWhereAppend?.invoke(queryBuilder, selectionArgs, ruleField)
|
extraWhereAppend?.invoke(queryBuilder, selectionArgs, ruleField)
|
||||||
queryBuilder.append(")")
|
queryBuilder.append(")")
|
||||||
numExpressions += 1;
|
numExpressions += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
fun allowKeywordsWhere(sb: StringBuilder, args: MutableList<String>, ruleField: String) {
|
fun allowKeywordsWhere(sb: StringBuilder, args: MutableList<String>, ruleField: String) {
|
||||||
|
|
|
@ -32,12 +32,12 @@ abstract class TwitterTimelineStreamCallback(val accountId: String) : SimpleUser
|
||||||
|
|
||||||
private val friends = mutableSetOf<String>()
|
private val friends = mutableSetOf<String>()
|
||||||
|
|
||||||
override final fun onFriendList(friendIds: Array<String>): Boolean {
|
final override fun onFriendList(friendIds: Array<String>): Boolean {
|
||||||
friends.addAll(friendIds)
|
friends.addAll(friendIds)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onStatus(status: Status): Boolean {
|
final override fun onStatus(status: Status): Boolean {
|
||||||
val userId = status.user.id
|
val userId = status.user.id
|
||||||
var handled = false
|
var handled = false
|
||||||
if (accountId == userId || userId in friends) {
|
if (accountId == userId || userId in friends) {
|
||||||
|
@ -57,7 +57,7 @@ abstract class TwitterTimelineStreamCallback(val accountId: String) : SimpleUser
|
||||||
return handled
|
return handled
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onFollow(createdAt: Date, source: User, target: User): Boolean {
|
final override fun onFollow(createdAt: Date, source: User, target: User): Boolean {
|
||||||
if (source.id == accountId) {
|
if (source.id == accountId) {
|
||||||
friends.add(target.id)
|
friends.add(target.id)
|
||||||
return true
|
return true
|
||||||
|
@ -68,7 +68,7 @@ abstract class TwitterTimelineStreamCallback(val accountId: String) : SimpleUser
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onFavorite(createdAt: Date, source: User, target: User,
|
final override fun onFavorite(createdAt: Date, source: User, target: User,
|
||||||
targetObject: Status): Boolean {
|
targetObject: Status): Boolean {
|
||||||
if (source.id == accountId) {
|
if (source.id == accountId) {
|
||||||
// TODO Update my favorite status
|
// TODO Update my favorite status
|
||||||
|
@ -80,7 +80,7 @@ abstract class TwitterTimelineStreamCallback(val accountId: String) : SimpleUser
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onUnfollow(createdAt: Date, source: User, followedUser: User): Boolean {
|
final override fun onUnfollow(createdAt: Date, source: User, followedUser: User): Boolean {
|
||||||
if (source.id == accountId) {
|
if (source.id == accountId) {
|
||||||
friends.remove(followedUser.id)
|
friends.remove(followedUser.id)
|
||||||
return true
|
return true
|
||||||
|
@ -88,7 +88,7 @@ abstract class TwitterTimelineStreamCallback(val accountId: String) : SimpleUser
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onQuotedTweet(createdAt: Date, source: User, target: User, targetObject: Status): Boolean {
|
final override fun onQuotedTweet(createdAt: Date, source: User, target: User, targetObject: Status): Boolean {
|
||||||
if (source.id == accountId) {
|
if (source.id == accountId) {
|
||||||
return false
|
return false
|
||||||
} else if (target.id == accountId) {
|
} else if (target.id == accountId) {
|
||||||
|
@ -99,7 +99,7 @@ abstract class TwitterTimelineStreamCallback(val accountId: String) : SimpleUser
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onFavoritedRetweet(createdAt: Date, source: User, target: User, targetObject: Status): Boolean {
|
final override fun onFavoritedRetweet(createdAt: Date, source: User, target: User, targetObject: Status): Boolean {
|
||||||
if (source.id == accountId) {
|
if (source.id == accountId) {
|
||||||
return false
|
return false
|
||||||
} else if (target.id == accountId) {
|
} else if (target.id == accountId) {
|
||||||
|
@ -110,7 +110,7 @@ abstract class TwitterTimelineStreamCallback(val accountId: String) : SimpleUser
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onRetweetedRetweet(createdAt: Date, source: User, target: User, targetObject: Status): Boolean {
|
final override fun onRetweetedRetweet(createdAt: Date, source: User, target: User, targetObject: Status): Boolean {
|
||||||
if (source.id == accountId) {
|
if (source.id == accountId) {
|
||||||
return false
|
return false
|
||||||
} else if (target.id == accountId) {
|
} else if (target.id == accountId) {
|
||||||
|
@ -121,7 +121,7 @@ abstract class TwitterTimelineStreamCallback(val accountId: String) : SimpleUser
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun onUserListMemberAddition(createdAt: Date, source: User, target: User, targetObject: UserList): Boolean {
|
final override fun onUserListMemberAddition(createdAt: Date, source: User, target: User, targetObject: UserList): Boolean {
|
||||||
if (source.id == accountId) {
|
if (source.id == accountId) {
|
||||||
return false
|
return false
|
||||||
} else if (target.id == accountId) {
|
} else if (target.id == accountId) {
|
||||||
|
@ -139,7 +139,7 @@ abstract class TwitterTimelineStreamCallback(val accountId: String) : SimpleUser
|
||||||
protected abstract fun onActivityAboutMe(activity: Activity): Boolean
|
protected abstract fun onActivityAboutMe(activity: Activity): Boolean
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
override abstract fun onDirectMessage(directMessage: DirectMessage): Boolean
|
abstract override fun onDirectMessage(directMessage: DirectMessage): Boolean
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
protected open fun onAllStatus(status: Status) {
|
protected open fun onAllStatus(status: Status) {
|
||||||
|
|
|
@ -22,17 +22,17 @@ abstract class FileBasedKeyValueSyncAction<DownloadSession : Closeable, UploadSe
|
||||||
|
|
||||||
protected abstract val snapshotFileName: String
|
protected abstract val snapshotFileName: String
|
||||||
|
|
||||||
override final fun MutableMap<String, String>.addAllData(data: MutableMap<String, String>): Boolean {
|
final override fun MutableMap<String, String>.addAllData(data: MutableMap<String, String>): Boolean {
|
||||||
this.putAll(data)
|
this.putAll(data)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun MutableMap<String, String>.removeAllData(data: MutableMap<String, String>): Boolean {
|
final override fun MutableMap<String, String>.removeAllData(data: MutableMap<String, String>): Boolean {
|
||||||
this.removeAll(data.keys)
|
this.removeAll(data.keys)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun MutableMap<String, String>.minus(data: MutableMap<String, String>): MutableMap<String, String> {
|
final override fun MutableMap<String, String>.minus(data: MutableMap<String, String>): MutableMap<String, String> {
|
||||||
val diff = HashMap<String, String>()
|
val diff = HashMap<String, String>()
|
||||||
for ((k, v) in this) {
|
for ((k, v) in this) {
|
||||||
val dv = data[k]
|
val dv = data[k]
|
||||||
|
@ -43,7 +43,7 @@ abstract class FileBasedKeyValueSyncAction<DownloadSession : Closeable, UploadSe
|
||||||
return diff
|
return diff
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun File.loadSnapshot(): HashMap<String, String> {
|
final override fun File.loadSnapshot(): HashMap<String, String> {
|
||||||
return reader().use {
|
return reader().use {
|
||||||
val snapshot = HashMap<String, String>()
|
val snapshot = HashMap<String, String>()
|
||||||
val parser = Xml.newPullParser()
|
val parser = Xml.newPullParser()
|
||||||
|
@ -53,7 +53,7 @@ abstract class FileBasedKeyValueSyncAction<DownloadSession : Closeable, UploadSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun File.saveSnapshot(data: MutableMap<String, String>) {
|
final override fun File.saveSnapshot(data: MutableMap<String, String>) {
|
||||||
writer().use {
|
writer().use {
|
||||||
val serializer = Xml.newSerializer()
|
val serializer = Xml.newSerializer()
|
||||||
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true)
|
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true)
|
||||||
|
@ -62,20 +62,20 @@ abstract class FileBasedKeyValueSyncAction<DownloadSession : Closeable, UploadSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override final var File.snapshotLastModified: Long
|
final override var File.snapshotLastModified: Long
|
||||||
get() = this.lastModified()
|
get() = this.lastModified()
|
||||||
set(value) {
|
set(value) {
|
||||||
this.setLastModified(value)
|
this.setLastModified(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun newData(): MutableMap<String, String> = HashMap()
|
final override fun newData(): MutableMap<String, String> = HashMap()
|
||||||
|
|
||||||
override final fun newSnapshotStore(): File {
|
final override fun newSnapshotStore(): File {
|
||||||
val syncDataDir: File = context.syncDataDir.mkdirIfNotExists() ?: throw IOException()
|
val syncDataDir: File = context.syncDataDir.mkdirIfNotExists() ?: throw IOException()
|
||||||
return File(syncDataDir, snapshotFileName)
|
return File(syncDataDir, snapshotFileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun MutableMap<String, String>.isDataEmpty(): Boolean = this.isEmpty()
|
final override fun MutableMap<String, String>.isDataEmpty(): Boolean = this.isEmpty()
|
||||||
|
|
||||||
override fun MutableMap<String, String>.dataContentEquals(localData: MutableMap<String, String>): Boolean {
|
override fun MutableMap<String, String>.dataContentEquals(localData: MutableMap<String, String>): Boolean {
|
||||||
return this.entries.contentEquals(localData.entries)
|
return this.entries.contentEquals(localData.entries)
|
||||||
|
|
|
@ -15,9 +15,9 @@ abstract class FileBasedPreferencesValuesSyncAction<DownloadSession : Closeable,
|
||||||
val processor: Processor
|
val processor: Processor
|
||||||
) : FileBasedKeyValueSyncAction<DownloadSession, UploadSession>(context) {
|
) : FileBasedKeyValueSyncAction<DownloadSession, UploadSession>(context) {
|
||||||
|
|
||||||
override final val snapshotFileName: String = processor.snapshotFileName
|
final override val snapshotFileName: String = processor.snapshotFileName
|
||||||
|
|
||||||
override final val whatData: String = processor.whatData
|
final override val whatData: String = processor.whatData
|
||||||
|
|
||||||
override fun addToLocal(data: MutableMap<String, String>) {
|
override fun addToLocal(data: MutableMap<String, String>) {
|
||||||
val editor = preferences.edit()
|
val editor = preferences.edit()
|
||||||
|
@ -35,7 +35,7 @@ abstract class FileBasedPreferencesValuesSyncAction<DownloadSession : Closeable,
|
||||||
editor.apply()
|
editor.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun loadFromLocal(): MutableMap<String, String> {
|
final override fun loadFromLocal(): MutableMap<String, String> {
|
||||||
val result = HashMap<String, String>()
|
val result = HashMap<String, String>()
|
||||||
for ((k, v) in preferences.all) {
|
for ((k, v) in preferences.all) {
|
||||||
processor.loadValue(result, k, v)
|
processor.loadValue(result, k, v)
|
||||||
|
|
|
@ -13,7 +13,7 @@ abstract class SingleFileBasedDataSyncAction<Data, SnapshotStore, DownloadSessio
|
||||||
|
|
||||||
private val ATTR_KEY = "key"
|
private val ATTR_KEY = "key"
|
||||||
|
|
||||||
override final fun execute(): Boolean {
|
final override fun execute(): Boolean {
|
||||||
DebugLog.d(LOGTAG_SYNC, "Begin syncing $whatData")
|
DebugLog.d(LOGTAG_SYNC, "Begin syncing $whatData")
|
||||||
|
|
||||||
if (!setup()) {
|
if (!setup()) {
|
||||||
|
|
|
@ -68,10 +68,6 @@ open class ExtendedFrameLayout(context: Context, attrs: AttributeSet? = null) :
|
||||||
return super.onTouchEvent(event)
|
return super.onTouchEvent(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||||
super.onSizeChanged(w, h, oldw, oldh)
|
super.onSizeChanged(w, h, oldw, oldh)
|
||||||
if (onSizeChangedListener != null) {
|
if (onSizeChangedListener != null) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import android.annotation.SuppressLint
|
||||||
import android.annotation.TargetApi
|
import android.annotation.TargetApi
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.support.v4.view.WindowInsetsCompat
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.WindowInsets
|
import android.view.WindowInsets
|
||||||
|
|
|
@ -25,7 +25,4 @@ import android.view.View
|
||||||
|
|
||||||
class MediaViewPager(context: Context, attrs: AttributeSet? = null) : ExtendedViewPager(context, attrs) {
|
class MediaViewPager(context: Context, attrs: AttributeSet? = null) : ExtendedViewPager(context, attrs) {
|
||||||
|
|
||||||
override fun canScroll(v: View, checkV: Boolean, dx: Int, x: Int, y: Int): Boolean {
|
|
||||||
return super.canScroll(v, checkV, dx, x, y)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -148,7 +148,7 @@ class UserViewHolder(
|
||||||
denyRequestButton.visibility = View.GONE
|
denyRequestButton.visibility = View.GONE
|
||||||
}
|
}
|
||||||
if (friendshipClickListener != null && !isMySelf) {
|
if (friendshipClickListener != null && !isMySelf) {
|
||||||
if (user.extras?.blocking ?: false) {
|
if (user.extras?.blocking == true) {
|
||||||
followButton.visibility = View.GONE
|
followButton.visibility = View.GONE
|
||||||
unblockButton.visibility = View.VISIBLE
|
unblockButton.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
|
@ -159,7 +159,7 @@ class UserViewHolder(
|
||||||
}
|
}
|
||||||
unblockButton.visibility = View.GONE
|
unblockButton.visibility = View.GONE
|
||||||
}
|
}
|
||||||
unmuteButton.visibility = if (user.extras?.muting ?: false) View.VISIBLE else View.GONE
|
unmuteButton.visibility = if (user.extras?.muting == true) View.VISIBLE else View.GONE
|
||||||
} else {
|
} else {
|
||||||
followButton.visibility = View.GONE
|
followButton.visibility = View.GONE
|
||||||
unblockButton.visibility = View.GONE
|
unblockButton.visibility = View.GONE
|
||||||
|
|
|
@ -23,7 +23,7 @@ import android.support.v4.view.ViewPager
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
|
||||||
object AccountsSelectorTransformer : ViewPager.PageTransformer {
|
object AccountsSelectorTransformer : ViewPager.PageTransformer {
|
||||||
const internal val selectorAccountsCount: Int = 3
|
internal const val selectorAccountsCount: Int = 3
|
||||||
|
|
||||||
override fun transformPage(page: View, position: Float) {
|
override fun transformPage(page: View, position: Float) {
|
||||||
if (position < 0) {
|
if (position < 0) {
|
||||||
|
|
Loading…
Reference in New Issue