use of android.support.v7.widget.helper.ItemTouchHelper.DOWN in project SeriesGuide by UweTrottmann.
the class MoviesSearchActivity method setupActionBar.
private void setupActionBar(MoviesDiscoverLink link) {
super.setupActionBar();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
// set title for screen readers
if (showSearchView) {
setTitle(R.string.search);
} else {
setTitle(link.titleRes);
}
setSearchViewVisible(showSearchView);
// setup search box
searchView.setThreshold(1);
searchView.setOnClickListener(searchViewClickListener);
searchView.setOnItemClickListener(searchViewItemClickListener);
searchView.setOnEditorActionListener(searchViewActionListener);
searchView.setHint(R.string.movies_search_hint);
// set in code as XML is overridden
searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
searchView.setInputType(EditorInfo.TYPE_CLASS_TEXT);
// manually retrieve the auto complete view popup background to override the theme
TypedValue outValue = new TypedValue();
getTheme().resolveAttribute(android.R.attr.autoCompleteTextViewStyle, outValue, true);
int[] attributes = new int[] { android.R.attr.popupBackground };
TypedArray a = getTheme().obtainStyledAttributes(outValue.data, attributes);
if (a.hasValue(0)) {
searchView.setDropDownBackgroundDrawable(a.getDrawable(0));
}
a.recycle();
// setup search history
searchHistory = new SearchHistory(this, SearchSettings.KEY_SUFFIX_TMDB);
searchHistoryAdapter = new ArrayAdapter<>(this, R.layout.item_dropdown, searchHistory.getSearchHistory());
searchView.setAdapter(searchHistoryAdapter);
// drop-down is auto-shown on config change, ensure it is hidden when recreating views
searchView.dismissDropDown();
// setup clear button
clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
searchView.setText(null);
searchView.requestFocus();
}
});
}
use of android.support.v7.widget.helper.ItemTouchHelper.DOWN in project NewPipe by TeamNewPipe.
the class ChannelActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ThemeHelper.setTheme(this, true);
setContentView(R.layout.activity_channel);
rootView = findViewById(android.R.id.content);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(true);
infoListAdapter = new InfoListAdapter(this, rootView);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.channel_streams_view);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
header = getLayoutInflater().inflate(R.layout.channel_header, recyclerView, false);
infoListAdapter.setHeader(header);
infoListAdapter.setFooter(getLayoutInflater().inflate(R.layout.pignate_footer, recyclerView, false));
recyclerView.setAdapter(infoListAdapter);
infoListAdapter.setOnStreamInfoItemSelectedListener(new InfoItemBuilder.OnInfoItemSelectedListener() {
@Override
public void selected(String url, int serviceId) {
NavStack.getInstance().openDetailActivity(ChannelActivity.this, url, serviceId);
}
});
// detect if list has ben scrolled to the bottom
recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
int pastVisiblesItems, visibleItemCount, totalItemCount;
super.onScrolled(recyclerView, dx, dy);
if (//check for scroll down
dy > 0) {
visibleItemCount = layoutManager.getChildCount();
totalItemCount = layoutManager.getItemCount();
pastVisiblesItems = layoutManager.findFirstVisibleItemPosition();
if ((visibleItemCount + pastVisiblesItems) >= totalItemCount && !isLoading && hasNextPage) {
pageNumber++;
requestData(true);
}
}
}
});
subS = getString(R.string.subscriber);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
channelBanner = (ImageView) header.findViewById(R.id.channel_banner_image);
avatarView = (ImageView) header.findViewById(R.id.channel_avatar_view);
titleView = (TextView) header.findViewById(R.id.channel_title_view);
subscirberView = (TextView) header.findViewById(R.id.channel_subscriber_view);
subscriberButton = (Button) header.findViewById(R.id.channel_subscribe_button);
subscriberLayout = header.findViewById(R.id.channel_subscriber_layout);
if (savedInstanceState == null) {
handleIntent(getIntent());
} else {
channelUrl = savedInstanceState.getString(NavStack.URL);
serviceId = savedInstanceState.getInt(NavStack.SERVICE_ID);
NavStack.getInstance().restoreSavedInstanceState(savedInstanceState);
handleIntent(getIntent());
}
}
use of android.support.v7.widget.helper.ItemTouchHelper.DOWN in project Robot-Scouter by SUPERCILEX.
the class ScoutTemplateSheet method setupRecyclerView.
private void setupRecyclerView(Bundle savedInstanceState) {
mRecyclerView = mRootView.findViewById(R.id.list);
mManager = new LinearLayoutManager(getContext());
mRecyclerView.setLayoutManager(mManager);
mRecyclerView.setHasFixedSize(true);
mItemTouchCallback = new ScoutTemplateItemTouchCallback(mRootView);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(mItemTouchCallback);
mItemTouchCallback.setItemTouchHelper(itemTouchHelper);
itemTouchHelper.attachToRecyclerView(mRecyclerView);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (dy > 0) {
// User scrolled down -> hide the FAB
mFam.hideMenuButton(true);
} else if (dy < 0) {
mFam.showMenuButton(true);
} else if (mHasAddedItem && (mManager.findFirstCompletelyVisibleItemPosition() != 0 || mManager.findLastCompletelyVisibleItemPosition() != mAdapter.getItemCount() - 1)) {
mFam.hideMenuButton(true);
}
mHasAddedItem = false;
}
});
mAdapter = new ScoutTemplateAdapter(FIREBASE_SCOUT_TEMPLATES.child(mTemplateKey), getChildFragmentManager(), mRecyclerView, mItemTouchCallback);
mRecyclerView.setAdapter(mAdapter);
mItemTouchCallback.setAdapter(mAdapter);
restoreRecyclerViewState(savedInstanceState, mManager);
}
use of android.support.v7.widget.helper.ItemTouchHelper.DOWN in project Robot-Scouter by SUPERCILEX.
the class TeamListFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mSavedInstanceState = savedInstanceState;
View rootView = inflater.inflate(R.layout.fragment_team_list, container, false);
mRecyclerView = rootView.findViewById(R.id.list);
mManager = new LinearLayoutManager(getContext());
mMenuHelper.setRecyclerView(mRecyclerView);
mRecyclerView.setLayoutManager(mManager);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (dy > 0) {
// User scrolled down -> hide the FAB
mFab.hide();
} else if (dy < 0 && mMenuHelper.noItemsSelected()) {
mFab.show();
}
}
});
restoreRecyclerViewState(mSavedInstanceState, mManager);
FirebaseAuth.getInstance().addAuthStateListener(this);
return rootView;
}
use of android.support.v7.widget.helper.ItemTouchHelper.DOWN in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ConfigureNotificationSettings method initLockscreenNotificationsForProfile.
// === Lockscreen (public / private) notifications ===
private void initLockscreenNotificationsForProfile() {
mLockscreenProfile = (RestrictedDropDownPreference) getPreferenceScreen().findPreference(KEY_LOCK_SCREEN_PROFILE_NOTIFICATIONS);
if (mLockscreenProfile == null) {
Log.i(TAG, "Preference not found: " + KEY_LOCK_SCREEN_PROFILE_NOTIFICATIONS);
return;
}
ArrayList<CharSequence> entries = new ArrayList<>();
ArrayList<CharSequence> values = new ArrayList<>();
entries.add(getString(R.string.lock_screen_notifications_summary_disable_profile));
values.add(Integer.toString(R.string.lock_screen_notifications_summary_disable_profile));
String summaryShowEntry = getString(R.string.lock_screen_notifications_summary_show_profile);
String summaryShowEntryValue = Integer.toString(R.string.lock_screen_notifications_summary_show_profile);
entries.add(summaryShowEntry);
values.add(summaryShowEntryValue);
setRestrictedIfNotificationFeaturesDisabled(summaryShowEntry, summaryShowEntryValue, KEYGUARD_DISABLE_SECURE_NOTIFICATIONS | KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS);
if (mSecureProfile) {
String summaryHideEntry = getString(R.string.lock_screen_notifications_summary_hide_profile);
String summaryHideEntryValue = Integer.toString(R.string.lock_screen_notifications_summary_hide_profile);
entries.add(summaryHideEntry);
values.add(summaryHideEntryValue);
setRestrictedIfNotificationFeaturesDisabled(summaryHideEntry, summaryHideEntryValue, KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);
}
mLockscreenProfile.setOnPreClickListener((Preference p) -> Utils.startQuietModeDialogIfNecessary(mContext, UserManager.get(mContext), mProfileChallengeUserId));
mLockscreenProfile.setEntries(entries.toArray(new CharSequence[entries.size()]));
mLockscreenProfile.setEntryValues(values.toArray(new CharSequence[values.size()]));
updateLockscreenNotificationsForProfile();
if (mLockscreenProfile.getEntries().length > 1) {
mLockscreenProfile.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final int val = Integer.parseInt((String) newValue);
if (val == mLockscreenSelectedValueProfile) {
return false;
}
final boolean enabled = val != R.string.lock_screen_notifications_summary_disable_profile;
final boolean show = val == R.string.lock_screen_notifications_summary_show_profile;
Settings.Secure.putIntForUser(getContentResolver(), Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, show ? 1 : 0, mProfileChallengeUserId);
Settings.Secure.putIntForUser(getContentResolver(), Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0, mProfileChallengeUserId);
mLockscreenSelectedValueProfile = val;
return true;
}
});
} else {
// There is one or less option for the user, disable the drop down.
mLockscreenProfile.setEnabled(false);
}
}
Aggregations