use of de.hdodenhof.circleimageview.CircleImageView in project MusicDNA by harjot-oberai.
the class HomeActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
WindowManager wm = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
screen_width = display.getWidth();
screen_height = display.getHeight();
ratio = (float) screen_height / (float) 1920;
ratio2 = (float) screen_width / (float) 1080;
ratio = Math.min(ratio, ratio2);
setContentView(R.layout.activity_home);
headSetReceiver = new HeadSetReceiver();
IntentFilter filter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
registerReceiver(headSetReceiver, filter);
PackageInfo pInfo;
try {
pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
versionName = pInfo.versionName;
versionCode = pInfo.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
mEndButton = new Button(this);
mEndButton.setBackgroundColor(themeColor);
mEndButton.setTextColor(Color.WHITE);
tp = new TextPaint();
tp.setColor(themeColor);
tp.setTextSize(65 * ratio);
tp.setFakeBoldText(true);
recentsViewAll = (TextView) findViewById(R.id.recents_view_all);
recentsViewAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFragment("recent");
}
});
playlistsViewAll = (TextView) findViewById(R.id.playlists_view_all);
playlistsViewAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFragment("allPlaylists");
}
});
copyrightText = (TextView) findViewById(R.id.copyright_text);
copyrightText.setText("Music DNA v" + versionName);
if (SplashActivity.tf4 != null) {
try {
copyrightText.setTypeface(SplashActivity.tf4);
} catch (Exception e) {
e.printStackTrace();
}
}
imgLoader = new ImageLoader(this);
ctx = this;
initializeHeaderImages();
hasSoftNavbar = CommonUtils.hasNavBar(this);
statusBarHeightinDp = CommonUtils.getStatusBarHeight(this);
navBarHeightSizeinDp = hasSoftNavbar ? CommonUtils.getNavBarHeight(this) : 0;
serviceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className, IBinder service) {
// cast the IBinder and get MyService instance
MediaPlayerService.LocalBinder binder = (MediaPlayerService.LocalBinder) service;
myService = binder.getService();
bound = true;
// register
myService.setCallbacks(HomeActivity.this);
}
@Override
public void onServiceDisconnected(ComponentName arg0) {
bound = false;
}
};
minuteList = new ArrayList<>();
for (int i = 1; i < 25; i++) {
minuteList.add(String.valueOf(i * 5));
}
sleepHandler = new Handler();
lps = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
lps.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
int margin = ((Number) (getResources().getDisplayMetrics().density * 12)).intValue();
lps.setMargins(margin, margin, margin, navBarHeightSizeinDp + ((Number) (getResources().getDisplayMetrics().density * 5)).intValue());
fragMan = getSupportFragmentManager();
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
if (SplashActivity.tf4 != null) {
collapsingToolbar.setCollapsedTitleTypeface(SplashActivity.tf4);
collapsingToolbar.setExpandedTitleTypeface(SplashActivity.tf4);
}
customLinearGradient = (CustomLinearGradient) findViewById(R.id.custom_linear_gradient);
customLinearGradient.setAlpha(170);
customLinearGradient.invalidate();
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
navigationView = (NavigationView) findViewById(R.id.nav_view);
if (navigationView != null) {
navigationView.setNavigationItemSelectedListener(this);
}
navigationView.setCheckedItem(R.id.nav_home);
View header = navigationView.getHeaderView(0);
navImageView = (ImageView) header.findViewById(R.id.nav_image_view);
if (navImageView != null) {
navImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PlayerFragment pFrag = getPlayerFragment();
if (pFrag != null) {
if (pFrag.mMediaPlayer != null && pFrag.mMediaPlayer.isPlaying()) {
onBackPressed();
isPlayerVisible = true;
// hideTabs();
showPlayer();
}
}
}
});
}
connManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
phoneStateListener = new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
PlayerFragment pFrag = playerFragment;
if (playerFragment != null) {
if (state == TelephonyManager.CALL_STATE_RINGING) {
// Incoming call: Pause music
if (pFrag.mMediaPlayer != null && pFrag.mMediaPlayer.isPlaying()) {
wasMediaPlayerPlaying = true;
pFrag.togglePlayPause();
} else {
wasMediaPlayerPlaying = false;
}
} else if (state == TelephonyManager.CALL_STATE_IDLE) {
// Not in call: Play music
if (pFrag.mMediaPlayer != null && !pFrag.mMediaPlayer.isPlaying() && wasMediaPlayerPlaying) {
pFrag.togglePlayPause();
}
} else if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
// A call is dialing, active or on hold
if (playerFragment.mMediaPlayer != null && pFrag.mMediaPlayer.isPlaying()) {
wasMediaPlayerPlaying = true;
pFrag.togglePlayPause();
} else {
wasMediaPlayerPlaying = false;
}
}
}
super.onCallStateChanged(state, incomingNumber);
}
};
TelephonyManager mgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
if (mgr != null) {
mgr.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}
mPrefs = getPreferences(MODE_PRIVATE);
prefsEditor = mPrefs.edit();
gson = new Gson();
main = this;
localBanner = (RelativeLayout) findViewById(R.id.localBanner);
favBanner = (ImageView) findViewById(R.id.favBanner);
recentBanner = (ImageView) findViewById(R.id.recentBanner);
folderBanner = (ImageView) findViewById(R.id.folderBanner);
savedDNABanner = (ImageView) findViewById(R.id.savedDNABanner);
localBannerPlayAll = (ImageView) findViewById(R.id.local_banner_play_all);
localBanner.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFragment("local");
}
});
favBanner.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFragment("favourite");
}
});
recentBanner.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFragment("recent");
}
});
folderBanner.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFragment("allFolders");
}
});
savedDNABanner.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFragment("allSavedDNAs");
}
});
localBannerPlayAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
queue.getQueue().clear();
for (int i = 0; i < localTrackList.size(); i++) {
UnifiedTrack ut = new UnifiedTrack(true, localTrackList.get(i), null);
queue.getQueue().add(ut);
}
if (queue.getQueue().size() > 0) {
Random r = new Random();
int tmp = r.nextInt(queue.getQueue().size());
queueCurrentIndex = tmp;
LocalTrack track = localTrackList.get(tmp);
localSelectedTrack = track;
streamSelected = false;
localSelected = true;
queueCall = false;
isReloaded = false;
onLocalTrackSelected(-1);
}
}
});
bottomToolbar = (FrameLayout) findViewById(R.id.bottomMargin);
spHome = (Toolbar) findViewById(R.id.smallPlayer_home);
playerControllerHome = (ImageView) findViewById(R.id.player_control_sp_home);
spImgHome = (CircleImageView) findViewById(R.id.selected_track_image_sp_home);
spTitleHome = (TextView) findViewById(R.id.selected_track_title_sp_home);
playerControllerHome.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (queue != null && queue.getQueue().size() > 0) {
onQueueItemClicked(queueCurrentIndex);
bottomToolbar.setVisibility(View.INVISIBLE);
}
}
});
playerControllerHome.setImageResource(R.drawable.ic_play_arrow_white_48dp);
spHome.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (queue != null && queue.getQueue().size() > 0) {
onQueueItemClicked(queueCurrentIndex);
bottomToolbar.setVisibility(View.INVISIBLE);
}
}
});
localRecyclerContainer = (RelativeLayout) findViewById(R.id.localRecyclerContainer);
recentsRecyclerContainer = (RelativeLayout) findViewById(R.id.recentsRecyclerContainer);
streamRecyclerContainer = (RelativeLayout) findViewById(R.id.streamRecyclerContainer);
playlistRecyclerContainer = (RelativeLayout) findViewById(R.id.playlistRecyclerContainer);
if (SplashActivity.tf4 != null) {
try {
((TextView) findViewById(R.id.playListRecyclerLabel)).setTypeface(SplashActivity.tf4);
((TextView) findViewById(R.id.recentsRecyclerLabel)).setTypeface(SplashActivity.tf4);
} catch (Exception e) {
e.printStackTrace();
}
}
localNothingText = (TextView) findViewById(R.id.localNothingText);
streamNothingText = (TextView) findViewById(R.id.streamNothingText);
recentsNothingText = (TextView) findViewById(R.id.recentsNothingText);
playlistNothingText = (TextView) findViewById(R.id.playlistNothingText);
localViewAll = (TextView) findViewById(R.id.localViewAll);
localViewAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFragment("local");
}
});
streamViewAll = (TextView) findViewById(R.id.streamViewAll);
streamViewAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFragment("stream");
}
});
progress = new Dialog(ctx);
progress.setCancelable(false);
progress.requestWindowFeature(Window.FEATURE_NO_TITLE);
progress.setContentView(R.layout.custom_progress_dialog);
progress.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
progress.show();
showCase = new ShowcaseView.Builder(this).blockAllTouches().singleShot(0).setStyle(R.style.CustomShowcaseTheme).useDecorViewAsParent().replaceEndButton(mEndButton).setContentTitlePaint(tp).setTarget(new ViewTarget(R.id.recentsRecyclerLabel, this)).setContentTitle("Recents and Playlists").setContentText("Here all you recent songs and playlists will be listed." + "Long press the cards or playlists for more options \n" + "\n" + "(Press Next to continue / Press back to Hide)").build();
showCase.setButtonText("Next");
showCase.setButtonPosition(lps);
showCase.overrideButtonClick(new View.OnClickListener() {
int count1 = 0;
@Override
public void onClick(View v) {
count1++;
switch(count1) {
case 1:
showCase.setTarget(new ViewTarget(R.id.local_banner_alt_showcase, (Activity) ctx));
showCase.setContentTitle("Local Songs");
showCase.setContentText("See all songs available locally, classified on basis of Artist and Album");
showCase.setButtonPosition(lps);
showCase.setButtonText("Next");
break;
case 2:
showCase.setTarget(new ViewTarget(searchView.getId(), (Activity) ctx));
showCase.setContentTitle("Search");
showCase.setContentText("Search for songs from local library and SoundCloud™");
showCase.setButtonPosition(lps);
showCase.setButtonText("Done");
break;
case 3:
showCase.hide();
break;
}
}
});
new loadSavedData().execute();
}
use of de.hdodenhof.circleimageview.CircleImageView in project ride-read-android by Ride-Read.
the class CommentListFragment method initView.
private void initView() {
List<Comment> comments = new ArrayList<Comment>();
comments.add(new Comment("12:29", "拍的真好", "", "陈晓村"));
comments.add(new Comment("11:20", "世界那么大,我想去看看", "", "镇一间"));
comments.add(new Comment("10:29", "我也想去", "", "黄花话"));
List<String> face_urls = new ArrayList<String>();
for (int i = 88; i > 0; i--) {
face_urls.add("" + i);
}
ListView listView = (ListView) mView.findViewById(R.id.timeline_detail_commentlist);
View v = LayoutInflater.from(getActivity().getApplicationContext()).inflate(R.layout.timeline_detail_headerview, null);
LikeLinearLayout linearLayout = (LikeLinearLayout) v.findViewById(R.id.likes_linearlayout);
for (int i = 0; i < face_urls.size(); i++) {
if (linearLayout.canAddView()) {
CircleImageView circleImageView = new CircleImageView(getContext());
circleImageView.setImageResource(R.mipmap.me);
circleImageView.setPadding(0, 0, 8, 0);
linearLayout.addView(circleImageView);
}
if (!linearLayout.canAddView()) {
break;
}
}
TextView like_nums = (TextView) v.findViewById(R.id.like_nums);
like_nums.setText(face_urls.size() + "");
TextView text = (TextView) v.findViewById(R.id.timeline_text);
NineGridImageView gridView = (NineGridImageView) v.findViewById(R.id.timeline_imgs);
// final VideoTextureView videoTextureView=(VideoTextureView)v.findViewById(R.id.timeline_videotextureview);
// ImageView iv_play=(ImageView)v.findViewById(R.id.iv_play);
TextView author = (TextView) v.findViewById(R.id.timeline_nickname);
TextView pushTime = (TextView) v.findViewById(R.id.timeline_time);
ImageView timeline_head = (ImageView) v.findViewById(R.id.timeline_head);
listView.addHeaderView(v);
if (timeline.isHasText() == true) {
text.setText(timeline.getText());
text.setVisibility(View.VISIBLE);
} else {
text.setVisibility(View.GONE);
}
NineGridImageViewAdapter<String> adapter = new NineGridImageViewAdapter<String>() {
@Override
protected void onDisplayImage(Context context, ImageView imageView, String imageurl) {
Glide.with(CommentListFragment.this).load(imageurl).fitCenter().into(imageView);
}
@Override
protected void onItemImageClick(Context context, ImageView imageView, int index, List<String> list) {
Intent intent = new Intent(getActivity(), ImageShowActivity.class);
ArrayList<String> arrayList = new ArrayList<String>();
arrayList.addAll(list);
intent.putStringArrayListExtra("imgurls", arrayList);
intent.putExtra("index", index);
startActivity(intent);
}
};
// 这里模拟传入图片链接列表
List<String> images = new ArrayList<String>();
images.add("http://img4.duitang.com/uploads/item/201407/27/20140727091026_GmVRQ.jpeg");
images.add("http://img.anzow.com/picture/2015719/2015071916305142.jpg");
images.add("http://image.tianjimedia.com/uploadImages/2012/244/RXDM27FT4601.jpg");
images.add("http://img1.gamedog.cn/2013/07/30/44-130I00ZU50-50.jpg");
images.add("http://www.33lc.com/article/UploadPic/2012-9/20129417163151547.jpg");
images.add("http://bizhi.cnanzhi.com/upload/bizhi/2014/1210/14181737602209.jpg");
images.add("http://image.tianjimedia.com/uploadImages/2012/244/P53844A81OPA.jpg");
images.add("http://img02.tooopen.com/images/20150527/tooopen_sy_126598151923.jpg");
images.add("http://k.zol-img.com.cn/sjbbs/7161/a7160286_s.jpg");
if (timeline.isHasImg() == true) {
gridView.setAdapter(adapter);
gridView.setImagesData(images);
gridView.setVisibility(View.VISIBLE);
} else {
gridView.setVisibility(View.GONE);
}
author.setText(timeline.getAuthor());
pushTime.setText(timeline.getPushTime());
timeline_head.setImageResource(R.mipmap.me);
listView.setAdapter(new CommentListAdapter(comments, getContext(), R.layout.timline_detail_comment_listitem));
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if (deleteDialogFragment == null) {
deleteDialogFragment = new DeleteDialogFragment();
}
deleteDialogFragment.show(CommentListFragment.this.getActivity().getSupportFragmentManager(), "deleteDialogFragment");
return true;
}
});
}
use of de.hdodenhof.circleimageview.CircleImageView in project ride-read-android by Ride-Read.
the class MineFragment method initView.
private void initView() {
TextView mineRealName = (TextView) mView.findViewById(R.id.real_name);
TextView mineMessage = (TextView) mView.findViewById(R.id.mine_tv_message);
TextView mineAttention = (TextView) mView.findViewById(R.id.mine_tv_attention);
TextView mineFans = (TextView) mView.findViewById(R.id.mine_tv_fans);
TextView mineAttentionNum = (TextView) mView.findViewById(R.id.mine_tv_attention_num);
TextView mineFansNum = (TextView) mView.findViewById(R.id.mine_tv_fans_num);
ImageView mineSetting = (ImageView) mView.findViewById(R.id.left_setting_icon);
CircleImageView mineUserHead = (CircleImageView) mView.findViewById(R.id.mine_civ_userhead);
if (data != null) {
mineRealName.setText(data.getUsername());
Glide.with(this).load(data.getFace_url()).into(mineUserHead);
mineAttentionNum.setText(data.getFollowing() + "");
mineFansNum.setText(data.getFollower() + "");
}
mineMessage.setOnClickListener(this);
mineAttention.setOnClickListener(this);
mineFans.setOnClickListener(this);
mineSetting.setOnClickListener(this);
mineUserHead.setOnClickListener(this);
mineAttentionNum.setOnClickListener(this);
mineFansNum.setOnClickListener(this);
}
use of de.hdodenhof.circleimageview.CircleImageView in project ride-read-android by Ride-Read.
the class RegisterFragment method onCreateView.
@Nullable
@Override
public View onCreateView(final LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View mView = inflater.inflate(R.layout.register_fragment_layout, container, false);
inviteCodeView = mView.findViewById(R.id.register_invite_include_layout);
initButton(inviteCodeView, R.id.register_btn_next, tagInvite);
phoneNumView = mView.findViewById(R.id.register_phonenum_include_ly);
initButton(phoneNumView, R.id.register_btn_next, tagPhone);
((TextView) phoneNumView.findViewById(R.id.register_tv_sendidentfycode)).setOnClickListener(this);
setPwdView = mView.findViewById(R.id.register_setpwd_include_ly);
initButton(setPwdView, R.id.register_btn_next, tagPwd);
setUnameView = mView.findViewById(R.id.register_setuname_include_ly);
initButton(setUnameView, R.id.register_btn_complete, null);
img = (CircleImageView) setUnameView.findViewById(R.id.register_civ_userhead);
img.setOnClickListener(this);
setuserhead_texthint = (TextView) setUnameView.findViewById(R.id.setuserhead_texthint);
mContext = getContext();
mActivity = getActivity();
initGallery();
return mView;
}
use of de.hdodenhof.circleimageview.CircleImageView in project ride-read-android by Ride-Read.
the class SelfTimelineActivity method initView.
private void initView() {
ImageView back = (ImageView) findViewById(R.id.left_setting_icon);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
View v = LayoutInflater.from(getApplicationContext()).inflate(R.layout.self_timeline_listview_headerview, null);
ListView listView = (ListView) findViewById(R.id.self_timeline_list);
listView.addHeaderView(v);
TextView self_timeline_name = (TextView) v.findViewById(R.id.self_timeline_name);
CircleImageView circleiv = (CircleImageView) v.findViewById(R.id.self_timeline_civ);
ImageView ivsex = (ImageView) v.findViewById(R.id.self_timeline_sex);
TextView signture = (TextView) v.findViewById(R.id.self_timeline_signture);
TextView self_timeline_attention = (TextView) v.findViewById(R.id.self_timeline_attention);
TextView self_timeline_fans = (TextView) v.findViewById(R.id.self_timeline_fans);
TextView self_timeline_location = (TextView) v.findViewById(R.id.self_timeline_location);
TextView self_timeline_school = (TextView) v.findViewById(R.id.self_timeline_school);
TextView self_timeline_xizuo = (TextView) v.findViewById(R.id.self_timeline_xizuo);
TextView self_timeline_job = (TextView) v.findViewById(R.id.self_timeline_job);
self_timeline_attention.setText(selftimeline.getAttention());
self_timeline_fans.setText(selftimeline.getFans());
self_timeline_job.setText(selftimeline.getJob());
self_timeline_location.setText(selftimeline.getLocation());
self_timeline_school.setText(selftimeline.getSchool());
self_timeline_name.setText(selftimeline.getName());
self_timeline_xizuo.setText(selftimeline.getXizuo());
signture.setText(selftimeline.getSignture());
ivsex.setImageResource(R.mipmap.female);
circleiv.setImageResource(R.mipmap.me);
listView.setAdapter(new SelfTimelineListAdapter(this, selftimeline.getSelftimelinelist(), R.layout.self_timeline_listitem));
}
Aggregations