ui fixes
optimized resources to make app small
@ -28,7 +28,7 @@ package org.mariotaku.twidere;
|
||||
public interface Constants extends TwidereConstants {
|
||||
|
||||
public static final String DATABASES_NAME = "twidere.sqlite";
|
||||
public static final int DATABASES_VERSION = 86;
|
||||
public static final int DATABASES_VERSION = 87;
|
||||
|
||||
public static final int MENU_GROUP_STATUS_EXTENSION = 10;
|
||||
public static final int MENU_GROUP_COMPOSE_EXTENSION = 11;
|
||||
|
@ -11,6 +11,7 @@ import android.view.MenuItem;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.fragment.iface.IBaseFragment;
|
||||
import org.mariotaku.twidere.fragment.support.AccountsManagerFragment;
|
||||
import org.mariotaku.twidere.view.TintedStatusFrameLayout;
|
||||
|
||||
/**
|
||||
* Accounts manager
|
||||
@ -18,6 +19,8 @@ import org.mariotaku.twidere.fragment.support.AccountsManagerFragment;
|
||||
*/
|
||||
public class AccountsManagerActivity extends BaseActionBarActivity {
|
||||
|
||||
private TintedStatusFrameLayout mMainContent;
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
@ -29,6 +32,12 @@ public class AccountsManagerActivity extends BaseActionBarActivity {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -37,6 +46,7 @@ public class AccountsManagerActivity extends BaseActionBarActivity {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
setContentView(R.layout.activity_content_fragment);
|
||||
mMainContent.setOnFitSystemWindowsListener(this);
|
||||
final FragmentManager fm = getSupportFragmentManager();
|
||||
final FragmentTransaction ft = fm.beginTransaction();
|
||||
ft.replace(R.id.main_content, new AccountsManagerFragment());
|
||||
@ -44,8 +54,8 @@ public class AccountsManagerActivity extends BaseActionBarActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fitSystemWindows(Rect insets) {
|
||||
super.fitSystemWindows(insets);
|
||||
public void onFitSystemWindows(Rect insets) {
|
||||
super.onFitSystemWindows(insets);
|
||||
final FragmentManager fm = getSupportFragmentManager();
|
||||
final Fragment f = fm.findFragmentById(R.id.main_content);
|
||||
if (f instanceof IBaseFragment) {
|
||||
|
@ -34,13 +34,13 @@ import org.mariotaku.twidere.fragment.iface.IBasePullToRefreshFragment;
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
import org.mariotaku.twidere.util.MessagesManager;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.view.MainFrameLayout.FitSystemWindowsCallback;
|
||||
import org.mariotaku.twidere.view.iface.IExtendedView.OnFitSystemWindowsListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@SuppressLint("Registered")
|
||||
public class BaseActionBarActivity extends ThemedActionBarActivity implements Constants,
|
||||
FitSystemWindowsCallback, SystemWindowsInsetsCallback, IControlBarActivity {
|
||||
OnFitSystemWindowsListener, SystemWindowsInsetsCallback, IControlBarActivity {
|
||||
|
||||
private boolean mInstanceStateSaved, mIsVisible, mIsOnTop;
|
||||
|
||||
@ -159,7 +159,7 @@ public class BaseActionBarActivity extends ThemedActionBarActivity implements Co
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fitSystemWindows(Rect insets) {
|
||||
public void onFitSystemWindows(Rect insets) {
|
||||
mSystemWindowsInsets = new Rect(insets);
|
||||
}
|
||||
|
||||
|
@ -344,6 +344,7 @@ public class HomeActivity extends BaseActionBarActivity implements OnClickListen
|
||||
mTabDisplayOption = getTabDisplayOptionInt(this);
|
||||
final int initialTabPosition = handleIntent(intent, savedInstanceState == null);
|
||||
|
||||
mColorStatusFrameLayout.setOnFitSystemWindowsListener(this);
|
||||
ThemeUtils.applyBackground(mTabIndicator);
|
||||
mPagerAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), mTabIndicator, 1);
|
||||
mViewPager.setAdapter(mPagerAdapter);
|
||||
|
@ -28,6 +28,7 @@ import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v4.view.WindowCompat;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -136,6 +137,7 @@ public class LinkHandlerActivity extends BaseActionBarActivity implements OnClic
|
||||
setActionBarBackground(actionBar, linkId, data);
|
||||
}
|
||||
setContentView(R.layout.activity_content_fragment);
|
||||
mMainContent.setOnFitSystemWindowsListener(this);
|
||||
setStatusBarColor(linkId, data);
|
||||
setTaskInfo(linkId, data);
|
||||
setSupportProgressBarIndeterminateVisibility(false);
|
||||
@ -157,17 +159,8 @@ public class LinkHandlerActivity extends BaseActionBarActivity implements OnClic
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getSystemWindowsInsets(Rect insets) {
|
||||
final boolean result = super.getSystemWindowsInsets(insets);
|
||||
// if (result) {
|
||||
// insets.bottom = 0;
|
||||
// }
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fitSystemWindows(Rect insets) {
|
||||
super.fitSystemWindows(insets);
|
||||
public void onFitSystemWindows(Rect insets) {
|
||||
super.onFitSystemWindows(insets);
|
||||
final Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.main_content);
|
||||
if (fragment instanceof IBaseFragment) {
|
||||
((IBaseFragment) fragment).requestFitSystemWindows();
|
||||
@ -190,8 +183,8 @@ public class LinkHandlerActivity extends BaseActionBarActivity implements OnClic
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
window.addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
}
|
||||
window.requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
|
||||
window.requestFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
|
||||
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
|
||||
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_MODE_OVERLAY);
|
||||
final int transitionRes;
|
||||
switch (linkId) {
|
||||
case LINK_ID_USER: {
|
||||
|
@ -25,6 +25,7 @@ import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
@ -2248,6 +2249,15 @@ public final class Utils implements Constants, TwitterConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static Activity findActivity(Context context) {
|
||||
if (context instanceof Activity) {
|
||||
return (Activity) context;
|
||||
} else if (context instanceof ContextWrapper) {
|
||||
return findActivity(((ContextWrapper) context).getBaseContext());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getTabDisplayOption(final Context context) {
|
||||
if (context == null) return null;
|
||||
final String defaultOption = context.getString(R.string.default_tab_display_option);
|
||||
@ -3970,7 +3980,7 @@ public final class Utils implements Constants, TwitterConstants {
|
||||
return appInfo.metaData != null && appInfo.metaData.getBoolean(METADATA_KEY_EXTENSION_USE_JSON, false);
|
||||
}
|
||||
|
||||
public static int getActionBarHeight(ActionBar actionBar) {
|
||||
public static int getActionBarHeight(@Nullable ActionBar actionBar) {
|
||||
if (actionBar == null) return 0;
|
||||
final Context context = actionBar.getThemedContext();
|
||||
final TypedValue tv = new TypedValue();
|
||||
@ -3982,7 +3992,7 @@ public final class Utils implements Constants, TwitterConstants {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getActionBarHeight(android.support.v7.app.ActionBar actionBar) {
|
||||
public static int getActionBarHeight(@Nullable android.support.v7.app.ActionBar actionBar) {
|
||||
if (actionBar == null) return 0;
|
||||
final Context context = actionBar.getThemedContext();
|
||||
final TypedValue tv = new TypedValue();
|
||||
|
@ -102,6 +102,8 @@ public final class TwidereSQLiteOpenHelper extends SQLiteOpenHelper implements C
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
|
||||
db.execSQL(createIndex("statuses_index", Statuses.TABLE_NAME, new String[]{Statuses.ACCOUNT_ID}, true));
|
||||
db.execSQL(createIndex("mentions_index", Mentions.TABLE_NAME, new String[]{Statuses.ACCOUNT_ID}, true));
|
||||
db.execSQL(createIndex("messages_inbox_index", DirectMessages.Inbox.TABLE_NAME, new String[]{DirectMessages.ACCOUNT_ID}, true));
|
||||
db.execSQL(createIndex("messages_outbox_index", DirectMessages.Outbox.TABLE_NAME, new String[]{DirectMessages.ACCOUNT_ID}, true));
|
||||
}
|
||||
|
||||
private void createViews(SQLiteDatabase db) {
|
||||
|
@ -19,13 +19,18 @@
|
||||
|
||||
package org.mariotaku.twidere.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Window;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.view.iface.IExtendedView;
|
||||
|
||||
public class ExtendedFrameLayout extends FrameLayout implements IExtendedView {
|
||||
@ -81,12 +86,36 @@ public class ExtendedFrameLayout extends FrameLayout implements IExtendedView {
|
||||
|
||||
@Override
|
||||
protected boolean fitSystemWindows(@NonNull Rect insets) {
|
||||
// if (mOnFitSystemWindowsListener != null && Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
|
||||
// mOnFitSystemWindowsListener.onFitSystemWindows(insets);
|
||||
// }
|
||||
if (mOnFitSystemWindowsListener != null) {
|
||||
mOnFitSystemWindowsListener.onFitSystemWindows(insets);
|
||||
}
|
||||
return super.fitSystemWindows(insets);
|
||||
}
|
||||
|
||||
Rect insets = new Rect();
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
// if (mOnFitSystemWindowsListener != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
// final OnFitSystemWindowsListener l = mOnFitSystemWindowsListener;
|
||||
// final Activity activity = Utils.findActivity(getContext());
|
||||
// if (activity instanceof ActionBarActivity) {
|
||||
// final ActionBarActivity actionBarActivity = (ActionBarActivity) activity;
|
||||
// insets.top = Utils.getActionBarHeight(actionBarActivity.getSupportActionBar());
|
||||
// l.onFitSystemWindows(insets);
|
||||
// } else if (activity != null && activity.getWindow().hasFeature(Window.FEATURE_ACTION_BAR
|
||||
// | Window.FEATURE_ACTION_BAR_OVERLAY)) {
|
||||
// insets.top = Utils.getActionBarHeight(activity.getActionBar());
|
||||
// l.onFitSystemWindows(insets);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean onTouchEvent(final MotionEvent event) {
|
||||
if (mTouchInterceptor != null) {
|
||||
|
@ -281,6 +281,7 @@ public class HeaderDrawerLayout extends ViewGroup {
|
||||
}
|
||||
|
||||
private boolean shouldLayoutHeaderBottomCallback() {
|
||||
if (mDragCallback == null) return false;
|
||||
return mDrawerCallback.shouldLayoutHeaderBottom();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.mariotaku.twidere.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/**
|
||||
@ -31,7 +30,4 @@ public class MainFrameLayout extends TintedStatusFrameLayout {
|
||||
super.setStatusBarHeight(height);
|
||||
}
|
||||
|
||||
public static interface FitSystemWindowsCallback {
|
||||
void fitSystemWindows(Rect insets);
|
||||
}
|
||||
}
|
||||
|
@ -26,16 +26,14 @@ import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import org.mariotaku.twidere.util.MathUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.view.MainFrameLayout.FitSystemWindowsCallback;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 14/11/26.
|
||||
*/
|
||||
public class TintedStatusFrameLayout extends FrameLayout {
|
||||
public class TintedStatusFrameLayout extends ExtendedFrameLayout {
|
||||
|
||||
private final Paint mBlackPaint, mShadowPaint, mColorPaint;
|
||||
|
||||
@ -112,10 +110,6 @@ public class TintedStatusFrameLayout extends FrameLayout {
|
||||
@Override
|
||||
protected boolean fitSystemWindows(@NonNull Rect insets) {
|
||||
setStatusBarHeight(Utils.getInsetsTopWithoutActionBarHeight(getContext(), insets.top));
|
||||
final Context context = getContext();
|
||||
if (context instanceof FitSystemWindowsCallback) {
|
||||
((FitSystemWindowsCallback) context).fitSystemWindows(insets);
|
||||
}
|
||||
return super.fitSystemWindows(insets);
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 279 B |
Before Width: | Height: | Size: 286 B After Width: | Height: | Size: 141 B |
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 109 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 549 B |
Before Width: | Height: | Size: 964 B After Width: | Height: | Size: 424 B |
Before Width: | Height: | Size: 611 B After Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 511 B After Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 499 B After Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 837 B After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 765 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 300 B |
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 659 B After Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 719 B After Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 474 B |
Before Width: | Height: | Size: 473 B After Width: | Height: | Size: 222 B |
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 628 B After Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 536 B |
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 852 B After Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 549 B After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 777 B After Width: | Height: | Size: 388 B |
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 177 B |
Before Width: | Height: | Size: 625 B After Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 886 B After Width: | Height: | Size: 418 B |
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 293 B |
Before Width: | Height: | Size: 338 B After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 848 B After Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 667 B After Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 659 B |
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 765 B After Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 622 B After Width: | Height: | Size: 317 B |
Before Width: | Height: | Size: 475 B After Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 813 B After Width: | Height: | Size: 390 B |
Before Width: | Height: | Size: 429 B After Width: | Height: | Size: 265 B |
Before Width: | Height: | Size: 955 B After Width: | Height: | Size: 493 B |
Before Width: | Height: | Size: 750 B After Width: | Height: | Size: 362 B |
Before Width: | Height: | Size: 730 B After Width: | Height: | Size: 376 B |
Before Width: | Height: | Size: 539 B After Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 836 B After Width: | Height: | Size: 409 B |
Before Width: | Height: | Size: 767 B After Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 348 B After Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 968 B After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 812 B After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 606 B After Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 952 B After Width: | Height: | Size: 517 B |
Before Width: | Height: | Size: 785 B After Width: | Height: | Size: 432 B |
Before Width: | Height: | Size: 933 B After Width: | Height: | Size: 479 B |
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 273 B After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 651 B After Width: | Height: | Size: 322 B |
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 439 B |
Before Width: | Height: | Size: 724 B After Width: | Height: | Size: 376 B |
Before Width: | Height: | Size: 496 B After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 209 B After Width: | Height: | Size: 123 B |
Before Width: | Height: | Size: 617 B After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 413 B |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 716 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 118 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 294 B |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 694 B |
Before Width: | Height: | Size: 518 B After Width: | Height: | Size: 342 B |
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 294 B |
Before Width: | Height: | Size: 476 B After Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 444 B After Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 323 B |
Before Width: | Height: | Size: 730 B After Width: | Height: | Size: 475 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 676 B |
Before Width: | Height: | Size: 791 B After Width: | Height: | Size: 252 B |