use of com.sdsmdg.harjot.MusicDNA.activities.HomeActivity in project MusicDNA by harjot-oberai.
the class QueueRecyclerAdapter method onItemDismiss.
@Override
public void onItemDismiss(int position) {
UnifiedTrack ut = queue.get(position);
if (HomeActivity.originalQueue != null)
HomeActivity.originalQueue.removeItem(ut);
queue.remove(position);
if (position < HomeActivity.queueCurrentIndex) {
HomeActivity.queueCurrentIndex--;
}
notifyItemRemoved(position);
((HomeActivity) ctx).updateVisualizerRecycler();
new HomeActivity.SaveQueue().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
use of com.sdsmdg.harjot.MusicDNA.activities.HomeActivity in project MusicDNA by harjot-oberai.
the class LocalMusicViewPagerFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
((HomeActivity) getActivity()).onQueryTextChange("");
isSearchboxVisible = false;
backBtn = (ImageView) view.findViewById(R.id.local_fragment_back_btn);
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().onBackPressed();
}
});
fragTitle = (TextView) view.findViewById(R.id.local_fragment_title);
if (SplashActivity.tf4 != null)
fragTitle.setTypeface(SplashActivity.tf4);
searchBox = (EditText) view.findViewById(R.id.local_fragment_search_box);
searchBox.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
((HomeActivity) getActivity()).onQueryTextChange(s.toString());
}
@Override
public void afterTextChanged(Editable s) {
}
});
searchIcon = (ImageView) view.findViewById(R.id.local_fragment_search_icon);
searchIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isSearchboxVisible) {
searchBox.setText("");
searchBox.setVisibility(View.INVISIBLE);
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(getActivity().INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
searchIcon.setImageResource(R.drawable.ic_search);
fragTitle.setVisibility(View.VISIBLE);
} else {
searchBox.setVisibility(View.VISIBLE);
searchBox.requestFocus();
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(getActivity().INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
searchIcon.setImageResource(R.drawable.ic_cross_white);
fragTitle.setVisibility(View.INVISIBLE);
}
isSearchboxVisible = !isSearchboxVisible;
}
});
viewPager = (ViewPager) view.findViewById(R.id.viewpager);
tabLayout = (TabLayout) view.findViewById(R.id.tabs);
tabLayout.setBackgroundColor(Color.parseColor("#111111"));
tabLayout.setSelectedTabIndicatorColor(HomeActivity.themeColor);
viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
}
use of com.sdsmdg.harjot.MusicDNA.activities.HomeActivity in project MusicDNA by harjot-oberai.
the class CommonUtils method hideKeyboard.
public static void hideKeyboard(Context ctx) {
View view = ((HomeActivity) ctx).getCurrentFocus();
if (view != null) {
InputMethodManager imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
use of com.sdsmdg.harjot.MusicDNA.activities.HomeActivity in project MusicDNA by harjot-oberai.
the class QueueRecyclerAdapter method onItemMove.
@Override
public void onItemMove(int fromPosition, int toPosition) {
UnifiedTrack prev = queue.remove(fromPosition);
queue.add(toPosition, prev);
notifyItemMoved(fromPosition, toPosition);
if (fromPosition == HomeActivity.queueCurrentIndex) {
HomeActivity.queueCurrentIndex = toPosition;
} else if (fromPosition > HomeActivity.queueCurrentIndex && toPosition == HomeActivity.queueCurrentIndex) {
HomeActivity.queueCurrentIndex++;
} else if (fromPosition < HomeActivity.queueCurrentIndex && toPosition == HomeActivity.queueCurrentIndex) {
HomeActivity.queueCurrentIndex--;
}
((HomeActivity) ctx).updateVisualizerRecycler();
new HomeActivity.SaveQueue().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Aggregations