Search in sources :

Example 6 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project remusic by aa112901.

the class PlaylistDetailAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(RecyclerView.ViewHolder itemHolder, final int i) {
    if (itemHolder instanceof ItemViewHolder) {
        MusicInfo localItem = arraylist.get(i - 1);
        ((ItemViewHolder) itemHolder).trackNumber.setText(i + "");
        ((ItemViewHolder) itemHolder).title.setText(localItem.musicName);
        ((ItemViewHolder) itemHolder).artist.setText(localItem.artist);
        ((ItemViewHolder) itemHolder).menu.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                MoreFragment morefragment = MoreFragment.newInstance(arraylist.get(i - 1).songId + "", IConstants.MUSICOVERFLOW);
                morefragment.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "music");
            }
        });
    } else if (itemHolder instanceof CommonItemViewHolder) {
        ((CommonItemViewHolder) itemHolder).textView.setText("(共" + arraylist.size() + "首)");
        ((CommonItemViewHolder) itemHolder).select.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, PlaylistSelectActivity.class);
                intent.putParcelableArrayListExtra("ids", arraylist);
                intent.putExtra("playlistid", playlistId);
                intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                mContext.startActivity(intent);
            }
        });
    }
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) Intent(android.content.Intent) MoreFragment(com.wm.remusic.fragment.MoreFragment) MusicInfo(com.wm.remusic.info.MusicInfo) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View)

Example 7 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project remusic by aa112901.

the class TabPagerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_tab, container, false);
    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    ((AppCompatActivity) mContext).setSupportActionBar(toolbar);
    toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
    ab = ((AppCompatActivity) mContext).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
    ab.setDisplayHomeAsUpEnabled(true);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mContext.onBackPressed();
        }
    });
    ImageView search = (ImageView) rootView.findViewById(R.id.bar_search);
    search.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final Intent intent = new Intent(mContext, LocalSearchActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            mContext.startActivity(intent);
        }
    });
    viewPager = (ViewPager) rootView.findViewById(R.id.viewpager);
    if (viewPager != null) {
        setupViewPager(viewPager);
        viewPager.setOffscreenPageLimit(3);
    }
    final TabLayout tabLayout = (TabLayout) rootView.findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);
    tabLayout.setTabTextColors(R.color.text_color, ThemeUtils.getThemeColorStateList(mContext, R.color.theme_color_primary).getDefaultColor());
    //        tabLayout.setTabTextColors(ThemeUtils.getThemeColorStateList(mContext,R.color.theme_color_primary));
    //                try {
    //            Field mField = TableLayout.class.getDeclaredField("mTabTextColors");
    //            mField.setAccessible(true);
    //            mField.set(tabLayout,ThemeUtils.getThemeColorStateList(mContext,R.color.theme_color_primary));
    //        } catch (NoSuchFieldException e) {
    //            e.printStackTrace();
    //        } catch (IllegalArgumentException e) {
    //            e.printStackTrace();
    //        } catch (IllegalAccessException e) {
    //            e.printStackTrace();
    //        }
    tabLayout.setSelectedTabIndicatorColor(ThemeUtils.getThemeColorStateList(mContext, R.color.theme_color_primary).getDefaultColor());
    return rootView;
}
Also used : TabLayout(android.support.design.widget.TabLayout) AppCompatActivity(android.support.v7.app.AppCompatActivity) Intent(android.content.Intent) LocalSearchActivity(com.wm.remusic.activity.LocalSearchActivity) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 8 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project lottie-android by airbnb.

the class AnimationFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_animation, container, false);
    ButterKnife.bind(this, view);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_back);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getFragmentManager().popBackStack();
        }
    });
    postUpdatePlayButtonText();
    onLoopChanged();
    animationView.addAnimatorListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
            startRecordingDroppedFrames();
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            recordDroppedFrames();
            postUpdatePlayButtonText();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            postUpdatePlayButtonText();
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
            recordDroppedFrames();
            startRecordingDroppedFrames();
        }
    });
    animationView.addAnimatorUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            seekBar.setProgress((int) (animation.getAnimatedFraction() * 100));
        }
    });
    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (!animationView.isAnimating()) {
                animationView.setProgress(progress / 100f);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    return view;
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) SeekBar(android.widget.SeekBar) AppCompatSeekBar(android.support.v7.widget.AppCompatSeekBar) AppCompatActivity(android.support.v7.app.AppCompatActivity) ValueAnimator(android.animation.ValueAnimator) LottieAnimationView(com.airbnb.lottie.LottieAnimationView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) Nullable(android.support.annotation.Nullable)

Example 9 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project native-navigation by airbnb.

the class NativeFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_native, container, false);
    final int count = getArguments().getInt(ARG_COUNT);
    Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    toolbar.setTitle("Fragment " + count);
    toolbar.setNavigationIcon(R.drawable.n2_ic_arrow_back_white);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getActivity().onBackPressed();
        }
    });
    view.findViewById(R.id.push).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getScreenCoordinator().pushScreen(newInstance(count + 1));
        }
    });
    view.findViewById(R.id.present).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Promise promise = new PromiseImpl(new Callback() {

                @Override
                public void invoke(Object... args) {
                    WritableMap map = (WritableMap) args[0];
                    ReadableMap payload = map.getMap("payload");
                    if (payload != null) {
                        String text = "Result: " + payload.getString(RESULT_TEXT);
                        Toast.makeText(getContext(), text, Toast.LENGTH_LONG).show();
                    }
                }
            }, new Callback() {

                @Override
                public void invoke(Object... args) {
                    Toast.makeText(getContext(), "Promise was rejected.", Toast.LENGTH_LONG).show();
                }
            });
            getScreenCoordinator().presentScreen(newInstance(0), promise);
        }
    });
    view.findViewById(R.id.push_rn).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getScreenCoordinator().pushScreen("ScreenOne");
        }
    });
    view.findViewById(R.id.present_rn).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getScreenCoordinator().presentScreen("ScreenOne");
        }
    });
    view.findViewById(R.id.pop).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getScreenCoordinator().pop();
        }
    });
    final EditText editText = (EditText) view.findViewById(R.id.payload);
    view.findViewById(R.id.dismiss).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Map<String, Object> payload = new HashMap<>();
            payload.put(RESULT_TEXT, editText.getText().toString());
            getScreenCoordinator().dismiss(Activity.RESULT_OK, payload);
        }
    });
    return view;
}
Also used : EditText(android.widget.EditText) WritableMap(com.facebook.react.bridge.WritableMap) AppCompatActivity(android.support.v7.app.AppCompatActivity) View(android.view.View) PromiseImpl(com.facebook.react.bridge.PromiseImpl) Promise(com.facebook.react.bridge.Promise) Callback(com.facebook.react.bridge.Callback) ReadableMap(com.facebook.react.bridge.ReadableMap) ReadableMap(com.facebook.react.bridge.ReadableMap) HashMap(java.util.HashMap) Map(java.util.Map) WritableMap(com.facebook.react.bridge.WritableMap) Toolbar(android.support.v7.widget.Toolbar) Nullable(android.support.annotation.Nullable)

Example 10 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project materialistic by hidroh.

the class FavoriteManagerTest method testLocalItemManager.

@Test
public void testLocalItemManager() {
    ActivityController<AppCompatActivity> controller = Robolectric.buildActivity(AppCompatActivity.class);
    AppCompatActivity activity = controller.create().start().resume().get();
    LocalItemManager.Observer observer = mock(LocalItemManager.Observer.class);
    manager.attach(RuntimeEnvironment.application, activity.getSupportLoaderManager(), observer, null);
    verify(observer).onChanged();
    assertThat(manager.getSize()).isEqualTo(2);
    assertThat(manager.getItem(0).getDisplayedTitle()).contains("ask HN");
    assertThat(manager.getItem(1).getDisplayedTitle()).contains("title");
    manager.detach();
    controller.pause().stop().destroy();
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) Test(org.junit.Test)

Aggregations

AppCompatActivity (android.support.v7.app.AppCompatActivity)85 View (android.view.View)36 ActionBar (android.support.v7.app.ActionBar)32 TextView (android.widget.TextView)22 RecyclerView (android.support.v7.widget.RecyclerView)18 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)16 ImageView (android.widget.ImageView)16 Toolbar (android.support.v7.widget.Toolbar)12 Fragment (android.support.v4.app.Fragment)8 PopupMenu (android.support.v7.widget.PopupMenu)8 Intent (android.content.Intent)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)6 Transition (android.transition.Transition)6 MenuItem (android.view.MenuItem)6 TargetApi (android.annotation.TargetApi)5 Activity (android.app.Activity)4 ColorDrawable (android.graphics.drawable.ColorDrawable)4 FragmentManager (android.support.v4.app.FragmentManager)4 PopupMenu (android.widget.PopupMenu)4 BindView (butterknife.BindView)4