diff --git a/twidere/src/google/java/org/mariotaku/twidere/util/StatusClusterRenderer.java b/twidere/src/google/java/org/mariotaku/twidere/util/StatusClusterRenderer.java index e38e37fd7..89ba8d94e 100644 --- a/twidere/src/google/java/org/mariotaku/twidere/util/StatusClusterRenderer.java +++ b/twidere/src/google/java/org/mariotaku/twidere/util/StatusClusterRenderer.java @@ -352,6 +352,7 @@ public class StatusClusterRenderer implements ClusterRenderer { this.mSphericalMercatorProjection = new SphericalMercatorProjection(256 * Math.pow(2, Math.min(zoom, mZoom))); } + @Override @SuppressLint("NewApi") public void run() { if (clusters.equals(StatusClusterRenderer.this.mClusters)) { diff --git a/twidere/src/main/java/org/mariotaku/dynamicgridview/DraggableArrayAdapter.java b/twidere/src/main/java/org/mariotaku/dynamicgridview/DraggableArrayAdapter.java index 54da91b54..66b5a0507 100644 --- a/twidere/src/main/java/org/mariotaku/dynamicgridview/DraggableArrayAdapter.java +++ b/twidere/src/main/java/org/mariotaku/dynamicgridview/DraggableArrayAdapter.java @@ -70,6 +70,7 @@ public class DraggableArrayAdapter extends ArrayAdapter implements Draggab return true; } + @Override public void removeAt(final int position) { super.removeAt(position); rebuildIdMap(); diff --git a/twidere/src/main/java/org/mariotaku/jsonserializer/JSONFileIO.java b/twidere/src/main/java/org/mariotaku/jsonserializer/JSONFileIO.java index 420bcaed3..254c9bc74 100644 --- a/twidere/src/main/java/org/mariotaku/jsonserializer/JSONFileIO.java +++ b/twidere/src/main/java/org/mariotaku/jsonserializer/JSONFileIO.java @@ -24,148 +24,147 @@ import java.util.ArrayList; public class JSONFileIO extends JSONSerializer { - public static final String JSON_CACHE_DIR = "json_cache"; - private static final String KEY_OBJECT = "object"; + public static final String JSON_CACHE_DIR = "json_cache"; + private static final String KEY_OBJECT = "object"; - private static final String KEY_CLASS = "class"; + private static final String KEY_CLASS = "class"; - public static JSONArray convertJSONArray(final InputStream stream) throws IOException { - final String string = convertString(stream); - try { - return new JSONArray(string); - } catch (final JSONException e) { - throw new IOException(e); - } - } + public static JSONArray convertJSONArray(final InputStream stream) throws IOException { + final String string = convertString(stream); + try { + return new JSONArray(string); + } catch (final JSONException e) { + throw new IOException(e); + } + } - public static JSONObject convertJSONObject(final InputStream stream) throws IOException { - final String string = convertString(stream); - try { - return new JSONObject(string); - } catch (final JSONException e) { - throw new IOException(e); - } - } + public static JSONObject convertJSONObject(final InputStream stream) throws IOException { + final String string = convertString(stream); + try { + return new JSONObject(string); + } catch (final JSONException e) { + throw new IOException(e); + } + } - public static String convertString(final InputStream stream) throws IOException { - if (stream == null) throw new FileNotFoundException(); - final BufferedReader reader = new BufferedReader(new InputStreamReader(stream, Charset.defaultCharset())); - final StringBuffer buf = new StringBuffer(); - String line = null; - while ((line = reader.readLine()) != null) { - buf.append(line); - buf.append('\n'); - } - reader.close(); - return buf.toString(); - } + public static String convertString(final InputStream stream) throws IOException { + if (stream == null) throw new FileNotFoundException(); + final BufferedReader reader = new BufferedReader(new InputStreamReader(stream, Charset.defaultCharset())); + final StringBuilder buf = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + buf.append(line); + buf.append('\n'); + } + reader.close(); + return buf.toString(); + } - public static File getSerializationFile(final Context context, final Object... args) throws IOException { - if (context == null || args == null || args.length == 0) return null; - final File cache_dir = Utils.getBestCacheDir(context, JSON_CACHE_DIR); - if (!cache_dir.exists()) { - cache_dir.mkdirs(); - } - final String filename = Utils.encodeQueryParams(TwidereArrayUtils.toString(args, '.', false)); - final File cache_file = new File(cache_dir, filename + ".json"); - return cache_file; - } + public static File getSerializationFile(final Context context, final Object... args) throws IOException { + if (context == null || args == null || args.length == 0) return null; + final File cache_dir = Utils.getBestCacheDir(context, JSON_CACHE_DIR); + if (!cache_dir.exists()) { + cache_dir.mkdirs(); + } + final String filename = Utils.encodeQueryParams(TwidereArrayUtils.toString(args, '.', false)); + return new File(cache_dir, filename + ".json"); + } - public static T[] readArray(final File file) throws IOException { - if (file == null) throw new FileNotFoundException(); - return readArray(new FileInputStream(file)); - } + public static T[] readArray(final File file) throws IOException { + if (file == null) throw new FileNotFoundException(); + return readArray(new FileInputStream(file)); + } - public static T[] readArray(final InputStream stream) throws IOException { - try { - final JSONObject json = new JSONObject(convertString(stream)); - final JSONParcelable.Creator creator = getCreator(json.getString(KEY_CLASS)); - return createArray(creator, json.getJSONArray(KEY_OBJECT)); - } catch (final JSONException e) { - throw new IOException(e); - } - } + public static T[] readArray(final InputStream stream) throws IOException { + try { + final JSONObject json = new JSONObject(convertString(stream)); + final JSONParcelable.Creator creator = getCreator(json.getString(KEY_CLASS)); + return createArray(creator, json.getJSONArray(KEY_OBJECT)); + } catch (final JSONException e) { + throw new IOException(e); + } + } - public static ArrayList readArrayList(final File file) throws IOException { - if (file == null) throw new FileNotFoundException(); - return readArrayList(new FileInputStream(file)); - } + public static ArrayList readArrayList(final File file) throws IOException { + if (file == null) throw new FileNotFoundException(); + return readArrayList(new FileInputStream(file)); + } - public static ArrayList readArrayList(final InputStream stream) throws IOException { - try { - final JSONObject json = new JSONObject(convertString(stream)); - final JSONParcelable.Creator creator = getCreator(json.getString(KEY_CLASS)); - return createArrayList(creator, json.getJSONArray(KEY_OBJECT)); - } catch (final JSONException e) { - throw new IOException(e); - } - } + public static ArrayList readArrayList(final InputStream stream) throws IOException { + try { + final JSONObject json = new JSONObject(convertString(stream)); + final JSONParcelable.Creator creator = getCreator(json.getString(KEY_CLASS)); + return createArrayList(creator, json.getJSONArray(KEY_OBJECT)); + } catch (final JSONException e) { + throw new IOException(e); + } + } - public static T readObject(final File file) throws IOException { - if (file == null) throw new FileNotFoundException(); - return readObject(new FileInputStream(file)); - } + public static T readObject(final File file) throws IOException { + if (file == null) throw new FileNotFoundException(); + return readObject(new FileInputStream(file)); + } - public static T readObject(final InputStream stream) throws IOException { - try { - final JSONObject json = new JSONObject(convertString(stream)); - final JSONParcelable.Creator creator = getCreator(json.optString(KEY_CLASS)); - return createObject(creator, json.optJSONObject(KEY_OBJECT)); - } catch (final JSONException e) { - throw new IOException(e); - } - } + public static T readObject(final InputStream stream) throws IOException { + try { + final JSONObject json = new JSONObject(convertString(stream)); + final JSONParcelable.Creator creator = getCreator(json.optString(KEY_CLASS)); + return createObject(creator, json.optJSONObject(KEY_OBJECT)); + } catch (final JSONException e) { + throw new IOException(e); + } + } - public static void writeArray(final File file, final T[] array) throws IOException { - writeArray(new FileOutputStream(file), array); - } + public static void writeArray(final File file, final T[] array) throws IOException { + writeArray(new FileOutputStream(file), array); + } - public static void writeArray(final OutputStream stream, final T[] array) - throws IOException { - if (stream == null || array == null) return; - final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream, Charset.defaultCharset())); - final JSONObject json = new JSONObject(); - try { - json.put(KEY_CLASS, array.getClass().getComponentType().getName()); - json.put(KEY_OBJECT, toJSONArray(array)); - writer.write(jsonToString(json)); - writer.flush(); - } catch (final JSONException e) { - throw new IOException(e); - } finally { - writer.close(); - } - } + public static void writeArray(final OutputStream stream, final T[] array) + throws IOException { + if (stream == null || array == null) return; + final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream, Charset.defaultCharset())); + final JSONObject json = new JSONObject(); + try { + json.put(KEY_CLASS, array.getClass().getComponentType().getName()); + json.put(KEY_OBJECT, toJSONArray(array)); + writer.write(jsonToString(json)); + writer.flush(); + } catch (final JSONException e) { + throw new IOException(e); + } finally { + writer.close(); + } + } - public static void writeObject(final File file, final T parcelable) throws IOException { - writeObject(new FileOutputStream(file), parcelable); - } + public static void writeObject(final File file, final T parcelable) throws IOException { + writeObject(new FileOutputStream(file), parcelable); + } - public static void writeObject(final OutputStream stream, final T parcelable) - throws IOException { - if (stream == null || parcelable == null) return; - final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream, Charset.defaultCharset())); - final JSONObject json = new JSONObject(); - try { - json.put(KEY_CLASS, parcelable.getClass().getName()); - json.put(KEY_OBJECT, toJSONObject(parcelable)); - writer.write(jsonToString(json)); - writer.flush(); - } catch (final JSONException e) { - throw new IOException(e); - } finally { - Utils.closeSilently(writer); - } - } + public static void writeObject(final OutputStream stream, final T parcelable) + throws IOException { + if (stream == null || parcelable == null) return; + final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream, Charset.defaultCharset())); + final JSONObject json = new JSONObject(); + try { + json.put(KEY_CLASS, parcelable.getClass().getName()); + json.put(KEY_OBJECT, toJSONObject(parcelable)); + writer.write(jsonToString(json)); + writer.flush(); + } catch (final JSONException e) { + throw new IOException(e); + } finally { + Utils.closeSilently(writer); + } + } - @SuppressWarnings("unchecked") - private static JSONParcelable.Creator getCreator(final String name) - throws IOException { - try { - final Class cls = Class.forName(name); - return (JSONParcelable.Creator) cls.getField("JSON_CREATOR").get(null); - } catch (final Exception e) { - throw new IOException(e); - } - } + @SuppressWarnings("unchecked") + private static JSONParcelable.Creator getCreator(final String name) + throws IOException { + try { + final Class cls = Class.forName(name); + return (JSONParcelable.Creator) cls.getField("JSON_CREATOR").get(null); + } catch (final Exception e) { + throw new IOException(e); + } + } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/FiltersActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/FiltersActivity.java index 9a5601e1a..858b113c2 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/FiltersActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/FiltersActivity.java @@ -20,13 +20,10 @@ package org.mariotaku.twidere.activity; import android.graphics.Rect; -import android.os.Build; import android.os.Bundle; import android.support.v4.app.NavUtils; import android.support.v4.view.ViewPager; -import android.support.v4.view.WindowCompat; import android.view.MenuItem; -import android.view.WindowManager.LayoutParams; import org.mariotaku.twidere.R; import org.mariotaku.twidere.activity.support.BaseDialogWhenLargeActivity; diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/support/BaseActionBarActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/support/BaseActionBarActivity.java index 111f16ffe..073c3f2ae 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/support/BaseActionBarActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/support/BaseActionBarActivity.java @@ -24,12 +24,8 @@ import android.content.Intent; import android.graphics.Rect; import android.os.Bundle; import android.support.annotation.NonNull; -import android.support.v7.widget.ActionMenuView; -import android.support.v7.widget.Toolbar; import android.view.KeyEvent; -import android.view.Menu; import android.view.MenuItem; -import android.view.View; import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.activity.iface.IControlBarActivity; @@ -38,7 +34,6 @@ import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCal import org.mariotaku.twidere.util.AsyncTwitterWrapper; import org.mariotaku.twidere.util.KeyboardShortcutsHandler.ShortcutCallback; import org.mariotaku.twidere.util.ThemeUtils; -import org.mariotaku.twidere.util.ViewUtils; import org.mariotaku.twidere.view.iface.IExtendedView.OnFitSystemWindowsListener; import java.util.ArrayList; diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/support/BrowserSignInActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/support/BrowserSignInActivity.java index 08dccf681..6d30e29b6 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/support/BrowserSignInActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/support/BrowserSignInActivity.java @@ -45,7 +45,6 @@ import org.mariotaku.twidere.provider.TwidereDataStore.Accounts; import org.mariotaku.twidere.util.AsyncTaskUtils; import org.mariotaku.twidere.util.OAuthPasswordAuthenticator; import org.mariotaku.twidere.util.ParseUtils; -import org.mariotaku.twidere.util.TwitterContentUtils; import org.mariotaku.twidere.util.Utils; import org.mariotaku.twidere.util.net.OkHttpClientFactory; import org.mariotaku.twidere.util.net.TwidereHostResolverFactory; diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/support/ComposeActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/support/ComposeActivity.java index 59baa9762..e108d734b 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/support/ComposeActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/support/ComposeActivity.java @@ -61,6 +61,7 @@ import android.support.v7.widget.RecyclerView.ItemDecoration; import android.support.v7.widget.RecyclerView.State; import android.support.v7.widget.RecyclerView.ViewHolder; import android.text.Editable; +import android.text.Spanned; import android.text.TextUtils; import android.text.TextWatcher; import android.util.Log; @@ -74,6 +75,7 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; +import android.view.View.OnKeyListener; import android.view.View.OnLongClickListener; import android.view.ViewGroup; import android.view.Window; @@ -135,8 +137,8 @@ import java.util.Collections; import java.util.List; import java.util.TreeSet; -public class ComposeActivity extends ThemedFragmentActivity implements TextWatcher, LocationListener, - OnMenuItemClickListener, OnClickListener, OnEditorActionListener, OnLongClickListener, Callback { +public class ComposeActivity extends ThemedFragmentActivity implements LocationListener, OnMenuItemClickListener, + OnClickListener, OnLongClickListener, Callback { private static final String FAKE_IMAGE_LINK = "https://www.example.com/fake_image.jpg"; private static final String EXTRA_IS_POSSIBLY_SENSITIVE = "is_possibly_sensitive"; @@ -178,10 +180,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements TextWatch private TextView mLocationText; private SupportMenuInflater mMenuInflater; - @Override - public void beforeTextChanged(final CharSequence s, final int start, final int count, final int after) { - - } @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { @@ -216,17 +214,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements TextWatch contentView.getPaddingRight(), contentView.getPaddingBottom()); } - @Override - public void onTextChanged(final CharSequence s, final int start, final int before, final int count) { - setMenu(); - updateTextCount(); - } - - @Override - public void afterTextChanged(final Editable s) { - - } - @Override public int getThemeColor() { return ThemeUtils.getUserAccentColor(this); @@ -370,13 +357,24 @@ public class ComposeActivity extends ThemedFragmentActivity implements TextWatch mAccountSelectorContainer.setVisibility(visible ? View.VISIBLE : View.GONE); } - @Override - public boolean onEditorAction(final TextView view, final int actionId, final KeyEvent event) { - if (actionId == EditorInfo.IME_ACTION_SEND) { - updateStatus(); - return true; + + public static boolean isFinishedComposing(CharSequence text) { + if (!(text instanceof Spanned)) return true; + final Spanned spanned = (Spanned) text; + try { + final Class cls = Class.forName("android.text.style.SpellCheckSpan"); + if (spanned.getSpans(0, spanned.length(), cls).length > 0) return false; + } catch (Exception ignored) { + } - return false; + try { + final Class cls = Class.forName("android.view.inputmethod.ComposingText"); + if (spanned.getSpans(0, spanned.length(), cls).length > 0) return false; + } catch (Exception ignored) { + + } +// if (spanned.getSpans(0, spanned.length(), SpanWatcher.class).length > 0) return false; + return true; } @Override @@ -600,18 +598,53 @@ public class ComposeActivity extends ThemedFragmentActivity implements TextWatch finish(); return; } -// mMenuBar.setIsBottomBar(true); mMenuBar.setOnMenuItemClickListener(this); - boolean quickSend = mPreferences.getBoolean(KEY_QUICK_SEND); - if (quickSend) { - mEditText.setImeOptions(EditorInfo.IME_ACTION_SEND); - mEditText.setComposeInputSingleLine(true); - } else { - mEditText.setImeOptions(EditorInfo.IME_ACTION_UNSPECIFIED); - mEditText.setComposeInputSingleLine(false); - } - mEditText.setOnEditorActionListener(this); - mEditText.addTextChangedListener(this); + final boolean sendByEnter = mPreferences.getBoolean(KEY_QUICK_SEND); + mEditText.setOnKeyListener(new OnKeyListener() { + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_ENTER && sendByEnter && event.getAction() == KeyEvent.ACTION_DOWN) { + updateStatus(); + return true; + } + return false; + } + }); + mEditText.setOnEditorActionListener(new OnEditorActionListener() { + + @Override + public boolean onEditorAction(final TextView view, final int actionId, final KeyEvent event) { + if (sendByEnter) { + if (event != null && actionId == EditorInfo.IME_NULL && event.getAction() == KeyEvent.ACTION_DOWN) { + updateStatus(); + return true; + } + } + return false; + } + }); + mEditText.addTextChangedListener(new TextWatcher() { + + @Override + public void beforeTextChanged(final CharSequence s, final int start, final int count, final int after) { + + } + + @Override + public void onTextChanged(final CharSequence s, final int start, final int before, final int count) { + setMenu(); + updateTextCount(); + } + + @Override + public void afterTextChanged(final Editable s) { + final int length = s.length(); + if (sendByEnter && length > 0 && s.charAt(length - 1) == '\n') { + s.delete(length - 1, length); + updateStatus(); + } + } + }); mEditText.setCustomSelectionActionModeCallback(this); mAccountSelectorContainer.setOnClickListener(this); mAccountSelectorButton.setOnClickListener(this); diff --git a/twidere/src/main/java/org/mariotaku/twidere/activity/support/DraftsActivity.java b/twidere/src/main/java/org/mariotaku/twidere/activity/support/DraftsActivity.java index 6e72f4ad5..cd13a69f1 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/activity/support/DraftsActivity.java +++ b/twidere/src/main/java/org/mariotaku/twidere/activity/support/DraftsActivity.java @@ -29,10 +29,8 @@ import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; -import android.graphics.Rect; import android.net.Uri; import android.os.AsyncTask; -import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.NonNull; @@ -42,7 +40,6 @@ import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; -import android.support.v4.view.WindowCompat; import android.support.v7.app.ActionBar; import android.util.Log; import android.util.SparseBooleanArray; @@ -50,7 +47,6 @@ import android.view.ActionMode; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.view.WindowManager.LayoutParams; import android.widget.AbsListView.MultiChoiceModeListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; @@ -72,7 +68,6 @@ import org.mariotaku.twidere.provider.TwidereDataStore.Drafts; import org.mariotaku.twidere.util.AsyncTaskUtils; import org.mariotaku.twidere.util.AsyncTwitterWrapper; import org.mariotaku.twidere.util.ThemeUtils; -import org.mariotaku.twidere.view.TintedStatusFrameLayout; import java.io.File; import java.util.ArrayList; diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsActivitiesAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsActivitiesAdapter.java index 31bbd59ae..7b3f77cdb 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsActivitiesAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsActivitiesAdapter.java @@ -107,12 +107,15 @@ public abstract class AbsActivitiesAdapter extends Adapter imp mStatusAdapterDelegate = new DummyStatusHolderAdapter(context); } + @Override public abstract ParcelableActivity getActivity(int position); + @Override public abstract int getActivityCount(); public abstract Data getData(); + @Override public abstract void setData(Data data); @Override @@ -189,6 +192,7 @@ public abstract class AbsActivitiesAdapter extends Adapter imp return mNameFirst; } + @Override public boolean isProfileImageEnabled() { return mDisplayProfileImage; } @@ -334,6 +338,7 @@ public abstract class AbsActivitiesAdapter extends Adapter imp return ITEM_VIEW_TYPE_STUB; } + @Override public final int getItemCount() { return getActivityCount() + (mLoadMoreIndicatorVisible ? 1 : 0); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsStatusesAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsStatusesAdapter.java index 006d7a812..889a96a2e 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsStatusesAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/AbsStatusesAdapter.java @@ -91,6 +91,7 @@ public abstract class AbsStatusesAdapter extends LoadMoreSupportAdapter extends BaseAdapter implements Filterable { /** * {@inheritDoc} */ + @Override public int getCount() { return mObjects.size(); } @@ -309,6 +310,7 @@ public class ArrayAdapter extends BaseAdapter implements Filterable { /** * {@inheritDoc} */ + @Override public T getItem(int position) { return mObjects.get(position); } @@ -326,6 +328,7 @@ public class ArrayAdapter extends BaseAdapter implements Filterable { /** * {@inheritDoc} */ + @Override public long getItemId(int position) { return position; } @@ -333,6 +336,7 @@ public class ArrayAdapter extends BaseAdapter implements Filterable { /** * {@inheritDoc} */ + @Override public View getView(int position, View convertView, ViewGroup parent) { return createViewFromResource(position, convertView, parent, mResource); } @@ -387,6 +391,7 @@ public class ArrayAdapter extends BaseAdapter implements Filterable { /** * {@inheritDoc} */ + @Override public Filter getFilter() { if (mFilter == null) { mFilter = new ArrayFilter(); diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/MessageEntriesAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/MessageEntriesAdapter.java index c479933d8..08706bc13 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/MessageEntriesAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/MessageEntriesAdapter.java @@ -93,6 +93,7 @@ public class MessageEntriesAdapter extends Adapter implements Consta }; } + @Override public Context getContext() { return mContext; } @@ -124,6 +125,7 @@ public class MessageEntriesAdapter extends Adapter implements Consta return new DirectMessageEntry(c); } + @Override public MediaLoaderWrapper getMediaLoader() { return mImageLoader; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableActivitiesAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableActivitiesAdapter.java index 98722f17d..da80227aa 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableActivitiesAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableActivitiesAdapter.java @@ -72,6 +72,7 @@ public class ParcelableActivitiesAdapter extends AbsActivitiesAdapter data) { mData = data; notifyDataSetChanged(); diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableStatusesAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableStatusesAdapter.java index 90b1ca27f..aea7a87b9 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableStatusesAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableStatusesAdapter.java @@ -54,11 +54,13 @@ public class ParcelableStatusesAdapter extends AbsStatusesAdapter data) { mData = data; notifyDataSetChanged(); } + @Override public List getData() { return mData; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableUsersAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableUsersAdapter.java index 58f9cc57e..de76079cb 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableUsersAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/ParcelableUsersAdapter.java @@ -20,8 +20,6 @@ package org.mariotaku.twidere.adapter; import android.content.Context; -import android.support.v7.widget.RecyclerView.ViewHolder; -import android.view.View; import org.mariotaku.twidere.model.ParcelableUser; import org.mariotaku.twidere.view.holder.UserViewHolder; diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IActivitiesAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IActivitiesAdapter.java index 93eb2f461..3c1e25bab 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IActivitiesAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IActivitiesAdapter.java @@ -38,6 +38,7 @@ public interface IActivitiesAdapter extends IContentCardAdapter, IGapSuppo @PreviewStyle int getMediaPreviewStyle(); + @Override MediaLoaderWrapper getMediaLoader(); MediaLoadingHandler getMediaLoadingHandler(); diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IStatusesAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IStatusesAdapter.java index 392c049e1..eb14dfde8 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IStatusesAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IStatusesAdapter.java @@ -1,7 +1,6 @@ package org.mariotaku.twidere.adapter.iface; import org.mariotaku.twidere.model.ParcelableStatus; -import org.mariotaku.twidere.util.MediaLoaderWrapper; import org.mariotaku.twidere.util.MediaLoadingHandler; import org.mariotaku.twidere.util.TwidereLinkify; import org.mariotaku.twidere.view.CardMediaContainer.PreviewStyle; diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IUsersAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IUsersAdapter.java index e72e0743b..d9ca6cce7 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IUsersAdapter.java +++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/iface/IUsersAdapter.java @@ -38,6 +38,7 @@ public interface IUsersAdapter extends IContentCardAdapter, UserClickListe boolean shouldShowAccountsColor(); + @Override MediaLoaderWrapper getMediaLoader(); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/app/TwidereApplication.java b/twidere/src/main/java/org/mariotaku/twidere/app/TwidereApplication.java index 5b71c0ac1..83d25a8c9 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/app/TwidereApplication.java +++ b/twidere/src/main/java/org/mariotaku/twidere/app/TwidereApplication.java @@ -146,7 +146,7 @@ public class TwidereApplication extends MultiDexApplication implements Constants if (mKeyboardShortcutsHandler.isEmpty() && !preferences.getBoolean(KEY_KEYBOARD_SHORTCUT_INITIALIZED, false)) { mKeyboardShortcutsHandler.reset(); - preferences.edit().putBoolean(KEY_KEYBOARD_SHORTCUT_INITIALIZED, true); + preferences.edit().putBoolean(KEY_KEYBOARD_SHORTCUT_INITIALIZED, true).apply(); } return mKeyboardShortcutsHandler; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/BaseFiltersFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/BaseFiltersFragment.java index 9c35d4023..c64f99884 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/BaseFiltersFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/BaseFiltersFragment.java @@ -58,7 +58,6 @@ import org.mariotaku.querybuilder.Columns.Column; import org.mariotaku.querybuilder.Expression; import org.mariotaku.querybuilder.RawItemArray; import org.mariotaku.twidere.R; -import org.mariotaku.twidere.activity.iface.IThemedActivity; import org.mariotaku.twidere.activity.support.UserListSelectorActivity; import org.mariotaku.twidere.adapter.SourceAutoCompleteAdapter; import org.mariotaku.twidere.adapter.UserHashtagAutoCompleteAdapter; diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AbsContentListFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AbsContentListFragment.java index 129ec4b88..1f43cc9c7 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AbsContentListFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AbsContentListFragment.java @@ -68,18 +68,22 @@ public abstract class AbsContentListFragment exte private A mAdapter; private ContentListScrollListener mScrollListener; + @Override public boolean canScroll(float dy) { return mDrawerCallback.canScroll(dy); } + @Override public void cancelTouch() { mDrawerCallback.cancelTouch(); } + @Override public void fling(float velocity) { mDrawerCallback.fling(velocity); } + @Override public boolean isScrollContent(float x, float y) { return mDrawerCallback.isScrollContent(x, y); } @@ -95,6 +99,7 @@ public abstract class AbsContentListFragment exte triggerRefresh(); } + @Override public void scrollBy(float dy) { mDrawerCallback.scrollBy(dy); } @@ -107,6 +112,7 @@ public abstract class AbsContentListFragment exte return true; } + @Override public void setControlVisible(boolean visible) { final FragmentActivity activity = getActivity(); if (activity instanceof BaseActionBarActivity) { @@ -114,18 +120,22 @@ public abstract class AbsContentListFragment exte } } + @Override public boolean shouldLayoutHeaderBottom() { return mDrawerCallback.shouldLayoutHeaderBottom(); } + @Override public void topChanged(int offset) { mDrawerCallback.topChanged(offset); } + @Override public A getAdapter() { return mAdapter; } + @Override public abstract boolean isRefreshing(); public LinearLayoutManager getLayoutManager() { @@ -138,6 +148,7 @@ public abstract class AbsContentListFragment exte mSwipeRefreshLayout.setRefreshing(refreshing && !mAdapter.isLoadMoreIndicatorVisible()); } + @Override public void onLoadMoreContents() { setLoadMoreIndicatorVisible(true); setRefreshEnabled(false); diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DirectMessagesFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DirectMessagesFragment.java index 9a94491c0..4894b8926 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DirectMessagesFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/DirectMessagesFragment.java @@ -344,6 +344,7 @@ public class DirectMessagesFragment extends BaseSupportFragment implements Loade mSwipeRefreshLayout.setRefreshing(refreshing && !mAdapter.isLoadMoreIndicatorVisible()); } + @Override public boolean isRefreshing() { if (mSwipeRefreshLayout == null || mAdapter == null) return false; return mSwipeRefreshLayout.isRefreshing() || mAdapter.isLoadMoreIndicatorVisible(); @@ -394,6 +395,7 @@ public class DirectMessagesFragment extends BaseSupportFragment implements Loade }); } + @Override public MessageEntriesAdapter getAdapter() { return mAdapter; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java index 802a4197b..6d6a5c398 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/StatusFragment.java @@ -1107,6 +1107,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac return RecyclerView.NO_POSITION; } + @Override public Context getContext() { return mContext; } @@ -1116,6 +1117,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac return mProfileImageStyle; } + @Override public float getTextSize() { return mTextSize; } @@ -1131,6 +1133,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac return mDisplayProfileImage; } + @Override public MediaLoaderWrapper getMediaLoader() { return mImageLoader; } @@ -1189,6 +1192,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac return mDisplayMediaPreview; } + @Override public boolean isNameFirst() { return mNameFirst; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/graphic/DrawableWrapper.java b/twidere/src/main/java/org/mariotaku/twidere/graphic/DrawableWrapper.java index 7c678f714..b2e9768df 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/graphic/DrawableWrapper.java +++ b/twidere/src/main/java/org/mariotaku/twidere/graphic/DrawableWrapper.java @@ -99,6 +99,7 @@ class DrawableWrapper extends Drawable implements Drawable.Callback { return mDrawable.getState(); } + @Override public void jumpToCurrentState() { DrawableCompat.jumpToCurrentState(mDrawable); } @@ -151,6 +152,7 @@ class DrawableWrapper extends Drawable implements Drawable.Callback { /** * {@inheritDoc} */ + @Override public void invalidateDrawable(Drawable who) { invalidateSelf(); } @@ -158,6 +160,7 @@ class DrawableWrapper extends Drawable implements Drawable.Callback { /** * {@inheritDoc} */ + @Override public void scheduleDrawable(Drawable who, Runnable what, long when) { scheduleSelf(what, when); } @@ -165,6 +168,7 @@ class DrawableWrapper extends Drawable implements Drawable.Callback { /** * {@inheritDoc} */ + @Override public void unscheduleDrawable(Drawable who, Runnable what) { unscheduleSelf(what); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/graphic/DropShadowDrawable.java b/twidere/src/main/java/org/mariotaku/twidere/graphic/DropShadowDrawable.java deleted file mode 100644 index cd81cdd15..000000000 --- a/twidere/src/main/java/org/mariotaku/twidere/graphic/DropShadowDrawable.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2014 Mariotaku Lee - * - * 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 . - */ - -package org.mariotaku.twidere.graphic; - -import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.BlurMaskFilter; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.Rect; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; - -import org.mariotaku.twidere.util.Utils; - -public final class DropShadowDrawable extends BitmapDrawable { - - private final Bitmap dropShadow, dropShadowMask; - - public DropShadowDrawable(final Resources resources, final Bitmap bitmap, final float shadowRadius, - final int shadowColor) { - this(resources, bitmap, shadowRadius, shadowColor, Color.TRANSPARENT); - } - - public DropShadowDrawable(final Resources resources, final Bitmap bitmap, final float shadowRadius, - final int shadowColor, final int shadowMaskColor) { - super(resources, bitmap); - final float density = resources.getDisplayMetrics().density; - final int shadowAlpha = Color.alpha(shadowColor), shadowMaskAlpha = Color.alpha(shadowMaskColor); - final boolean hasShadow = shadowRadius != 0 && shadowAlpha != 0; - dropShadow = hasShadow ? createDropShadow(bitmap, shadowRadius * density, shadowColor) : null; - dropShadowMask = shadowMaskAlpha != 0 ? createDropShadowMask(bitmap, shadowMaskColor) : null; - } - - public DropShadowDrawable(final Resources resources, final Drawable drawable, final float shadowRadius, - final int shadowColor) { - this(resources, drawable, shadowRadius, shadowColor, Color.TRANSPARENT); - } - - public DropShadowDrawable(final Resources resources, final Drawable drawable, final float shadowRadius, - final int shadowColor, final int shadowMaskColor) { - this(resources, Utils.getBitmap(drawable), shadowRadius, shadowColor, shadowMaskColor); - } - - public DropShadowDrawable(final Resources resources, final int res, final float shadowRadius, final int shadowColor) { - this(resources, res, shadowRadius, shadowColor, Color.TRANSPARENT); - } - - public DropShadowDrawable(final Resources resources, final int res, final float shadowRadius, - final int shadowColor, final int shadowMaskColor) { - this(resources, Utils.getBitmap(resources.getDrawable(res)), shadowRadius, shadowColor, shadowMaskColor); - } - - @Override - public void draw(final Canvas canvas) { - final Rect bounds = getBounds(); - if (dropShadow != null) { - canvas.drawBitmap(dropShadow, bounds.left, bounds.top, null); - } - if (dropShadowMask != null) { - canvas.drawBitmap(dropShadowMask, bounds.left, bounds.top, null); - } - super.draw(canvas); - } - - private static Bitmap createDropShadow(final Bitmap src, final float radius, final int color) { - if (src == null) return null; - final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); - final int width = src.getWidth(), height = src.getHeight(); - final Bitmap dest = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); - final Canvas canvas = new Canvas(dest); - // Create background - final Bitmap alpha = src.extractAlpha(); - paint.setColor(color); - canvas.drawBitmap(alpha, 0, 0, paint); - // Create outer blur - final BlurMaskFilter filter = new BlurMaskFilter(radius, BlurMaskFilter.Blur.OUTER); - paint.setMaskFilter(filter); - canvas.drawBitmap(alpha, 0, 0, paint); - return dest; - } - - private static Bitmap createDropShadowMask(final Bitmap src, final int color) { - if (src == null) return null; - final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); - final int width = src.getWidth(), height = src.getHeight(); - final Bitmap dest = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); - final Canvas canvas = new Canvas(dest); - // Create background - final Bitmap alpha = src.extractAlpha(); - paint.setColor(color); - canvas.drawBitmap(alpha, 0, 0, paint); - return dest; - } -} diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/AppVersionPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/AppVersionPreference.java index 340b238b8..716c79703 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/preference/AppVersionPreference.java +++ b/twidere/src/main/java/org/mariotaku/twidere/preference/AppVersionPreference.java @@ -31,49 +31,49 @@ import org.mariotaku.twidere.activity.NyanActivity; public class AppVersionPreference extends Preference { - public Handler mHandler = new Handler(); - protected int mClickCount; + public Handler mHandler = new Handler(); + protected int mClickCount; - private final Runnable mResetCounterRunnable = new Runnable() { + private final Runnable mResetCounterRunnable = new Runnable() { - @Override - public void run() { - mClickCount = 0; - } - }; + @Override + public void run() { + mClickCount = 0; + } + }; - public AppVersionPreference(final Context context) { - this(context, null); - } + public AppVersionPreference(final Context context) { + this(context, null); + } - public AppVersionPreference(final Context context, final AttributeSet attrs) { - this(context, attrs, android.R.attr.preferenceStyle); - } + public AppVersionPreference(final Context context, final AttributeSet attrs) { + this(context, attrs, android.R.attr.preferenceStyle); + } - public AppVersionPreference(final Context context, final AttributeSet attrs, final int defStyle) { - super(context, attrs, defStyle); - final PackageManager pm = context.getPackageManager(); - try { - final PackageInfo info = pm.getPackageInfo(context.getPackageName(), 0); - setTitle(info.applicationInfo.loadLabel(pm)); - setSummary(info.versionName); - } catch (final PackageManager.NameNotFoundException e) { + public AppVersionPreference(final Context context, final AttributeSet attrs, final int defStyle) { + super(context, attrs, defStyle); + final PackageManager pm = context.getPackageManager(); + try { + final PackageInfo info = pm.getPackageInfo(context.getPackageName(), 0); + setTitle(info.applicationInfo.loadLabel(pm)); + setSummary(info.versionName); + } catch (final PackageManager.NameNotFoundException e) { + throw new AssertionError(e); + } + } - } - } - - @Override - protected void onClick() { - mHandler.removeCallbacks(mResetCounterRunnable); - mClickCount++; - if (mClickCount >= 7) { - final Context context = getContext(); - if (context != null) { - mClickCount = 0; - context.startActivity(new Intent(context, NyanActivity.class)); - } - } - mHandler.postDelayed(mResetCounterRunnable, 3000); - } + @Override + protected void onClick() { + mHandler.removeCallbacks(mResetCounterRunnable); + mClickCount++; + if (mClickCount >= 7) { + final Context context = getContext(); + if (context != null) { + mClickCount = 0; + context.startActivity(new Intent(context, NyanActivity.class)); + } + } + mHandler.postDelayed(mResetCounterRunnable, 3000); + } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/provider/TwidereDataProvider.java b/twidere/src/main/java/org/mariotaku/twidere/provider/TwidereDataProvider.java index 3b6ae66d0..7a27bf804 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/provider/TwidereDataProvider.java +++ b/twidere/src/main/java/org/mariotaku/twidere/provider/TwidereDataProvider.java @@ -843,6 +843,7 @@ public final class TwidereDataProvider extends ContentProvider implements Consta filteredSelection, null, null, null, Statuses.SORT_ORDER_TIMESTAMP_DESC); final Cursor userCursor = mDatabaseWrapper.query(Statuses.TABLE_NAME, userProjection, filteredSelection, null, Statuses.USER_ID, null, Statuses.SORT_ORDER_TIMESTAMP_DESC); + //noinspection TryFinallyCanBeTryWithResources try { final int usersCount = userCursor.getCount(); final int statusesCount = statusCursor.getCount(); @@ -917,6 +918,7 @@ public final class TwidereDataProvider extends ContentProvider implements Consta filteredSelection, null, null, null, Statuses.SORT_ORDER_TIMESTAMP_DESC); final Cursor userCursor = mDatabaseWrapper.query(Mentions.TABLE_NAME, userProjection, filteredSelection, null, Statuses.USER_ID, null, Statuses.SORT_ORDER_TIMESTAMP_DESC); + //noinspection TryFinallyCanBeTryWithResources try { final int usersCount = userCursor.getCount(); final int statusesCount = statusCursor.getCount(); @@ -1097,6 +1099,7 @@ public final class TwidereDataProvider extends ContentProvider implements Consta filteredSelection, null, null, null, DirectMessages.DEFAULT_SORT_ORDER); final Cursor userCursor = mDatabaseWrapper.query(DirectMessages.Inbox.TABLE_NAME, userProjection, filteredSelection, null, DirectMessages.SENDER_ID, null, DirectMessages.DEFAULT_SORT_ORDER); + //noinspection TryFinallyCanBeTryWithResources try { final int usersCount = userCursor.getCount(); final int messagesCount = messageCursor.getCount(); diff --git a/twidere/src/main/java/org/mariotaku/twidere/service/BackgroundOperationService.java b/twidere/src/main/java/org/mariotaku/twidere/service/BackgroundOperationService.java index 9fc133fef..37a87ab26 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/service/BackgroundOperationService.java +++ b/twidere/src/main/java/org/mariotaku/twidere/service/BackgroundOperationService.java @@ -181,7 +181,7 @@ public class BackgroundOperationService extends IntentService implements Constan mHandler.post(new Runnable() { @Override public void run() { - Toast.makeText(BackgroundOperationService.this, message, longMessage ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT); + Toast.makeText(BackgroundOperationService.this, message, longMessage ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT).show(); } }); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/DirectMessageOnLinkClickHandler.java b/twidere/src/main/java/org/mariotaku/twidere/util/DirectMessageOnLinkClickHandler.java index 9baa98434..a89302ed1 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/DirectMessageOnLinkClickHandler.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/DirectMessageOnLinkClickHandler.java @@ -38,6 +38,7 @@ public class DirectMessageOnLinkClickHandler extends OnLinkClickHandler { super(context, manager); } + @Override protected boolean isPrivateData() { return true; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/LongSparseArrayUtils.java b/twidere/src/main/java/org/mariotaku/twidere/util/LongSparseArrayUtils.java index e858f91f8..9e9bebcd2 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/LongSparseArrayUtils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/LongSparseArrayUtils.java @@ -46,8 +46,8 @@ public class LongSparseArrayUtils { */ public static void setValues(final LongSparseArray array, final long[] keys, final E uniqueValue) { final int length = keys.length; - for (int i = 0; i < length; i++) { - array.put(keys[i], uniqueValue); - } + for (long key : keys) { + array.put(key, uniqueValue); + } } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/TwidereLinkify.java b/twidere/src/main/java/org/mariotaku/twidere/util/TwidereLinkify.java index 63eacc40e..1db40b256 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/TwidereLinkify.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/TwidereLinkify.java @@ -73,10 +73,10 @@ public final class TwidereLinkify implements Constants { public static final int[] ALL_LINK_TYPES = new int[]{LINK_TYPE_LINK, LINK_TYPE_MENTION, LINK_TYPE_HASHTAG, LINK_TYPE_STATUS, LINK_TYPE_CASHTAG}; - public static final String AVAILABLE_URL_SCHEME_PREFIX = "(https?:\\/\\/)?"; + public static final String AVAILABLE_URL_SCHEME_PREFIX = "(https?://)?"; public static final String TWITTER_PROFILE_IMAGES_AVAILABLE_SIZES = "(bigger|normal|mini|reasonably_small)"; - private static final String STRING_PATTERN_TWITTER_PROFILE_IMAGES_NO_SCHEME = "(twimg[\\d\\w\\-]+\\.akamaihd\\.net|[\\w\\d]+\\.twimg\\.com)\\/profile_images\\/([\\d\\w\\-_]+)\\/([\\d\\w\\-_]+)_" + private static final String STRING_PATTERN_TWITTER_PROFILE_IMAGES_NO_SCHEME = "(twimg[\\d\\w\\-]+\\.akamaihd\\.net|[\\w\\d]+\\.twimg\\.com)/profile_images/([\\d\\w\\-_]+)/([\\d\\w\\-_]+)_" + TWITTER_PROFILE_IMAGES_AVAILABLE_SIZES + "(\\.?" + AVAILABLE_IMAGE_SHUFFIX + ")?"; private static final String STRING_PATTERN_TWITTER_PROFILE_IMAGES = AVAILABLE_URL_SCHEME_PREFIX + STRING_PATTERN_TWITTER_PROFILE_IMAGES_NO_SCHEME; @@ -87,12 +87,12 @@ public final class TwidereLinkify implements Constants { public static final int GROUP_ID_TWITTER_STATUS_STATUS_ID = 6; public static final int GROUP_ID_TWITTER_LIST_SCREEN_NAME = 4; public static final int GROUP_ID_TWITTER_LIST_LIST_NAME = 5; - private static final String STRING_PATTERN_TWITTER_STATUS_NO_SCHEME = "((mobile|www)\\.)?twitter\\.com\\/(?:#!\\/)?(\\w+)\\/status(es)?\\/(\\d+)(\\/photo\\/\\d)?\\/?"; + private static final String STRING_PATTERN_TWITTER_STATUS_NO_SCHEME = "((mobile|www)\\.)?twitter\\.com/(?:#!/)?(\\w+)/status(es)?/(\\d+)(/photo/\\d)?/?"; private static final String STRING_PATTERN_TWITTER_STATUS = AVAILABLE_URL_SCHEME_PREFIX + STRING_PATTERN_TWITTER_STATUS_NO_SCHEME; public static final Pattern PATTERN_TWITTER_STATUS = Pattern.compile(STRING_PATTERN_TWITTER_STATUS, Pattern.CASE_INSENSITIVE); - private static final String STRING_PATTERN_TWITTER_LIST_NO_SCHEME = "((mobile|www)\\.)?twitter\\.com\\/(?:#!\\/)?(\\w+)\\/lists\\/(.+)\\/?"; + private static final String STRING_PATTERN_TWITTER_LIST_NO_SCHEME = "((mobile|www)\\.)?twitter\\.com/(?:#!/)?(\\w+)/lists/(.+)/?"; private static final String STRING_PATTERN_TWITTER_LIST = AVAILABLE_URL_SCHEME_PREFIX + STRING_PATTERN_TWITTER_LIST_NO_SCHEME; public static final Pattern PATTERN_TWITTER_LIST = Pattern.compile(STRING_PATTERN_TWITTER_LIST, diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java b/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java index df1f67ee1..c6e22d3d3 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/Utils.java @@ -1874,12 +1874,15 @@ public final class Utils implements Constants, TwitterConstants { @HighlightStyle public static int getLinkHighlightingStyleInt(final String option) { - if (VALUE_LINK_HIGHLIGHT_OPTION_BOTH.equals(option)) - return VALUE_LINK_HIGHLIGHT_OPTION_CODE_BOTH; - else if (VALUE_LINK_HIGHLIGHT_OPTION_HIGHLIGHT.equals(option)) - return VALUE_LINK_HIGHLIGHT_OPTION_CODE_HIGHLIGHT; - else if (VALUE_LINK_HIGHLIGHT_OPTION_UNDERLINE.equals(option)) - return VALUE_LINK_HIGHLIGHT_OPTION_CODE_UNDERLINE; + if (option == null) return VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE; + switch (option) { + case VALUE_LINK_HIGHLIGHT_OPTION_BOTH: + return VALUE_LINK_HIGHLIGHT_OPTION_CODE_BOTH; + case VALUE_LINK_HIGHLIGHT_OPTION_HIGHLIGHT: + return VALUE_LINK_HIGHLIGHT_OPTION_CODE_HIGHLIGHT; + case VALUE_LINK_HIGHLIGHT_OPTION_UNDERLINE: + return VALUE_LINK_HIGHLIGHT_OPTION_CODE_UNDERLINE; + } return VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE; } @@ -2800,6 +2803,7 @@ public final class Utils implements Constants, TwitterConstants { final String[] projection = {Accounts.CONSUMER_KEY, Accounts.CONSUMER_SECRET}; final String selection = Expression.equals(Accounts.ACCOUNT_ID, accountId).getSQL(); final Cursor c = context.getContentResolver().query(Accounts.CONTENT_URI, projection, selection, null, null); + //noinspection TryFinallyCanBeTryWithResources try { if (c.moveToPosition(0)) return TwitterContentUtils.isOfficialKey(context, c.getString(0), c.getString(1)); @@ -4106,6 +4110,7 @@ public final class Utils implements Constants, TwitterConstants { final ContentResolver cr = context.getContentResolver(); final Expression where = Expression.equals(Users.USER_ID, userId); final Cursor c = cr.query(Users.CONTENT_URI, new String[0], where.getSQL(), null, null); + //noinspection TryFinallyCanBeTryWithResources try { return c.getCount() > 0; } finally { @@ -4119,6 +4124,7 @@ public final class Utils implements Constants, TwitterConstants { final Expression where = Expression.and(Expression.equals(ConversationEntries.ACCOUNT_ID, accountId), Expression.equals(ConversationEntries.CONVERSATION_ID, conversationId)); final Cursor c = cr.query(ConversationEntries.CONTENT_URI, null, where.getSQL(), null, null); + //noinspection TryFinallyCanBeTryWithResources try { if (c.moveToFirst()) return ParcelableUser.fromDirectMessageConversationEntry(c); } finally { diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/accessor/ActivityAccessor.java b/twidere/src/main/java/org/mariotaku/twidere/util/accessor/ActivityAccessor.java index a1cb5fe2e..fc4d367eb 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/accessor/ActivityAccessor.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/accessor/ActivityAccessor.java @@ -149,10 +149,12 @@ public class ActivityAccessor { public static final Creator CREATOR = new Creator() { + @Override public TaskDescriptionCompat createFromParcel(Parcel source) { return new TaskDescriptionCompat(source); } + @Override public TaskDescriptionCompat[] newArray(int size) { return new TaskDescriptionCompat[size]; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/accessor/BackStackEntryAccessor.java b/twidere/src/main/java/org/mariotaku/twidere/util/accessor/BackStackEntryAccessor.java index 851aa520c..54065c463 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/accessor/BackStackEntryAccessor.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/accessor/BackStackEntryAccessor.java @@ -34,7 +34,7 @@ public class BackStackEntryAccessor { final Field fragmentField = mHead.getClass().getField("fragment"); final Object fragment = fragmentField.get(mHead); if (fragment instanceof Fragment) return (Fragment) fragment; - } catch (final NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { + } catch (final NoSuchFieldException | IllegalArgumentException | IllegalAccessException ignored) { } return null; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/collection/CompactHashSet.java b/twidere/src/main/java/org/mariotaku/twidere/util/collection/CompactHashSet.java index 0e479662b..76eb0919b 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/collection/CompactHashSet.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/collection/CompactHashSet.java @@ -100,14 +100,16 @@ public class CompactHashSet extends java.util.AbstractSet { * @return an Iterator over the elements in this set. * @see ConcurrentModificationException */ + @Override @NonNull public Iterator iterator() { - return new CompactHashIterator(); + return new CompactHashIterator<>(); } /** * Returns the number of elements in this set (its cardinality). */ + @Override public int size() { return elements; } @@ -115,6 +117,7 @@ public class CompactHashSet extends java.util.AbstractSet { /** * Returns true if this set contains no elements. */ + @Override public boolean isEmpty() { return elements == 0; } @@ -125,6 +128,7 @@ public class CompactHashSet extends java.util.AbstractSet { * @param o element whose presence in this set is to be tested. * @return true if this set contains the specified element. */ + @Override public boolean contains(Object o) { if (o == null) o = nullObject; @@ -154,6 +158,7 @@ public class CompactHashSet extends java.util.AbstractSet { * @return true if the set did not already contain the specified * element. */ + @Override @SuppressWarnings("unchecked") public boolean add(Object o) { if (o == null) o = nullObject; @@ -208,6 +213,7 @@ public class CompactHashSet extends java.util.AbstractSet { /** * Removes the specified element from the set. */ + @Override @SuppressWarnings("unchecked") public boolean remove(Object o) { if (o == null) o = nullObject; @@ -244,6 +250,7 @@ public class CompactHashSet extends java.util.AbstractSet { /** * Removes all of the elements from this set. */ + @Override public void clear() { elements = 0; for (int ix = 0; ix < objects.length; ix++) @@ -252,23 +259,25 @@ public class CompactHashSet extends java.util.AbstractSet { modCount++; } + @Override @NonNull public Object[] toArray() { Object[] result = new Object[elements]; Object[] objects = this.objects; int pos = 0; - for (int i = 0; i < objects.length; i++) - if (objects[i] != null && objects[i] != deletedObject) { - if (objects[i] == nullObject) + for (Object object : objects) + if (object != null && object != deletedObject) { + if (object == nullObject) result[pos++] = null; else - result[pos++] = objects[i]; + result[pos++] = object; } // unchecked because it should only contain E return result; } // not sure if this needs to have generics + @Override @NonNull @SuppressWarnings("unchecked") public T[] toArray(@NonNull T[] a) { @@ -278,12 +287,12 @@ public class CompactHashSet extends java.util.AbstractSet { a.getClass().getComponentType(), size); E[] objects = this.objects; int pos = 0; - for (int i = 0; i < objects.length; i++) - if (objects[i] != null && objects[i] != deletedObject) { - if (objects[i] == nullObject) + for (E object : objects) + if (object != null && object != deletedObject) { + if (object == nullObject) a[pos++] = null; else - a[pos++] = (T) objects[i]; + a[pos++] = (T) object; } return a; } @@ -330,8 +339,7 @@ public class CompactHashSet extends java.util.AbstractSet { @SuppressWarnings("unchecked") E[] newObjects = (E[]) new Object[newCapacity]; - for (int ix = 0; ix < oldCapacity; ix++) { - Object o = objects[ix]; + for (E o : objects) { if (o == null || o == deletedObject) continue; @@ -377,10 +385,12 @@ public class CompactHashSet extends java.util.AbstractSet { expectedModCount = modCount; } + @Override public boolean hasNext() { return index < objects.length; } + @Override @SuppressWarnings({"empty-statement", "unchecked"}) public T next() { if (modCount != expectedModCount) @@ -402,6 +412,7 @@ public class CompactHashSet extends java.util.AbstractSet { return (T) objects[lastReturned]; } + @Override @SuppressWarnings("unchecked") public void remove() { if (modCount != expectedModCount) diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java b/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java index a9bcf1773..ef91d03ac 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/TwidereImageDownloader.java @@ -117,8 +117,7 @@ public class TwidereImageDownloader extends BaseImageDownloader implements Const if (statusCode != -1 && isTwitterProfileImage(uriString) && !uriString.contains("_normal.")) { try { return getStreamFromNetworkInternal(getNormalTwitterProfileImage(uriString), extras); - } catch (final TwitterException e2) { - + } catch (final TwitterException ignored) { } } throw new IOException(String.format(Locale.US, "Error downloading image %s, error code: %d", uriString, diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/URLFileNameGenerator.java b/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/URLFileNameGenerator.java index 3e1d3276c..2db9532e2 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/URLFileNameGenerator.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/imageloader/URLFileNameGenerator.java @@ -24,16 +24,16 @@ import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; public class URLFileNameGenerator implements FileNameGenerator { - private final Md5FileNameGenerator mGenerator; + private final Md5FileNameGenerator mGenerator; - public URLFileNameGenerator() { - mGenerator = new Md5FileNameGenerator(); - } + public URLFileNameGenerator() { + mGenerator = new Md5FileNameGenerator(); + } - @Override - public String generate(final String imageUri) { - if (imageUri == null) return null; - return mGenerator.generate(imageUri.replaceFirst("https?:\\/\\/", "")); - } + @Override + public String generate(final String imageUri) { + if (imageUri == null) return null; + return mGenerator.generate(imageUri.replaceFirst("https?://", "")); + } } diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java b/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java index 5d5739182..424510556 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/net/TwidereHostAddressResolver.java @@ -27,6 +27,7 @@ import android.util.Log; import org.apache.http.conn.util.InetAddressUtils; import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.util.HostsFileParser; +import org.mariotaku.twidere.util.UriUtils; import org.mariotaku.twidere.util.Utils; import org.xbill.DNS.AAAARecord; import org.xbill.DNS.ARecord; diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/ExtendedViewPager.java b/twidere/src/main/java/org/mariotaku/twidere/view/ExtendedViewPager.java index 62c6cfd36..6d17a37f0 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/ExtendedViewPager.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/ExtendedViewPager.java @@ -20,8 +20,6 @@ package org.mariotaku.twidere.view; import android.content.Context; -import android.graphics.Rect; -import android.support.annotation.NonNull; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; @@ -48,9 +46,4 @@ public class ExtendedViewPager extends ViewPager { return super.onTouchEvent(event); } - @Override - protected boolean fitSystemWindows(@NonNull Rect insets) { - return super.fitSystemWindows(insets); - } - } diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/HomeActionButtonCompat.java b/twidere/src/main/java/org/mariotaku/twidere/view/HomeActionButtonCompat.java index 2e61b8fe8..c66f2d9ac 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/HomeActionButtonCompat.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/HomeActionButtonCompat.java @@ -82,14 +82,17 @@ public class HomeActionButtonCompat extends FrameLayout implements IHomeActionBu } + @Override public void setIcon(final Bitmap bm) { mIconView.setImageBitmap(bm); } + @Override public void setIcon(final Drawable drawable) { mIconView.setImageDrawable(drawable); } + @Override public void setIcon(final int resId) { mIconView.setImageResource(resId); } @@ -99,15 +102,18 @@ public class HomeActionButtonCompat extends FrameLayout implements IHomeActionBu mIconView.setColorFilter(color, mode); } + @Override public void setShowProgress(final boolean showProgress) { mProgressBar.setVisibility(showProgress ? View.VISIBLE : View.GONE); mIconView.setVisibility(showProgress ? View.GONE : View.VISIBLE); } + @Override public void setTitle(final CharSequence title) { setContentDescription(title); } + @Override public void setTitle(final int title) { setTitle(getResources().getText(title)); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/StatusComposeEditText.java b/twidere/src/main/java/org/mariotaku/twidere/view/StatusComposeEditText.java index d3fd96e38..e8d3a4839 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/StatusComposeEditText.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/StatusComposeEditText.java @@ -35,7 +35,6 @@ public class StatusComposeEditText extends ThemedMultiAutoCompleteTextView imple private UserHashtagAutoCompleteAdapter mAdapter; private long mAccountId; - private boolean mInputSingleLine; public StatusComposeEditText(final Context context) { this(context, null); @@ -49,22 +48,15 @@ public class StatusComposeEditText extends ThemedMultiAutoCompleteTextView imple super(context, attrs, defStyle); setTokenizer(new ScreenNameTokenizer()); setMovementMethod(ArrowKeyMovementMethod.getInstance()); - updateComposeInputType(); + setupComposeInputType(); } - private void updateComposeInputType() { + private void setupComposeInputType() { int rawInputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; - if (!mInputSingleLine) { - rawInputType |= InputType.TYPE_TEXT_FLAG_MULTI_LINE; - } + rawInputType |= InputType.TYPE_TEXT_FLAG_MULTI_LINE; setRawInputType(rawInputType); } - public void setComposeInputSingleLine(boolean singleLine) { - mInputSingleLine = singleLine; - updateComposeInputType(); - } - @Override protected int computeVerticalScrollRange() { return super.computeVerticalScrollRange(); diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/TintedStatusFrameLayout.java b/twidere/src/main/java/org/mariotaku/twidere/view/TintedStatusFrameLayout.java index 6d9534b3a..0d18f4574 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/TintedStatusFrameLayout.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/TintedStatusFrameLayout.java @@ -61,6 +61,7 @@ public class TintedStatusFrameLayout extends ExtendedFrameLayout { mBlackPaint.setColor(Color.BLACK); mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + a.recycle(); setWillNotDraw(false); setFactor(1); } diff --git a/twidere/src/main/java/org/mariotaku/twidere/view/holder/GapViewHolder.java b/twidere/src/main/java/org/mariotaku/twidere/view/holder/GapViewHolder.java index b9520e8c5..ef222e7e6 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/view/holder/GapViewHolder.java +++ b/twidere/src/main/java/org/mariotaku/twidere/view/holder/GapViewHolder.java @@ -40,6 +40,6 @@ public class GapViewHolder extends RecyclerView.ViewHolder implements OnClickLis @Override public void onClick(View v) { - adapter.onGapClick(this, getPosition()); + adapter.onGapClick(this, getLayoutPosition()); } } diff --git a/twidere/src/main/res/layout/activity_compose.xml b/twidere/src/main/res/layout/activity_compose.xml index cd3eb38b5..eaacb51ed 100644 --- a/twidere/src/main/res/layout/activity_compose.xml +++ b/twidere/src/main/res/layout/activity_compose.xml @@ -19,10 +19,10 @@ --> @@ -62,7 +62,6 @@ android:completionThreshold="1" android:gravity="top" android:hint="@string/status_hint" - android:imeOptions="actionDone" android:minLines="6" android:padding="@dimen/element_spacing_normal" android:scrollbars="vertical"/> @@ -79,8 +78,8 @@ android:padding="@dimen/element_spacing_normal"> diff --git a/twidere/src/main/res/values/strings.xml b/twidere/src/main/res/values/strings.xml index 2ab73aa51..6d50cf23f 100644 --- a/twidere/src/main/res/values/strings.xml +++ b/twidere/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ - + Compose Add account @@ -90,8 +90,8 @@ %s retweeted %1$s and another retweeted %1$s and %2$d others retweeted - %d retweet - %d retweets + %d retweet + %d retweets Retweeted by %s Retweeted by %1$s and %2$d others Retweeted by %d users @@ -255,8 +255,8 @@ Hit \"Enter\" to Send Send tweet when hit \"Enter\". Discard - 1 item selected - %d items selected + 1 item selected + %d items selected Custom host mapping Host mapping like /etc/hosts, but does not require any additional permissions. Host @@ -420,15 +420,15 @@ Updated list \"%s\"\'s details. Subscribed to list \"%s\". Unsubscribed from list \"%s\". - Added %1$d user to list \"%2$s\". - Added %1$d users to list \"%2$s\". + Added %1$d user to list \"%2$s\". + Added %1$d users to list \"%2$s\". Added %1$s to list \"%2$s\". Deleted %1$s from list \"%2$s\". - Deleted %1$d user from list \"%2$s\". - Deleted %1$d users from list \"%2$s\". + Deleted %1$d user from list \"%2$s\". + Deleted %1$d users from list \"%2$s\". Delete %1$s from list \"%2$s\"? - Delete %1$d user from list \"%2$s\"? - Delete %1$d users from list \"%2$s\"? + Delete %1$d user from list \"%2$s\"? + Delete %1$d users from list \"%2$s\"? Subscribe Unsubscribe Background Toast notification @@ -439,8 +439,8 @@ A little gift for chatterbox Tweet saved to draft. Default account - %1$s (%2$d tweet per day) - %1$s (%2$d tweets per day) + %1$s (%2$d tweet per day) + %1$s (%2$d tweets per day) Empty content Fast image loading Enable to make images load faster, disable this if some image can\'t be displayed. @@ -540,12 +540,12 @@ View Replies Compact cards Display more cards on screen - %d new tweet - %d new tweets - %d new mention - %d new mentions - %d new conversation - %d new conversations + %d new tweet + %d new tweets + %d new mention + %d new mentions + %d new conversation + %d new conversations Tweet from %1$s (@%2$s), at %3$s %1$s\n\n%2$s Rate limit @@ -606,8 +606,8 @@ Want old icon back? Icon restored! Add - %d media - %d media + %d media + %d media Delete selcted drafts? Extra configurations Click an item to config @@ -662,8 +662,8 @@ Media preview style Draft saved Open Twitter links - another - %d others + another + %d others Type name to search No user found Members @@ -718,10 +718,10 @@ Server address Security key Hide card actions - %d tweet - %d tweets - %d favorites - %d favorites + %d tweet + %d tweets + %d favorites + %d favorites Your unsent tweets will save here Keyboard shortcuts Press keys