List of usage examples for android.app Activity setContentView
public void setContentView(View view)
From source file:com.savvasdalkitsis.butterknifeaspects.aspects.Binder.java
static void bindTo(Activity activity) { activity.setContentView(findLayoutId(activity)); ButterKnife.bind(activity); }
From source file:Main.java
public static void setLayout(Activity context, int layout, int titleBar) { context.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); context.setContentView(layout); context.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, titleBar); }
From source file:Main.java
public static void initialize(Activity activity, int layout) { // Do all sorts of common task for your activities here including: activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); activity.setContentView(layout); activity.getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON); activity.getActionBar().setDisplayOptions( ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); }
From source file:net.xkor.genaroid.Genaroid.java
public static void setContentView(@NonNull Activity activity) { int layoutId = Genaroid.getLayoutId(activity); if (layoutId != 0) { activity.setContentView(layoutId); }// ww w . j av a 2 s . c om }
From source file:Main.java
/** * add GestureOverlayView to an activity * @param activity/*from ww w. ja v a2 s.c o m*/ * @return added GestureOverlayView */ public static GestureOverlayView addGestureViewToActivity(Activity activity) { View contentView = getContentView(activity); GestureOverlayView view = new GestureOverlayView(activity); view.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1)); activity.setContentView(view); view.addView(contentView); // adds the PhoneGap browser view.getChildAt(0).setLayoutParams(new FrameLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT, 1)); activity.setContentView(view); view.setGestureVisible(false); return view; }
From source file:com.aaplab.android.roboboost.RoboBoost.java
/** * Sets content for specified activity and injects all fields and methods marked by injection annotations in object. * <p>/*w w w . j a v a 2 s . com*/ * See full list of injection annotations in javadoc for this class. * </p> * * @param activity Activity an activity to be processed and which content will be used for resolving injections, can't be * <code>null</code> * @param layoutId int layout id to be inflated * @throws IllegalArgumentException if <code>activity</code> is <code>null</code> * @throws InflateException if any injection error has occured */ public static void setInjectedContentView(Activity activity, int layoutId) { activity.setContentView(layoutId); doInjections(activity); }
From source file:com.aaplab.android.roboboost.RoboBoost.java
/** * Sets content for specified activity and injects all fields and methods marked by injection annotations in object. * <p>/*from w ww . jav a2s . c o m*/ * See full list of injection annotations in javadoc for this class. * </p> * * @param activity Activity an activity to be processed and which content will be used for resolving injections, can't be * <code>null</code> * @param contentView View view to be inflated * @throws IllegalArgumentException if any argument is <code>null</code> * @throws InflateException if any injection error has occured */ public static void setInjectedContentView(Activity activity, View contentView) { activity.setContentView(contentView); doInjections(activity); }
From source file:com.apptentive.android.sdk.module.engagement.interaction.view.TextModalInteractionView.java
@Override public void doOnCreate(final Activity activity, Bundle onSavedInstanceState) { activity.setContentView(R.layout.apptentive_textmodal_interaction_center); TextView title = (TextView) activity.findViewById(R.id.title); if (interaction.getTitle() == null) { title.setVisibility(View.GONE); } else {// ww w .j a va 2s . co m title.setText(interaction.getTitle()); } TextView body = (TextView) activity.findViewById(R.id.body); if (interaction.getBody() == null) { body.setVisibility(View.GONE); } else { body.setText(interaction.getBody()); } LinearLayout bottomArea = (LinearLayout) activity.findViewById(R.id.bottom_area); List<Action> actions = interaction.getActions().getAsList(); boolean vertical; if (actions != null && !actions.isEmpty()) { int totalChars = 0; for (Action button : actions) { totalChars += button.getLabel().length(); } if (actions.size() == 1) { vertical = false; } else if (actions.size() == 2) { vertical = totalChars > MAX_TEXT_LENGTH_FOR_TWO_BUTTONS; } else if (actions.size() == 3) { vertical = totalChars > MAX_TEXT_LENGTH_FOR_THREE_BUTTONS; } else if (actions.size() == 4) { vertical = totalChars > MAX_TEXT_LENGTH_FOR_FOUR_BUTTONS; } else { vertical = true; } if (vertical) { bottomArea.setOrientation(LinearLayout.VERTICAL); } else { bottomArea.setOrientation(LinearLayout.HORIZONTAL); } for (int i = 0; i < actions.size(); i++) { final Action buttonAction = actions.get(i); final int position = i; ApptentiveDialogButton button = new ApptentiveDialogButton(activity); button.setText(buttonAction.getLabel()); switch (buttonAction.getType()) { case dismiss: button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { JSONObject data = new JSONObject(); try { data.put(TextModalInteraction.EVENT_KEY_ACTION_ID, buttonAction.getId()); data.put(Action.KEY_LABEL, buttonAction.getLabel()); data.put(TextModalInteraction.EVENT_KEY_ACTION_POSITION, position); } catch (JSONException e) { Log.e("Error creating Event data object.", e); } EngagementModule.engageInternal(activity, interaction, TextModalInteraction.EVENT_NAME_DISMISS, data.toString()); activity.finish(); } }); break; case interaction: button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LaunchInteractionAction launchInteractionButton = (LaunchInteractionAction) buttonAction; List<Invocation> invocations = launchInteractionButton.getInvocations(); String interactionIdToLaunch = null; for (Invocation invocation : invocations) { if (invocation.isCriteriaMet(activity)) { interactionIdToLaunch = invocation.getInteractionId(); break; } } Interaction invokedInteraction = null; if (interactionIdToLaunch != null) { Interactions interactions = InteractionManager.getInteractions(activity); if (interactions != null) { invokedInteraction = interactions.getInteraction(interactionIdToLaunch); } } JSONObject data = new JSONObject(); try { data.put(TextModalInteraction.EVENT_KEY_ACTION_ID, buttonAction.getId()); data.put(Action.KEY_LABEL, buttonAction.getLabel()); data.put(TextModalInteraction.EVENT_KEY_ACTION_POSITION, position); data.put(TextModalInteraction.EVENT_KEY_INVOKED_INTERACTION_ID, invokedInteraction == null ? JSONObject.NULL : invokedInteraction.getId()); } catch (JSONException e) { Log.e("Error creating Event data object.", e); } EngagementModule.engageInternal(activity, interaction, TextModalInteraction.EVENT_NAME_INTERACTION, data.toString()); if (invokedInteraction != null) { EngagementModule.launchInteraction(activity, invokedInteraction); } activity.finish(); } }); break; } bottomArea.addView(button); } } else { bottomArea.setVisibility(View.GONE); } }
From source file:com.android.browser.GearsSettingsDialog.java
public GearsSettingsDialog(Activity activity, Handler handler, String arguments) { super(activity, handler, arguments); activity.setContentView(R.layout.gears_settings); }
From source file:com.f2prateek.dfg.ui.debug.DebugAppContainer.java
@Override public ViewGroup get(final Activity activity, DFGApplication app) { this.app = app; this.activity = activity; drawerContext = activity;/*from w ww. j av a 2s . co m*/ activity.setContentView(R.layout.debug_activity_frame); // Manually find the debug drawer and inflate the drawer layout inside of it. ViewGroup drawer = findById(activity, R.id.debug_drawer); LayoutInflater.from(drawerContext).inflate(R.layout.debug_drawer_content, drawer); // Inject after inflating the drawer layout so its views are available to inject. ButterKnife.inject(this, activity); // Set up the contextual actions to watch views coming in and out of the content area. Set<ContextualDebugActions.DebugAction<?>> debugActions = Collections.emptySet(); ContextualDebugActions contextualActions = new ContextualDebugActions(this, debugActions); content.setOnHierarchyChangeListener(HierarchyTreeChangeListener.wrap(contextualActions)); drawerLayout.setDrawerShadow(R.drawable.debug_drawer_shadow, GravityCompat.END); drawerLayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerOpened(View drawerView) { refreshPicassoStats(); } }); // If you have not seen the debug drawer before, show it with a message if (!seenDebugDrawer.get()) { drawerLayout.postDelayed(new Runnable() { @Override public void run() { drawerLayout.openDrawer(GravityCompat.END); Toast.makeText(activity, R.string.debug_drawer_welcome, Toast.LENGTH_LONG).show(); } }, 1000); seenDebugDrawer.set(true); } setupUserInterfaceSection(); setupBuildSection(); setupDeviceSection(); setupPicassoSection(); return content; }