use of android.support.v7.app.AppCompatActivity in project remusic by aa112901.
the class ArtistDetailFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_common, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(mContext);
recyclerView.setLayoutManager(layoutManager);
artDetailAdapter = new ArtDetailAdapter(null);
recyclerView.setAdapter(artDetailAdapter);
recyclerView.setHasFixedSize(true);
setItemDecoration();
reloadAdapter();
ArtistInfo artistInfo = MusicUtils.getArtistinfo(mContext, artistID);
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
((AppCompatActivity) mContext).setSupportActionBar(toolbar);
ab = ((AppCompatActivity) mContext).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(artistInfo.artist_name);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (getActivity() != null)
getActivity().onBackPressed();
}
});
return view;
}
use of android.support.v7.app.AppCompatActivity in project remusic by aa112901.
the class RecentFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_recent, container, false);
TopTracksLoader recentloader = new TopTracksLoader(getActivity(), TopTracksLoader.QueryType.RecentSongs);
List<Song> recentsongs = SongLoader.getSongsForCursor(TopTracksLoader.getCursor());
int songCountInt = recentsongs.size();
mList = recentsongs;
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(getActivity()), 0, 0);
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle("最近播放");
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().onBackPressed();
}
});
new loadSongs().execute("");
return view;
}
use of android.support.v7.app.AppCompatActivity in project native-navigation by airbnb.
the class ReactNativeFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
postponeEnterTransition();
View v = inflater.inflate(R.layout.fragment_react_native, container, false);
toolbar = (ReactToolbar) v.findViewById(R.id.toolbar);
// TODO(lmr): should we make the "loading" XML configurable?
loadingView = v.findViewById(R.id.loading_view);
contentContainer = (ReactNativeFragmentViewGroup) v.findViewById(R.id.content_container);
contentContainer.setKeyListener(this);
activity = (AppCompatActivity) getActivity();
activity.setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Activity activity = ReactNativeFragment.this.getActivity();
if (activity instanceof ScreenCoordinatorComponent) {
((ScreenCoordinatorComponent) activity).getScreenCoordinator().onBackPressed();
} else {
activity.onBackPressed();
}
}
});
String moduleName = getArguments().getString(EXTRA_REACT_MODULE_NAME);
Log.d(TAG, "onCreateView " + moduleName);
initialConfig = reactNavigationCoordinator.getInitialConfigForModuleName(moduleName);
// for reconciliation, we save this in "renderedConfig" until the real one comes down
renderedConfig = initialConfig;
if (initialConfig.hasKey("screenColor")) {
int backgroundColor = initialConfig.getInt("screenColor");
// TODO(lmr): do we need to create a style for this?...
// if (backgroundColor == Color.TRANSPARENT) {
// // This needs to happen before setContentView gets called
// setTheme(R.style.Theme_Airbnb_ReactTranslucent);
// }
}
return v;
}
use of android.support.v7.app.AppCompatActivity in project native-navigation by airbnb.
the class DefaultNavigationImplementation method getBarHeight.
public float getBarHeight(ReactInterface component, ReactToolbar toolbar, ActionBar actionBar, ReadableMap config, boolean firstCall) {
Activity activity = component.getActivity();
TypedValue typedValue = new TypedValue();
int attributeResourceId = android.R.attr.actionBarSize;
if (activity instanceof AppCompatActivity) {
attributeResourceId = R.attr.actionBarSize;
}
if (activity.getTheme().resolveAttribute(attributeResourceId, typedValue, true)) {
float px = TypedValue.complexToDimension(typedValue.data, activity.getResources().getDisplayMetrics());
float pixelDensity = Resources.getSystem().getDisplayMetrics().density;
return px / pixelDensity;
}
// if we've made it here, we need to guess...
return activity.getResources().getDimensionPixelSize(R.dimen.abc_action_bar_default_height_material);
}
use of android.support.v7.app.AppCompatActivity in project EffectiveAndroid by rallat.
the class ScreenContainerImpl method initToolbar.
private void initToolbar(AppCompatActivity activity) {
activity.setSupportActionBar(toolbar);
final ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp);
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
Aggregations