use of android.os.Message in project Meizhi by drakeet.
the class FloatView method setNotification.
public void setNotification(final HeadsUp headsUp) {
this.headsUp = headsUp;
mHandle = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (headsUp.isActivateStatusBar()) {
HeadsUpManager.getInstant(getContext()).silencerNotify(headsUp);
}
HeadsUpManager.getInstant(getContext()).animDismiss(headsUp);
}
};
cutDownTime = new CutDownTime();
if (!headsUp.isSticky()) {
cutDownTime.start();
}
cutDown = headsUp.getDuration();
if (headsUp.getCustomView() == null) {
View defaultView = LayoutInflater.from(getContext()).inflate(R.layout.notification, rootView, false);
rootView.addView(defaultView);
ImageView imageView = (ImageView) defaultView.findViewById(R.id.iconIM);
TextView titleTV = (TextView) defaultView.findViewById(R.id.titleTV);
TextView timeTV = (TextView) defaultView.findViewById(R.id.timeTV);
TextView messageTV = (TextView) defaultView.findViewById(R.id.messageTV);
imageView.setImageResource(headsUp.getIcon());
titleTV.setText(headsUp.getTitleStr());
messageTV.setText(headsUp.getMsgStr());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
timeTV.setText(simpleDateFormat.format(new Date()));
if (headsUp.isExpand() && headsUp.getActions().size() > 0) {
defaultView.findViewById(R.id.menuL).setVisibility(VISIBLE);
defaultView.findViewById(R.id.line).setVisibility(VISIBLE);
defaultView.findViewById(R.id.menu1).setVisibility(VISIBLE);
ImageView imageView1 = (ImageView) defaultView.findViewById(R.id.menuIM1);
ImageView imageView2 = (ImageView) defaultView.findViewById(R.id.menuIM2);
ImageView imageView3 = (ImageView) defaultView.findViewById(R.id.menuIM3);
TextView text1 = (TextView) defaultView.findViewById(R.id.menuText1);
TextView text2 = (TextView) defaultView.findViewById(R.id.menuText2);
TextView text3 = (TextView) defaultView.findViewById(R.id.menuText3);
imageView1.setImageResource(headsUp.getActions().get(0).icon);
text1.setText(headsUp.getActions().get(0).title);
defaultView.findViewById(R.id.menu1).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
headsUp.getActions().get(0).actionIntent.send();
cancel();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
});
if (headsUp.getActions().size() > 1) {
defaultView.findViewById(R.id.menu2).setVisibility(VISIBLE);
imageView2.setImageResource(headsUp.getActions().get(1).icon);
text2.setText(headsUp.getActions().get(1).title);
defaultView.findViewById(R.id.menu2).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
headsUp.getActions().get(1).actionIntent.send();
cancel();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
});
}
if (headsUp.getActions().size() > 2) {
defaultView.findViewById(R.id.menu3).setVisibility(VISIBLE);
imageView3.setImageResource(headsUp.getActions().get(2).icon);
text3.setText(headsUp.getActions().get(2).title);
defaultView.findViewById(R.id.menu3).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
headsUp.getActions().get(2).actionIntent.send();
cancel();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
});
}
}
} else {
setCustomView(headsUp.getCustomView());
}
}
use of android.os.Message in project Launcher3 by chislon.
the class LauncherTransitionable method sendAdvanceMessage.
private void sendAdvanceMessage(long delay) {
mHandler.removeMessages(ADVANCE_MSG);
Message msg = mHandler.obtainMessage(ADVANCE_MSG);
mHandler.sendMessageDelayed(msg, delay);
mAutoAdvanceSentTime = System.currentTimeMillis();
}
use of android.os.Message in project PlayerHater by chrisrhoden.
the class SongQueue method getHandler.
private static Handler getHandler() {
if (sHandler == null) {
HandlerThread thread = new HandlerThread("SongQueue");
thread.start();
sHandler = new Handler(thread.getLooper()) {
@Override
public void handleMessage(Message msg) {
SongMessage m = (SongMessage) msg.obj;
switch(msg.what) {
case CURRENT_SONG:
m.queue.sendSongChanged(m.song, m.oldSong);
break;
case NEXT_SONG:
m.queue.sendNextSongChanged(m.song, m.oldSong);
}
}
};
}
return sHandler;
}
use of android.os.Message in project AndroidDynamicLoader by mmin18.
the class AsyncTask method postResult.
private Result postResult(Result result) {
@SuppressWarnings("unchecked") Message message = sHandler.obtainMessage(MESSAGE_POST_RESULT, new AsyncTaskResult<Result>(this, result));
message.sendToTarget();
return result;
}
use of android.os.Message in project qksms by moezbhatti.
the class TransactionService method onStartCommand.
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null) {
// Call onNewIntent (below) on the Transaction thread.
Message msg = mServiceHandler.obtainMessage(EVENT_NEW_INTENT);
msg.arg1 = startId;
msg.obj = intent;
mServiceHandler.sendMessage(msg);
}
// [1]: http://developer.android.com/reference/android/app/Service.html#START_NOT_STICKY
return Service.START_NOT_STICKY;
}
Aggregations