Search in sources :

Example 81 with AppCompatActivity

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;
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) TintImageView(com.bilibili.magicasakura.widgets.TintImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ArtistInfo(com.wm.remusic.info.ArtistInfo)

Example 82 with AppCompatActivity

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;
}
Also used : Song(com.wm.remusic.recent.Song) AppCompatActivity(android.support.v7.app.AppCompatActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) TopTracksLoader(com.wm.remusic.recent.TopTracksLoader) ActionBar(android.support.v7.app.ActionBar)

Example 83 with AppCompatActivity

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;
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) Activity(android.app.Activity) View(android.view.View) ReactRootView(com.facebook.react.ReactRootView)

Example 84 with AppCompatActivity

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);
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) AppCompatActivity(android.support.v7.app.AppCompatActivity) Activity(android.app.Activity) TypedValue(android.util.TypedValue)

Example 85 with AppCompatActivity

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);
    }
}
Also used : ActionBar(android.support.v7.app.ActionBar)

Aggregations

AppCompatActivity (android.support.v7.app.AppCompatActivity)99 View (android.view.View)43 ActionBar (android.support.v7.app.ActionBar)36 TextView (android.widget.TextView)28 RecyclerView (android.support.v7.widget.RecyclerView)21 ImageView (android.widget.ImageView)17 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)16 Toolbar (android.support.v7.widget.Toolbar)14 BindView (butterknife.BindView)11 Fragment (android.support.v4.app.Fragment)8 PopupMenu (android.support.v7.widget.PopupMenu)8 Transition (android.transition.Transition)7 MenuItem (android.view.MenuItem)7 Intent (android.content.Intent)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)6 TargetApi (android.annotation.TargetApi)5 Activity (android.app.Activity)4 ColorDrawable (android.graphics.drawable.ColorDrawable)4 Bundle (android.os.Bundle)4 FragmentManager (android.support.v4.app.FragmentManager)4