use of wei.mark.standout.StandOutWindow in project StandOut by pingpongboss.
the class MultiWindow method onReceiveData.
@Override
public void onReceiveData(int id, int requestCode, Bundle data, Class<? extends StandOutWindow> fromCls, int fromId) {
// to show off the data sending framework
switch(requestCode) {
case WidgetsWindow.DATA_CHANGED_TEXT:
Window window = getWindow(id);
if (window == null) {
String errorText = String.format(Locale.US, "%s received data but Window id: %d is not open.", getAppName(), id);
Toast.makeText(this, errorText, Toast.LENGTH_SHORT).show();
return;
}
String changedText = data.getString("changedText");
TextView status = (TextView) window.findViewById(R.id.id);
status.setTextSize(20);
status.setText("Received data from WidgetsWindow: " + changedText);
break;
default:
Log.d("MultiWindow", "Unexpected data received.");
break;
}
}
use of wei.mark.standout.StandOutWindow in project StandOut by pingpongboss.
the class FloatingFolder method onReceiveData.
@Override
public void onReceiveData(int id, int requestCode, Bundle data, Class<? extends StandOutWindow> fromCls, int fromId) {
switch(requestCode) {
case APP_SELECTOR_CODE:
if (APP_SELECTOR_ID == id) {
// app selector receives data
Window window = show(APP_SELECTOR_ID);
window.data.putInt("fromId", fromId);
}
break;
case APP_SELECTOR_FINISHED_CODE:
final ActivityInfo app = data.getParcelable("app");
Log.d("FloatingFolder", "Received app: " + app);
Window window = getWindow(id);
if (window == null) {
return;
}
ViewGroup flow = (ViewGroup) window.findViewById(R.id.flow);
addAppToFolder(id, app, flow);
onUserAddApp(id, app);
break;
case STARTUP_CODE:
loadAllFolders();
if (mFolders.size() == 0) {
mFolders.put(DEFAULT_ID, new FolderModel());
show(DEFAULT_ID);
} else {
for (int i = 0; i < mFolders.size(); i++) {
FolderModel folder = mFolders.get(mFolders.keyAt(i));
if (folder.shown) {
show(folder.id);
}
}
}
break;
}
}
use of wei.mark.standout.StandOutWindow in project Roundr by MohammadAdib.
the class Corner method onStartCommand.
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null) {
String action = intent.getAction();
int corner = intent.getIntExtra("id", DEFAULT_ID);
if (corner == ONGOING_NOTIFICATION_ID) {
throw new RuntimeException("ID cannot equals StandOutWindow.ONGOING_NOTIFICATION_ID");
}
if (ACTION_SHOW.equals(action) || ACTION_RESTORE.equals(action)) {
show(corner);
} else if (ACTION_SETTINGS.equals(action)) {
try {
Intent intentS = new Intent(this, SettingsActivity.class);
intentS.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intentS);
} catch (Exception e) {
// Addressing this issue: http://i.imgur.com/Op9kfy8.png
}
} else if (ACTION_HIDE.equals(action)) {
hide(corner);
} else if (ACTION_CLOSE.equals(action)) {
close(corner);
} else if (ACTION_CLOSE_ALL.equals(action)) {
closeAll();
} else if (ACTION_SEND_DATA.equals(action)) {
if (isExistingId(corner) || corner == DISREGARD_ID) {
Bundle data = intent.getBundleExtra("wei.mark.standout.data");
int requestCode = intent.getIntExtra("requestCode", 0);
@SuppressWarnings("unchecked") Class<? extends StandOutWindow> fromCls = (Class<? extends StandOutWindow>) intent.getSerializableExtra("wei.mark.standout.fromCls");
int fromId = intent.getIntExtra("fromId", DEFAULT_ID);
onReceiveData(corner, requestCode, data, fromCls, fromId);
}
}
}
return START_NOT_STICKY;
}
use of wei.mark.standout.StandOutWindow in project Roundr by MohammadAdib.
the class Corner method onReceiveData.
@Override
public void onReceiveData(int corner, int requestCode, Bundle data, Class<? extends StandOutWindow> fromCls, int fromId) {
Window window = getWindow(corner);
if (requestCode == UPDATE_CODE) {
// Update the corners when device is rotated
updateViewLayout(3, getParams(3, window));
updateViewLayout(2, getParams(2, window));
updateViewLayout(1, getParams(1, window));
updateViewLayout(0, getParams(0, window));
} else if (requestCode == NOTIFICATION_CODE) {
if (!prefs.getBoolean("notification", true)) {
// Hide Notification Icon (for <= Gingerbread devices only)
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = getPersistentNotification(corner);
notification.icon = wei.mark.standout.R.drawable.nothing;
mNotificationManager.notify(getClass().hashCode() + ONGOING_NOTIFICATION_ID, notification);
Log.d("Hello World", "");
} else {
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = getPersistentNotification(corner);
mNotificationManager.notify(getClass().hashCode() + ONGOING_NOTIFICATION_ID, notification);
}
}
}
Aggregations