improved theme
This commit is contained in:
parent
bf42c3d792
commit
f4a2fdc207
|
@ -373,7 +373,8 @@
|
||||||
android:name=".activity.support.DraftsActivity"
|
android:name=".activity.support.DraftsActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:label="@string/drafts"
|
android:label="@string/drafts"
|
||||||
android:launchMode="singleTop">
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@style/Theme.Twidere.Dark.DialogWhenLarge">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="org.mariotaku.twidere.DRAFTS"/>
|
<action android:name="org.mariotaku.twidere.DRAFTS"/>
|
||||||
|
|
||||||
|
@ -388,7 +389,8 @@
|
||||||
android:name=".activity.support.AccountsManagerActivity"
|
android:name=".activity.support.AccountsManagerActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:label="@string/accounts"
|
android:label="@string/accounts"
|
||||||
android:launchMode="singleTop">
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@style/Theme.Twidere.Dark.DialogWhenLarge">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="org.mariotaku.twidere.ACCOUNTS"/>
|
<action android:name="org.mariotaku.twidere.ACCOUNTS"/>
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import android.view.MenuItem;
|
||||||
import android.view.WindowManager.LayoutParams;
|
import android.view.WindowManager.LayoutParams;
|
||||||
|
|
||||||
import org.mariotaku.twidere.R;
|
import org.mariotaku.twidere.R;
|
||||||
import org.mariotaku.twidere.activity.support.BaseActionBarActivity;
|
import org.mariotaku.twidere.activity.support.BaseDialogWhenLargeActivity;
|
||||||
import org.mariotaku.twidere.adapter.support.SupportTabsAdapter;
|
import org.mariotaku.twidere.adapter.support.SupportTabsAdapter;
|
||||||
import org.mariotaku.twidere.fragment.BaseFiltersFragment.FilteredKeywordsFragment;
|
import org.mariotaku.twidere.fragment.BaseFiltersFragment.FilteredKeywordsFragment;
|
||||||
import org.mariotaku.twidere.fragment.BaseFiltersFragment.FilteredLinksFragment;
|
import org.mariotaku.twidere.fragment.BaseFiltersFragment.FilteredLinksFragment;
|
||||||
|
@ -38,11 +38,9 @@ import org.mariotaku.twidere.fragment.BaseFiltersFragment.FilteredUsersFragment;
|
||||||
import org.mariotaku.twidere.graphic.EmptyDrawable;
|
import org.mariotaku.twidere.graphic.EmptyDrawable;
|
||||||
import org.mariotaku.twidere.util.ThemeUtils;
|
import org.mariotaku.twidere.util.ThemeUtils;
|
||||||
import org.mariotaku.twidere.view.TabPagerIndicator;
|
import org.mariotaku.twidere.view.TabPagerIndicator;
|
||||||
import org.mariotaku.twidere.view.TintedStatusFrameLayout;
|
|
||||||
|
|
||||||
public class FiltersActivity extends BaseActionBarActivity {
|
public class FiltersActivity extends BaseDialogWhenLargeActivity {
|
||||||
|
|
||||||
private TintedStatusFrameLayout mMainContent;
|
|
||||||
private TabPagerIndicator mPagerIndicator;
|
private TabPagerIndicator mPagerIndicator;
|
||||||
private ViewPager mViewPager;
|
private ViewPager mViewPager;
|
||||||
|
|
||||||
|
@ -53,12 +51,6 @@ public class FiltersActivity extends BaseActionBarActivity {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFitSystemWindows(Rect insets) {
|
|
||||||
super.onFitSystemWindows(insets);
|
|
||||||
mMainContent.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
@ -79,10 +71,7 @@ public class FiltersActivity extends BaseActionBarActivity {
|
||||||
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
|
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
|
||||||
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_MODE_OVERLAY);
|
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_MODE_OVERLAY);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
ThemeUtils.applyActionBarBackground(getSupportActionBar(), this, getCurrentThemeResourceId(),
|
setContentView(R.layout.activity_filters);
|
||||||
getCurrentThemeColor(), getThemeBackgroundOption(), false);
|
|
||||||
setContentView(R.layout.activity_content_pages);
|
|
||||||
mMainContent.setOnFitSystemWindowsListener(this);
|
|
||||||
mAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), null, 1);
|
mAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), null, 1);
|
||||||
mViewPager.setAdapter(mAdapter);
|
mViewPager.setAdapter(mAdapter);
|
||||||
mViewPager.setOffscreenPageLimit(2);
|
mViewPager.setOffscreenPageLimit(2);
|
||||||
|
@ -99,22 +88,16 @@ public class FiltersActivity extends BaseActionBarActivity {
|
||||||
ThemeUtils.initPagerIndicatorAsActionBarTab(this, mPagerIndicator);
|
ThemeUtils.initPagerIndicatorAsActionBarTab(this, mPagerIndicator);
|
||||||
ThemeUtils.setCompatToolbarOverlay(this, new EmptyDrawable());
|
ThemeUtils.setCompatToolbarOverlay(this, new EmptyDrawable());
|
||||||
|
|
||||||
mMainContent.setDrawShadow(false);
|
}
|
||||||
mMainContent.setDrawColor(true);
|
|
||||||
mMainContent.setFactor(1);
|
@Override
|
||||||
final int color = getCurrentThemeColor();
|
protected boolean isActionBarOutlineEnabled() {
|
||||||
final int alpha = ThemeUtils.isTransparentBackground(getThemeBackgroundOption()) ? getCurrentThemeBackgroundAlpha() : 0xFF;
|
return false;
|
||||||
if (ThemeUtils.isDarkTheme(getCurrentThemeResourceId())) {
|
|
||||||
mMainContent.setColor(getResources().getColor(R.color.background_color_action_bar_dark), alpha);
|
|
||||||
} else {
|
|
||||||
mMainContent.setColor(color, alpha);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSupportContentChanged() {
|
public void onSupportContentChanged() {
|
||||||
super.onSupportContentChanged();
|
super.onSupportContentChanged();
|
||||||
mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content);
|
|
||||||
mViewPager = (ViewPager) findViewById(R.id.view_pager);
|
mViewPager = (ViewPager) findViewById(R.id.view_pager);
|
||||||
mPagerIndicator = (TabPagerIndicator) findViewById(R.id.view_pager_tabs);
|
mPagerIndicator = (TabPagerIndicator) findViewById(R.id.view_pager_tabs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,17 @@ import org.mariotaku.twidere.view.TintedStatusFrameLayout;
|
||||||
* Accounts manager
|
* Accounts manager
|
||||||
* Created by mariotaku on 14/10/26.
|
* Created by mariotaku on 14/10/26.
|
||||||
*/
|
*/
|
||||||
public class AccountsManagerActivity extends BaseActionBarActivity {
|
public class AccountsManagerActivity extends BaseDialogWhenLargeActivity {
|
||||||
|
|
||||||
private TintedStatusFrameLayout mMainContent;
|
@Override
|
||||||
|
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) {
|
||||||
|
((IBaseFragment) f).requestFitSystemWindows();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||||
|
@ -33,12 +41,6 @@ public class AccountsManagerActivity extends BaseActionBarActivity {
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSupportContentChanged() {
|
|
||||||
super.onSupportContentChanged();
|
|
||||||
mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
|
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
|
||||||
|
@ -48,20 +50,9 @@ public class AccountsManagerActivity extends BaseActionBarActivity {
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
}
|
}
|
||||||
setContentView(R.layout.activity_content_fragment);
|
setContentView(R.layout.activity_content_fragment);
|
||||||
mMainContent.setOnFitSystemWindowsListener(this);
|
|
||||||
final FragmentManager fm = getSupportFragmentManager();
|
final FragmentManager fm = getSupportFragmentManager();
|
||||||
final FragmentTransaction ft = fm.beginTransaction();
|
final FragmentTransaction ft = fm.beginTransaction();
|
||||||
ft.replace(R.id.main_content, new AccountsManagerFragment());
|
ft.replace(R.id.main_content, new AccountsManagerFragment());
|
||||||
ft.commit();
|
ft.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
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) {
|
|
||||||
((IBaseFragment) f).requestFitSystemWindows();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,12 @@ import android.content.Intent;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v7.widget.ActionMenuView;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import org.mariotaku.twidere.Constants;
|
import org.mariotaku.twidere.Constants;
|
||||||
import org.mariotaku.twidere.activity.iface.IControlBarActivity;
|
import org.mariotaku.twidere.activity.iface.IControlBarActivity;
|
||||||
|
@ -34,6 +38,7 @@ import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCal
|
||||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.ShortcutCallback;
|
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.ShortcutCallback;
|
||||||
import org.mariotaku.twidere.util.ThemeUtils;
|
import org.mariotaku.twidere.util.ThemeUtils;
|
||||||
|
import org.mariotaku.twidere.util.ViewUtils;
|
||||||
import org.mariotaku.twidere.view.iface.IExtendedView.OnFitSystemWindowsListener;
|
import org.mariotaku.twidere.view.iface.IExtendedView.OnFitSystemWindowsListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -136,6 +141,7 @@ public class BaseActionBarActivity extends ThemedActionBarActivity implements Co
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
@ -207,4 +213,5 @@ public class BaseActionBarActivity extends ThemedActionBarActivity implements Co
|
||||||
public void unregisterControlBarOffsetListener(ControlBarOffsetListener listener) {
|
public void unregisterControlBarOffsetListener(ControlBarOffsetListener listener) {
|
||||||
mControlBarOffsetListeners.remove(listener);
|
mControlBarOffsetListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
* Twidere - Twitter client for Android
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.mariotaku.twidere.activity.support;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.widget.ActionMenuView;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.R;
|
||||||
|
import org.mariotaku.twidere.util.ThemeUtils;
|
||||||
|
import org.mariotaku.twidere.util.ViewUtils;
|
||||||
|
import org.mariotaku.twidere.view.TintedStatusFrameLayout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mariotaku on 15/4/17.
|
||||||
|
*/
|
||||||
|
public class BaseDialogWhenLargeActivity extends BaseActionBarActivity {
|
||||||
|
|
||||||
|
private TintedStatusFrameLayout mMainContent;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final int getThemeResourceId() {
|
||||||
|
return ThemeUtils.getDialogWhenLargeThemeResource(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setupActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
|
final boolean result = super.onPrepareOptionsMenu(menu);
|
||||||
|
if (!shouldSetActionItemColor()) return result;
|
||||||
|
final View actionBarView = getWindow().findViewById(android.support.v7.appcompat.R.id.action_bar);
|
||||||
|
if (actionBarView instanceof Toolbar) {
|
||||||
|
final int themeColor = getCurrentThemeColor();
|
||||||
|
final int themeId = getCurrentThemeResourceId();
|
||||||
|
final int itemColor = ThemeUtils.getContrastActionBarItemColor(this, themeId, themeColor);
|
||||||
|
final Toolbar toolbar = (Toolbar) actionBarView;
|
||||||
|
ThemeUtils.setActionBarOverflowColor(toolbar, itemColor);
|
||||||
|
ThemeUtils.wrapToolbarMenuIcon(ViewUtils.findViewByType(actionBarView, ActionMenuView.class), itemColor, itemColor);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSupportContentChanged() {
|
||||||
|
super.onSupportContentChanged();
|
||||||
|
mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content);
|
||||||
|
setupTintStatusBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected TintedStatusFrameLayout getMainContent() {
|
||||||
|
return mMainContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isActionBarOutlineEnabled() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean shouldSetActionItemColor() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupActionBar() {
|
||||||
|
final ActionBar actionBar = getSupportActionBar();
|
||||||
|
if (actionBar == null) return;
|
||||||
|
|
||||||
|
final int themeColor = getCurrentThemeColor();
|
||||||
|
final int themeId = getCurrentThemeResourceId();
|
||||||
|
final String option = getThemeBackgroundOption();
|
||||||
|
final int actionBarItemsColor = ThemeUtils.getContrastActionBarItemColor(this, themeId, themeColor);
|
||||||
|
ThemeUtils.applyActionBarBackground(actionBar, this, themeId, themeColor, option, isActionBarOutlineEnabled());
|
||||||
|
ThemeUtils.setActionBarItemsColor(getWindow(), actionBar, actionBarItemsColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupTintStatusBar() {
|
||||||
|
if (mMainContent == null) return;
|
||||||
|
|
||||||
|
final int color = getCurrentThemeColor();
|
||||||
|
final int alpha = ThemeUtils.isTransparentBackground(getThemeBackgroundOption()) ? getCurrentThemeBackgroundAlpha() : 0xFF;
|
||||||
|
if (ThemeUtils.isDarkTheme(getCurrentThemeResourceId())) {
|
||||||
|
mMainContent.setColor(getResources().getColor(R.color.background_color_action_bar_dark), alpha);
|
||||||
|
} else {
|
||||||
|
mMainContent.setColor(color, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
mMainContent.setDrawShadow(false);
|
||||||
|
mMainContent.setDrawColor(true);
|
||||||
|
mMainContent.setFactor(1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,8 +29,10 @@ import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
@ -48,6 +50,7 @@ import android.view.ActionMode;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.WindowManager.LayoutParams;
|
||||||
import android.widget.AbsListView.MultiChoiceModeListener;
|
import android.widget.AbsListView.MultiChoiceModeListener;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
@ -69,6 +72,7 @@ import org.mariotaku.twidere.provider.TwidereDataStore.Drafts;
|
||||||
import org.mariotaku.twidere.util.AsyncTaskUtils;
|
import org.mariotaku.twidere.util.AsyncTaskUtils;
|
||||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||||
import org.mariotaku.twidere.util.ThemeUtils;
|
import org.mariotaku.twidere.util.ThemeUtils;
|
||||||
|
import org.mariotaku.twidere.view.TintedStatusFrameLayout;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -76,7 +80,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static org.mariotaku.twidere.util.Utils.getDefaultTextSize;
|
import static org.mariotaku.twidere.util.Utils.getDefaultTextSize;
|
||||||
|
|
||||||
public class DraftsActivity extends BaseActionBarActivity implements LoaderCallbacks<Cursor>, OnItemClickListener,
|
public class DraftsActivity extends BaseDialogWhenLargeActivity implements LoaderCallbacks<Cursor>, OnItemClickListener,
|
||||||
MultiChoiceModeListener {
|
MultiChoiceModeListener {
|
||||||
|
|
||||||
private ContentResolver mResolver;
|
private ContentResolver mResolver;
|
||||||
|
@ -194,12 +198,19 @@ public class DraftsActivity extends BaseActionBarActivity implements LoaderCallb
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(final Bundle savedInstanceState) {
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
|
getWindow().addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
|
}
|
||||||
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
|
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
|
||||||
|
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
|
||||||
|
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_MODE_OVERLAY);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mResolver = getContentResolver();
|
mResolver = getContentResolver();
|
||||||
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||||
mTextSize = mPreferences.getInt(KEY_TEXT_SIZE, getDefaultTextSize(this));
|
mTextSize = mPreferences.getInt(KEY_TEXT_SIZE, getDefaultTextSize(this));
|
||||||
setContentView(R.layout.layout_list_with_empty_view);
|
|
||||||
|
setContentView(R.layout.activity_drafts);
|
||||||
|
|
||||||
final ActionBar actionBar = getSupportActionBar();
|
final ActionBar actionBar = getSupportActionBar();
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
|
@ -216,6 +227,15 @@ public class DraftsActivity extends BaseActionBarActivity implements LoaderCallb
|
||||||
setListShown(false);
|
setListShown(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
final AsyncTwitterWrapper twitter = getTwitterWrapper();
|
||||||
|
if (twitter != null) {
|
||||||
|
twitter.clearNotificationAsync(NOTIFICATION_ID_DRAFTS);
|
||||||
|
}
|
||||||
|
super.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
@ -227,15 +247,6 @@ public class DraftsActivity extends BaseActionBarActivity implements LoaderCallb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStart() {
|
|
||||||
final AsyncTwitterWrapper twitter = getTwitterWrapper();
|
|
||||||
if (twitter != null) {
|
|
||||||
twitter.clearNotificationAsync(NOTIFICATION_ID_DRAFTS);
|
|
||||||
}
|
|
||||||
super.onStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
|
|
@ -47,6 +47,7 @@ import org.mariotaku.twidere.fragment.iface.IBaseFragment;
|
||||||
import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCallback;
|
import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCallback;
|
||||||
import org.mariotaku.twidere.fragment.iface.SupportFragmentCallback;
|
import org.mariotaku.twidere.fragment.iface.SupportFragmentCallback;
|
||||||
import org.mariotaku.twidere.fragment.support.SearchFragment;
|
import org.mariotaku.twidere.fragment.support.SearchFragment;
|
||||||
|
import org.mariotaku.twidere.fragment.support.UserFragment;
|
||||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
|
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
|
||||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.ShortcutCallback;
|
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.ShortcutCallback;
|
||||||
import org.mariotaku.twidere.util.MultiSelectEventHandler;
|
import org.mariotaku.twidere.util.MultiSelectEventHandler;
|
||||||
|
@ -294,6 +295,11 @@ public class LinkHandlerActivity extends BaseActionBarActivity implements System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldSetActionItemColor() {
|
||||||
|
return !(getCurrentVisibleFragment() instanceof UserFragment);
|
||||||
|
}
|
||||||
|
|
||||||
private void setTaskInfo(int linkId, Uri uri) {
|
private void setTaskInfo(int linkId, Uri uri) {
|
||||||
switch (linkId) {
|
switch (linkId) {
|
||||||
case LINK_ID_USER: {
|
case LINK_ID_USER: {
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.mariotaku.twidere.activity.support;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.AsyncTask.Status;
|
import android.os.AsyncTask.Status;
|
||||||
|
@ -62,7 +61,6 @@ import org.mariotaku.twidere.util.ParseUtils;
|
||||||
import org.mariotaku.twidere.util.ThemeUtils;
|
import org.mariotaku.twidere.util.ThemeUtils;
|
||||||
import org.mariotaku.twidere.util.TwitterWrapper;
|
import org.mariotaku.twidere.util.TwitterWrapper;
|
||||||
import org.mariotaku.twidere.view.ForegroundColorView;
|
import org.mariotaku.twidere.view.ForegroundColorView;
|
||||||
import org.mariotaku.twidere.view.TintedStatusFrameLayout;
|
|
||||||
import org.mariotaku.twidere.view.iface.IExtendedView.OnSizeChangedListener;
|
import org.mariotaku.twidere.view.iface.IExtendedView.OnSizeChangedListener;
|
||||||
|
|
||||||
import twitter4j.Twitter;
|
import twitter4j.Twitter;
|
||||||
|
@ -74,7 +72,7 @@ import static org.mariotaku.twidere.util.Utils.getTwitterInstance;
|
||||||
import static org.mariotaku.twidere.util.Utils.isMyAccount;
|
import static org.mariotaku.twidere.util.Utils.isMyAccount;
|
||||||
import static org.mariotaku.twidere.util.Utils.showErrorMessage;
|
import static org.mariotaku.twidere.util.Utils.showErrorMessage;
|
||||||
|
|
||||||
public class UserProfileEditorActivity extends BaseActionBarActivity implements OnSizeChangedListener, TextWatcher,
|
public class UserProfileEditorActivity extends BaseDialogWhenLargeActivity implements OnSizeChangedListener, TextWatcher,
|
||||||
OnClickListener, LoaderCallbacks<SingleResponse<ParcelableUser>> {
|
OnClickListener, LoaderCallbacks<SingleResponse<ParcelableUser>> {
|
||||||
|
|
||||||
private static final int LOADER_ID_USER = 1;
|
private static final int LOADER_ID_USER = 1;
|
||||||
|
@ -86,7 +84,6 @@ public class UserProfileEditorActivity extends BaseActionBarActivity implements
|
||||||
private MediaLoaderWrapper mLazyImageLoader;
|
private MediaLoaderWrapper mLazyImageLoader;
|
||||||
private AsyncTaskManager mAsyncTaskManager;
|
private AsyncTaskManager mAsyncTaskManager;
|
||||||
private AsyncTask<Object, Object, ?> mTask;
|
private AsyncTask<Object, Object, ?> mTask;
|
||||||
private TintedStatusFrameLayout mMainContent;
|
|
||||||
private ImageView mProfileImageView;
|
private ImageView mProfileImageView;
|
||||||
private ImageView mProfileBannerView;
|
private ImageView mProfileBannerView;
|
||||||
private EditText mEditName, mEditDescription, mEditLocation, mEditUrl;
|
private EditText mEditName, mEditDescription, mEditLocation, mEditUrl;
|
||||||
|
@ -113,124 +110,6 @@ public class UserProfileEditorActivity extends BaseActionBarActivity implements
|
||||||
public void afterTextChanged(final Editable s) {
|
public void afterTextChanged(final Editable s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getThemeResourceId() {
|
|
||||||
return ThemeUtils.getDialogWhenLargeThemeResource(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case MENU_HOME: {
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
case MENU_SAVE: {
|
|
||||||
final String name = ParseUtils.parseString(mEditName.getText());
|
|
||||||
final String url = ParseUtils.parseString(mEditUrl.getText());
|
|
||||||
final String location = ParseUtils.parseString(mEditLocation.getText());
|
|
||||||
final String description = ParseUtils.parseString(mEditDescription.getText());
|
|
||||||
final int linkColor = mLinkColor.getColor();
|
|
||||||
final int backgroundColor = mBackgroundColor.getColor();
|
|
||||||
mTask = new UpdateProfileTaskInternal(this, mAccountId, mUser, name, url, location,
|
|
||||||
description, linkColor, backgroundColor);
|
|
||||||
AsyncTaskUtils.executeTask(mTask);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(final Bundle savedInstanceState) {
|
|
||||||
final Window window = getWindow();
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
|
||||||
window.addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
|
||||||
}
|
|
||||||
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
|
|
||||||
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
mAsyncTaskManager = TwidereApplication.getInstance(this).getAsyncTaskManager();
|
|
||||||
mLazyImageLoader = TwidereApplication.getInstance(this).getMediaLoaderWrapper();
|
|
||||||
final Intent intent = getIntent();
|
|
||||||
final long accountId = intent.getLongExtra(EXTRA_ACCOUNT_ID, -1);
|
|
||||||
mAccountId = accountId;
|
|
||||||
if (!isMyAccount(this, accountId)) {
|
|
||||||
finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final ActionBar actionBar = getSupportActionBar();
|
|
||||||
final int themeColor = getCurrentThemeColor();
|
|
||||||
if (actionBar != null) {
|
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
|
||||||
final int themeId = getCurrentThemeResourceId();
|
|
||||||
final String option = getThemeBackgroundOption();
|
|
||||||
final int actionBarItemsColor = ThemeUtils.getContrastActionBarItemColor(this, themeId, themeColor);
|
|
||||||
ThemeUtils.applyActionBarBackground(actionBar, this, themeId, themeColor, option, true);
|
|
||||||
ThemeUtils.setActionBarItemsColor(getWindow(), actionBar, actionBarItemsColor);
|
|
||||||
}
|
|
||||||
setContentView(R.layout.activity_user_profile_editor);
|
|
||||||
|
|
||||||
mMainContent.setOnFitSystemWindowsListener(this);
|
|
||||||
if (ThemeUtils.isDarkTheme(getCurrentThemeResourceId())) {
|
|
||||||
mMainContent.setColor(getResources().getColor(R.color.background_color_action_bar_dark));
|
|
||||||
} else {
|
|
||||||
mMainContent.setColor(themeColor);
|
|
||||||
}
|
|
||||||
mMainContent.setDrawColor(true);
|
|
||||||
// setOverrideExitAniamtion(false);
|
|
||||||
mEditName.addTextChangedListener(this);
|
|
||||||
mEditDescription.addTextChangedListener(this);
|
|
||||||
mEditLocation.addTextChangedListener(this);
|
|
||||||
mEditUrl.addTextChangedListener(this);
|
|
||||||
mProfileImageView.setOnClickListener(this);
|
|
||||||
mProfileBannerView.setOnClickListener(this);
|
|
||||||
mProfileImageCamera.setOnClickListener(this);
|
|
||||||
mProfileImageGallery.setOnClickListener(this);
|
|
||||||
mProfileBannerGallery.setOnClickListener(this);
|
|
||||||
mProfileBannerRemove.setOnClickListener(this);
|
|
||||||
mSetLinkColor.setOnClickListener(this);
|
|
||||||
mSetBackgroundColor.setOnClickListener(this);
|
|
||||||
|
|
||||||
if (savedInstanceState != null && savedInstanceState.getParcelable(EXTRA_USER) != null) {
|
|
||||||
final ParcelableUser user = savedInstanceState.getParcelable(EXTRA_USER);
|
|
||||||
displayUser(user);
|
|
||||||
mEditName.setText(savedInstanceState.getString(EXTRA_NAME, user.name));
|
|
||||||
mEditLocation.setText(savedInstanceState.getString(EXTRA_LOCATION, user.location));
|
|
||||||
mEditDescription.setText(savedInstanceState.getString(EXTRA_DESCRIPTION, user.description_expanded));
|
|
||||||
mEditUrl.setText(savedInstanceState.getString(EXTRA_URL, user.url_expanded));
|
|
||||||
} else {
|
|
||||||
getUserInfo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFitSystemWindows(Rect insets) {
|
|
||||||
mMainContent.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
|
||||||
super.onFitSystemWindows(insets);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSaveInstanceState(final Bundle outState) {
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
outState.putParcelable(EXTRA_USER, mUser);
|
|
||||||
outState.putString(EXTRA_NAME, ParseUtils.parseString(mEditName.getText()));
|
|
||||||
outState.putString(EXTRA_DESCRIPTION, ParseUtils.parseString(mEditDescription.getText()));
|
|
||||||
outState.putString(EXTRA_LOCATION, ParseUtils.parseString(mEditLocation.getText()));
|
|
||||||
outState.putString(EXTRA_URL, ParseUtils.parseString(mEditUrl.getText()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View view) {
|
public void onClick(final View view) {
|
||||||
final ParcelableUser user = mUser;
|
final ParcelableUser user = mUser;
|
||||||
|
@ -311,6 +190,100 @@ public class UserProfileEditorActivity extends BaseActionBarActivity implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case MENU_HOME: {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case MENU_SAVE: {
|
||||||
|
final String name = ParseUtils.parseString(mEditName.getText());
|
||||||
|
final String url = ParseUtils.parseString(mEditUrl.getText());
|
||||||
|
final String location = ParseUtils.parseString(mEditLocation.getText());
|
||||||
|
final String description = ParseUtils.parseString(mEditDescription.getText());
|
||||||
|
final int linkColor = mLinkColor.getColor();
|
||||||
|
final int backgroundColor = mBackgroundColor.getColor();
|
||||||
|
mTask = new UpdateProfileTaskInternal(this, mAccountId, mUser, name, url, location,
|
||||||
|
description, linkColor, backgroundColor);
|
||||||
|
AsyncTaskUtils.executeTask(mTask);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
|
final Window window = getWindow();
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
|
window.addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
|
}
|
||||||
|
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
|
||||||
|
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
mAsyncTaskManager = TwidereApplication.getInstance(this).getAsyncTaskManager();
|
||||||
|
mLazyImageLoader = TwidereApplication.getInstance(this).getMediaLoaderWrapper();
|
||||||
|
final Intent intent = getIntent();
|
||||||
|
final long accountId = intent.getLongExtra(EXTRA_ACCOUNT_ID, -1);
|
||||||
|
mAccountId = accountId;
|
||||||
|
if (!isMyAccount(this, accountId)) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final ActionBar actionBar = getSupportActionBar();
|
||||||
|
if (actionBar != null) {
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
|
setContentView(R.layout.activity_user_profile_editor);
|
||||||
|
|
||||||
|
// setOverrideExitAniamtion(false);
|
||||||
|
mEditName.addTextChangedListener(this);
|
||||||
|
mEditDescription.addTextChangedListener(this);
|
||||||
|
mEditLocation.addTextChangedListener(this);
|
||||||
|
mEditUrl.addTextChangedListener(this);
|
||||||
|
mProfileImageView.setOnClickListener(this);
|
||||||
|
mProfileBannerView.setOnClickListener(this);
|
||||||
|
mProfileImageCamera.setOnClickListener(this);
|
||||||
|
mProfileImageGallery.setOnClickListener(this);
|
||||||
|
mProfileBannerGallery.setOnClickListener(this);
|
||||||
|
mProfileBannerRemove.setOnClickListener(this);
|
||||||
|
mSetLinkColor.setOnClickListener(this);
|
||||||
|
mSetBackgroundColor.setOnClickListener(this);
|
||||||
|
|
||||||
|
if (savedInstanceState != null && savedInstanceState.getParcelable(EXTRA_USER) != null) {
|
||||||
|
final ParcelableUser user = savedInstanceState.getParcelable(EXTRA_USER);
|
||||||
|
displayUser(user);
|
||||||
|
mEditName.setText(savedInstanceState.getString(EXTRA_NAME, user.name));
|
||||||
|
mEditLocation.setText(savedInstanceState.getString(EXTRA_LOCATION, user.location));
|
||||||
|
mEditDescription.setText(savedInstanceState.getString(EXTRA_DESCRIPTION, user.description_expanded));
|
||||||
|
mEditUrl.setText(savedInstanceState.getString(EXTRA_URL, user.url_expanded));
|
||||||
|
} else {
|
||||||
|
getUserInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(final Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putParcelable(EXTRA_USER, mUser);
|
||||||
|
outState.putString(EXTRA_NAME, ParseUtils.parseString(mEditName.getText()));
|
||||||
|
outState.putString(EXTRA_DESCRIPTION, ParseUtils.parseString(mEditDescription.getText()));
|
||||||
|
outState.putString(EXTRA_LOCATION, ParseUtils.parseString(mEditLocation.getText()));
|
||||||
|
outState.putString(EXTRA_URL, ParseUtils.parseString(mEditUrl.getText()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSizeChanged(final View view, final int w, final int h, final int oldw, final int oldh) {
|
public void onSizeChanged(final View view, final int w, final int h, final int oldw, final int oldh) {
|
||||||
}
|
}
|
||||||
|
@ -318,7 +291,6 @@ public class UserProfileEditorActivity extends BaseActionBarActivity implements
|
||||||
@Override
|
@Override
|
||||||
public void onSupportContentChanged() {
|
public void onSupportContentChanged() {
|
||||||
super.onSupportContentChanged();
|
super.onSupportContentChanged();
|
||||||
mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content);
|
|
||||||
mProgressContainer = findViewById(R.id.progress_container);
|
mProgressContainer = findViewById(R.id.progress_container);
|
||||||
mEditProfileContent = findViewById(R.id.edit_profile_content);
|
mEditProfileContent = findViewById(R.id.edit_profile_content);
|
||||||
mProfileBannerView = (ImageView) findViewById(R.id.profile_banner);
|
mProfileBannerView = (ImageView) findViewById(R.id.profile_banner);
|
||||||
|
|
|
@ -933,6 +933,7 @@ public class ThemeUtils implements Constants {
|
||||||
}
|
}
|
||||||
actionBar.setHomeAsUpIndicator(drawable);
|
actionBar.setHomeAsUpIndicator(drawable);
|
||||||
setActionBarTitleTextColor(window, itemColor);
|
setActionBarTitleTextColor(window, itemColor);
|
||||||
|
setActionBarSubtitleTextColor(window, itemColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setActionBarOverflowColor(Toolbar toolbar, int itemColor) {
|
public static void setActionBarOverflowColor(Toolbar toolbar, int itemColor) {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.mariotaku.twidere.view;
|
package org.mariotaku.twidere.view;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
@ -27,6 +28,7 @@ import android.graphics.Rect;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.R;
|
||||||
import org.mariotaku.twidere.util.MathUtils;
|
import org.mariotaku.twidere.util.MathUtils;
|
||||||
import org.mariotaku.twidere.util.Utils;
|
import org.mariotaku.twidere.util.Utils;
|
||||||
|
|
||||||
|
@ -36,6 +38,7 @@ import org.mariotaku.twidere.util.Utils;
|
||||||
public class TintedStatusFrameLayout extends ExtendedFrameLayout {
|
public class TintedStatusFrameLayout extends ExtendedFrameLayout {
|
||||||
|
|
||||||
private final Paint mBlackPaint, mShadowPaint, mColorPaint;
|
private final Paint mBlackPaint, mShadowPaint, mColorPaint;
|
||||||
|
private final boolean mSetPadding;
|
||||||
|
|
||||||
private int mStatusBarHeight;
|
private int mStatusBarHeight;
|
||||||
private float mFactor;
|
private float mFactor;
|
||||||
|
@ -52,6 +55,8 @@ public class TintedStatusFrameLayout extends ExtendedFrameLayout {
|
||||||
|
|
||||||
public TintedStatusFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
public TintedStatusFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
|
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TintedStatusLayout);
|
||||||
|
mSetPadding = a.getBoolean(R.styleable.TintedStatusLayout_setPadding, false);
|
||||||
mBlackPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
mBlackPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
mBlackPaint.setColor(Color.BLACK);
|
mBlackPaint.setColor(Color.BLACK);
|
||||||
mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
@ -111,6 +116,9 @@ public class TintedStatusFrameLayout extends ExtendedFrameLayout {
|
||||||
@Override
|
@Override
|
||||||
protected boolean fitSystemWindows(@NonNull Rect insets) {
|
protected boolean fitSystemWindows(@NonNull Rect insets) {
|
||||||
setStatusBarHeight(Utils.getInsetsTopWithoutActionBarHeight(getContext(), insets.top));
|
setStatusBarHeight(Utils.getInsetsTopWithoutActionBarHeight(getContext(), insets.top));
|
||||||
|
if (mSetPadding) {
|
||||||
|
setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
||||||
|
}
|
||||||
return super.fitSystemWindows(insets);
|
return super.fitSystemWindows(insets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,7 @@
|
||||||
<org.mariotaku.twidere.view.TintedStatusFrameLayout
|
<org.mariotaku.twidere.view.TintedStatusFrameLayout
|
||||||
android:id="@+id/main_content"
|
android:id="@+id/main_content"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
app:setPadding="true"/>
|
||||||
<include layout="@layout/layout_content_pages_common"/>
|
|
||||||
|
|
||||||
</org.mariotaku.twidere.view.TintedStatusFrameLayout>
|
|
|
@ -17,13 +17,15 @@
|
||||||
~ You should have received a copy of the GNU General Public License
|
~ You should have received a copy of the GNU General Public License
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<FrameLayout
|
<org.mariotaku.twidere.view.TintedStatusFrameLayout
|
||||||
|
android:id="@+id/main_content"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:animateLayoutChanges="true">
|
android:animateLayoutChanges="true"
|
||||||
|
app:setPadding="true">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/list_container"
|
android:id="@+id/list_container"
|
||||||
|
@ -72,4 +74,4 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"/>
|
android:layout_gravity="center"/>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</FrameLayout>
|
</org.mariotaku.twidere.view.TintedStatusFrameLayout>
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
~ Twidere - Twitter client for Android
|
~ Twidere - Twitter client for Android
|
||||||
~
|
~
|
||||||
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
~ Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
~
|
~
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
~ This program is free software: you can redistribute it and/or modify
|
||||||
~ it under the terms of the GNU General Public License as published by
|
~ it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,17 +18,14 @@
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.MainFrameLayout
|
<org.mariotaku.twidere.view.TintedStatusFrameLayout
|
||||||
|
android:id="@+id/main_content"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
app:setPadding="true">
|
||||||
tools:context=".activity.FiltersActivity">
|
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.ExtendedViewPager
|
<include layout="@layout/layout_content_pages_common"/>
|
||||||
android:id="@+id/pager"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
|
|
||||||
</org.mariotaku.twidere.view.MainFrameLayout>
|
</org.mariotaku.twidere.view.TintedStatusFrameLayout>
|
||||||
|
|
|
@ -19,21 +19,20 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.TintedStatusFrameLayout
|
<org.mariotaku.twidere.view.TintedStatusFrameLayout
|
||||||
|
android:id="@+id/main_content"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/main_content"
|
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
app:setPadding="true">
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:id="@+id/edit_profile_content"
|
android:id="@+id/edit_profile_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_below="@+id/done_bar"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
@ -344,8 +343,6 @@
|
||||||
android:id="@+id/progress_container"
|
android:id="@+id/progress_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_below="@+id/done_bar"
|
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
tools:visibility="gone">
|
tools:visibility="gone">
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,9 @@
|
||||||
<attr name="headerLayout" format="reference"/>
|
<attr name="headerLayout" format="reference"/>
|
||||||
<attr name="contentLayout" format="reference"/>
|
<attr name="contentLayout" format="reference"/>
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
<declare-styleable name="TintedStatusLayout">
|
||||||
|
<attr name="setPadding" format="boolean"/>
|
||||||
|
</declare-styleable>
|
||||||
<attr name="notificationType">
|
<attr name="notificationType">
|
||||||
<flag name="none" value="0"/>
|
<flag name="none" value="0"/>
|
||||||
<flag name="ringtone" value="1"/>
|
<flag name="ringtone" value="1"/>
|
||||||
|
|
Loading…
Reference in New Issue