1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2024-12-20 12:43:47 +01:00

theme fixes

This commit is contained in:
Mariotaku Lee 2015-03-13 04:32:54 +08:00
parent 5ed2c4cdb7
commit b07a363f10
25 changed files with 127 additions and 42 deletions

View File

@ -43,7 +43,7 @@ import org.osmdroid.views.overlay.OverlayItem;
import java.util.ArrayList;
import java.util.List;
public class OpenStreetMapViewerActivity extends BaseSupportActivity implements Constants {
public class OpenStreetMapViewerActivity extends BaseActionBarActivity implements Constants {
private MapView mMapView;
private double mLatitude, mLongitude;

View File

@ -38,7 +38,7 @@ import org.mariotaku.twidere.fragment.support.WebMapFragment;
import org.mariotaku.twidere.util.ParseUtils;
import org.mariotaku.twidere.util.ThemeUtils;
public class GoogleMapViewerActivity extends BaseSupportActivity implements Constants {
public class GoogleMapViewerActivity extends BaseActionBarActivity implements Constants {
@Override
public int getThemeResourceId() {

View File

@ -49,7 +49,7 @@ import android.widget.AutoCompleteTextView;
import org.mariotaku.querybuilder.Expression;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.support.BaseSupportActivity;
import org.mariotaku.twidere.activity.support.BaseActionBarActivity;
import org.mariotaku.twidere.activity.support.UserListSelectorActivity;
import org.mariotaku.twidere.adapter.SourceAutoCompleteAdapter;
import org.mariotaku.twidere.adapter.UserHashtagAutoCompleteAdapter;
@ -68,7 +68,7 @@ import org.mariotaku.twidere.util.ThemeUtils;
import static org.mariotaku.twidere.util.Utils.getDefaultAccountId;
public class FiltersActivity extends BaseSupportActivity implements TabListener, OnPageChangeListener {
public class FiltersActivity extends BaseActionBarActivity implements TabListener, OnPageChangeListener {
private static final String EXTRA_AUTO_COMPLETE_TYPE = "auto_complete_type";
private static final int AUTO_COMPLETE_TYPE_SOURCES = 2;

View File

@ -15,7 +15,7 @@ import org.mariotaku.twidere.fragment.support.AccountsManagerFragment;
/**
* Created by mariotaku on 14/10/26.
*/
public class AccountsManagerActivity extends BaseSupportActivity {
public class AccountsManagerActivity extends BaseActionBarActivity {
@Override
public boolean onOptionsItemSelected(final MenuItem item) {

View File

@ -39,7 +39,7 @@ import org.mariotaku.twidere.view.MainFrameLayout.FitSystemWindowsCallback;
import java.util.ArrayList;
@SuppressLint("Registered")
public class BaseSupportActivity extends ThemedActionBarActivity implements Constants,
public class BaseActionBarActivity extends ThemedActionBarActivity implements Constants,
FitSystemWindowsCallback, SystemWindowsInsetsCallback, IControlBarActivity {
private boolean mInstanceStateSaved, mIsVisible, mIsOnTop;

View File

@ -30,7 +30,7 @@ import android.widget.Toast;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.fragment.BaseWebViewFragment;
public class BrowserActivity extends BaseSupportActivity {
public class BrowserActivity extends BaseActionBarActivity {
private Uri mUri = Uri.parse("about:blank");

View File

@ -68,6 +68,7 @@ import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
@ -148,7 +149,7 @@ import static org.mariotaku.twidere.util.Utils.getShareStatus;
import static org.mariotaku.twidere.util.Utils.showErrorMessage;
import static org.mariotaku.twidere.util.Utils.showMenuItemToast;
public class ComposeActivity extends ThemedActionBarActivity implements TextWatcher, LocationListener,
public class ComposeActivity extends ThemedFragmentActivity implements TextWatcher, LocationListener,
OnMenuItemClickListener, View.OnClickListener, OnEditorActionListener, OnLongClickListener {
private static final String FAKE_IMAGE_LINK = "https://www.example.com/fake_image.jpg";
@ -511,6 +512,15 @@ public class ComposeActivity extends ThemedActionBarActivity implements TextWatc
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) {
}
@ -547,8 +557,8 @@ public class ComposeActivity extends ThemedActionBarActivity implements TextWatc
}
@Override
public void onSupportContentChanged() {
super.onSupportContentChanged();
public void onContentChanged() {
super.onContentChanged();
mEditText = (EditText) findViewById(R.id.edit_text);
mMediaPreviewGrid = (GridView) findViewById(R.id.media_thumbnail_preview);
mMenuBar = (ActionMenuView) findViewById(R.id.menu_bar);
@ -600,7 +610,7 @@ public class ComposeActivity extends ThemedActionBarActivity implements TextWatc
mValidator = new TwidereValidator(this);
mImageLoader = app.getImageLoaderWrapper();
setContentView(R.layout.activity_compose);
setSupportProgressBarIndeterminateVisibility(false);
// setSupportProgressBarIndeterminateVisibility(false);
setFinishOnTouchOutside(false);
final long[] defaultAccountIds = getAccountIds(this);
if (defaultAccountIds.length <= 0) {

View File

@ -20,7 +20,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class DataExportActivity extends BaseSupportActivity implements FileSelectorDialogFragment.Callback,
public class DataExportActivity extends BaseActionBarActivity implements FileSelectorDialogFragment.Callback,
DataExportImportTypeSelectorDialogFragment.Callback {
private ExportSettingsTask mTask;

View File

@ -18,7 +18,7 @@ import org.mariotaku.twidere.util.ThemeUtils;
import java.io.File;
import java.io.IOException;
public class DataImportActivity extends BaseSupportActivity implements FileSelectorDialogFragment.Callback,
public class DataImportActivity extends BaseActionBarActivity implements FileSelectorDialogFragment.Callback,
DataExportImportTypeSelectorDialogFragment.Callback {
private ImportSettingsTask mImportSettingsTask;

View File

@ -71,7 +71,7 @@ import java.util.List;
import static org.mariotaku.twidere.util.Utils.getDefaultTextSize;
public class DraftsActivity extends BaseSupportActivity implements LoaderCallbacks<Cursor>, OnItemClickListener,
public class DraftsActivity extends BaseActionBarActivity implements LoaderCallbacks<Cursor>, OnItemClickListener,
MultiChoiceModeListener {
private ContentResolver mResolver;

View File

@ -128,7 +128,7 @@ import static org.mariotaku.twidere.util.Utils.openMessageConversation;
import static org.mariotaku.twidere.util.Utils.openSearch;
import static org.mariotaku.twidere.util.Utils.showMenuItemToast;
public class HomeActivity extends BaseSupportActivity implements OnClickListener, OnPageChangeListener,
public class HomeActivity extends BaseActionBarActivity implements OnClickListener, OnPageChangeListener,
SupportFragmentCallback, OnOpenedListener, OnClosedListener,
OnLongClickListener, AnimatorListener {

View File

@ -54,7 +54,7 @@ import org.mariotaku.twidere.view.TintedStatusFrameLayout;
import static org.mariotaku.twidere.util.Utils.createFragmentForIntent;
import static org.mariotaku.twidere.util.Utils.matchLinkId;
public class LinkHandlerActivity extends BaseSupportActivity implements OnClickListener,
public class LinkHandlerActivity extends BaseActionBarActivity implements OnClickListener,
OnLongClickListener, SystemWindowsInsetsCallback, IControlBarActivity {
private MultiSelectEventHandler mMultiSelectHandler;

View File

@ -25,6 +25,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
@ -74,6 +75,8 @@ import org.mariotaku.twidere.util.SwipeDismissListViewTouchListener.DismissCallb
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.util.content.ContentResolverUtils;
import org.mariotaku.twidere.view.ExtendedRelativeLayout;
import org.mariotaku.twidere.view.iface.IExtendedView.OnFitSystemWindowsListener;
import java.util.ArrayList;
import java.util.List;
@ -83,14 +86,17 @@ import static org.mariotaku.twidere.util.UserColorNameUtils.getUserNickname;
/**
* Created by mariotaku on 15/1/6.
*/
public class QuickSearchBarActivity extends BaseSupportActivity implements OnClickListener,
OnEditorActionListener, LoaderCallbacks<List<SuggestionItem>>, TextWatcher, OnItemSelectedListener, OnItemClickListener, DismissCallbacks {
public class QuickSearchBarActivity extends ThemedFragmentActivity implements OnClickListener,
OnEditorActionListener, LoaderCallbacks<List<SuggestionItem>>, TextWatcher,
OnItemSelectedListener, OnItemClickListener, DismissCallbacks, OnFitSystemWindowsListener {
private Spinner mAccountSpinner;
private EditText mSearchQuery;
private View mSearchSubmit;
private ListView mSuggestionsList;
private SuggestionsAdapter mUsersSearchAdapter;
private ExtendedRelativeLayout mMainContent;
private Rect mSystemWindowsInsets = new Rect();
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -118,6 +124,12 @@ public class QuickSearchBarActivity extends BaseSupportActivity implements OnCli
getSupportLoaderManager().restartLoader(0, null, this);
}
@Override
public void onFitSystemWindows(Rect insets) {
mSystemWindowsInsets.set(insets);
updateWindowAttributes();
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final SuggestionItem item = mUsersSearchAdapter.getItem(position);
@ -134,6 +146,11 @@ public class QuickSearchBarActivity extends BaseSupportActivity implements OnCli
}
@Override
public int getThemeColor() {
return ThemeUtils.getUserAccentColor(this, getThemeResourceId());
}
@Override
public int getThemeResourceId() {
return ThemeUtils.getQuickSearchBarThemeResource(this);
@ -156,6 +173,7 @@ public class QuickSearchBarActivity extends BaseSupportActivity implements OnCli
mAccountSpinner.setSelection(index);
}
}
mMainContent.setOnFitSystemWindowsListener(this);
mUsersSearchAdapter = new SuggestionsAdapter(this);
mSuggestionsList.setAdapter(mUsersSearchAdapter);
mSuggestionsList.setOnItemClickListener(this);
@ -186,8 +204,9 @@ public class QuickSearchBarActivity extends BaseSupportActivity implements OnCli
}
@Override
public void onSupportContentChanged() {
super.onSupportContentChanged();
public void onContentChanged() {
super.onContentChanged();
mMainContent = (ExtendedRelativeLayout) findViewById(R.id.main_content);
mAccountSpinner = (Spinner) findViewById(R.id.account_spinner);
mSearchQuery = (EditText) findViewById(R.id.search_query);
mSearchSubmit = findViewById(R.id.search_submit);
@ -248,6 +267,7 @@ public class QuickSearchBarActivity extends BaseSupportActivity implements OnCli
final Window window = getWindow();
final WindowManager.LayoutParams attributes = window.getAttributes();
attributes.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
attributes.y = mSystemWindowsInsets.top;
window.setAttributes(attributes);
}

View File

@ -84,7 +84,7 @@ import static org.mariotaku.twidere.util.Utils.isUserLoggedIn;
import static org.mariotaku.twidere.util.Utils.showErrorMessage;
import static org.mariotaku.twidere.util.Utils.trim;
public class SignInActivity extends BaseSupportActivity implements TwitterConstants, OnClickListener,
public class SignInActivity extends BaseActionBarActivity implements TwitterConstants, OnClickListener,
TextWatcher {
private static final String TWITTER_SIGNUP_URL = "https://twitter.com/signup";
@ -138,7 +138,7 @@ public class SignInActivity extends BaseSupportActivity implements TwitterConsta
break;
}
case REQUEST_BROWSER_SIGN_IN: {
if (resultCode == BaseSupportActivity.RESULT_OK && data != null) {
if (resultCode == BaseActionBarActivity.RESULT_OK && data != null) {
doLogin(data);
}
break;

View File

@ -69,7 +69,7 @@ import static org.mariotaku.twidere.util.Utils.getTwitterInstance;
import static org.mariotaku.twidere.util.Utils.isMyAccount;
import static org.mariotaku.twidere.util.Utils.showErrorMessage;
public class UserProfileEditorActivity extends BaseSupportActivity implements OnSizeChangedListener, TextWatcher,
public class UserProfileEditorActivity extends BaseActionBarActivity implements OnSizeChangedListener, TextWatcher,
OnClickListener, LoaderCallbacks<SingleResponse<ParcelableUser>> {
private static final int LOADER_ID_USER = 1;

View File

@ -27,7 +27,7 @@ import android.content.IntentFilter;
import android.content.SharedPreferences;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.activity.support.BaseSupportActivity;
import org.mariotaku.twidere.activity.support.BaseActionBarActivity;
import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
import org.mariotaku.twidere.util.MultiSelectManager;
@ -82,8 +82,8 @@ public class BaseFragment extends Fragment implements Constants {
public void setProgressBarIndeterminateVisibility(final boolean visible) {
final Activity activity = getActivity();
if (activity instanceof BaseSupportActivity) {
((BaseSupportActivity) activity).setProgressBarIndeterminateVisibility(visible);
if (activity instanceof BaseActionBarActivity) {
((BaseActionBarActivity) activity).setProgressBarIndeterminateVisibility(visible);
}
}

View File

@ -28,7 +28,7 @@ import com.squareup.otto.Subscribe;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.iface.IControlBarActivity;
import org.mariotaku.twidere.activity.iface.IControlBarActivity.ControlBarOffsetListener;
import org.mariotaku.twidere.activity.support.BaseSupportActivity;
import org.mariotaku.twidere.activity.support.BaseActionBarActivity;
import org.mariotaku.twidere.adapter.AbsStatusesAdapter;
import org.mariotaku.twidere.adapter.AbsStatusesAdapter.StatusAdapterListener;
import org.mariotaku.twidere.adapter.decorator.DividerItemDecoration;
@ -424,8 +424,8 @@ public abstract class AbsStatusesFragment<Data> extends BaseSupportFragment impl
private void setControlVisible(boolean visible) {
final FragmentActivity activity = getActivity();
if (activity instanceof BaseSupportActivity) {
((BaseSupportActivity) activity).setControlBarVisibleAnimate(visible);
if (activity instanceof BaseActionBarActivity) {
((BaseActionBarActivity) activity).setControlBarVisibleAnimate(visible);
}
}

View File

@ -32,7 +32,7 @@ import android.support.v4.app.FragmentActivity;
import android.view.View;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.activity.support.BaseSupportActivity;
import org.mariotaku.twidere.activity.support.BaseActionBarActivity;
import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.fragment.iface.IBaseFragment;
import org.mariotaku.twidere.fragment.iface.SupportFragmentCallback;
@ -98,8 +98,8 @@ public class BaseSupportFragment extends Fragment implements IBaseFragment, Cons
public void setProgressBarIndeterminateVisibility(final boolean visible) {
final Activity activity = getActivity();
if (activity instanceof BaseSupportActivity) {
((BaseSupportActivity) activity).setProgressBarIndeterminateVisibility(visible);
if (activity instanceof BaseActionBarActivity) {
((BaseActionBarActivity) activity).setProgressBarIndeterminateVisibility(visible);
}
}

View File

@ -68,7 +68,7 @@ import org.mariotaku.querybuilder.Expression;
import org.mariotaku.querybuilder.OrderBy;
import org.mariotaku.querybuilder.RawItemArray;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.support.BaseSupportActivity;
import org.mariotaku.twidere.activity.support.BaseActionBarActivity;
import org.mariotaku.twidere.activity.support.ImagePickerActivity;
import org.mariotaku.twidere.adapter.AccountsSpinnerAdapter;
import org.mariotaku.twidere.adapter.MessageConversationAdapter;
@ -196,7 +196,7 @@ public class DirectMessagesConversationFragment extends BaseSupportFragment impl
if (view == null) throw new AssertionError();
final Context viewContext = view.getContext();
setHasOptionsMenu(true);
final BaseSupportActivity activity = (BaseSupportActivity) getActivity();
final BaseActionBarActivity activity = (BaseActionBarActivity) getActivity();
final ActionBar actionBar = activity.getSupportActionBar();
if (actionBar == null) throw new NullPointerException();
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
@ -632,7 +632,7 @@ public class DirectMessagesConversationFragment extends BaseSupportFragment impl
}
private void updateActionBar() {
final BaseSupportActivity activity = (BaseSupportActivity) getActivity();
final BaseActionBarActivity activity = (BaseActionBarActivity) getActivity();
final ActionBar actionBar = activity.getSupportActionBar();
if (actionBar == null) return;
actionBar.setDisplayOptions(mRecipient != null ? ActionBar.DISPLAY_SHOW_TITLE : ActionBar.DISPLAY_SHOW_CUSTOM,

View File

@ -33,7 +33,7 @@ import com.twitter.Extractor;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.support.BaseSupportActivity;
import org.mariotaku.twidere.activity.support.BaseActionBarActivity;
import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.menu.AccountActionProvider;
import org.mariotaku.twidere.model.ParcelableAccount;
@ -64,13 +64,13 @@ public class MultiSelectEventHandler implements Constants, ActionMode.Callback,
private ActionMode mActionMode;
private final BaseSupportActivity mActivity;
private final BaseActionBarActivity mActivity;
private AccountActionProvider mAccountActionProvider;
public static final int MENU_GROUP = 201;
public MultiSelectEventHandler(final BaseSupportActivity activity) {
public MultiSelectEventHandler(final BaseActionBarActivity activity) {
mActivity = activity;
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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/>.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#3e3e3e"/>
<size android:height="1dp"/>
</shape>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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/>.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#e0e0e0"/>
<size android:height="1dp"/>
</shape>

View File

@ -121,8 +121,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="?android:colorBackground"
android:divider="?dividerVertical"
android:background="?android:panelColorBackground"
android:divider="?android:dividerVertical"
android:orientation="vertical"
android:showDividers="beginning">

View File

@ -18,12 +18,13 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout
<org.mariotaku.twidere.view.ExtendedRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/main_content"
android:padding="@dimen/element_spacing_normal">
<android.support.v7.widget.CardView
@ -91,4 +92,4 @@
</android.support.v7.widget.CardView>
</RelativeLayout>
</org.mariotaku.twidere.view.ExtendedRelativeLayout>

View File

@ -187,12 +187,16 @@
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:panelColorBackground">#3c3c3c</item>
<item name="android:dividerVertical">@drawable/divider_compose_vertical_dark</item>
</style>
<style name="Theme.Twidere.Light.Compose" parent="Theme.Compat.Base.Light.Dialog">
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:panelColorBackground">#e5e5e5</item>
<item name="android:dividerVertical">@drawable/divider_compose_vertical_light</item>
</style>
<style name="Theme.Twidere.Light.QuickSearchBar" parent="Theme.Twidere.Light.Dialog">