Пример #1
3
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.line_list);

    // Setup the list
    adapter = new IconAdapter<FileWrapper>(this, R.layout.line_list_item);
    ListView list = (ListView) findViewById(R.id.list);
    list.setAdapter(adapter);
    list.setOnItemClickListener(this);

    // Load Directory
    if (savedInstanceState != null) {
      backStack = savedInstanceState.getParcelableArrayList("BACKSTACK");
    }

    if (backStack == null || backStack.size() == 0) {
      backStack = new ArrayList<BackStackItem>();
      String startPath =
          (startDirectory == null || startDirectory.isEmpty())
              ? Environment.getExternalStorageDirectory().getPath()
              : startDirectory;
      backStack.add(new BackStackItem(startPath, false));
    }

    wrapFiles();
    this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
  }
Пример #2
2
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    MyView vw = new MyView(this);
    setContentView(vw);

    mFont = Typeface.createFromAsset(getAssets(), "balloons.ttf");
  }
Пример #3
2
  // Setup
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // Log.v("SDL", "onCreate()");
    super.onCreate(savedInstanceState);

    // So we can call stuff from static callbacks
    mSingleton = this;

    // Set up the surface
    mSurface = new SDLSurface(getApplication());

    // Make sure this variable is initialized here!
    mExitCalledFromJava = false;

    if (Build.VERSION.SDK_INT >= 12) {
      mJoystickHandler = new SDLJoystickHandler_API12();
    } else {
      mJoystickHandler = new SDLJoystickHandler();
    }

    mLayout = new AbsoluteLayout(this);
    mLayout.addView(mSurface);

    setContentView(mLayout);
  }
Пример #4
1
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   textView = new TextView(this);
   textView.setText("Toca y arrastra (solo un dedo)");
   textView.setOnTouchListener(this);
   setContentView(textView);
 }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Create a SQLite database holding event info
    DatabaseOpener dbopenhelper = new DatabaseOpener(this);
    db = dbopenhelper.getWritableDatabase();

    setContentView(R.layout.event_list);

    this.lv = (ListView) findViewById(R.id.eventListView);
    // Subclass CursorAdapter to read data from the database into the
    // ListView
    Cursor c =
        db.query(
            "event",
            new String[] {"_id", "isfavorite", "name", "starttime", "endtime"},
            null,
            null,
            null,
            null,
            "starttime asc");
    dbadapter = new EventListCursorAdapter(this, c, false);
    lv.setAdapter(dbadapter);
  }
Пример #6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // remove title
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main_game);

    allDoneLevels = new ArrayList<>();
    AssetManager am = getResources().getAssets();

    final GameBoard boardView = (GameBoard) this.findViewById(R.id.gameBoard);
    final HowdyShadeView howdyShadeView = (HowdyShadeView) this.findViewById(R.id.howdyShadeView);
    final GlowingBoard glowingBoard = (GlowingBoard) this.findViewById(R.id.glowingBoard);
    final HowdyView howdyView = (HowdyView) this.findViewById(R.id.howdyView);
    this.game = new Game();

    boardView.setHowdyShadeView(howdyShadeView);
    boardView.setGlowingBoard(glowingBoard);
    boardView.setHowdyView(howdyView);
    boardView.setOnTouchListener(new BoardGameTouchListener(this));
  }
Пример #7
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   Intent intent = getIntent();
   Uri uri = intent.getData();
   if (uri != null) {
     MainActivity.addLink(this, uri.toString());
     Uri newUri = Uri.parse("view-source:" + uri.toString());
     startChrome(newUri);
   }
   if (Intent.ACTION_SEND.equals(intent.getAction())) {
     Bundle extras = intent.getExtras();
     if (extras != null) {
       String text = extras.getString(Intent.EXTRA_TEXT);
       Pattern pattern = Pattern.compile(URL_PATTERN);
       if (text != null) {
         Matcher m = pattern.matcher(text);
         if (m.find()) {
           String url = m.group(1);
           MainActivity.addLink(this, url);
           Uri newUri = Uri.parse("view-source:" + url);
           startChrome(newUri);
         }
       }
     }
   }
   this.finish();
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    //
    //	this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.main_login);

    mEtAccount = (EditText) findViewById(R.id.mainLoginEditAccount);
    mEtPassword = (EditText) findViewById(R.id.mainLoginEditPassword);
    mBtnLogin = (Button) findViewById(R.id.mainLoginBtn);
    mBtnRegister = (Button) findViewById(R.id.main_btn_register);

    /* this is to render the password edittext font to be default */
    mEtPassword.setTypeface(Typeface.DEFAULT);
    mEtPassword.setTransformationMethod(new PasswordTransformationMethod());

    mBtnLogin.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            MainActivity.this.tryLogin();
          }
        });

    mBtnRegister.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            Intent intent0 = new Intent(MainActivity.this, RegisterActivity.class);
            startActivity(intent0);
          }
        });
  }
Пример #9
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
      // We can read and write the media

      try {
        url = (String) getIntent().getExtras().get(Intent.EXTRA_TEXT) + "#view:list";
      } catch (Exception e) {
        url = "https://www.dropbox.com/s/8owsfcia59ko76i#view:list";
        // Used for testing if it's not opened from the dropox action menu
        // Obviously what needs to happen here is a message suggesting that the user use the dropbox
        // app, and a textbox in case they've got the url copied.
      }

      showDialog(
          PROGRESS_DIALOG); // Do the work in a separate thread so we can update the UI
                            // simultaneously.

    } else {
      // Can't write files, so show a message and quit.

    }
  }
Пример #10
0
  /** Called when the activity is first created */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "LoaderActivity created");
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.content);

    // Instantiate custom adapter
    mAdapter = new LoaderAdapter();

    // Handle listview and assign adapter
    mListView = (ListView) findViewById(R.id.content_list_view);
    mListView.setAdapter(mAdapter);
    mListView.setVisibility(View.GONE);
    mListView.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {
          public boolean onItemLongClick(AdapterView parent, View view, int position, long id) {
            selectItem(position);
            return true;
          }
        });

    mStatusLabel = (TextView) findViewById(R.id.content_status_label);
    mStatusLabel.setVisibility(View.VISIBLE);

    String userHash = NavigineApp.Settings.getString("user_hash", "");
    if (userHash.length() == 0) showUserHashDialog();
    else refreshMapList();
  }
Пример #11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.xiph_copyright);

    TextView tv = (TextView) findViewById(R.id.text);
    tv.setText(getXiphCopyright());
    tv.setMovementMethod(new ScrollingMovementMethod());
  }
Пример #12
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.data_callwordcp);

    mText = (EditText) findViewById(R.id.edittext);

    findViewById(R.id.readall).setOnClickListener(mClickListener);
    findViewById(R.id.readone).setOnClickListener(mClickListener);
    findViewById(R.id.insert).setOnClickListener(mClickListener);
    findViewById(R.id.delete).setOnClickListener(mClickListener);
    findViewById(R.id.update).setOnClickListener(mClickListener);
  }
Пример #13
0
  @SuppressLint("NewApi")
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    BattleGrid grid = new BattleGrid(getBaseContext(), 10, 10);
    setContentView(grid);

    grid.addUnit(new Warrior("Conan", "Blue", 1, 3));
    grid.addUnit(new Mage("Gandalf", "Blue", 2, 1));
    grid.addUnit(new Archer("Robin Hood", "Red", 4, 6));
    grid.addUnit(new Archer("Also Robin Hood", "Red", 5, 2));
  }
Пример #14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    sdk = android.os.Build.VERSION.SDK_INT;
    player = 1;

    tv = (TextView) findViewById(R.id.mainTextView);
    tv1 = (TextView) findViewById(R.id.mainTextViewVencedor);
    tv.setText("Jogador 1");
  }
Пример #15
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.settings);
   this.setTitle(R.string.setting);
   sp = PreferenceManager.getDefaultSharedPreferences(this);
   edit = sp.edit();
   Button widgettheme = (Button) findViewById(R.id.widgettheme);
   Button settime = (Button) findViewById(R.id.settime);
   Button save = (Button) findViewById(R.id.set_save);
   nc = (CheckBox) findViewById(R.id.nightcheck);
   rs = (CheckBox) findViewById(R.id.ringswitch);
   widgettheme.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View Button) {
           AlertDialog.Builder ad =
               new AlertDialog.Builder(Settings.this)
                   .setTitle("选择颜色?")
                   .setItems(
                       color,
                       new DialogInterface.OnClickListener() {
                         @Override
                         public void onClick(DialogInterface p1, int p2) {
                           edit.putInt("widgetTextColor", colori[p2]);
                           edit.commit();
                         }
                       });
           ad.show();
         }
       });
   settime.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View Button) {
           Intent set = new Intent(Settings.this, Settime.class);
           startActivity(set);
           return;
         }
       });
   save.setOnClickListener(
       new View.OnClickListener() {
         public void onClick(View Button) {
           save();
           return;
         }
       });
   nc.setChecked(sp.getBoolean("nightmode", false));
   if (sp.getBoolean("timewrong", false) == true) {
     rs.setChecked(false);
     rs.setClickable(false);
   }
 }
Пример #16
0
  // Setup
  protected void onCreate(Bundle savedInstanceState) {
    // Log.v("SDL", "onCreate()");
    super.onCreate(savedInstanceState);

    // So we can call stuff from static callbacks
    mSingleton = this;

    // Set up the surface
    mSurface = new SDLSurface(getApplication());
    setContentView(mSurface);
    SurfaceHolder holder = mSurface.getHolder();
    holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
  }
Пример #17
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.input_contextmenu);

    mBtn = (Button) findViewById(R.id.button);
    registerForContextMenu(mBtn);

    mEdit = (EditText) findViewById(R.id.edittext);
    registerForContextMenu(mEdit);

    mImage = (MyImage) findViewById(R.id.myimage);
    registerForContextMenu(mImage);
  }
Пример #18
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.c09_overscroll);

    for (int i = 1001; i <= 1003; i++) {
      mItem.add(Integer.toString(i));
    }

    mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mItem);

    mList = (ListView) findViewById(R.id.list);
    mList.setAdapter(mAdapter);
  }
Пример #19
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.codelayout);

    LinearLayout MyLinear = (LinearLayout) findViewById(R.id.mylinear);
    MyLinear.setOrientation(LinearLayout.HORIZONTAL);

    Button MyBtn = (Button) findViewById(R.id.mybutton);
    MyBtn.setTextSize(40);

    EditText MyEdit = (EditText) findViewById(R.id.myedit);
    MyEdit.setBackgroundColor(0xff00ff00);
  }
Пример #20
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.c19_sdcard);

    mEdit = (EditText) findViewById(R.id.edittext);

    String ext = Environment.getExternalStorageState();
    if (ext.equals(Environment.MEDIA_MOUNTED)) {
      mSdPath = Environment.getExternalStorageDirectory().getAbsolutePath();
    } else {
      mSdPath = Environment.MEDIA_UNMOUNTED;
    }
  }
Пример #21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_loading);

    getWindow().setFormat(PixelFormat.RGBA_8888);

    mPref = new Manage_Camera_SharedPreference(AC_Loading.this);

    loadingIconLayout = (ImageView) findViewById(R.id.loadingIcon);

    cTimer.start();
  }
Пример #22
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState == null) {
      x = 50;
    } else {
      x = savedInstanceState.getInt("x");
    }
    y = 50;
    vw = new MyView(this);
    vw.setFocusable(true);
    vw.setFocusableInTouchMode(true);
    setContentView(vw);
  }
Пример #23
0
  // Setup
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // Log.v("SDL", "onCreate()");
    super.onCreate(savedInstanceState);

    // So we can call stuff from static callbacks
    mSingleton = this;

    // Set up the surface
    mSurface = new SDLSurface(getApplication());

    mLayout = new AbsoluteLayout(this);
    mLayout.addView(mSurface);

    setContentView(mLayout);
  }
Пример #24
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate");
    super.onCreate(savedInstanceState);
    Thread.currentThread().setUncaughtExceptionHandler(this);
    setContentView(R.layout.main);

    inputView = (EditText) findViewById(R.id.input_view);
    inputView.setOnEditorActionListener(this);

    listAdapter = new ArrayAdapter<String>(this, R.layout.row);
    listAdapter.setNotifyOnChange(true);

    resultsView = (ListView) this.findViewById(R.id.results_view);
    resultsView.setAdapter(listAdapter);
    resultsView.setOnItemClickListener(this);
  }
Пример #25
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    c = this;
    preferences = PreferenceManager.getDefaultSharedPreferences(c);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.gpu_sgx540);

    gpuCurrent = readFile(Constants.GPU_SGX540);
    seekGpu = (SeekBar) findViewById(R.id.seek_gpu);

    gpu = Arrays.asList(153, 307, 384);
    seekBar(gpu.size() - 1, gpu.indexOf(gpuCurrent));

    /*else{
    seekGpu.setEnabled(false);
    seekIva.setEnabled(false);
    TextView ns = (TextView)findViewById(R.id.not_supported);
    ns.setVisibility(View.VISIBLE);
    }*/
    preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

    curGpuTxt = (TextView) findViewById(R.id.current_gpu);
    maxGpuTxt = (TextView) findViewById(R.id.max_gpu);
    minGpuTxt = (TextView) findViewById(R.id.min_gpu);

    mhz = getResources().getString(R.string.mhz);
    current = getResources().getString(R.string.current);
    max = getResources().getString(R.string._max);
    min = getResources().getString(R.string._min);
    curGpuTxt.setText(current + ": " + (gpuCurrent) + mhz);
    maxGpuTxt.setText(max + ": " + gpu.get(2) + mhz);
    minGpuTxt.setText(min + ": " + gpu.get(0) + mhz);

    Button cancel = (Button) findViewById(R.id.cancel);
    cancel.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            finish();
          }
        });
  }
Пример #26
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);
   drawView = (DrawingView) findViewById(R.id.drawing);
   smallBrush = getResources().getInteger(R.integer.small_size);
   mediumBrush = getResources().getInteger(R.integer.medium_size);
   largeBrush = getResources().getInteger(R.integer.large_size);
   drawBtn = (ImageButton) findViewById(R.id.draw_btn);
   drawBtn.setOnClickListener(this);
   drawView.setBrushSize(mediumBrush);
   eraseBtn = (ImageButton) findViewById(R.id.erase_btn);
   eraseBtn.setOnClickListener(this);
   newBtn = (ImageButton) findViewById(R.id.new_btn);
   newBtn.setOnClickListener(this);
   equalsBtn = (ImageButton) findViewById(R.id.equals_btn);
   equalsBtn.setOnClickListener(this);
 }
Пример #27
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.receiver);

    final Button cancelbtn = (Button) findViewById(R.id.ButtonCancel);
    // cancelbtn.setEnabled(false);
    cancelbtn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // streamtask.cancel(true);
            finish();
          }
        });

    try {
      Intent intent = getIntent();
      String action = intent.getAction();
      String type = intent.getType();

      if ((!(Intent.ACTION_SEND.equals(action))) || (type == null)) {
        throw new RuntimeException("Unknown intent action or type");
      }

      if (!("text/plain".equals(type))) {
        throw new RuntimeException("Type is not text/plain");
      }

      String extra = intent.getStringExtra(Intent.EXTRA_TEXT);
      if (extra == null) {
        throw new RuntimeException("Cannot get shared text");
      }

      final DownloadStreamTask streamtask = new DownloadStreamTask(this);

      //	Once created, a task is executed very simply:
      streamtask.execute(extra);

    } catch (Exception e) {
      Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();
    }
  }
Пример #28
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dialog_showdialog);

    Button btn = (Button) findViewById(R.id.call);
    btn.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            showDialog(SampleDialog);
          }
        });
    Button btn2 = (Button) findViewById(R.id.call2);
    btn2.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            showDialog(QuestionDialog);
          }
        });
  }
Пример #29
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    helper = new dbHelper(this);
    try {
      db = helper.getWritableDatabase();
    } catch (SQLiteException ex) {
      db = helper.getReadableDatabase();
    }

    edit_name = (EditText) findViewById(R.id.name);
    edit_tel = (EditText) findViewById(R.id.tel);

    findViewById(R.id.add)
        .setOnClickListener(
            new View.OnClickListener() {
              public void onClick(View v) {

                String name = edit_name.getText().toString();
                String tel = edit_tel.getText().toString();
                db.execSQL("INSERT INTO contact VALUES (null, '" + name + "', '" + tel + "');");
              }
            });
    findViewById(R.id.query)
        .setOnClickListener(
            new View.OnClickListener() {
              public void onClick(View v) {
                String name = edit_name.getText().toString();
                Cursor cursor;
                cursor =
                    db.rawQuery("SELECT name, tel FROM contact WHERE name='" + name + "';", null);

                while (cursor.moveToNext()) {
                  String tel = cursor.getString(1);
                  edit_tel.setText(tel);
                }
              }
            });
  }
Пример #30
0
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.copyintent);
 }