Java Code Examples for android.view.Window

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/views/.

Source file: CameraSurface.java

  33 
vote

private void initializeScreenBrightness(){
  Window win=this.mActivity.getWindow();
  int mode=Settings.System.getInt(this.getContext().getContentResolver(),Settings.System.SCREEN_BRIGHTNESS_MODE,Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
  if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
    WindowManager.LayoutParams winParams=win.getAttributes();
    winParams.screenBrightness=DEFAULT_CAMERA_BRIGHTNESS;
    win.setAttributes(winParams);
  }
}
 

Example 2

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/app/.

Source file: ActionBarImpl.java

  32 
vote

public ActionBarImpl(Activity activity,int features){
  mActivity=activity;
  Window window=activity.getWindow();
  View decor=window.getDecorView();
  init(decor);
  if ((features & (1 << Window.FEATURE_ACTION_BAR_OVERLAY)) == 0) {
    mContentView=(NineFrameLayout)decor.findViewById(android.R.id.content);
  }
}
 

Example 3

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/app/.

Source file: ActionBarImpl.java

  32 
vote

public ActionBarImpl(Activity activity,int features){
  mActivity=activity;
  Window window=activity.getWindow();
  View decor=window.getDecorView();
  init(decor);
  if ((features & (1 << Window.FEATURE_ACTION_BAR_OVERLAY)) == 0) {
    mContentView=(NineFrameLayout)decor.findViewById(android.R.id.content);
  }
}
 

Example 4

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/app/.

Source file: ActionBarImpl.java

  32 
vote

public ActionBarImpl(Activity activity,int features){
  mActivity=activity;
  Window window=activity.getWindow();
  View decor=window.getDecorView();
  init(decor);
  if ((features & (1 << Window.FEATURE_ACTION_BAR_OVERLAY)) == 0) {
    mContentView=(NineFrameLayout)decor.findViewById(android.R.id.content);
  }
}
 

Example 5

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/app/.

Source file: ActionBarImpl.java

  32 
vote

public ActionBarImpl(Activity activity,int features){
  mActivity=activity;
  Window window=activity.getWindow();
  View decor=window.getDecorView();
  init(decor);
  if ((features & (1 << Window.FEATURE_ACTION_BAR_OVERLAY)) == 0) {
    mContentView=(NineFrameLayout)decor.findViewById(android.R.id.content);
  }
}
 

Example 6

From project andlytics, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/app/.

Source file: ActionBarImpl.java

  32 
vote

public ActionBarImpl(Activity activity,int features){
  mActivity=activity;
  Window window=activity.getWindow();
  View decor=window.getDecorView();
  init(decor);
  if ((features & (1 << Window.FEATURE_ACTION_BAR_OVERLAY)) == 0) {
    mContentView=(NineFrameLayout)decor.findViewById(android.R.id.content);
  }
}
 

Example 7

From project Android, under directory /app/src/main/java/com/github/mobile/ui/user/.

Source file: HomeActivity.java

  31 
vote

private void reloadOrgs(){
  getSupportLoaderManager().restartLoader(0,null,new LoaderCallbacks<List<User>>(){
    @Override public Loader<List<User>> onCreateLoader(    int id,    Bundle bundle){
      return HomeActivity.this.onCreateLoader(id,bundle);
    }
    @Override public void onLoadFinished(    Loader<List<User>> loader,    final List<User> users){
      HomeActivity.this.onLoadFinished(loader,users);
      if (users.isEmpty())       return;
      Window window=getWindow();
      if (window == null)       return;
      View view=window.getDecorView();
      if (view == null)       return;
      view.post(new Runnable(){
        @Override public void run(){
          isDefaultUser=false;
          setOrg(users.get(0));
        }
      }
);
    }
    @Override public void onLoaderReset(    Loader<List<User>> loader){
      HomeActivity.this.onLoaderReset(loader);
    }
  }
);
}
 

Example 8

From project abalone-android, under directory /src/com/bytopia/abalone/.

Source file: SplashAcitvity.java

  29 
vote

public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.splash);
  Thread splashTimer=new Thread(){
    public void run(){
      try {
        long ms=0;
        while (m_bSplashActive && ms < m_dwSplashTime) {
          sleep(100);
          if (!m_bPaused)           ms+=100;
        }
        startActivity(new Intent("com.bytopia.abalone.MAINMENU"));
      }
 catch (      Exception e) {
        Log.e("Splash",e.toString());
      }
 finally {
        finish();
      }
    }
  }
;
  splashTimer.start();
}
 

Example 9

From project AChartEngine, under directory /client/src/org/achartengine/demo/.

Source file: Demo.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().requestFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.main);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.titlebar_icon);
  findViewById(R.id.button_multiseries_data_provider).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      Uri u=DataContentProvider.BASE_URI.buildUpon().appendPath(DataContentProvider.CHART_DATA_MULTISERIES_PATH).appendPath(DataContentProvider.CHART_DATA_UNLABELED_PATH).build();
      Intent i=new Intent(Intent.ACTION_VIEW,u);
      i.putExtra(Intent.EXTRA_TITLE,TemperatureData.DEMO_CHART_TITLE);
      startActivity(i);
    }
  }
);
  findViewById(R.id.button_labeled_multiseries_data_provider).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      Uri u=DataContentProvider.BASE_URI.buildUpon().appendPath(DataContentProvider.CHART_DATA_MULTISERIES_PATH).appendPath(DataContentProvider.CHART_DATA_LABELED_PATH).build();
      Intent i=new Intent(Intent.ACTION_VIEW,u);
      i.putExtra(Intent.EXTRA_TITLE,DonutData.DEMO_CHART_TITLE);
      startActivity(i);
    }
  }
);
}
 

Example 10

From project ActionBarCompat, under directory /ActionBarCompat/src/sk/m217/actionbarcompat/.

Source file: ActionBarHelperBase.java

  29 
vote

public void initActionBar(){
  if (mInitialized) {
    return;
  }
  mActivity.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.actionbar_compat);
  setupActionBar();
  mMenu=new SimpleMenu(mActivity);
  mMenu.setCallback(new SimpleMenu.Callback(){
    @Override public boolean onMenuItemSelected(    SimpleMenu menu,    MenuItem item){
      return mActivity.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL,item);
    }
  }
);
  mActivity.onCreatePanelMenu(Window.FEATURE_OPTIONS_PANEL,mMenu);
  mActivity.onPrepareOptionsMenu(mMenu);
  for (int i=0; i < mMenu.size(); i++) {
    MenuItem item=mMenu.getItem(i);
    if (mActionItemIds.contains(item.getItemId())) {
      addActionItemCompatFromMenuItem(item);
    }
  }
  mExpandedMenuPresenter=new ExpandedActionViewMenuPresenter();
  mActionMenuPresenter=new ActionMenuPresenter();
  mMenu.addMenuPresenter(mExpandedMenuPresenter);
  mMenu.addMenuPresenter(mActionMenuPresenter);
  mInitialized=true;
}
 

Example 11

From project aksunai, under directory /src/org/androidnerds/app/aksunai/ui/.

Source file: ChatSwitcher.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.chat_switcher_dialog);
  mContainer=(ViewGroup)findViewById(R.id.pseudogallery);
synchronized (mServer.mMessageLists) {
    for (    MessageList c : mServer.mMessageLists.values()) {
      LayoutInflater inflater=(LayoutInflater)mCtx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View v=inflater.inflate(R.layout.chat_switcher_item,null);
      TextView tv=(TextView)v.findViewById(R.id.switcher_chat_title);
      tv.setText(c.mName);
      ImageView iv=(ImageView)v.findViewById(R.id.avatar);
      if (c.mType == MessageList.Type.PRIVATE) {
        iv.setImageResource(R.drawable.chat);
      }
 else       if (c.mType == MessageList.Type.CHANNEL) {
        iv.setImageResource(R.drawable.channel);
      }
 else {
        iv.setImageResource(R.drawable.server);
      }
      v.setOnClickListener(mClickListener);
      mContainer.addView(v);
    }
  }
  mContainer.requestLayout();
}
 

Example 12

From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/.

Source file: AddCommentActivity.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.layout_add_comment);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.icon_nouveau_rapport);
  final EditText commentField=(EditText)findViewById(R.id.EditText_comment);
  commentField.setText(getIntent().getStringExtra(IntentData.EXTRA_COMMENT));
  ((TextView)findViewById(R.id.TextView_remaining_chars)).setText((140 - commentField.getText().length()) + " car. restant");
  commentField.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(    Editable s){
      ((TextView)findViewById(R.id.TextView_remaining_chars)).setText((140 - commentField.getText().length()) + " car. restant");
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
  findViewById(R.id.Button_validate).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (commentField.getText().toString().trim().length() > 0) {
        Intent result=new Intent();
        result.putExtra(IntentData.EXTRA_COMMENT,commentField.getText().toString());
        setResult(RESULT_OK,result);
        finish();
      }
 else {
        Toast.makeText(getApplicationContext(),"Veuillez entrer un commentaire",Toast.LENGTH_SHORT).show();
      }
    }
  }
);
}
 

Example 13

From project and-bible, under directory /tests/Buttons/src/org/andbible/buttons/.

Source file: CustomTitlebarActivityBase.java

  29 
vote

/** 
 * custom title bar code to add the FEATURE_CUSTOM_TITLE just before setContentView and set the new titlebar layout just after
 */
@Override public void setContentView(int layoutResID){
  requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
  super.setContentView(layoutResID);
  getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.title_bar);
  mDocumentTitleLink=(Button)findViewById(R.id.titleDocument);
  mPageTitleLink=(Button)findViewById(R.id.titlePassage);
  mProgressBarIndeterminate=(ProgressBar)findViewById(R.id.progressCircular);
  mQuickBibleChangeLink=(Button)findViewById(R.id.quickBibleChange);
  mQuickCommentaryChangeLink=(Button)findViewById(R.id.quickCommentaryChange);
  mDocumentTitleLink.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
    }
  }
);
  mPageTitleLink.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
    }
  }
);
  mQuickBibleChangeLink.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
    }
  }
);
  mQuickCommentaryChangeLink.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
    }
  }
);
}
 

Example 14

From project android-api-demos, under directory /src/com/mobeelizer/demos/activities/.

Source file: BaseActivity.java

  29 
vote

/** 
 * Allows to display information or error dialog with specific text to the user. Round brackets contains the  {@code id} value required to show eachdialog. <p> <b>Possible information dialogs:</b><br/> - Simple Sync Activity Help ( {@code D_SIMPLE_SYNC})<br/> - Photo Sync Activity Help ( {@code D_PHOTO_SYNC})<br/> - Permissions Activity Help ( {@code D_PERMISSIONS})<br/> - Conflicts Activity Help ( {@code D_CONFLICTS})<br/> - Relations Activity Help ( {@code D_RELATIONS}) <p> The custom dialog ( {@code D_CUSTOM}) can also be shown. In this case additional information needs to be provided. <br/> Custom dialog requires reference to  {@link Bundle} object with thefollowing fields:<br/> - type of the dialog (information or error) -  {@code IS_INFO} as{@code boolean}<br/> - text to display as resource id -  {@code TEXT_RES_ID} as {@code int}<br/> - text to display as String object -  {@code CUSTOM_TEXT} as{@code String} <br/><br/> The last two can be used interchangeably but when both are used resource id is preferred.
 */
@Override protected Dialog onCreateDialog(final int id,final Bundle args){
  Dialog dialog=null;
switch (id) {
case D_CUSTOM:
    if (args == null || (args.getInt(TEXT_RES_ID,-1) == -1 && args.getString(CUSTOM_TEXT) == null)) {
      return null;
    }
case D_SIMPLE_SYNC:
case D_PHOTO_SYNC:
case D_PERMISSIONS:
case D_CONFLICTS:
case D_RELATIONS:
case D_PUSH_NOTIFICATIONS:
  break;
default :
return null;
}
dialog=new Dialog(this,R.style.MobeelizerDialogTheme);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
return dialog;
}
 

Example 15

From project Android-automation, under directory /TmtsApp/src/com/taobao/tmts/framework/app/.

Source file: ListViewActivity.java

  29 
vote

public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.listview_layout);
  ListView listview=(ListView)findViewById(R.id.my_listview);
  ArrayList<HashMap<String,Object>> listitem=new ArrayList<HashMap<String,Object>>();
  for (int i=0; i < 100; i++) {
    HashMap<String,Object> map=new HashMap<String,Object>();
    map.put("itemimage",R.drawable.icon);
    map.put("itemTitle","Item" + i);
    map.put("itemText","Thank you!");
    listitem.add(map);
  }
  SimpleAdapter listitemAdapter=new SimpleAdapter(this,listitem,R.layout.listview_item_layout,new String[]{"itemimage","itemTitle","itemText"},new int[]{R.id.ItemImage,R.id.ItemTitle,R.id.ItemText});
  listview.setAdapter(listitemAdapter);
  listview.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
    }
  }
);
  listview.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){
    @Override public void onCreateContextMenu(    ContextMenu menu,    View v,    ContextMenuInfo menuInfo){
      menu.setHeaderTitle("Hello");
      menu.add(0,0,0,"Item One");
      menu.add(0,1,0,"Item Two");
    }
  }
);
}
 

Example 16

From project android-bankdroid, under directory /src/com/liato/bankdroid/.

Source file: LockableActivity.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  mLockPatternUtils=new LockPatternUtils(this);
  mLockPatternUtils.setVisiblePatternEnabled(mPrefs.getBoolean("patternlock_visible_pattern",true));
  mLockPatternUtils.setTactileFeedbackEnabled(mPrefs.getBoolean("patternlock_tactile_feedback",false));
  requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
}
 

Example 17

From project android-client_1, under directory /src/com/googlecode/asmack/view/.

Source file: AuthenticatorActivity.java

  29 
vote

/** 
 * Create an AuthenticatorActivity based on a bundle.
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  accountManager=AccountManager.get(this);
  final Intent intent=getIntent();
  String username=intent.getStringExtra(PARAM_USERNAME);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.login);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,android.R.drawable.ic_dialog_alert);
  EditText usernameEdit=(EditText)findViewById(R.id.e_mail_textbox);
  usernameEdit.setText(username);
}
 

Example 18

From project android-context, under directory /defunct/.

Source file: DialogActivity.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.dialog_activity);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,android.R.drawable.ic_dialog_alert);
  timer.schedule(new ContextDismissTask(),(DISMISS_TIMEOUT * 1000));
}
 

Example 19

From project Android-File-Manager, under directory /src/com/nexes/manager/.

Source file: ApplicationBackup.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.backup_layout);
  mAppLabel=(TextView)findViewById(R.id.backup_label);
  Button button=(Button)findViewById(R.id.backup_button_all);
  button.setOnClickListener(this);
  mAppList=new ArrayList<ApplicationInfo>();
  mPackMag=getPackageManager();
  get_downloaded_apps();
  setListAdapter(new TableView());
}
 

Example 20

From project android-gltron, under directory /GlTron/src/com/glTron/.

Source file: glTron.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  WindowManager w=getWindowManager();
  Display d=w.getDefaultDisplay();
  int width=d.getWidth();
  int height=d.getHeight();
  super.onCreate(savedInstanceState);
  this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  _View=new OpenGLView(this,width,height);
  setContentView(_View);
}
 

Example 21

From project android-joedayz, under directory /Proyectos/AndroidFoursquare/src/com/mycompany/fsq/.

Source file: FoursquareDialog.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mSpinner=new ProgressDialog(getContext());
  mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
  mSpinner.setMessage("Loading...");
  mContent=new LinearLayout(getContext());
  mContent.setOrientation(LinearLayout.VERTICAL);
  setUpTitle();
  setUpWebView();
  Display display=getWindow().getWindowManager().getDefaultDisplay();
  final float scale=getContext().getResources().getDisplayMetrics().density;
  float[] dimensions=(display.getWidth() < display.getHeight()) ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
  addContentView(mContent,new FrameLayout.LayoutParams((int)(dimensions[0] * scale + 0.5f),(int)(dimensions[1] * scale + 0.5f)));
  CookieSyncManager.createInstance(getContext());
  CookieManager cookieManager=CookieManager.getInstance();
  cookieManager.removeAllCookie();
}