improved theme
This commit is contained in:
parent
0e452a4f59
commit
d7b304af98
|
@ -0,0 +1,23 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /Users/mariotaku/Tools/android-sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
-keepclassmembers class android.support.v7.internal.app.WindowDecorActionBar {
|
||||
private mContextView;
|
||||
}
|
||||
-keepclassmembers class android.support.v7.internal.widget.ActionBarOverlayLayout {
|
||||
private mWindowContentOverlay;
|
||||
}
|
|
@ -232,7 +232,9 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:name=".activity.FiltersActivity"
|
||||
android:label="@string/filters">
|
||||
android:label="@string/filters"
|
||||
android:theme="@style/Theme.Twidere.Dark.DialogWhenLarge"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.FILTERS"/>
|
||||
|
||||
|
@ -277,8 +279,8 @@
|
|||
android:label="@string/set_color"
|
||||
android:theme="@style/Theme.Twidere.Light.NoDisplay"/>
|
||||
<activity
|
||||
android:theme="@style/Theme.Twidere.Dark.DialogWhenLarge"
|
||||
android:name=".activity.support.LinkHandlerActivity"
|
||||
android:theme="@style/Theme.Twidere.Dark.DialogWhenLarge"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
|
|
|
@ -19,85 +19,44 @@
|
|||
|
||||
package org.mariotaku.twidere.activity;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Rect;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v4.view.ViewPager.OnPageChangeListener;
|
||||
import android.support.v4.view.WindowCompat;
|
||||
import android.support.v4.widget.SimpleCursorAdapter;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.ActionBar.Tab;
|
||||
import android.support.v7.app.ActionBar.TabListener;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.view.WindowManager.LayoutParams;
|
||||
|
||||
import org.mariotaku.querybuilder.Expression;
|
||||
import org.mariotaku.twidere.R;
|
||||
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;
|
||||
import org.mariotaku.twidere.adapter.support.SupportTabsAdapter;
|
||||
import org.mariotaku.twidere.fragment.BaseFiltersFragment;
|
||||
import org.mariotaku.twidere.fragment.BaseFiltersFragment.FilteredKeywordsFragment;
|
||||
import org.mariotaku.twidere.fragment.BaseFiltersFragment.FilteredLinksFragment;
|
||||
import org.mariotaku.twidere.fragment.BaseFiltersFragment.FilteredSourcesFragment;
|
||||
import org.mariotaku.twidere.fragment.BaseFiltersFragment.FilteredUsersFragment;
|
||||
import org.mariotaku.twidere.fragment.support.BaseSupportDialogFragment;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.Filters;
|
||||
import org.mariotaku.twidere.util.ContentValuesCreator;
|
||||
import org.mariotaku.twidere.util.ParseUtils;
|
||||
import org.mariotaku.twidere.graphic.EmptyDrawable;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.view.TabPagerIndicator;
|
||||
import org.mariotaku.twidere.view.TintedStatusFrameLayout;
|
||||
|
||||
import static org.mariotaku.twidere.util.Utils.getDefaultAccountId;
|
||||
|
||||
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;
|
||||
public class FiltersActivity extends BaseActionBarActivity {
|
||||
|
||||
private TintedStatusFrameLayout mMainContent;
|
||||
private TabPagerIndicator mPagerIndicator;
|
||||
private ViewPager mViewPager;
|
||||
|
||||
private SupportTabsAdapter mAdapter;
|
||||
|
||||
private ActionBar mActionBar;
|
||||
private SharedPreferences mPreferences;
|
||||
|
||||
@Override
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
public boolean getSystemWindowsInsets(Rect insets) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_filters, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(final Menu menu) {
|
||||
return true;
|
||||
public void onFitSystemWindows(Rect insets) {
|
||||
super.onFitSystemWindows(insets);
|
||||
mMainContent.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -107,163 +66,58 @@ public class FiltersActivity extends BaseActionBarActivity implements TabListene
|
|||
NavUtils.navigateUpFromSameTask(this);
|
||||
return true;
|
||||
}
|
||||
case MENU_ADD: {
|
||||
final Fragment f = mAdapter.getItem(mViewPager.getCurrentItem());
|
||||
if (!(f instanceof BaseFiltersFragment)) return true;
|
||||
final Bundle args = new Bundle();
|
||||
if (f instanceof FilteredUsersFragment) {
|
||||
final Intent intent = new Intent(INTENT_ACTION_SELECT_USER);
|
||||
intent.setClass(this, UserListSelectorActivity.class);
|
||||
intent.putExtra(EXTRA_ACCOUNT_ID, getDefaultAccountId(this));
|
||||
startActivityForResult(intent, REQUEST_SELECT_USER);
|
||||
return true;
|
||||
}
|
||||
if (f instanceof FilteredSourcesFragment) {
|
||||
args.putInt(EXTRA_AUTO_COMPLETE_TYPE, AUTO_COMPLETE_TYPE_SOURCES);
|
||||
}
|
||||
args.putParcelable(EXTRA_URI, ((BaseFiltersFragment) f).getContentUri());
|
||||
final AddItemFragment dialog = new AddItemFragment();
|
||||
dialog.setArguments(args);
|
||||
dialog.show(getSupportFragmentManager(), "add_rule");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public 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_OVERLAY);
|
||||
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_MODE_OVERLAY);
|
||||
super.onCreate(savedInstanceState);
|
||||
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE);
|
||||
setContentView(R.layout.activity_filters);
|
||||
mActionBar = getSupportActionBar();
|
||||
mAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), null);
|
||||
mActionBar.setDisplayHomeAsUpEnabled(true);
|
||||
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
addTab(FilteredUsersFragment.class, R.string.users, 0);
|
||||
addTab(FilteredKeywordsFragment.class, R.string.keywords, 1);
|
||||
addTab(FilteredSourcesFragment.class, R.string.sources, 2);
|
||||
addTab(FilteredLinksFragment.class, R.string.links, 3);
|
||||
ThemeUtils.applyActionBarBackground(getSupportActionBar(), this, getCurrentThemeResourceId(),
|
||||
getCurrentThemeColor(), false);
|
||||
setContentView(R.layout.activity_content_pages);
|
||||
mMainContent.setOnFitSystemWindowsListener(this);
|
||||
mAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), null, 1);
|
||||
mViewPager.setAdapter(mAdapter);
|
||||
mViewPager.setOnPageChangeListener(this);
|
||||
}
|
||||
mViewPager.setOffscreenPageLimit(2);
|
||||
mPagerIndicator.setViewPager(mViewPager);
|
||||
mPagerIndicator.setTabDisplayOption(TabPagerIndicator.LABEL);
|
||||
|
||||
@Override
|
||||
public boolean getSystemWindowsInsets(Rect insets) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(final int position, final float positionOffset, final int positionOffsetPixels) {
|
||||
}
|
||||
mAdapter.addTab(FilteredUsersFragment.class, null, getString(R.string.users), null, 0, null);
|
||||
mAdapter.addTab(FilteredKeywordsFragment.class, null, getString(R.string.keywords), null, 1, null);
|
||||
mAdapter.addTab(FilteredSourcesFragment.class, null, getString(R.string.sources), null, 2, null);
|
||||
mAdapter.addTab(FilteredLinksFragment.class, null, getString(R.string.links), null, 3, null);
|
||||
|
||||
@Override
|
||||
public void onPageSelected(final int position) {
|
||||
if (mActionBar == null) return;
|
||||
mActionBar.setSelectedNavigationItem(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(final int state) {
|
||||
ThemeUtils.initPagerIndicatorAsActionBarTab(this, mPagerIndicator);
|
||||
ThemeUtils.setCompatToolbarOverlay(this, new EmptyDrawable());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabSelected(final Tab tab, final FragmentTransaction ft) {
|
||||
mViewPager.setCurrentItem(tab.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(final Tab tab, final FragmentTransaction ft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(final Tab tab, final FragmentTransaction ft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_SELECT_USER: {
|
||||
final Fragment filter = mAdapter.getItem(mViewPager.getCurrentItem());
|
||||
if (resultCode != RESULT_OK || !(filter instanceof FilteredUsersFragment) || !data.hasExtra(EXTRA_USER))
|
||||
return;
|
||||
final ParcelableUser user = data.getParcelableExtra(EXTRA_USER);
|
||||
final ContentValues values = ContentValuesCreator.createFilteredUser(user);
|
||||
final ContentResolver resolver = getContentResolver();
|
||||
resolver.delete(Filters.Users.CONTENT_URI, Expression.equals(Filters.Users.USER_ID, user.id).getSQL(), null);
|
||||
resolver.insert(Filters.Users.CONTENT_URI, values);
|
||||
break;
|
||||
}
|
||||
mMainContent.setDrawShadow(false);
|
||||
mMainContent.setDrawColor(true);
|
||||
mMainContent.setFactor(1);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private void addTab(final Class<? extends Fragment> cls, final int name, final int position) {
|
||||
if (mActionBar == null || mAdapter == null) return;
|
||||
mActionBar.addTab(mActionBar.newTab().setText(name).setTabListener(this));
|
||||
mAdapter.addTab(cls, null, getString(name), null, position, null);
|
||||
@Override
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content);
|
||||
mViewPager = (ViewPager) findViewById(R.id.view_pager);
|
||||
mPagerIndicator = (TabPagerIndicator) findViewById(R.id.view_pager_tabs);
|
||||
}
|
||||
|
||||
public static final class AddItemFragment extends BaseSupportDialogFragment implements OnClickListener {
|
||||
|
||||
private AutoCompleteTextView mEditText;
|
||||
|
||||
private SimpleCursorAdapter mUserAutoCompleteAdapter;
|
||||
|
||||
@Override
|
||||
public void onClick(final DialogInterface dialog, final int which) {
|
||||
switch (which) {
|
||||
case DialogInterface.BUTTON_POSITIVE:
|
||||
if (mEditText.length() <= 0) return;
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(Filters.VALUE, getText());
|
||||
final Bundle args = getArguments();
|
||||
final Uri uri = args.getParcelable(EXTRA_URI);
|
||||
getContentResolver().insert(uri, values);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||
final FragmentActivity activity = getActivity();
|
||||
final Context wrapped = ThemeUtils.getDialogThemedContext(activity);
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped);
|
||||
buildDialog(builder);
|
||||
final View view = LayoutInflater.from(wrapped).inflate(R.layout.auto_complete_textview, null);
|
||||
builder.setView(view);
|
||||
mEditText = (AutoCompleteTextView) view.findViewById(R.id.edit_text);
|
||||
final Bundle args = getArguments();
|
||||
final int auto_complete_type = args != null ? args.getInt(EXTRA_AUTO_COMPLETE_TYPE, 0) : 0;
|
||||
if (auto_complete_type != 0) {
|
||||
if (auto_complete_type == AUTO_COMPLETE_TYPE_SOURCES) {
|
||||
mUserAutoCompleteAdapter = new SourceAutoCompleteAdapter(activity);
|
||||
} else {
|
||||
final UserHashtagAutoCompleteAdapter adapter = new UserHashtagAutoCompleteAdapter(activity);
|
||||
adapter.setAccountId(Utils.getDefaultAccountId(activity));
|
||||
mUserAutoCompleteAdapter = adapter;
|
||||
}
|
||||
mEditText.setAdapter(mUserAutoCompleteAdapter);
|
||||
mEditText.setThreshold(1);
|
||||
}
|
||||
builder.setTitle(R.string.add_rule);
|
||||
builder.setPositiveButton(android.R.string.ok, this);
|
||||
builder.setNegativeButton(android.R.string.cancel, this);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
protected String getText() {
|
||||
return ParseUtils.parseString(mEditText.getText());
|
||||
}
|
||||
|
||||
private void buildDialog(final Builder builder) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ public class LinkHandlerActivity extends BaseActionBarActivity implements System
|
|||
mMainContent.setDrawColor(true);
|
||||
mMainContent.setFactor(1);
|
||||
final int color = getCurrentThemeColor();
|
||||
final int alpha = getCurrentThemeBackgroundAlpha();
|
||||
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 {
|
||||
|
|
|
@ -87,6 +87,13 @@ public abstract class ThemedActionBarActivity extends ActionBarActivity implemen
|
|||
restartActivity(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSupportActionModeStarted(android.support.v7.view.ActionMode mode) {
|
||||
super.onSupportActionModeStarted(mode);
|
||||
ThemeUtils.applySupportActionModeBackground(mode, this, getCurrentThemeResourceId(),
|
||||
getCurrentThemeColor(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
if (Utils.isDebugBuild()) {
|
||||
|
|
|
@ -19,9 +19,15 @@
|
|||
|
||||
package org.mariotaku.twidere.fragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -30,6 +36,7 @@ import android.database.Cursor;
|
|||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
|
@ -37,10 +44,12 @@ import android.util.SparseBooleanArray;
|
|||
import android.view.ActionMode;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView.MultiChoiceModeListener;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.TextView;
|
||||
|
@ -49,21 +58,27 @@ import org.mariotaku.querybuilder.Columns.Column;
|
|||
import org.mariotaku.querybuilder.Expression;
|
||||
import org.mariotaku.querybuilder.RawItemArray;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.activity.support.UserListSelectorActivity;
|
||||
import org.mariotaku.twidere.adapter.SourceAutoCompleteAdapter;
|
||||
import org.mariotaku.twidere.adapter.UserHashtagAutoCompleteAdapter;
|
||||
import org.mariotaku.twidere.fragment.support.BaseSupportDialogFragment;
|
||||
import org.mariotaku.twidere.fragment.support.BaseSupportListFragment;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.Filters;
|
||||
import org.mariotaku.twidere.util.ContentValuesCreator;
|
||||
import org.mariotaku.twidere.util.ParseUtils;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.UserColorNameUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
import static org.mariotaku.twidere.util.Utils.getDefaultAccountId;
|
||||
|
||||
public abstract class BaseFiltersFragment extends BaseSupportListFragment implements LoaderManager.LoaderCallbacks<Cursor>,
|
||||
MultiChoiceModeListener {
|
||||
|
||||
private ListView mListView;
|
||||
|
||||
private SimpleCursorAdapter mAdapter;
|
||||
|
||||
private ContentResolver mResolver;
|
||||
|
||||
private ActionMode mActionMode;
|
||||
|
||||
private static final String EXTRA_AUTO_COMPLETE_TYPE = "auto_complete_type";
|
||||
private static final int AUTO_COMPLETE_TYPE_SOURCES = 2;
|
||||
private final BroadcastReceiver mStateReceiver = new BroadcastReceiver() {
|
||||
|
||||
@Override
|
||||
|
@ -76,9 +91,74 @@ public abstract class BaseFiltersFragment extends BaseSupportListFragment implem
|
|||
}
|
||||
|
||||
};
|
||||
private ListView mListView;
|
||||
private SimpleCursorAdapter mAdapter;
|
||||
private ContentResolver mResolver;
|
||||
private ActionMode mActionMode;
|
||||
|
||||
public abstract Uri getContentUri();
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
mResolver = getContentResolver();
|
||||
mAdapter = createListAdapter();
|
||||
setListAdapter(mAdapter);
|
||||
mListView = getListView();
|
||||
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
|
||||
mListView.setMultiChoiceModeListener(this);
|
||||
setEmptyText(getString(R.string.no_rule));
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
setListShown(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
|
||||
final View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
final View lv = view.findViewById(android.R.id.list);
|
||||
final Resources res = getResources();
|
||||
final float density = res.getDisplayMetrics().density;
|
||||
final int padding = (int) density * 16;
|
||||
lv.setId(android.R.id.list);
|
||||
lv.setPadding(padding, 0, padding, 0);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
final IntentFilter filter = new IntentFilter(BROADCAST_FILTERS_UPDATED);
|
||||
registerReceiver(mStateReceiver, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
unregisterReceiver(mStateReceiver);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(final boolean isVisibleToUser) {
|
||||
super.setUserVisibleHint(isVisibleToUser);
|
||||
if (!isVisibleToUser && mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateActionMode(final ActionMode mode, final Menu menu) {
|
||||
mActionMode = mode;
|
||||
mode.getMenuInflater().inflate(R.menu.action_multi_select_items, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareActionMode(final ActionMode mode, final Menu menu) {
|
||||
updateTitle(mode);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionItemClicked(final ActionMode mode, final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
@ -102,58 +182,14 @@ public abstract class BaseFiltersFragment extends BaseSupportListFragment implem
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
mResolver = getContentResolver();
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mAdapter = createListAdapter();
|
||||
setListAdapter(mAdapter);
|
||||
mListView = getListView();
|
||||
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
|
||||
mListView.setMultiChoiceModeListener(this);
|
||||
setEmptyText(getString(R.string.no_rule));
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
setListShown(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateActionMode(final ActionMode mode, final Menu menu) {
|
||||
mActionMode = mode;
|
||||
getActivity().getMenuInflater().inflate(R.menu.action_multi_select_items, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(final int id, final Bundle args) {
|
||||
return new CursorLoader(getActivity(), getContentUri(), getContentColumns(), null, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
|
||||
final View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
final View lv = view.findViewById(android.R.id.list);
|
||||
final Resources res = getResources();
|
||||
final float density = res.getDisplayMetrics().density;
|
||||
final int padding = (int) density * 16;
|
||||
lv.setId(android.R.id.list);
|
||||
lv.setPadding(padding, 0, padding, 0);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(final ActionMode mode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemCheckedStateChanged(final ActionMode mode, final int position, final long id,
|
||||
final boolean checked) {
|
||||
updateTitle(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(final Loader<Cursor> loader) {
|
||||
mAdapter.swapCursor(null);
|
||||
public Loader<Cursor> onCreateLoader(final int id, final Bundle args) {
|
||||
return new CursorLoader(getActivity(), getContentUri(), getContentColumns(), null, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -163,30 +199,34 @@ public abstract class BaseFiltersFragment extends BaseSupportListFragment implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareActionMode(final ActionMode mode, final Menu menu) {
|
||||
updateTitle(mode);
|
||||
return true;
|
||||
public void onLoaderReset(final Loader<Cursor> loader) {
|
||||
mAdapter.swapCursor(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
final IntentFilter filter = new IntentFilter(BROADCAST_FILTERS_UPDATED);
|
||||
registerReceiver(mStateReceiver, filter);
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.menu_filters, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
unregisterReceiver(mStateReceiver);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(final boolean isVisibleToUser) {
|
||||
super.setUserVisibleHint(isVisibleToUser);
|
||||
if (!isVisibleToUser && mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case MENU_ADD: {
|
||||
final Bundle args = new Bundle();
|
||||
args.putParcelable(EXTRA_URI, getContentUri());
|
||||
final AddItemFragment dialog = new AddItemFragment();
|
||||
dialog.setArguments(args);
|
||||
dialog.show(getFragmentManager(), "add_rule");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemCheckedStateChanged(final ActionMode mode, final int position, final long id,
|
||||
final boolean checked) {
|
||||
updateTitle(mode);
|
||||
}
|
||||
|
||||
protected SimpleCursorAdapter createListAdapter() {
|
||||
|
@ -201,17 +241,89 @@ public abstract class BaseFiltersFragment extends BaseSupportListFragment implem
|
|||
mode.setTitle(getResources().getQuantityString(R.plurals.Nitems_selected, count, count));
|
||||
}
|
||||
|
||||
public static final class AddItemFragment extends BaseSupportDialogFragment implements OnClickListener {
|
||||
|
||||
private AutoCompleteTextView mEditText;
|
||||
|
||||
private android.support.v4.widget.SimpleCursorAdapter mUserAutoCompleteAdapter;
|
||||
|
||||
@Override
|
||||
public void onClick(final DialogInterface dialog, final int which) {
|
||||
switch (which) {
|
||||
case DialogInterface.BUTTON_POSITIVE:
|
||||
if (mEditText.length() <= 0) return;
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(Filters.VALUE, getText());
|
||||
final Bundle args = getArguments();
|
||||
final Uri uri = args.getParcelable(EXTRA_URI);
|
||||
getContentResolver().insert(uri, values);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||
final FragmentActivity activity = getActivity();
|
||||
final Context wrapped = ThemeUtils.getDialogThemedContext(activity);
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped);
|
||||
buildDialog(builder);
|
||||
final View view = LayoutInflater.from(wrapped).inflate(R.layout.auto_complete_textview, null);
|
||||
builder.setView(view);
|
||||
mEditText = (AutoCompleteTextView) view.findViewById(R.id.edit_text);
|
||||
final Bundle args = getArguments();
|
||||
final int auto_complete_type = args != null ? args.getInt(EXTRA_AUTO_COMPLETE_TYPE, 0) : 0;
|
||||
if (auto_complete_type != 0) {
|
||||
if (auto_complete_type == AUTO_COMPLETE_TYPE_SOURCES) {
|
||||
mUserAutoCompleteAdapter = new SourceAutoCompleteAdapter(activity);
|
||||
} else {
|
||||
final UserHashtagAutoCompleteAdapter adapter = new UserHashtagAutoCompleteAdapter(activity);
|
||||
adapter.setAccountId(Utils.getDefaultAccountId(activity));
|
||||
mUserAutoCompleteAdapter = adapter;
|
||||
}
|
||||
mEditText.setAdapter(mUserAutoCompleteAdapter);
|
||||
mEditText.setThreshold(1);
|
||||
}
|
||||
builder.setTitle(R.string.add_rule);
|
||||
builder.setPositiveButton(android.R.string.ok, this);
|
||||
builder.setNegativeButton(android.R.string.cancel, this);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
protected String getText() {
|
||||
return ParseUtils.parseString(mEditText.getText());
|
||||
}
|
||||
|
||||
private void buildDialog(final Builder builder) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static final class FilterListAdapter extends SimpleCursorAdapter {
|
||||
|
||||
private static final String[] from = new String[]{Filters.VALUE};
|
||||
|
||||
private static final int[] to = new int[]{android.R.id.text1};
|
||||
|
||||
public FilterListAdapter(final Context context) {
|
||||
super(context, android.R.layout.simple_list_item_activated_1, null, from, to, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final class FilteredKeywordsFragment extends BaseFiltersFragment {
|
||||
|
||||
@Override
|
||||
public Uri getContentUri() {
|
||||
return Filters.Keywords.CONTENT_URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getContentColumns() {
|
||||
return Filters.Keywords.COLUMNS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri getContentUri() {
|
||||
return Filters.Keywords.CONTENT_URI;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -241,10 +353,79 @@ public abstract class BaseFiltersFragment extends BaseSupportListFragment implem
|
|||
return Filters.Sources.CONTENT_URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case MENU_ADD: {
|
||||
final Bundle args = new Bundle();
|
||||
args.putInt(EXTRA_AUTO_COMPLETE_TYPE, AUTO_COMPLETE_TYPE_SOURCES);
|
||||
args.putParcelable(EXTRA_URI, getContentUri());
|
||||
final AddItemFragment dialog = new AddItemFragment();
|
||||
dialog.setArguments(args);
|
||||
dialog.show(getFragmentManager(), "add_rule");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final class FilteredUsersFragment extends BaseFiltersFragment {
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_SELECT_USER: {
|
||||
if (resultCode != FragmentActivity.RESULT_OK || !data.hasExtra(EXTRA_USER))
|
||||
return;
|
||||
final ParcelableUser user = data.getParcelableExtra(EXTRA_USER);
|
||||
final ContentValues values = ContentValuesCreator.createFilteredUser(user);
|
||||
final ContentResolver resolver = getContentResolver();
|
||||
resolver.delete(Filters.Users.CONTENT_URI, Expression.equals(Filters.Users.USER_ID, user.id).getSQL(), null);
|
||||
resolver.insert(Filters.Users.CONTENT_URI, values);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final class FilterUsersListAdapter extends SimpleCursorAdapter {
|
||||
|
||||
private final boolean mNameFirst;
|
||||
private int mUserIdIdx, mNameIdx, mScreenNameIdx;
|
||||
|
||||
public FilterUsersListAdapter(final Context context) {
|
||||
super(context, android.R.layout.simple_list_item_activated_1, null, new String[0], new int[0], 0);
|
||||
final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME,
|
||||
Context.MODE_PRIVATE);
|
||||
mNameFirst = prefs.getBoolean(KEY_NAME_FIRST, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindView(@NonNull final View view, final Context context, @NonNull final Cursor cursor) {
|
||||
super.bindView(view, context, cursor);
|
||||
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
final long userId = cursor.getLong(mUserIdIdx);
|
||||
final String name = cursor.getString(mNameIdx);
|
||||
final String screenName = cursor.getString(mScreenNameIdx);
|
||||
final String displayName = UserColorNameUtils.getDisplayName(context, userId, name, screenName, mNameFirst);
|
||||
text1.setText(displayName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor swapCursor(final Cursor c) {
|
||||
final Cursor old = super.swapCursor(c);
|
||||
if (c != null) {
|
||||
mUserIdIdx = c.getColumnIndex(Filters.Users.USER_ID);
|
||||
mNameIdx = c.getColumnIndex(Filters.Users.NAME);
|
||||
mScreenNameIdx = c.getColumnIndex(Filters.Users.SCREEN_NAME);
|
||||
}
|
||||
return old;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getContentColumns() {
|
||||
return Filters.Users.COLUMNS;
|
||||
|
@ -260,53 +441,20 @@ public abstract class BaseFiltersFragment extends BaseSupportListFragment implem
|
|||
return new FilterUsersListAdapter(getActivity());
|
||||
}
|
||||
|
||||
private static final class FilterUsersListAdapter extends SimpleCursorAdapter {
|
||||
|
||||
private int mUserIdIdx, mNameIdx, mScreenNameIdx;
|
||||
|
||||
private final boolean mNameFirst;
|
||||
|
||||
public FilterUsersListAdapter(final Context context) {
|
||||
super(context, android.R.layout.simple_list_item_activated_1, null, new String[0], new int[0], 0);
|
||||
final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME,
|
||||
Context.MODE_PRIVATE);
|
||||
mNameFirst = prefs.getBoolean(KEY_NAME_FIRST, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindView(@NonNull final View view, final Context context, @NonNull final Cursor cursor) {
|
||||
super.bindView(view, context, cursor);
|
||||
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
final long user_id = cursor.getLong(mUserIdIdx);
|
||||
final String name = cursor.getString(mNameIdx);
|
||||
final String screen_name = cursor.getString(mScreenNameIdx);
|
||||
final String display_name = UserColorNameUtils.getDisplayName(context, user_id, name, screen_name, mNameFirst);
|
||||
text1.setText(display_name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor swapCursor(final Cursor c) {
|
||||
final Cursor old = super.swapCursor(c);
|
||||
if (c != null) {
|
||||
mUserIdIdx = c.getColumnIndex(Filters.Users.USER_ID);
|
||||
mNameIdx = c.getColumnIndex(Filters.Users.NAME);
|
||||
mScreenNameIdx = c.getColumnIndex(Filters.Users.SCREEN_NAME);
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case MENU_ADD: {
|
||||
final Intent intent = new Intent(INTENT_ACTION_SELECT_USER);
|
||||
intent.setClass(getActivity(), UserListSelectorActivity.class);
|
||||
intent.putExtra(EXTRA_ACCOUNT_ID, getDefaultAccountId(getActivity()));
|
||||
startActivityForResult(intent, REQUEST_SELECT_USER);
|
||||
return true;
|
||||
}
|
||||
return old;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class FilterListAdapter extends SimpleCursorAdapter {
|
||||
|
||||
private static final String[] from = new String[]{Filters.VALUE};
|
||||
|
||||
private static final int[] to = new int[]{android.R.id.text1};
|
||||
|
||||
public FilterListAdapter(final Context context) {
|
||||
super(context, android.R.layout.simple_list_item_activated_1, null, from, to, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,6 @@ import android.os.Bundle;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
|
||||
import org.mariotaku.twidere.adapter.AbsUsersAdapter;
|
||||
import org.mariotaku.twidere.loader.iface.IExtendedLoader;
|
||||
|
@ -56,32 +53,10 @@ abstract class AbsUsersFragment<Data> extends AbsContentListFragment<AbsUsersAda
|
|||
@Override
|
||||
public void onLoadFinished(Loader<Data> loader, Data data) {
|
||||
final AbsUsersAdapter<Data> adapter = getAdapter();
|
||||
final long lastReadId;
|
||||
final int lastVisiblePos, lastVisibleTop;
|
||||
final LinearLayoutManager layoutManager = getLayoutManager();
|
||||
lastVisiblePos = layoutManager.findFirstVisibleItemPosition();
|
||||
if (lastVisiblePos != RecyclerView.NO_POSITION) {
|
||||
lastReadId = adapter.getUserId(lastVisiblePos);
|
||||
final View positionView = layoutManager.findViewByPosition(lastVisiblePos);
|
||||
lastVisibleTop = positionView != null ? positionView.getTop() : 0;
|
||||
} else {
|
||||
lastReadId = -1;
|
||||
lastVisibleTop = 0;
|
||||
}
|
||||
adapter.setData(data);
|
||||
if (!(loader instanceof IExtendedLoader) || ((IExtendedLoader) loader).isFromUser()) {
|
||||
adapter.setLoadMoreSupported(hasMoreData(data));
|
||||
setRefreshEnabled(true);
|
||||
int pos = -1;
|
||||
for (int i = 0, j = adapter.getItemCount(); i < j; i++) {
|
||||
if (lastReadId != -1 && lastReadId == adapter.getUserId(i)) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos != -1 && adapter.isUser(pos) && (lastVisiblePos != 0)) {
|
||||
layoutManager.scrollToPositionWithOffset(pos, lastVisibleTop);
|
||||
}
|
||||
}
|
||||
if (loader instanceof IExtendedLoader) {
|
||||
((IExtendedLoader) loader).setFromUser(false);
|
||||
|
|
|
@ -96,9 +96,9 @@ import org.mariotaku.twidere.util.AsyncTaskUtils;
|
|||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
import org.mariotaku.twidere.util.ClipboardUtils;
|
||||
import org.mariotaku.twidere.util.CompareUtils;
|
||||
import org.mariotaku.twidere.util.MediaLoadingHandler;
|
||||
import org.mariotaku.twidere.util.LinkCreator;
|
||||
import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
||||
import org.mariotaku.twidere.util.MediaLoadingHandler;
|
||||
import org.mariotaku.twidere.util.MenuUtils;
|
||||
import org.mariotaku.twidere.util.SharedPreferencesWrapper;
|
||||
import org.mariotaku.twidere.util.StatusAdapterLinkClickHandler;
|
||||
|
@ -854,8 +854,8 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
|
||||
textView.setMovementMethod(StatusContentMovementMethod.getInstance());
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
quoteTextView.setCustomSelectionActionModeCallback(new StatusActionModeCallback(quoteTextView, fragment, activity));
|
||||
textView.setCustomSelectionActionModeCallback(new StatusActionModeCallback(textView, fragment, activity));
|
||||
quoteTextView.setCustomSelectionActionModeCallback(new StatusActionModeCallback(quoteTextView, fragment, activity));
|
||||
textView.setCustomSelectionActionModeCallback(new StatusActionModeCallback(textView, fragment, activity));
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -873,12 +873,6 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
final FragmentActivity activity = fragment.getActivity();
|
||||
if (activity instanceof IThemedActivity) {
|
||||
final int themeRes = ((IThemedActivity) activity).getCurrentThemeResourceId();
|
||||
final int accentColor = ((IThemedActivity) activity).getCurrentThemeColor();
|
||||
ThemeUtils.applySupportActionModeBackground(mode, fragment.getActivity(), themeRes, accentColor, true);
|
||||
}
|
||||
mode.getMenuInflater().inflate(R.menu.action_status_text_selection, menu);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -190,8 +190,13 @@ public class ThemeUtils implements Constants {
|
|||
// Very dirty implementation
|
||||
if (!(mode instanceof SupportActionModeWrapper) || !(activity instanceof IThemedActivity))
|
||||
return;
|
||||
final android.support.v7.view.ActionMode modeCompat =
|
||||
SupportActionModeWrapperTrojan.getWrappedObject((SupportActionModeWrapper) mode);
|
||||
final android.support.v7.view.ActionMode modeCompat = SupportActionModeWrapperTrojan.getWrappedObject((SupportActionModeWrapper) mode);
|
||||
applySupportActionModeBackground(modeCompat, activity, themeRes, accentColor, outlineEnabled);
|
||||
}
|
||||
|
||||
public static void applySupportActionModeBackground(android.support.v7.view.ActionMode modeCompat,
|
||||
FragmentActivity activity, int themeRes,
|
||||
int accentColor, boolean outlineEnabled) {
|
||||
if (!(modeCompat instanceof ActionModeImpl)) return;
|
||||
try {
|
||||
WindowDecorActionBar actionBar = null;
|
||||
|
@ -921,6 +926,12 @@ public class ThemeUtils implements Constants {
|
|||
}
|
||||
}
|
||||
|
||||
public static void setCompatToolbarOverlayMode(Activity activity, boolean mode) {
|
||||
final View view = activity.getWindow().findViewById(android.support.v7.appcompat.R.id.decor_content_parent);
|
||||
if (!(view instanceof ActionBarOverlayLayout)) return;
|
||||
((ActionBarOverlayLayout) view).setOverlayMode(mode);
|
||||
}
|
||||
|
||||
public static void setupDrawerBackground(Context context, View view) {
|
||||
if (!(context instanceof IThemedActivity)) return;
|
||||
final int themeRes = ((IThemedActivity) context).getCurrentThemeResourceId();
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?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/>.
|
||||
-->
|
||||
|
||||
<org.mariotaku.twidere.view.TintedStatusFrameLayout
|
||||
android:id="@+id/main_content"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include layout="@layout/layout_content_pages_common"/>
|
||||
|
||||
</org.mariotaku.twidere.view.TintedStatusFrameLayout>
|
|
@ -19,69 +19,9 @@
|
|||
-->
|
||||
<FrameLayout
|
||||
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">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/pages_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/view_pager_tabs"/>
|
||||
|
||||
<org.mariotaku.twidere.view.TabPagerIndicator
|
||||
android:id="@+id/view_pager_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/element_size_normal"
|
||||
android:outlineProvider="background"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
app:tabDividerVerticalPadding="@dimen/element_spacing_mlarge"
|
||||
app:tabExpandEnabled="true"
|
||||
app:tabHorizontalPadding="@dimen/element_spacing_large"
|
||||
app:tabIconColor="?android:colorForeground"
|
||||
app:tabShowDivider="true"
|
||||
tools:ignore="UnusedAttribute"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/pager_window_overlay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/view_pager"
|
||||
android:layout_alignTop="@+id/view_pager"
|
||||
android:background="?android:windowContentOverlay"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/pages_error_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_large"
|
||||
android:visibility="gone">
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconView
|
||||
android:id="@+id/pages_error_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:color="?android:textColorSecondary"
|
||||
android:src="@drawable/ic_info_error_generic"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pages_error_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/element_spacing_normal"
|
||||
android:textAppearance="?android:textAppearanceMedium"/>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/layout_content_pages_common"/>
|
||||
|
||||
</FrameLayout>
|
|
@ -0,0 +1,87 @@
|
|||
<?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/>.
|
||||
-->
|
||||
<merge
|
||||
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">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/pages_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/view_pager_tabs"/>
|
||||
|
||||
<org.mariotaku.twidere.view.TabPagerIndicator
|
||||
android:id="@+id/view_pager_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/element_size_normal"
|
||||
android:outlineProvider="background"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
app:tabDividerVerticalPadding="@dimen/element_spacing_mlarge"
|
||||
app:tabExpandEnabled="true"
|
||||
app:tabHorizontalPadding="@dimen/element_spacing_large"
|
||||
app:tabIconColor="?android:colorForeground"
|
||||
app:tabShowDivider="true"
|
||||
tools:ignore="UnusedAttribute"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/pager_window_overlay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/view_pager"
|
||||
android:layout_alignTop="@+id/view_pager"
|
||||
android:background="?android:windowContentOverlay"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/pages_error_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_large"
|
||||
android:visibility="gone">
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconView
|
||||
android:id="@+id/pages_error_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:color="?android:textColorSecondary"
|
||||
android:src="@drawable/ic_info_error_generic"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pages_error_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/element_spacing_normal"
|
||||
android:textAppearance="?android:textAppearanceMedium"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</merge>
|
Loading…
Reference in New Issue