simplified keyboard shortcuts code
This commit is contained in:
parent
fb823d7003
commit
9eaf596f77
|
@ -81,6 +81,7 @@ dependencies {
|
|||
compile 'com.pnikosis:materialish-progress:1.5'
|
||||
compile 'com.squareup.okhttp:okhttp:2.3.0'
|
||||
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.5'
|
||||
compile 'com.github.johnpersano:supertoasts:1.3.4@aar'
|
||||
compile 'com.github.mariotaku:MessageBubbleView:1.0'
|
||||
compile 'com.github.mariotaku:DragSortListView:0.6.1'
|
||||
compile 'com.github.mariotaku:SlidingMenu:1.3'
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.mariotaku.twidere.activity.iface.IControlBarActivity;
|
|||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCallback;
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.view.iface.IExtendedView.OnFitSystemWindowsListener;
|
||||
|
@ -43,11 +44,16 @@ public class BaseAppCompatActivity extends ThemedAppCompatActivity implements Co
|
|||
OnFitSystemWindowsListener, SystemWindowsInsetsCallback, IControlBarActivity,
|
||||
KeyboardShortcutCallback {
|
||||
|
||||
// Utility classes
|
||||
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
|
||||
|
||||
// Registered listeners
|
||||
private ArrayList<ControlBarOffsetListener> mControlBarOffsetListeners = new ArrayList<>();
|
||||
|
||||
private boolean mInstanceStateSaved;
|
||||
private boolean mIsVisible;
|
||||
|
||||
private Rect mSystemWindowsInsets;
|
||||
private ArrayList<ControlBarOffsetListener> mControlBarOffsetListeners = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public boolean getSystemWindowsInsets(Rect insets) {
|
||||
|
@ -86,21 +92,17 @@ public class BaseAppCompatActivity extends ThemedAppCompatActivity implements Co
|
|||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
|
||||
if (handleKeyboardShortcutSingle(keyCode, event)) return true;
|
||||
if (handleKeyboardShortcutSingle(mKeyboardShortcutsHandler, keyCode, event)) return true;
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (handleKeyboardShortcutRepeat(keyCode, event.getRepeatCount(), event)) return true;
|
||||
if (handleKeyboardShortcutRepeat(mKeyboardShortcutsHandler, keyCode, event.getRepeatCount(), event))
|
||||
return true;
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
|
||||
return super.onKeyMultiple(keyCode, repeatCount, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
@ -118,12 +120,12 @@ public class BaseAppCompatActivity extends ThemedAppCompatActivity implements Co
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
public boolean handleKeyboardShortcutSingle(KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
public boolean handleKeyboardShortcutRepeat(KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -134,6 +136,7 @@ public class BaseAppCompatActivity extends ThemedAppCompatActivity implements Co
|
|||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mKeyboardShortcutsHandler = TwidereApplication.getInstance(this).getKeyboardShortcutsHandler();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -61,13 +61,13 @@ 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.InputType;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.ActionMode;
|
||||
import android.view.ActionMode.Callback;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -83,6 +83,9 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.johnpersano.supertoasts.SuperToast;
|
||||
import com.github.johnpersano.supertoasts.SuperToast.Duration;
|
||||
import com.github.johnpersano.supertoasts.SuperToast.OnDismissListener;
|
||||
import com.nostra13.universalimageloader.utils.IoUtils;
|
||||
import com.twitter.Extractor;
|
||||
|
||||
|
@ -108,6 +111,7 @@ import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
|||
import org.mariotaku.twidere.util.ContentValuesCreator;
|
||||
import org.mariotaku.twidere.util.EditTextEnterHandler;
|
||||
import org.mariotaku.twidere.util.EditTextEnterHandler.EnterListener;
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
|
||||
import org.mariotaku.twidere.util.MathUtils;
|
||||
import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
||||
import org.mariotaku.twidere.util.MenuUtils;
|
||||
|
@ -136,24 +140,27 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class ComposeActivity extends ThemedFragmentActivity implements LocationListener, OnMenuItemClickListener,
|
||||
OnClickListener, OnLongClickListener, Callback {
|
||||
public class ComposeActivity extends ThemedFragmentActivity implements LocationListener,
|
||||
OnMenuItemClickListener, OnClickListener, OnLongClickListener, Callback {
|
||||
|
||||
// Constants
|
||||
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";
|
||||
private static final String EXTRA_SHOULD_SAVE_ACCOUNTS = "should_save_accounts";
|
||||
private static final String EXTRA_ORIGINAL_TEXT = "original_text";
|
||||
private static final String EXTRA_SHARE_SCREENSHOT = "share_screenshot";
|
||||
|
||||
// Utility classes
|
||||
private final Extractor mExtractor = new Extractor();
|
||||
private final Rect mWindowDecorHitRect = new Rect();
|
||||
private TwidereValidator mValidator;
|
||||
private AsyncTwitterWrapper mTwitterWrapper;
|
||||
private LocationManager mLocationManager;
|
||||
private SharedPreferencesWrapper mPreferences;
|
||||
private ParcelableLocation mRecentLocation;
|
||||
private ContentResolver mResolver;
|
||||
private AsyncTask<Object, Object, ?> mTask;
|
||||
private SupportMenuInflater mMenuInflater;
|
||||
|
||||
// Views
|
||||
private GridView mMediaPreviewGrid;
|
||||
private ActionMenuView mMenuBar;
|
||||
private StatusComposeEditText mEditText;
|
||||
|
@ -161,15 +168,7 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
private StatusTextCountView mSendTextCountView;
|
||||
private RecyclerView mAccountSelector;
|
||||
private View mAccountSelectorContainer;
|
||||
private MediaPreviewAdapter mMediaPreviewAdapter;
|
||||
private boolean mIsPossiblySensitive, mShouldSaveAccounts;
|
||||
private boolean mImageUploaderUsed, mStatusShortenerUsed;
|
||||
private ParcelableStatus mInReplyToStatus;
|
||||
private ParcelableUser mMentionUser;
|
||||
private DraftItem mDraftItem;
|
||||
private long mInReplyToStatusId;
|
||||
private String mOriginalText;
|
||||
private AccountIconsAdapter mAccountsAdapter;
|
||||
private ShapedImageView mProfileImageView;
|
||||
private BadgeView mCountView;
|
||||
private View mAccountSelectorButton;
|
||||
|
@ -177,41 +176,20 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
private View mLocationContainer;
|
||||
private ActionIconView mLocationIcon;
|
||||
private TextView mLocationText;
|
||||
private SupportMenuInflater mMenuInflater;
|
||||
|
||||
// Adapters
|
||||
private MediaPreviewAdapter mMediaPreviewAdapter;
|
||||
private AccountIconsAdapter mAccountsAdapter;
|
||||
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
final Window window = getWindow();
|
||||
final Rect rect = new Rect();
|
||||
window.getDecorView().getWindowVisibleDisplayFrame(rect);
|
||||
final View contentView = window.findViewById(android.R.id.content);
|
||||
final int statusBarHeight = rect.top;
|
||||
contentView.getWindowVisibleDisplayFrame(rect);
|
||||
final int paddingTop = statusBarHeight + Utils.getActionBarHeight(this) - rect.top;
|
||||
contentView.setPadding(contentView.getPaddingLeft(), paddingTop,
|
||||
contentView.getPaddingRight(), contentView.getPaddingBottom());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
ThemeUtils.wrapMenuIcon(this, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
final Window window = getWindow();
|
||||
final View contentView = window.findViewById(android.R.id.content);
|
||||
contentView.setPadding(contentView.getPaddingLeft(), 0,
|
||||
contentView.getPaddingRight(), contentView.getPaddingBottom());
|
||||
}
|
||||
// Data fields
|
||||
private ParcelableLocation mRecentLocation;
|
||||
private ParcelableStatus mInReplyToStatus;
|
||||
private ParcelableUser mMentionUser;
|
||||
private String mOriginalText;
|
||||
private long mInReplyToStatusId;
|
||||
private boolean mIsPossiblySensitive, mShouldSaveAccounts;
|
||||
private boolean mImageUploaderUsed, mStatusShortenerUsed;
|
||||
private boolean mNavigateBackPressed;
|
||||
|
||||
@Override
|
||||
public int getThemeColor() {
|
||||
|
@ -223,38 +201,23 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
return ThemeUtils.getComposeThemeResource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(final Bundle outState) {
|
||||
outState.putLongArray(EXTRA_ACCOUNT_IDS, mAccountsAdapter.getSelectedAccountIds());
|
||||
outState.putParcelableArrayList(EXTRA_MEDIA, new ArrayList<Parcelable>(getMediaList()));
|
||||
outState.putBoolean(EXTRA_IS_POSSIBLY_SENSITIVE, mIsPossiblySensitive);
|
||||
outState.putParcelable(EXTRA_STATUS, mInReplyToStatus);
|
||||
outState.putLong(EXTRA_STATUS_ID, mInReplyToStatusId);
|
||||
outState.putParcelable(EXTRA_USER, mMentionUser);
|
||||
outState.putParcelable(EXTRA_DRAFT, mDraftItem);
|
||||
outState.putBoolean(EXTRA_SHOULD_SAVE_ACCOUNTS, mShouldSaveAccounts);
|
||||
outState.putString(EXTRA_ORIGINAL_TEXT, mOriginalText);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
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) {
|
||||
|
||||
|
||||
private void toggleLocation() {
|
||||
final boolean attachLocation = mPreferences.getBoolean(KEY_ATTACH_LOCATION, false);
|
||||
mPreferences.edit().putBoolean(KEY_ATTACH_LOCATION, !attachLocation).apply();
|
||||
startLocationUpdateIfEnabled();
|
||||
updateLocationState();
|
||||
setMenu();
|
||||
updateTextCount();
|
||||
}
|
||||
|
||||
private void updateLocationState() {
|
||||
final boolean attachLocation = mPreferences.getBoolean(KEY_ATTACH_LOCATION, false);
|
||||
if (attachLocation) {
|
||||
mLocationIcon.setColorFilter(getCurrentThemeColor(), Mode.SRC_ATOP);
|
||||
} else {
|
||||
mLocationIcon.setColorFilter(mLocationIcon.getDefaultColor(), Mode.SRC_ATOP);
|
||||
mLocationText.setText(R.string.no_location);
|
||||
}
|
||||
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
|
||||
|
@ -317,6 +280,32 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(final Bundle outState) {
|
||||
outState.putLongArray(EXTRA_ACCOUNT_IDS, mAccountsAdapter.getSelectedAccountIds());
|
||||
outState.putParcelableArrayList(EXTRA_MEDIA, new ArrayList<Parcelable>(getMediaList()));
|
||||
outState.putBoolean(EXTRA_IS_POSSIBLY_SENSITIVE, mIsPossiblySensitive);
|
||||
outState.putParcelable(EXTRA_STATUS, mInReplyToStatus);
|
||||
outState.putLong(EXTRA_STATUS_ID, mInReplyToStatusId);
|
||||
outState.putParcelable(EXTRA_USER, mMentionUser);
|
||||
outState.putParcelable(EXTRA_DRAFT, mDraftItem);
|
||||
outState.putBoolean(EXTRA_SHOULD_SAVE_ACCOUNTS, mShouldSaveAccounts);
|
||||
outState.putString(EXTRA_ORIGINAL_TEXT, mOriginalText);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mImageUploaderUsed = !ServicePickerPreference.isNoneValue(mPreferences.getString(KEY_MEDIA_UPLOADER, null));
|
||||
mStatusShortenerUsed = !ServicePickerPreference.isNoneValue(mPreferences.getString(KEY_STATUS_SHORTENER, null));
|
||||
startLocationUpdateIfEnabled();
|
||||
setMenu();
|
||||
updateTextCount();
|
||||
final int textSize = mPreferences.getInt(KEY_TEXT_SIZE, Utils.getDefaultTextSize(this));
|
||||
mEditText.setTextSize(textSize * 1.25f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
saveAccountSelection();
|
||||
|
@ -352,44 +341,44 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
}
|
||||
}
|
||||
|
||||
private void setAccountSelectorVisible(boolean visible) {
|
||||
mAccountSelectorContainer.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
final Window window = getWindow();
|
||||
final Rect rect = new Rect();
|
||||
window.getDecorView().getWindowVisibleDisplayFrame(rect);
|
||||
final View contentView = window.findViewById(android.R.id.content);
|
||||
final int statusBarHeight = rect.top;
|
||||
contentView.getWindowVisibleDisplayFrame(rect);
|
||||
final int paddingTop = statusBarHeight + Utils.getActionBarHeight(this) - rect.top;
|
||||
contentView.setPadding(contentView.getPaddingLeft(), paddingTop,
|
||||
contentView.getPaddingRight(), contentView.getPaddingBottom());
|
||||
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) {
|
||||
|
||||
}
|
||||
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;
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
ThemeUtils.wrapMenuIcon(this, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
final Window window = getWindow();
|
||||
final View contentView = window.findViewById(android.R.id.content);
|
||||
contentView.setPadding(contentView.getPaddingLeft(), 0,
|
||||
contentView.getPaddingRight(), contentView.getPaddingBottom());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(final Location location) {
|
||||
setRecentLocation(ParcelableLocation.fromLocation(location));
|
||||
}
|
||||
|
||||
private void setRecentLocation(ParcelableLocation location) {
|
||||
if (location != null) {
|
||||
mLocationText.setText(location.getHumanReadableString(3));
|
||||
} else {
|
||||
mLocationText.setText(R.string.unknown_location);
|
||||
}
|
||||
mRecentLocation = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(final String provider, final int status, final Bundle extras) {
|
||||
|
||||
|
@ -399,15 +388,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
public void onProviderEnabled(final String provider) {
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MenuInflater getMenuInflater() {
|
||||
if (mMenuInflater == null) {
|
||||
mMenuInflater = new SupportMenuInflater(this);
|
||||
}
|
||||
return mMenuInflater;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(final String provider) {
|
||||
}
|
||||
|
@ -523,8 +503,9 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
public boolean onTouchEvent(final MotionEvent event) {
|
||||
switch (event.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
getWindow().getDecorView().getHitRect(mWindowDecorHitRect);
|
||||
if (!mWindowDecorHitRect.contains(Math.round(event.getX()), Math.round(event.getY()))) {
|
||||
final Rect rect = new Rect();
|
||||
getWindow().getDecorView().getHitRect(rect);
|
||||
if (!rect.contains(Math.round(event.getX()), Math.round(event.getY()))) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
|
@ -552,6 +533,15 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
mLocationText = (TextView) findViewById(R.id.location_text);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MenuInflater getMenuInflater() {
|
||||
if (mMenuInflater == null) {
|
||||
mMenuInflater = new SupportMenuInflater(this);
|
||||
}
|
||||
return mMenuInflater;
|
||||
}
|
||||
|
||||
public void removeAllMedia(final List<ParcelableMediaUpdate> list) {
|
||||
mMediaPreviewAdapter.removeAll(list);
|
||||
updateMediaPreview();
|
||||
|
@ -573,9 +563,22 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
displayNewDraftNotification(text, draftUri);
|
||||
}
|
||||
|
||||
public void setSelectedAccounts(ParcelableAccount... accounts) {
|
||||
if (accounts.length == 1) {
|
||||
mCountView.setText(null);
|
||||
final ParcelableAccount account = accounts[0];
|
||||
mImageLoader.displayProfileImage(mProfileImageView, account.profile_image_url);
|
||||
mProfileImageView.setBorderColor(account.color);
|
||||
} else {
|
||||
mCountView.setText(String.valueOf(accounts.length));
|
||||
mImageLoader.cancelDisplayTask(mProfileImageView);
|
||||
mProfileImageView.setImageDrawable(null);
|
||||
mProfileImageView.setBorderColors(Utils.getAccountColors(accounts));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
// requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
super.onCreate(savedInstanceState);
|
||||
mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
mPreferences = SharedPreferencesWrapper.getInstance(this, SHARED_PREFERENCES_NAME,
|
||||
|
@ -587,7 +590,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
mValidator = new TwidereValidator(this);
|
||||
mImageLoader = app.getMediaLoaderWrapper();
|
||||
setContentView(R.layout.activity_compose);
|
||||
// setSupportProgressBarIndeterminateVisibility(false);
|
||||
setFinishOnTouchOutside(false);
|
||||
final long[] defaultAccountIds = Utils.getAccountIds(this);
|
||||
if (defaultAccountIds.length <= 0) {
|
||||
|
@ -698,37 +700,40 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
notifyAccountSelectionChanged();
|
||||
}
|
||||
|
||||
public void setSelectedAccounts(ParcelableAccount... accounts) {
|
||||
if (accounts.length == 1) {
|
||||
mCountView.setText(null);
|
||||
final ParcelableAccount account = accounts[0];
|
||||
mImageLoader.displayProfileImage(mProfileImageView, account.profile_image_url);
|
||||
mProfileImageView.setBorderColor(account.color);
|
||||
} else {
|
||||
mCountView.setText(String.valueOf(accounts.length));
|
||||
mImageLoader.cancelDisplayTask(mProfileImageView);
|
||||
mProfileImageView.setImageDrawable(null);
|
||||
mProfileImageView.setBorderColors(Utils.getAccountColors(accounts));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mImageUploaderUsed = !ServicePickerPreference.isNoneValue(mPreferences.getString(KEY_MEDIA_UPLOADER, null));
|
||||
mStatusShortenerUsed = !ServicePickerPreference.isNoneValue(mPreferences.getString(KEY_STATUS_SHORTENER, null));
|
||||
startLocationUpdateIfEnabled();
|
||||
setMenu();
|
||||
updateTextCount();
|
||||
final int textSize = mPreferences.getInt(KEY_TEXT_SIZE, Utils.getDefaultTextSize(this));
|
||||
mEditText.setTextSize(textSize * 1.25f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTitleChanged(final CharSequence title, final int color) {
|
||||
super.onTitleChanged(title, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
final String action = handler.getKeyAction("navigation", keyCode, event);
|
||||
if ("navigation.back".equals(action)) {
|
||||
if (mEditText.length() == 0) {
|
||||
if (!mNavigateBackPressed) {
|
||||
final SuperToast toast = SuperToast.create(this, getString(R.string.press_again_to_close), Duration.SHORT);
|
||||
toast.setOnDismissListener(new OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(View view) {
|
||||
mNavigateBackPressed = false;
|
||||
}
|
||||
});
|
||||
toast.show();
|
||||
mNavigateBackPressed = true;
|
||||
} else {
|
||||
onBackPressed();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.handleKeyboardShortcutSingle(handler, keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(@NonNull KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
return super.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
|
||||
private void addMedia(final ParcelableMediaUpdate media) {
|
||||
mMediaPreviewAdapter.add(media);
|
||||
updateMediaPreview();
|
||||
|
@ -749,7 +754,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
return Uri.fromFile(file);
|
||||
}
|
||||
|
||||
|
||||
private void displayNewDraftNotification(String text, Uri draftUri) {
|
||||
final NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
|
||||
|
@ -773,39 +777,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
nm.notify(draftUri.toString(), NOTIFICATION_ID_DRAFTS, builder.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* The Location Manager manages location providers. This code searches for
|
||||
* the best provider of data (GPS, WiFi/cell phone tower lookup, some other
|
||||
* mechanism) and finds the last known location.
|
||||
*/
|
||||
private boolean startLocationUpdateIfEnabled() {
|
||||
final LocationManager lm = mLocationManager;
|
||||
final boolean attachLocation = mPreferences.getBoolean(KEY_ATTACH_LOCATION);
|
||||
if (!attachLocation) {
|
||||
lm.removeUpdates(this);
|
||||
return false;
|
||||
}
|
||||
final Criteria criteria = new Criteria();
|
||||
criteria.setAccuracy(Criteria.ACCURACY_FINE);
|
||||
final String provider = lm.getBestProvider(criteria, true);
|
||||
if (provider != null) {
|
||||
mLocationText.setText(R.string.getting_location);
|
||||
lm.requestLocationUpdates(provider, 0, 0, this);
|
||||
final Location location;
|
||||
if (lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
|
||||
location = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
|
||||
} else {
|
||||
location = lm.getLastKnownLocation(provider);
|
||||
}
|
||||
if (location != null) {
|
||||
onLocationChanged(location);
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(this, R.string.cannot_get_location, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return provider != null;
|
||||
}
|
||||
|
||||
private ParcelableMediaUpdate[] getMedia() {
|
||||
final List<ParcelableMediaUpdate> list = getMediaList();
|
||||
return list.toArray(new ParcelableMediaUpdate[list.size()]);
|
||||
|
@ -975,6 +946,10 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
return !mMediaPreviewAdapter.isEmpty();
|
||||
}
|
||||
|
||||
private boolean isQuote() {
|
||||
return INTENT_ACTION_QUOTE.equals(getIntent().getAction());
|
||||
}
|
||||
|
||||
private boolean isQuotingProtectedStatus() {
|
||||
if (!isQuote() || mInReplyToStatus == null) return false;
|
||||
return mInReplyToStatus.user_is_protected && mInReplyToStatus.account_id != mInReplyToStatus.user_id;
|
||||
|
@ -987,6 +962,13 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
return is_reply && text.equals(mOriginalText);
|
||||
}
|
||||
|
||||
private void notifyAccountSelectionChanged() {
|
||||
final ParcelableAccount[] accounts = mAccountsAdapter.getSelectedAccounts();
|
||||
setSelectedAccounts(accounts);
|
||||
mEditText.setAccountId(accounts.length > 0 ? accounts[0].account_id : Utils.getDefaultAccountId(this));
|
||||
// mAccountActionProvider.setSelectedAccounts(mAccountsAdapter.getSelectedAccounts());
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.KITKAT)
|
||||
private boolean openDocument() {
|
||||
final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
|
@ -1017,6 +999,10 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
editor.apply();
|
||||
}
|
||||
|
||||
private void setAccountSelectorVisible(boolean visible) {
|
||||
mAccountSelectorContainer.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private boolean setComposeTitle(final Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
if (INTENT_ACTION_REPLY.equals(action)) {
|
||||
|
@ -1080,6 +1066,48 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
// mProgress.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void setRecentLocation(ParcelableLocation location) {
|
||||
if (location != null) {
|
||||
mLocationText.setText(location.getHumanReadableString(3));
|
||||
} else {
|
||||
mLocationText.setText(R.string.unknown_location);
|
||||
}
|
||||
mRecentLocation = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Location Manager manages location providers. This code searches for
|
||||
* the best provider of data (GPS, WiFi/cell phone tower lookup, some other
|
||||
* mechanism) and finds the last known location.
|
||||
*/
|
||||
private boolean startLocationUpdateIfEnabled() {
|
||||
final LocationManager lm = mLocationManager;
|
||||
final boolean attachLocation = mPreferences.getBoolean(KEY_ATTACH_LOCATION);
|
||||
if (!attachLocation) {
|
||||
lm.removeUpdates(this);
|
||||
return false;
|
||||
}
|
||||
final Criteria criteria = new Criteria();
|
||||
criteria.setAccuracy(Criteria.ACCURACY_FINE);
|
||||
final String provider = lm.getBestProvider(criteria, true);
|
||||
if (provider != null) {
|
||||
mLocationText.setText(R.string.getting_location);
|
||||
lm.requestLocationUpdates(provider, 0, 0, this);
|
||||
final Location location;
|
||||
if (lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
|
||||
location = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
|
||||
} else {
|
||||
location = lm.getLastKnownLocation(provider);
|
||||
}
|
||||
if (location != null) {
|
||||
onLocationChanged(location);
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(this, R.string.cannot_get_location, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return provider != null;
|
||||
}
|
||||
|
||||
private boolean takePhoto() {
|
||||
final Intent intent = new Intent(this, ImagePickerActivity.class);
|
||||
intent.setAction(INTENT_ACTION_TAKE_PHOTO);
|
||||
|
@ -1087,6 +1115,25 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
return true;
|
||||
}
|
||||
|
||||
private void toggleLocation() {
|
||||
final boolean attachLocation = mPreferences.getBoolean(KEY_ATTACH_LOCATION, false);
|
||||
mPreferences.edit().putBoolean(KEY_ATTACH_LOCATION, !attachLocation).apply();
|
||||
startLocationUpdateIfEnabled();
|
||||
updateLocationState();
|
||||
setMenu();
|
||||
updateTextCount();
|
||||
}
|
||||
|
||||
private void updateLocationState() {
|
||||
final boolean attachLocation = mPreferences.getBoolean(KEY_ATTACH_LOCATION, false);
|
||||
if (attachLocation) {
|
||||
mLocationIcon.setColorFilter(getCurrentThemeColor(), Mode.SRC_ATOP);
|
||||
} else {
|
||||
mLocationIcon.setColorFilter(mLocationIcon.getDefaultColor(), Mode.SRC_ATOP);
|
||||
mLocationText.setText(R.string.no_location);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMediaPreview() {
|
||||
final int count = mMediaPreviewAdapter.getCount();
|
||||
final Resources res = getResources();
|
||||
|
@ -1155,10 +1202,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isQuote() {
|
||||
return INTENT_ACTION_QUOTE.equals(getIntent().getAction());
|
||||
}
|
||||
|
||||
private void updateTextCount() {
|
||||
if (mSendTextCountView == null || mEditText == null) return;
|
||||
final String textOrig = ParseUtils.parseString(mEditText.getText());
|
||||
|
@ -1230,6 +1273,16 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
return result;
|
||||
}
|
||||
|
||||
public void setSelectedAccountIds(long... accountIds) {
|
||||
mSelection.clear();
|
||||
if (accountIds != null) {
|
||||
for (long accountId : accountIds) {
|
||||
mSelection.put(accountId, true);
|
||||
}
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public ParcelableAccount[] getSelectedAccounts() {
|
||||
if (mAccounts == null) return new ParcelableAccount[0];
|
||||
|
@ -1249,16 +1302,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
return getSelectedAccountIds().length == 0;
|
||||
}
|
||||
|
||||
public void setSelectedAccountIds(long... accountIds) {
|
||||
mSelection.clear();
|
||||
if (accountIds != null) {
|
||||
for (long accountId : accountIds) {
|
||||
mSelection.put(accountId, true);
|
||||
}
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountIconViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
final View view = mInflater.inflate(R.layout.adapter_item_compose_account, parent, false);
|
||||
|
@ -1291,13 +1334,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
|
|||
}
|
||||
}
|
||||
|
||||
private void notifyAccountSelectionChanged() {
|
||||
final ParcelableAccount[] accounts = mAccountsAdapter.getSelectedAccounts();
|
||||
setSelectedAccounts(accounts);
|
||||
mEditText.setAccountId(accounts.length > 0 ? accounts[0].account_id : Utils.getDefaultAccountId(this));
|
||||
// mAccountActionProvider.setSelectedAccounts(mAccountsAdapter.getSelectedAccounts());
|
||||
}
|
||||
|
||||
private static class AddBitmapTask extends AddMediaTask {
|
||||
|
||||
private final Bitmap mBitmap;
|
||||
|
|
|
@ -86,7 +86,6 @@ import org.mariotaku.twidere.provider.TwidereDataStore.Mentions;
|
|||
import org.mariotaku.twidere.provider.TwidereDataStore.Statuses;
|
||||
import org.mariotaku.twidere.util.AsyncTaskUtils;
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
import org.mariotaku.twidere.util.TwidereColorUtils;
|
||||
import org.mariotaku.twidere.util.CustomTabUtils;
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback;
|
||||
|
@ -95,6 +94,7 @@ import org.mariotaku.twidere.util.MultiSelectEventHandler;
|
|||
import org.mariotaku.twidere.util.ParseUtils;
|
||||
import org.mariotaku.twidere.util.ReadStateManager;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.TwidereColorUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.util.ViewUtils;
|
||||
import org.mariotaku.twidere.util.accessor.ActivityAccessor;
|
||||
|
@ -146,7 +146,6 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
|||
|
||||
private MultiSelectEventHandler mMultiSelectHandler;
|
||||
private ReadStateManager mReadStateManager;
|
||||
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
|
||||
|
||||
private SupportTabsAdapter mPagerAdapter;
|
||||
|
||||
|
@ -262,9 +261,9 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutSingle(keyCode, event)) return true;
|
||||
String action = mKeyboardShortcutsHandler.getKeyAction("home", keyCode, event);
|
||||
public boolean handleKeyboardShortcutSingle(KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutSingle(handler, keyCode, event)) return true;
|
||||
String action = handler.getKeyAction("home", keyCode, event);
|
||||
if (action != null) {
|
||||
switch (action) {
|
||||
case "home.accounts_dashboard": {
|
||||
|
@ -278,7 +277,7 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
|||
}
|
||||
}
|
||||
}
|
||||
action = mKeyboardShortcutsHandler.getKeyAction("navigation", keyCode, event);
|
||||
action = handler.getKeyAction("navigation", keyCode, event);
|
||||
if (action != null) {
|
||||
switch (action) {
|
||||
case "navigation.previous_tab": {
|
||||
|
@ -311,7 +310,7 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
|||
}
|
||||
}
|
||||
}
|
||||
return mKeyboardShortcutsHandler.handleKey(this, null, keyCode, event);
|
||||
return handler.handleKey(this, null, keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -327,9 +326,9 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutRepeat(keyCode, repeatCount, event)) return true;
|
||||
return super.handleKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
public boolean handleKeyboardShortcutRepeat(KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutRepeat(handler, keyCode, repeatCount, event)) return true;
|
||||
return super.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -353,7 +352,6 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
|||
mReadStateManager = app.getReadStateManager();
|
||||
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
mMultiSelectHandler = new MultiSelectEventHandler(this);
|
||||
mKeyboardShortcutsHandler = app.getKeyboardShortcutsHandler();
|
||||
mMultiSelectHandler.dispatchOnCreate();
|
||||
final long[] accountIds = getAccountIds(this);
|
||||
if (accountIds.length == 0) {
|
||||
|
@ -689,18 +687,21 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
|||
return mTabIndicator.getHeight() - mTabIndicator.getStripHeight();
|
||||
}
|
||||
|
||||
private boolean handleFragmentKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
private boolean handleFragmentKeyboardShortcutRepeat(final KeyboardShortcutsHandler handler,
|
||||
final int keyCode, final int repeatCount,
|
||||
@NonNull final KeyEvent event) {
|
||||
final Fragment fragment = getKeyboardShortcutRecipient();
|
||||
if (fragment instanceof KeyboardShortcutCallback) {
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean handleFragmentKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
private boolean handleFragmentKeyboardShortcutSingle(final KeyboardShortcutsHandler handler,
|
||||
final int keyCode, @NonNull final KeyEvent event) {
|
||||
final Fragment fragment = getKeyboardShortcutRecipient();
|
||||
if (fragment instanceof KeyboardShortcutCallback) {
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutSingle(keyCode, event);
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutSingle(handler, keyCode, event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ import android.view.WindowManager.LayoutParams;
|
|||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.iface.IControlBarActivity;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.fragment.iface.IBaseFragment;
|
||||
import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCallback;
|
||||
import org.mariotaku.twidere.fragment.iface.SupportFragmentCallback;
|
||||
|
@ -68,7 +67,6 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
|
|||
private ControlBarShowHideHelper mControlBarShowHideHelper = new ControlBarShowHideHelper(this);
|
||||
|
||||
private MultiSelectEventHandler mMultiSelectHandler;
|
||||
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
|
||||
|
||||
private TintedStatusFrameLayout mMainContent;
|
||||
|
||||
|
@ -115,15 +113,15 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutSingle(keyCode, event)) return true;
|
||||
return mKeyboardShortcutsHandler.handleKey(this, null, keyCode, event);
|
||||
public boolean handleKeyboardShortcutSingle(KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutSingle(handler, keyCode, event)) return true;
|
||||
return handler.handleKey(this, null, keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutRepeat(keyCode, repeatCount, event)) return true;
|
||||
return super.handleKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
public boolean handleKeyboardShortcutRepeat(KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutRepeat(handler, keyCode, repeatCount, event)) return true;
|
||||
return super.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +133,6 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
|
|||
final int linkId = matchLinkId(data);
|
||||
requestWindowFeatures(getWindow(), linkId, data);
|
||||
super.onCreate(savedInstanceState);
|
||||
mKeyboardShortcutsHandler = TwidereApplication.getInstance(this).getKeyboardShortcutsHandler();
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
@ -209,18 +206,21 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
|
|||
return !(getCurrentVisibleFragment() instanceof UserFragment);
|
||||
}
|
||||
|
||||
private boolean handleFragmentKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
private boolean handleFragmentKeyboardShortcutRepeat(KeyboardShortcutsHandler handler, int keyCode,
|
||||
int repeatCount, @NonNull KeyEvent event) {
|
||||
final Fragment fragment = getCurrentVisibleFragment();
|
||||
if (fragment instanceof KeyboardShortcutCallback) {
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutRepeat(handler, keyCode,
|
||||
repeatCount, event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean handleFragmentKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
private boolean handleFragmentKeyboardShortcutSingle(KeyboardShortcutsHandler handler, int keyCode,
|
||||
@NonNull KeyEvent event) {
|
||||
final Fragment fragment = getCurrentVisibleFragment();
|
||||
if (fragment instanceof KeyboardShortcutCallback) {
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutSingle(keyCode, event);
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutSingle(handler, keyCode, event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,17 +27,26 @@ import android.text.SpannableStringBuilder;
|
|||
import android.text.Spanned;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback;
|
||||
import org.mariotaku.twidere.util.StrictModeUtils;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle;
|
||||
|
||||
public abstract class ThemedFragmentActivity extends FragmentActivity implements Constants, IThemedActivity {
|
||||
public abstract class ThemedFragmentActivity extends FragmentActivity implements Constants,
|
||||
IThemedActivity, KeyboardShortcutCallback {
|
||||
|
||||
// Utility classes
|
||||
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
|
||||
|
||||
// Data fields
|
||||
private int mCurrentThemeResource, mCurrentThemeColor, mCurrentThemeBackgroundAlpha;
|
||||
@ShapeStyle
|
||||
private int mProfileImageStyle;
|
||||
|
@ -96,6 +105,7 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
|
|||
}
|
||||
setTheme();
|
||||
super.onCreate(savedInstanceState);
|
||||
mKeyboardShortcutsHandler = TwidereApplication.getInstance(this).getKeyboardShortcutsHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,4 +136,27 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
|
|||
setTheme(mCurrentThemeResource);
|
||||
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource, mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(@NonNull KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
|
||||
if (handleKeyboardShortcutSingle(mKeyboardShortcutsHandler, keyCode, event)) return true;
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (handleKeyboardShortcutRepeat(mKeyboardShortcutsHandler, keyCode, event.getRepeatCount(), event))
|
||||
return true;
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ public class KeyboardShortcutsFragment extends BasePreferenceFragment {
|
|||
navigation.addPreference(makePreferences("navigation", "navigation.previous_tab"));
|
||||
navigation.addPreference(makePreferences("navigation", "navigation.next_tab"));
|
||||
navigation.addPreference(makePreferences("navigation", "navigation.refresh"));
|
||||
navigation.addPreference(makePreferences("navigation", "navigation.back"));
|
||||
final PreferenceCategory statuses = makeAndAddCategory(getString(R.string.statuses));
|
||||
statuses.addPreference(makePreferences("status", "status.reply"));
|
||||
statuses.addPreference(makePreferences("status", "status.retweet"));
|
||||
|
|
|
@ -57,7 +57,6 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentListFragment<A
|
|||
private SharedPreferences mPreferences;
|
||||
private PopupMenu mPopupMenu;
|
||||
private ReadStateManager mReadStateManager;
|
||||
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
|
||||
private RecyclerViewNavigationHelper mRecyclerViewNavigationHelper;
|
||||
|
||||
private ParcelableStatus mSelectedStatus;
|
||||
|
@ -89,9 +88,9 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentListFragment<A
|
|||
public abstract int getStatuses(long[] accountIds, long[] maxIds, long[] sinceIds);
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
public boolean handleKeyboardShortcutSingle(KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
if (!KeyboardShortcutsHandler.isValidForHotkey(keyCode, event)) return false;
|
||||
String action = mKeyboardShortcutsHandler.getKeyAction("navigation", keyCode, event);
|
||||
String action = handler.getKeyAction("navigation", keyCode, event);
|
||||
if ("navigation.refresh".equals(action)) {
|
||||
triggerRefresh();
|
||||
return true;
|
||||
|
@ -109,7 +108,7 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentListFragment<A
|
|||
final ParcelableStatus status = getAdapter().getStatus(position);
|
||||
if (status == null) return false;
|
||||
if (action == null) {
|
||||
action = mKeyboardShortcutsHandler.getKeyAction("status", keyCode, event);
|
||||
action = handler.getKeyAction("status", keyCode, event);
|
||||
}
|
||||
if (action == null) return false;
|
||||
switch (action) {
|
||||
|
@ -137,9 +136,9 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentListFragment<A
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(final int keyCode, final int repeatCount,
|
||||
public boolean handleKeyboardShortcutRepeat(KeyboardShortcutsHandler handler, final int keyCode, final int repeatCount,
|
||||
@NonNull final KeyEvent event) {
|
||||
return mRecyclerViewNavigationHelper.handleKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
return mRecyclerViewNavigationHelper.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -351,9 +350,8 @@ public abstract class AbsStatusesFragment<Data> extends AbsContentListFragment<A
|
|||
final RecyclerView recyclerView = getRecyclerView();
|
||||
final LinearLayoutManager layoutManager = getLayoutManager();
|
||||
final ContentListScrollListener scrollListener = getScrollListener();
|
||||
mKeyboardShortcutsHandler = application.getKeyboardShortcutsHandler();
|
||||
mRecyclerViewNavigationHelper = new RecyclerViewNavigationHelper(mKeyboardShortcutsHandler,
|
||||
recyclerView, layoutManager, adapter);
|
||||
mRecyclerViewNavigationHelper = new RecyclerViewNavigationHelper(recyclerView, layoutManager,
|
||||
adapter);
|
||||
|
||||
adapter.setListener(this);
|
||||
scrollListener.setOnScrollListener(new OnScrollListener() {
|
||||
|
|
|
@ -46,7 +46,6 @@ import org.mariotaku.twidere.view.holder.UserViewHolder;
|
|||
abstract class AbsUsersFragment<Data> extends AbsContentListFragment<AbsUsersAdapter<Data>>
|
||||
implements LoaderCallbacks<Data>, UserAdapterListener, KeyboardShortcutCallback {
|
||||
|
||||
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
|
||||
private RecyclerViewNavigationHelper mRecyclerViewNavigationHelper;
|
||||
|
||||
public final Data getData() {
|
||||
|
@ -54,13 +53,13 @@ abstract class AbsUsersFragment<Data> extends AbsContentListFragment<AbsUsersAda
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
public boolean handleKeyboardShortcutSingle(KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
return mRecyclerViewNavigationHelper.handleKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
public boolean handleKeyboardShortcutRepeat(KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
return mRecyclerViewNavigationHelper.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,13 +68,12 @@ abstract class AbsUsersFragment<Data> extends AbsContentListFragment<AbsUsersAda
|
|||
|
||||
final FragmentActivity activity = getActivity();
|
||||
final TwidereApplication application = TwidereApplication.getInstance(activity);
|
||||
mKeyboardShortcutsHandler = application.getKeyboardShortcutsHandler();
|
||||
final AbsUsersAdapter<Data> adapter = getAdapter();
|
||||
final RecyclerView recyclerView = getRecyclerView();
|
||||
final LinearLayoutManager layoutManager = getLayoutManager();
|
||||
adapter.setListener(this);
|
||||
|
||||
mRecyclerViewNavigationHelper = new RecyclerViewNavigationHelper(mKeyboardShortcutsHandler, recyclerView, layoutManager, adapter);
|
||||
mRecyclerViewNavigationHelper = new RecyclerViewNavigationHelper(recyclerView, layoutManager, adapter);
|
||||
final Bundle loaderArgs = new Bundle(getArguments());
|
||||
loaderArgs.putBoolean(EXTRA_FROM_USER, true);
|
||||
getLoaderManager().initLoader(0, loaderArgs, this);
|
||||
|
|
|
@ -144,7 +144,6 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
|||
private Context mThemedContext;
|
||||
private MediaLoaderWrapper mImageLoader;
|
||||
private SupportAccountActionProvider mAccountActionProvider;
|
||||
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
|
||||
|
||||
private boolean mSwitchAccountAnimationPlaying;
|
||||
|
||||
|
@ -156,13 +155,16 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
public boolean handleKeyboardShortcutSingle(@NonNull final KeyboardShortcutsHandler handler,
|
||||
final int keyCode, @NonNull final KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
final String action = mKeyboardShortcutsHandler.getKeyAction("navigation", keyCode, event);
|
||||
public boolean handleKeyboardShortcutRepeat(@NonNull final KeyboardShortcutsHandler handler,
|
||||
final int keyCode, final int repeatCount,
|
||||
@NonNull final KeyEvent event) {
|
||||
final String action = handler.getKeyAction("navigation", keyCode, event);
|
||||
if (action == null) return false;
|
||||
final int offset;
|
||||
switch (action) {
|
||||
|
@ -403,7 +405,6 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
|||
final Context context = view.getContext();
|
||||
final TwidereApplication application = TwidereApplication.getInstance(context);
|
||||
mImageLoader = application.getMediaLoaderWrapper();
|
||||
mKeyboardShortcutsHandler = application.getKeyboardShortcutsHandler();
|
||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||
final ListView listView = getListView();
|
||||
listView.setItemsCanFocus(true);
|
||||
|
|
|
@ -105,7 +105,6 @@ public class DirectMessagesFragment extends BaseSupportFragment implements Loade
|
|||
private SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
private View mProgressContainer;
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
|
||||
private RecyclerViewNavigationHelper mRecyclerViewNavigationHelper;
|
||||
private Rect mSystemWindowsInsets = new Rect();
|
||||
private int mControlBarOffsetPixels;
|
||||
|
@ -144,13 +143,16 @@ public class DirectMessagesFragment extends BaseSupportFragment implements Loade
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
public boolean handleKeyboardShortcutSingle(@NonNull final KeyboardShortcutsHandler handler,
|
||||
final int keyCode, @NonNull final KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
return mRecyclerViewNavigationHelper.handleKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
public boolean handleKeyboardShortcutRepeat(@NonNull final KeyboardShortcutsHandler handler,
|
||||
final int keyCode, final int repeatCount,
|
||||
@NonNull final KeyEvent event) {
|
||||
return mRecyclerViewNavigationHelper.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -172,7 +174,6 @@ public class DirectMessagesFragment extends BaseSupportFragment implements Loade
|
|||
final View view = getView();
|
||||
if (view == null) throw new AssertionError();
|
||||
final TwidereApplication application = TwidereApplication.getInstance(getActivity());
|
||||
mKeyboardShortcutsHandler = application.getKeyboardShortcutsHandler();
|
||||
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
final Context viewContext = view.getContext();
|
||||
mMultiSelectManager = getMultiSelectManager();
|
||||
|
@ -184,11 +185,12 @@ public class DirectMessagesFragment extends BaseSupportFragment implements Loade
|
|||
mSwipeRefreshLayout.setColorSchemeColors(ThemeUtils.getUserAccentColor(viewContext));
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mRecyclerViewNavigationHelper = new RecyclerViewNavigationHelper(mKeyboardShortcutsHandler, mRecyclerView, mLayoutManager, mAdapter);
|
||||
mRecyclerViewNavigationHelper = new RecyclerViewNavigationHelper(mRecyclerView, mLayoutManager, mAdapter);
|
||||
|
||||
final ContentListScrollListener scrollListener = new ContentListScrollListener(this);
|
||||
scrollListener.setTouchSlop(ViewConfiguration.get(viewContext).getScaledTouchSlop());
|
||||
mRecyclerView.setOnScrollListener(scrollListener);
|
||||
// TODO remove scroll listener
|
||||
mRecyclerView.addOnScrollListener(scrollListener);
|
||||
|
||||
final DividerItemDecoration itemDecoration = new DividerItemDecoration(viewContext, mLayoutManager.getOrientation());
|
||||
final Resources res = viewContext.getResources();
|
||||
|
|
|
@ -70,8 +70,6 @@ public class SearchFragment extends BaseSupportFragment implements RefreshScroll
|
|||
private SupportTabsAdapter mPagerAdapter;
|
||||
private TabPagerIndicator mPagerIndicator;
|
||||
|
||||
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
|
||||
|
||||
private int mControlBarOffsetPixels;
|
||||
private int mControlBarHeight;
|
||||
|
||||
|
@ -108,9 +106,9 @@ public class SearchFragment extends BaseSupportFragment implements RefreshScroll
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutSingle(keyCode, event)) return true;
|
||||
final String action = mKeyboardShortcutsHandler.getKeyAction("navigation", keyCode, event);
|
||||
public boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutSingle(handler, keyCode, event)) return true;
|
||||
final String action = handler.getKeyAction("navigation", keyCode, event);
|
||||
if (action != null) {
|
||||
switch (action) {
|
||||
case "navigation.previous_tab": {
|
||||
|
@ -129,12 +127,12 @@ public class SearchFragment extends BaseSupportFragment implements RefreshScroll
|
|||
}
|
||||
}
|
||||
}
|
||||
return mKeyboardShortcutsHandler.handleKey(getActivity(), null, keyCode, event);
|
||||
return handler.handleKey(getActivity(), null, keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
return handleFragmentKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
public boolean handleKeyboardShortcutRepeat(@NonNull KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
return handleFragmentKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
|
||||
public void hideIndicator() {
|
||||
|
@ -160,7 +158,6 @@ public class SearchFragment extends BaseSupportFragment implements RefreshScroll
|
|||
final Bundle args = getArguments();
|
||||
final FragmentActivity activity = getActivity();
|
||||
final TwidereApplication app = TwidereApplication.getInstance(activity);
|
||||
mKeyboardShortcutsHandler = app.getKeyboardShortcutsHandler();
|
||||
mPagerAdapter = new SupportTabsAdapter(activity, getChildFragmentManager(), null, 1);
|
||||
mPagerAdapter.addTab(StatusesSearchFragment.class, args, getString(R.string.statuses), R.drawable.ic_action_twitter, 0, null);
|
||||
mPagerAdapter.addTab(SearchUsersFragment.class, args, getString(R.string.users), R.drawable.ic_action_user, 1, null);
|
||||
|
@ -311,18 +308,18 @@ public class SearchFragment extends BaseSupportFragment implements RefreshScroll
|
|||
return getCurrentVisibleFragment();
|
||||
}
|
||||
|
||||
private boolean handleFragmentKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
private boolean handleFragmentKeyboardShortcutRepeat(KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
final Fragment fragment = getKeyboardShortcutRecipient();
|
||||
if (fragment instanceof KeyboardShortcutCallback) {
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean handleFragmentKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
private boolean handleFragmentKeyboardShortcutSingle(KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
final Fragment fragment = getKeyboardShortcutRecipient();
|
||||
if (fragment instanceof KeyboardShortcutCallback) {
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutSingle(keyCode, event);
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutSingle(handler, keyCode, event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -151,27 +151,33 @@ import static org.mariotaku.twidere.util.Utils.showErrorMessage;
|
|||
public class StatusFragment extends BaseSupportFragment implements LoaderCallbacks<SingleResponse<ParcelableStatus>>,
|
||||
OnMediaClickListener, StatusAdapterListener, KeyboardShortcutCallback {
|
||||
|
||||
// Constants
|
||||
private static final int LOADER_ID_DETAIL_STATUS = 1;
|
||||
private static final int LOADER_ID_STATUS_REPLIES = 2;
|
||||
private static final int STATE_LOADED = 1;
|
||||
private static final int STATE_LOADING = 2;
|
||||
private static final int STATE_ERROR = 3;
|
||||
|
||||
// Views
|
||||
private View mStatusContent;
|
||||
private View mProgressContainer;
|
||||
private View mErrorContainer;
|
||||
private RecyclerView mRecyclerView;
|
||||
|
||||
private DividerItemDecoration mItemDecoration;
|
||||
private RecyclerView mRecyclerView;
|
||||
private PopupMenu mPopupMenu;
|
||||
|
||||
private StatusAdapter mStatusAdapter;
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
|
||||
private LoadConversationTask mLoadConversationTask;
|
||||
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
|
||||
private RecyclerViewNavigationHelper mRecyclerViewNavigationHelper;
|
||||
|
||||
// Data fields
|
||||
private boolean mRepliesLoaderInitialized;
|
||||
private ParcelableStatus mSelectedStatus;
|
||||
|
||||
// Listeners
|
||||
private LoaderCallbacks<List<ParcelableStatus>> mRepliesLoaderCallback = new LoaderCallbacks<List<ParcelableStatus>>() {
|
||||
@Override
|
||||
public Loader<List<ParcelableStatus>> onCreateLoader(int id, Bundle args) {
|
||||
|
@ -200,8 +206,6 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
|
||||
}
|
||||
};
|
||||
private PopupMenu mPopupMenu;
|
||||
private ParcelableStatus mSelectedStatus;
|
||||
private OnMenuItemClickListener mOnStatusMenuItemClickListener = new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
@ -277,9 +281,8 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
|
||||
final FragmentActivity activity = getActivity();
|
||||
final TwidereApplication application = TwidereApplication.getInstance(activity);
|
||||
mKeyboardShortcutsHandler = application.getKeyboardShortcutsHandler();
|
||||
mRecyclerViewNavigationHelper = new RecyclerViewNavigationHelper(mKeyboardShortcutsHandler,
|
||||
mRecyclerView, mLayoutManager, mStatusAdapter);
|
||||
mRecyclerViewNavigationHelper = new RecyclerViewNavigationHelper(mRecyclerView, mLayoutManager,
|
||||
mStatusAdapter);
|
||||
|
||||
setState(STATE_LOADING);
|
||||
|
||||
|
@ -412,7 +415,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
public boolean handleKeyboardShortcutSingle(KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
if (!KeyboardShortcutsHandler.isValidForHotkey(keyCode, event)) return false;
|
||||
final View focusedChild = RecyclerViewUtils.findRecyclerViewChild(mRecyclerView, mLayoutManager.getFocusedChild());
|
||||
final int position;
|
||||
|
@ -424,7 +427,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
if (position == -1) return false;
|
||||
final ParcelableStatus status = getAdapter().getStatus(position);
|
||||
if (status == null) return false;
|
||||
String action = mKeyboardShortcutsHandler.getKeyAction("status", keyCode, event);
|
||||
String action = handler.getKeyAction("status", keyCode, event);
|
||||
if (action == null) return false;
|
||||
switch (action) {
|
||||
case "status.reply": {
|
||||
|
@ -451,9 +454,11 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(final int keyCode, final int repeatCount,
|
||||
public boolean handleKeyboardShortcutRepeat(@NonNull final KeyboardShortcutsHandler handler,
|
||||
final int keyCode, final int repeatCount,
|
||||
@NonNull final KeyEvent event) {
|
||||
return mRecyclerViewNavigationHelper.handleKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
return mRecyclerViewNavigationHelper.handleKeyboardShortcutRepeat(handler, keyCode,
|
||||
repeatCount, event);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -109,7 +109,6 @@ import org.mariotaku.twidere.model.SupportTabSpec;
|
|||
import org.mariotaku.twidere.provider.TwidereDataStore.CachedUsers;
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.Filters;
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
import org.mariotaku.twidere.util.TwidereColorUtils;
|
||||
import org.mariotaku.twidere.util.ContentValuesCreator;
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback;
|
||||
|
@ -119,6 +118,7 @@ import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
|||
import org.mariotaku.twidere.util.MenuUtils;
|
||||
import org.mariotaku.twidere.util.ParseUtils;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.TwidereColorUtils;
|
||||
import org.mariotaku.twidere.util.TwidereLinkify;
|
||||
import org.mariotaku.twidere.util.TwidereLinkify.OnLinkClickListener;
|
||||
import org.mariotaku.twidere.util.UserColorNameUtils;
|
||||
|
@ -195,7 +195,6 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
|
||||
private MediaLoaderWrapper mProfileImageLoader;
|
||||
private SupportTabsAdapter mPagerAdapter;
|
||||
private KeyboardShortcutsHandler mKeyboardShortcutsHandler;
|
||||
|
||||
private ParcelableUser mUser;
|
||||
private Relationship mRelationship;
|
||||
|
@ -683,7 +682,6 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
mActionBarShadowColor = 0xA0000000;
|
||||
final TwidereApplication app = TwidereApplication.getInstance(activity);
|
||||
mProfileImageLoader = app.getMediaLoaderWrapper();
|
||||
mKeyboardShortcutsHandler = app.getKeyboardShortcutsHandler();
|
||||
final Bundle args = getArguments();
|
||||
long accountId = -1, userId = -1;
|
||||
String screenName = null;
|
||||
|
@ -1070,9 +1068,9 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutSingle(keyCode, event)) return true;
|
||||
final String action = mKeyboardShortcutsHandler.getKeyAction("navigation", keyCode, event);
|
||||
public boolean handleKeyboardShortcutSingle(KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
if (handleFragmentKeyboardShortcutSingle(handler, keyCode, event)) return true;
|
||||
final String action = handler.getKeyAction("navigation", keyCode, event);
|
||||
if (action != null) {
|
||||
switch (action) {
|
||||
case "navigation.previous_tab": {
|
||||
|
@ -1091,26 +1089,28 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
}
|
||||
}
|
||||
}
|
||||
return mKeyboardShortcutsHandler.handleKey(getActivity(), null, keyCode, event);
|
||||
return handler.handleKey(getActivity(), null, keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
return handleFragmentKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
public boolean handleKeyboardShortcutRepeat(@NonNull final KeyboardShortcutsHandler handler,
|
||||
final int keyCode, final int repeatCount,
|
||||
@NonNull final KeyEvent event) {
|
||||
return handleFragmentKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
|
||||
private boolean handleFragmentKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
private boolean handleFragmentKeyboardShortcutRepeat(@NonNull KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
final Fragment fragment = getKeyboardShortcutRecipient();
|
||||
if (fragment instanceof KeyboardShortcutCallback) {
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutRepeat(keyCode, repeatCount, event);
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean handleFragmentKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event) {
|
||||
private boolean handleFragmentKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
|
||||
final Fragment fragment = getKeyboardShortcutRecipient();
|
||||
if (fragment instanceof KeyboardShortcutCallback) {
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutSingle(keyCode, event);
|
||||
return ((KeyboardShortcutCallback) fragment).handleKeyboardShortcutSingle(handler, keyCode, event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public class KeyboardShortcutsHandler implements Constants {
|
|||
sActionLabelMap.put("navigation.refresh", R.string.refresh);
|
||||
sActionLabelMap.put("navigation.previous_tab", R.string.previous_tab);
|
||||
sActionLabelMap.put("navigation.next_tab", R.string.next_tab);
|
||||
sActionLabelMap.put("navigation.back", R.string.keyboard_shortcut_back);
|
||||
|
||||
sMetaNameMap.put(KeyEvent.META_FUNCTION_ON, "fn");
|
||||
sMetaNameMap.put(KeyEvent.META_META_ON, "meta");
|
||||
|
@ -250,9 +251,9 @@ public class KeyboardShortcutsHandler implements Constants {
|
|||
}
|
||||
|
||||
public static interface KeyboardShortcutCallback {
|
||||
boolean handleKeyboardShortcutSingle(int keyCode, @NonNull KeyEvent event);
|
||||
boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event);
|
||||
|
||||
boolean handleKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event);
|
||||
boolean handleKeyboardShortcutRepeat(@NonNull KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -331,6 +332,8 @@ public class KeyboardShortcutsHandler implements Constants {
|
|||
final String upperName = keyName.toUpperCase(Locale.US);
|
||||
final int keyCode = KeyEvent.keyCodeFromString(KEYCODE_STRING_PREFIX + upperName);
|
||||
if (keyCode == KeyEvent.KEYCODE_UNKNOWN) return upperName;
|
||||
if (keyCode == KeyEvent.KEYCODE_DEL) return "Backspace";
|
||||
if (keyCode == KeyEvent.KEYCODE_FORWARD_DEL) return "Delete";
|
||||
return String.valueOf(new KeyEvent(KeyEvent.ACTION_DOWN, keyCode).getDisplayLabel());
|
||||
}
|
||||
|
||||
|
|
|
@ -33,20 +33,24 @@ import android.view.View;
|
|||
public class RecyclerViewNavigationHelper {
|
||||
|
||||
private int positionBackup;
|
||||
private final KeyboardShortcutsHandler handler;
|
||||
@NonNull
|
||||
private final RecyclerView view;
|
||||
@NonNull
|
||||
private final LinearLayoutManager manager;
|
||||
@NonNull
|
||||
private final Adapter<ViewHolder> adapter;
|
||||
|
||||
public RecyclerViewNavigationHelper(KeyboardShortcutsHandler handler, RecyclerView view,
|
||||
LinearLayoutManager manager, Adapter<ViewHolder> adapter) {
|
||||
this.handler = handler;
|
||||
public RecyclerViewNavigationHelper(@NonNull final RecyclerView view,
|
||||
@NonNull final LinearLayoutManager manager,
|
||||
@NonNull final Adapter<ViewHolder> adapter) {
|
||||
this.view = view;
|
||||
this.manager = manager;
|
||||
this.adapter = adapter;
|
||||
}
|
||||
|
||||
public boolean handleKeyboardShortcutRepeat(int keyCode, int repeatCount, @NonNull KeyEvent event) {
|
||||
public boolean handleKeyboardShortcutRepeat(@NonNull final KeyboardShortcutsHandler handler,
|
||||
final int keyCode, final int repeatCount,
|
||||
@NonNull final KeyEvent event) {
|
||||
final String action = handler.getKeyAction("navigation", keyCode, event);
|
||||
if (action == null) return false;
|
||||
final int direction;
|
||||
|
|
|
@ -56,7 +56,6 @@ public class RecyclerViewUtils {
|
|||
final View viewToFocus;
|
||||
if (firstVisibleView != null) {
|
||||
viewToFocus = firstVisibleView;
|
||||
firstVisibleView.requestFocus();
|
||||
} else if (view != null) {
|
||||
viewToFocus = findRecyclerViewChild(recyclerView, view);
|
||||
} else {
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="false"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="false">
|
||||
|
||||
<ProgressBar
|
||||
style="?android:progressBarStyle"
|
||||
|
|
|
@ -20,28 +20,4 @@
|
|||
|
||||
<resources>
|
||||
|
||||
<!--<style name="Widget.Base" parent="android:Widget.Material"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.ActionButton.Overflow" parent="android:Widget.Material.ActionButton.Overflow"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.ActionButton" parent="android:Widget.Material.ActionButton"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light.ActionButton.Overflow" parent="android:Widget.Material.Light.ActionButton.Overflow"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light.ActionButton" parent="android:Widget.Material.Light.ActionButton"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light" parent="android:Widget.Material.Light"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light.ImageButton" parent="android:Widget.Material.Light.ImageButton"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.ImageButton" parent="android:Widget.Material.ImageButton"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.ActionBar" parent="android:Widget.Material.ActionBar"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.ActionBar.Solid" parent="android:Widget.Material.ActionBar.Solid"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light.ActionBar.Solid" parent="android:Widget.Material.Light.ActionBar.Solid"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light.ActionBar.Solid.Inverse" parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse"/>-->
|
||||
|
||||
</resources>
|
|
@ -22,14 +22,10 @@
|
|||
|
||||
<style name="Theme.Base" parent="android:Theme.Material"/>
|
||||
|
||||
<style name="Theme.Base.NoActionBar" parent="android:Theme.Material.NoActionBar"/>
|
||||
|
||||
<style name="Theme.Base.Dialog" parent="android:Theme.Material.Dialog"/>
|
||||
|
||||
<style name="Theme.Base.Light" parent="android:Theme.Material.Light"/>
|
||||
|
||||
<style name="Theme.Base.Light.DarkActionBar" parent="android:Theme.Material.Light.DarkActionBar"/>
|
||||
|
||||
<style name="Theme.Base.Light.Dialog" parent="android:Theme.Material.Light.Dialog"/>
|
||||
|
||||
</resources>
|
|
@ -734,4 +734,6 @@
|
|||
<string name="open_accounts_dashboard">Open accounts dashboard</string>
|
||||
<string name="previous_tab">Previous tab</string>
|
||||
<string name="next_tab">Next tab</string>
|
||||
<string name="keyboard_shortcut_back">Back</string>
|
||||
<string name="press_again_to_close">Press again to close</string>
|
||||
</resources>
|
|
@ -1,67 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Widget.Twidere.ActionBar.Colored" parent="Widget.Base.Light.ActionBar.Solid">
|
||||
<!--<item name="android:background">@drawable/ab_twidere_solid_color_holo</item>-->
|
||||
<!--<item name="android:background">@android:color/transparent</item>-->
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.ActionBar.Colored.Inverse" parent="Widget.Base.Light.ActionBar.Solid.Inverse">
|
||||
<!--<item name="android:background">@drawable/ab_twidere_solid_color_holo</item>-->
|
||||
<!--<item name="android:background">@android:color/transparent</item>-->
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.ActionBar.Dark" parent="Widget.Base.ActionBar.Solid">
|
||||
<!--<item name="android:background">@drawable/ab_twidere_solid_dark_holo</item>-->
|
||||
<!--<item name="android:background">@android:color/transparent</item>-->
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.ActionBar.Light" parent="Widget.Base.Light.ActionBar.Solid">
|
||||
<!--<item name="android:background">@drawable/ab_twidere_solid_light_holo</item>-->
|
||||
<!--<item name="android:background">@android:color/transparent</item>-->
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.ActionBar.Light.DarkActionBar" parent="Widget.Base.Light.ActionBar.Solid.Inverse">
|
||||
<!--<item name="android:background">@drawable/ab_twidere_solid_dark_holo</item>-->
|
||||
<!--<item name="android:background">@android:color/transparent</item>-->
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.Viewer.ActionBar" parent="Widget.AppCompat.ActionBar">
|
||||
<item name="background">@drawable/bg_viewer_actionbar</item>
|
||||
<item name="backgroundSplit">@drawable/bg_viewer_actionbar</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.ImageButton.Borderless" parent="Widget.Base.ImageButton">
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.Light.ImageButton.Borderless" parent="Widget.Base.Light.ImageButton">
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.SelectableView" parent="Widget.Base">
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.Light.SelectableView" parent="Widget.Base.Light">
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.ActionButton.Colored" parent="Widget.Base.Light.ActionButton">
|
||||
<item name="android:background">?android:actionBarItemBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.ActionButton.Overflow.Colored" parent="Widget.Base.Light.ActionButton.Overflow">
|
||||
<item name="android:background">?android:actionBarItemBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.ActionButton.Colored.DarkActionBar" parent="Widget.Base.ActionButton">
|
||||
<item name="android:background">?android:actionBarItemBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Twidere.ActionButton.Overflow.Colored.DarkActionBar" parent="Widget.Base.ActionButton.Overflow">
|
||||
<item name="android:background">?android:actionBarItemBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="Animation.Twidere.Activity" parent="android:Animation.Activity">
|
||||
<item name="android:activityOpenEnterAnimation">@anim/activity_open_enter</item>
|
||||
|
@ -70,40 +15,6 @@
|
|||
<item name="android:activityCloseExitAnimation">@anim/activity_close_exit</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.TabPageIndicator.TabItem.Content" parent="@android:style/Widget">
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:paddingLeft">8dp</item>
|
||||
<item name="android:paddingRight">8dp</item>
|
||||
<item name="android:paddingTop">6dp</item>
|
||||
<item name="android:paddingBottom">6dp</item>
|
||||
<item name="android:orientation">horizontal</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.TabPageIndicator.TabItem.TextView" parent="@android:style/Widget.DeviceDefault.TextView">
|
||||
<item name="android:textAppearance">@style/TextAppearance.TabPageIndicator</item>
|
||||
<item name="android:textColor">#fff3f3f3</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:paddingTop">4dp</item>
|
||||
<item name="android:paddingBottom">4dp</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.TabPageIndicator.TabItem.TextView.Dark">
|
||||
<item name="android:textColor">#fff3f3f3</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.TabPageIndicator.TabItem.TextView.Light">
|
||||
<item name="android:textColor">#ff000000</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.TabPageIndicator.TabItem.TextView.Light.DarkActionBar">
|
||||
<item name="android:textColor">#fff3f3f3</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.TabPageIndicator" parent="android:TextAppearance.Small"/>
|
||||
|
||||
<style name="Widget.CardActionButton" parent="Widget.Base.ImageButton">
|
||||
<item name="android:background">?android:selectableItemBackground</item>
|
||||
<item name="android:color">?android:textColorSecondary</item>
|
||||
|
|
|
@ -20,28 +20,4 @@
|
|||
|
||||
<resources>
|
||||
|
||||
<!--<style name="Widget.Base" parent="android:Widget.Holo"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.ActionButton.Overflow" parent="android:Widget.Holo.ActionButton.Overflow"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.ActionButton" parent="android:Widget.Holo.ActionButton"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light.ActionButton.Overflow" parent="android:Widget.Holo.Light.ActionButton.Overflow"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light.ActionButton" parent="android:Widget.Holo.Light.ActionButton"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light" parent="android:Widget.Holo.Light"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light.ImageButton" parent="android:Widget.Holo.Light.ImageButton"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.ImageButton" parent="android:Widget.Holo.ImageButton"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.ActionBar" parent="android:Widget.Holo.ActionBar"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.ActionBar.Solid" parent="android:Widget.Holo.ActionBar.Solid"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light.ActionBar.Solid" parent="android:Widget.Holo.Light.ActionBar.Solid"/>-->
|
||||
|
||||
<!--<style name="Widget.Base.Light.ActionBar.Solid.Inverse" parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse"/>-->
|
||||
|
||||
</resources>
|
|
@ -22,26 +22,12 @@
|
|||
|
||||
<style name="Widget.Base" parent="android:Widget.Holo"/>
|
||||
|
||||
<style name="Widget.Base.ActionButton.Overflow" parent="Widget.AppCompat.ActionButton.Overflow"/>
|
||||
|
||||
<style name="Widget.Base.ActionButton" parent="Widget.AppCompat.ActionButton"/>
|
||||
|
||||
<style name="Widget.Base.Light.ActionButton.Overflow" parent="Widget.AppCompat.Light.ActionButton.Overflow"/>
|
||||
|
||||
<style name="Widget.Base.Light.ActionButton" parent="Widget.AppCompat.Light.ActionButton"/>
|
||||
|
||||
<style name="Widget.Base.Light" parent="android:Widget.Holo.Light"/>
|
||||
|
||||
<style name="Widget.Base.Light.ImageButton" parent="android:Widget.Holo.Light.ImageButton"/>
|
||||
|
||||
<style name="Widget.Base.ImageButton" parent="android:Widget.Holo.ImageButton"/>
|
||||
|
||||
<style name="Widget.Base.ActionBar" parent="Widget.AppCompat.ActionBar"/>
|
||||
|
||||
<style name="Widget.Base.ActionBar.Solid" parent="Widget.AppCompat.ActionBar.Solid"/>
|
||||
|
||||
<style name="Widget.Base.Light.ActionBar.Solid" parent="Widget.AppCompat.Light.ActionBar.Solid"/>
|
||||
|
||||
<style name="Widget.Base.Light.ActionBar.Solid.Inverse" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse"/>
|
||||
|
||||
</resources>
|
|
@ -14,13 +14,6 @@
|
|||
<item name="android:windowBackground">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Blank.Translucent" parent="Theme.Compat.Base.NoActionBar">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<!--<item name="android:windowAnimationStyle">@style/Animation.Twidere.Activity</item>-->
|
||||
<item name="android:windowBackground">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Blank.Dialog" parent="Theme.Compat.Base.Dialog"/>
|
||||
|
||||
<style name="Theme.Twidere.Dark" parent="Theme.Compat.Base">
|
||||
|
@ -51,7 +44,7 @@
|
|||
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light" parent="Theme.Compat.Base.Light.DarkActionBar">
|
||||
<style name="Theme.Twidere.Light" parent="Theme.Compat.Base.Light">
|
||||
|
||||
<item name="windowActionBar">false</item>
|
||||
|
||||
|
@ -251,7 +244,7 @@
|
|||
<item name="android:windowBackground">@color/bg_color_drawer_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Dark.NoDisplay" parent="Theme.Compat.Base">
|
||||
<style name="Theme.Twidere.Dark.NoDisplay">
|
||||
<item name="android:windowBackground">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
|
@ -260,7 +253,7 @@
|
|||
<item name="android:windowNoDisplay">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.NoDisplay" parent="Theme.Compat.Base.Light">
|
||||
<style name="Theme.Twidere.Light.NoDisplay">
|
||||
<item name="android:windowBackground">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
|
|
|
@ -22,14 +22,10 @@
|
|||
|
||||
<style name="Theme.Base" parent="android:Theme.Holo"/>
|
||||
|
||||
<style name="Theme.Base.NoActionBar" parent="android:Theme.Holo.NoActionBar"/>
|
||||
|
||||
<style name="Theme.Base.Dialog" parent="android:Theme.Holo.Dialog"/>
|
||||
|
||||
<style name="Theme.Base.Light" parent="android:Theme.Holo.Light"/>
|
||||
|
||||
<style name="Theme.Base.Light.DarkActionBar" parent="android:Theme.Holo.Light.DarkActionBar"/>
|
||||
|
||||
<style name="Theme.Base.Light.Dialog" parent="android:Theme.Holo.Light.Dialog"/>
|
||||
|
||||
</resources>
|
|
@ -36,7 +36,6 @@
|
|||
</style>
|
||||
|
||||
<style name="Theme.Compat.Base.Dialog" parent="Theme.AppCompat.Dialog">
|
||||
|
||||
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_dark</item>
|
||||
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_light</item>
|
||||
</style>
|
||||
|
@ -51,11 +50,6 @@
|
|||
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Compat.Base.Light.DarkActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item>
|
||||
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Compat.Base.Light.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:textColorTertiary">@color/tertiary_text_mtrl_light</item>
|
||||
<item name="android:textColorTertiaryInverse">@color/tertiary_text_mtrl_dark</item>
|
||||
|
|
Loading…
Reference in New Issue