use of java.security.SecureRandom in project UltimateRecyclerView by cymcsg.
the class SimpleAnimationAdapter method onBindHeaderViewHolder.
@Override
public void onBindHeaderViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
TextView textView = (TextView) viewHolder.itemView.findViewById(R.id.stick_text);
textView.setText(String.valueOf(getItem(position).charAt(0)));
// viewHolder.itemView.setBackgroundColor(Color.parseColor("#AA70DB93"));
viewHolder.itemView.setBackgroundColor(Color.parseColor("#AAffffff"));
ImageView imageView = (ImageView) viewHolder.itemView.findViewById(R.id.stick_img);
SecureRandom imgGen = new SecureRandom();
switch(imgGen.nextInt(3)) {
case 0:
imageView.setImageResource(R.drawable.scn1);
break;
case 1:
imageView.setImageResource(R.drawable.jr13);
break;
case 2:
imageView.setImageResource(R.drawable.jr16);
break;
}
}
use of java.security.SecureRandom in project UltimateRecyclerView by cymcsg.
the class sectionCommonAdapter method onBindHeaderViewHolder.
/**
* this is the section header binding
*
* @param viewHolder section holder
* @param position position
*/
@Override
public void onBindHeaderViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
TextView textView = (TextView) viewHolder.itemView.findViewById(R.id.stick_text);
textView.setText(String.valueOf(getItem(hasHeaderView() ? position - 1 : position).charAt(0)));
// viewHolder.itemView.setBackgroundColor(Color.parseColor("#AA70DB93"));
viewHolder.itemView.setBackgroundColor(Color.parseColor("#AAffffff"));
ImageView imageView = (ImageView) viewHolder.itemView.findViewById(R.id.stick_img);
SecureRandom imgGen = new SecureRandom();
switch(imgGen.nextInt(3)) {
case 0:
imageView.setImageResource(R.drawable.scn1);
break;
case 1:
imageView.setImageResource(R.drawable.jr13);
break;
case 2:
imageView.setImageResource(R.drawable.jr16);
break;
}
}
use of java.security.SecureRandom in project UltimateRecyclerView by cymcsg.
the class sectionZeroAdapter method withBindHolder.
/*
@Override
public long generateHeaderId(int position) {
// URLogs.d("position--" + position + " " + getItem(position));
if (getItem(position).length() > 0)
return getItem(position).charAt(0);
else return -1;
}*/
@Override
protected void withBindHolder(itemCommonBinder holder, String data, int position) {
holder.textViewSample.setText(data + "just the sample data");
holder.item_view.setBackgroundColor(Color.parseColor("#AAffffff"));
SecureRandom imgGen = new SecureRandom();
switch(imgGen.nextInt(3)) {
case 0:
holder.imageViewSample.setImageResource(R.drawable.scn1);
break;
case 1:
holder.imageViewSample.setImageResource(R.drawable.jr13);
break;
case 2:
holder.imageViewSample.setImageResource(R.drawable.jr16);
break;
}
}
use of java.security.SecureRandom in project UltimateRecyclerView by cymcsg.
the class SimpleAdapter method onBindHeaderViewHolder.
@Override
public void onBindHeaderViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
TextView textView = (TextView) viewHolder.itemView.findViewById(R.id.stick_text);
textView.setText(String.valueOf(getItem(position).charAt(0)));
// viewHolder.itemView.setBackgroundColor(Color.parseColor("#AA70DB93"));
viewHolder.itemView.setBackgroundColor(Color.parseColor("#AAffffff"));
ImageView imageView = (ImageView) viewHolder.itemView.findViewById(R.id.stick_img);
SecureRandom imgGen = new SecureRandom();
switch(imgGen.nextInt(3)) {
case 0:
imageView.setImageResource(R.drawable.jr1);
break;
case 1:
imageView.setImageResource(R.drawable.jr2);
break;
case 2:
imageView.setImageResource(R.drawable.jr3);
break;
}
}
use of java.security.SecureRandom in project android_frameworks_base by ParanoidAndroid.
the class SettingsProvider method ensureAndroidIdIsSet.
private boolean ensureAndroidIdIsSet(int userHandle) {
final Cursor c = queryForUser(Settings.Secure.CONTENT_URI, new String[] { Settings.NameValueTable.VALUE }, Settings.NameValueTable.NAME + "=?", new String[] { Settings.Secure.ANDROID_ID }, null, userHandle);
try {
final String value = c.moveToNext() ? c.getString(0) : null;
if (value == null) {
final SecureRandom random = new SecureRandom();
final String newAndroidIdValue = Long.toHexString(random.nextLong());
final ContentValues values = new ContentValues();
values.put(Settings.NameValueTable.NAME, Settings.Secure.ANDROID_ID);
values.put(Settings.NameValueTable.VALUE, newAndroidIdValue);
final Uri uri = insertForUser(Settings.Secure.CONTENT_URI, values, userHandle);
if (uri == null) {
Slog.e(TAG, "Unable to generate new ANDROID_ID for user " + userHandle);
return false;
}
Slog.d(TAG, "Generated and saved new ANDROID_ID [" + newAndroidIdValue + "] for user " + userHandle);
// Write a dropbox entry if it's a restricted profile
if (mUserManager.getUserInfo(userHandle).isRestricted()) {
DropBoxManager dbm = (DropBoxManager) getContext().getSystemService(Context.DROPBOX_SERVICE);
if (dbm != null && dbm.isTagEnabled(DROPBOX_TAG_USERLOG)) {
dbm.addText(DROPBOX_TAG_USERLOG, System.currentTimeMillis() + ",restricted_profile_ssaid," + newAndroidIdValue + "\n");
}
}
}
return true;
} finally {
c.close();
}
}
Aggregations