use of android.support.v7.app.AppCompatActivity in project Android-ObservableScrollView by ksoichiro.
the class ViewPagerTabFragmentParentFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_viewpagertabfragment_parent, container, false);
AppCompatActivity parentActivity = (AppCompatActivity) getActivity();
mPagerAdapter = new NavigationAdapter(getChildFragmentManager());
mPager = (ViewPager) view.findViewById(R.id.pager);
mPager.setAdapter(mPagerAdapter);
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(mPager);
ViewConfiguration vc = ViewConfiguration.get(parentActivity);
mSlop = vc.getScaledTouchSlop();
mInterceptionLayout = (TouchInterceptionFrameLayout) view.findViewById(R.id.container);
mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
return view;
}
use of android.support.v7.app.AppCompatActivity in project material-components-android by material-components.
the class AppBarLayoutBaseTest method configureContent.
@CallSuper
protected void configureContent(@LayoutRes final int layoutResId, @StringRes final int titleResId) throws Throwable {
onView(withId(R.id.coordinator_stub)).perform(inflateViewStub(layoutResId));
mAppBar = (AppBarLayout) mCoordinatorLayout.findViewById(R.id.app_bar);
mCollapsingToolbar = (CollapsingToolbarLayout) mAppBar.findViewById(R.id.collapsing_app_bar);
mToolbar = (Toolbar) mAppBar.findViewById(R.id.toolbar);
final AppCompatActivity activity = activityTestRule.getActivity();
activityTestRule.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.setSupportActionBar(mToolbar);
}
});
final CharSequence activityTitle = activity.getString(titleResId);
activityTestRule.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.setTitle(activityTitle);
}
});
getInstrumentation().waitForIdleSync();
if (mCollapsingToolbar != null) {
onView(withId(R.id.collapsing_app_bar)).perform(setTitle(activityTitle)).perform(setContentScrimColor(Color.MAGENTA));
}
TextView dialog = (TextView) mCoordinatorLayout.findViewById(R.id.textview_dialogue);
if (dialog != null) {
onView(withId(R.id.textview_dialogue)).perform(setText(TextUtils.concat(Shakespeare.DIALOGUE)));
}
mDefaultElevationValue = mAppBar.getResources().getDimension(R.dimen.design_appbar_elevation);
}
use of android.support.v7.app.AppCompatActivity in project Shuttle by timusus.
the class ThemeUtils method themeActionBar.
@SuppressLint("NewApi")
public static Drawable themeActionBar(AppCompatActivity activity) {
if (activity == null) {
return null;
}
if (ShuttleUtils.hasLollipop()) {
Bitmap bitmap = BitmapFactory.decodeResource(activity.getResources(), R.mipmap.ic_launcher);
if (bitmap != null) {
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(null, bitmap, ColorUtils.getPrimaryColor());
activity.setTaskDescription(td);
bitmap.recycle();
}
}
if (ThemeUtils.getInstance().themeType == ThemeType.TYPE_LIGHT || ThemeUtils.getInstance().themeType == ThemeType.TYPE_DARK) {
activity.getSupportActionBar().setBackgroundDrawable(DrawableUtils.getColoredDrawable(activity, CompatUtils.getDrawableCompat(activity, R.drawable.ab_transparent)));
}
if (activity instanceof MainActivity || isActionBarSolid(activity)) {
ActionBar actionBar = activity.getSupportActionBar();
Drawable actionBarDrawable = DrawableUtils.getColoredDrawable(activity, CompatUtils.getDrawableCompat(activity, R.drawable.action_bar_bg));
actionBar.setBackgroundDrawable(actionBarDrawable);
return actionBarDrawable;
}
return null;
}
use of android.support.v7.app.AppCompatActivity in project Shuttle by timusus.
the class AlbumArtistFragment method onOverflowClick.
@Override
public void onOverflowClick(View v, int position, AlbumArtist albumArtist) {
PopupMenu menu = new PopupMenu(AlbumArtistFragment.this.getActivity(), v);
MenuUtils.addAlbumArtistMenuOptions(getActivity(), menu);
MenuUtils.addClickHandler((AppCompatActivity) getActivity(), menu, albumArtist);
menu.show();
}
use of android.support.v7.app.AppCompatActivity in project Shuttle by timusus.
the class DetailFragment method onOverflowClick.
@Override
public void onOverflowClick(View v, final int position, final Song song) {
PopupMenu menu = new PopupMenu(getActivity(), v);
MenuUtils.addSongMenuOptions(getActivity(), menu);
if (playlist != null && playlist.canEdit) {
menu.getMenu().add(SONG_FRAGMENT_GROUP_ID, REMOVE, 10, R.string.remove_from_playlist);
}
MenuUtils.addClickHandler((AppCompatActivity) getActivity(), menu, song, item -> {
switch(item.getItemId()) {
case BLACKLIST:
adapter.removeItem(position);
BlacklistHelper.addToBlacklist(song);
return true;
case REMOVE:
if (playlist != null) {
adapter.removeItem(position);
Uri uri = MediaStore.Audio.Playlists.Members.getContentUri("external", playlist.id);
getActivity().getContentResolver().delete(ContentUris.withAppendedId(uri, song.playlistSongId), null, null);
}
}
return false;
});
menu.show();
}
Aggregations