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);
}
});
}
}
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;
}
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;
}
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;
}
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();
}
Aggregations