/** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

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

          public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("text/plain");
            intent.putExtra(Intent.EXTRA_TEXT, "Test");
            startActivity(Intent.createChooser(intent, "¤À¨É"));
          }
        });

    TextView tv_msg = (TextView) findViewById(R.id.tv_message);
    Intent intent = getIntent();
    Log.d("LINCYU", "ACTION: " + intent.getAction());
    if (intent.getAction().equals(Intent.ACTION_SEND)) {

      tv_msg.setText(intent.getStringExtra(Intent.EXTRA_TEXT));
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    retrieveLocationButton = (Button) findViewById(R.id.retrieve_location_button);
    reverseGeocodingButton = (Button) findViewById(R.id.reverse_geocoding_button);

    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

    locationManager.requestLocationUpdates(
        LocationManager.GPS_PROVIDER,
        MINIMUM_TIME_BETWEEN_UPDATES,
        MINIMUM_DISTANCE_CHANGE_FOR_UPDATES,
        new MyLocationListener());

    retrieveLocationButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            showCurrentLocation();
          }
        });

    reverseGeocodingButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            performReverseGeocodingInBackground();
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    final View view = inflater.inflate(R.layout.carbon_cycle_view, container, false);

    TextView diagramTxt = (TextView) view.findViewById(R.id.txt_diagram);
    TextView savedScoreTxt = (TextView) view.findViewById(R.id.score_saved);

    Button startBtn = (Button) view.findViewById(R.id.go_diagram_btn);

    diagramTxt.setTypeface(tfThin);
    startBtn.setTypeface(tfThin);
    savedScoreTxt.setText((int) ((score / GAME_SCORE) * 100) + "% Sucess");

    startBtn.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {

            Intent carbonIntent = new Intent(getActivity(), DiagramPlayCarbonCycle.class);
            carbonIntent.putExtra("SOURCE", "Fragment");
            carbonIntent.putExtra("TRY_CYCLE", 0);
            carbonIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            carbonIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            carbonIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            startActivity(carbonIntent);
          }
        });

    return view;
  }
Example #4
1
  @Override
  public void onDraw(Canvas canvas, RectF latlonRect, RectF tilesRect, DrawSettings nightMode) {
    BaseMapLayer mainLayer = view.getMainLayer();
    boolean zoomInEnabled =
        mainLayer != null && view.getZoom() < mainLayer.getMaximumShownMapZoom();
    boolean zoomOutEnabled =
        mainLayer != null && view.getZoom() > mainLayer.getMinimumShownMapZoom();
    if (zoomInButton.isEnabled() != zoomInEnabled) {
      zoomInButton.setEnabled(zoomInEnabled);
    }
    if (zoomOutButton.isEnabled() != zoomOutEnabled) {
      zoomOutButton.setEnabled(zoomOutEnabled);
    }

    drawApplicationMode(canvas);

    if (view.isZooming()) {
      showZoomLevel = true;
      showUIHandler.removeMessages(SHOW_ZOOM_LEVEL_MSG_ID);
    } else {
      if (showZoomLevel) {
        hideZoomLevelInTime();
      }
    }
    if (showZoomLevel || !view.getSettings().SHOW_RULER.get()) {
      drawZoomLevel(canvas);
    } else {
      drawRuler(canvas);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final Button runButton = new Button(this);
    runButton.setText("Run away!");

    final RelativeLayout runLayout = (RelativeLayout) findViewById(R.id.runLayout);
    runLayout.addView(runButton);

    final RelativeLayout.LayoutParams buttonParams =
        new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    runButton.setOnClickListener(
        new Button.OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Random rand = new Random();
            buttonParams.leftMargin = rand.nextInt(runLayout.getWidth() - 100);
            buttonParams.topMargin = rand.nextInt(runLayout.getHeight() - 100);

            runButton.setLayoutParams(buttonParams);
          }
        });
  }
Example #6
1
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mDbHelper = new NotesDbAdapter(this);
    mDbHelper.open();

    setContentView(R.layout.note_edit);
    setTitle(R.string.edit_note);

    mTitleText = (EditText) findViewById(R.id.title);
    mBodyText = (EditText) findViewById(R.id.body);

    Button confirmButton = (Button) findViewById(R.id.confirm);

    mRowId =
        (savedInstanceState == null)
            ? null
            : (Long) savedInstanceState.getSerializable(NotesDbAdapter.KEY_ROWID);
    if (mRowId == null) {
      Bundle extras = getIntent().getExtras();
      mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID) : null;
    }

    populateFields();

    confirmButton.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View view) {
            setResult(RESULT_OK);
            finish();
          }
        });
  }
  private void listAll() {
    ViewGroup root = mList;
    root.removeAllViews();

    // 列出所有已经安装的插件
    Collection<PluginDescriptor> plugins = PluginLoader.getPlugins();
    Iterator<PluginDescriptor> itr = plugins.iterator();
    while (itr.hasNext()) {
      final PluginDescriptor pluginDescriptor = itr.next();
      Button button = new Button(this);
      button.setPadding(10, 10, 10, 10);
      button.setText("插件id:" + pluginDescriptor.getPackageName() + ",点击查看");
      button.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              Intent intent = new Intent(PluginListActivity.this, PluginDetailActivity.class);
              intent.putExtra("plugin_id", pluginDescriptor.getPackageName());
              startActivity(intent);
            }
          });

      LayoutParams layoutParam =
          new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
      layoutParam.topMargin = 10;
      layoutParam.bottomMargin = 10;
      layoutParam.gravity = Gravity.LEFT;
      root.addView(button, layoutParam);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    bt1 = (Button) findViewById(R.id.bt_1);
    intent = new Intent(this, NextActivity.class);
    intent.putExtra("name", "kookmin");
    bt1.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // create intent instance
            startActivity(intent);
          }
        });

    bt2 = (Button) findViewById(R.id.bt_2);
    bt2.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent i = new Intent(Intent.ACTION_VIEW);
            Uri u = Uri.parse("http://www.naver.com/");
            i.setData(u);
            startActivity(i);
          }
        });
  }
    @Override
    protected void onCreate() {
      // inflate layout
      LayoutInflater inflater =
          (LayoutInflater)
              this.anchor.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

      ViewGroup root = (ViewGroup) inflater.inflate(R.layout.popup_grid_layout, null);

      // setup button events
      for (int i = 0, icount = root.getChildCount(); i < icount; i++) {
        View v = root.getChildAt(i);

        if (v instanceof TableRow) {
          TableRow row = (TableRow) v;

          for (int j = 0, jcount = row.getChildCount(); j < jcount; j++) {
            View item = row.getChildAt(j);
            if (item instanceof Button) {
              Button b = (Button) item;
              b.setOnClickListener(this);
            }
          }
        }
      }

      // set the inflated view as what we want to display
      this.setContentView(root);
    }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_inscription);

    // NAVIGATION : vers l'écran des abonnés
    Button but_abonne = (Button) findViewById(R.id.but_abonne);
    but_abonne.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View view) {
            Intent intent = new Intent(view.getContext(), AbonneActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
            startActivityForResult(intent, 0);
          }
        });

    // NAVIGATION : retour à l'écran d'accueil
    Button but_exit = (Button) findViewById(R.id.but_exit);
    but_exit.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View view) {
            Intent intent = new Intent(getApplicationContext(), AccueilActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
          }
        });
  }
Example #11
0
  private void playFile() {
    if (playingFile == null || !playingFile.isFile()) resetPlayingFile();
    if (playingFile == null) {
      Toast.makeText(AndroidWave.this, "Cannot play file", Toast.LENGTH_SHORT).show();
      return;
    }
    if (mp != null) mp.stop();
    Log.d("file to play", playingFile.getAbsolutePath());
    mp = MediaPlayer.create(AndroidWave.this, Uri.fromFile(playingFile));
    if (mp == null) {
      Toast.makeText(AndroidWave.this, "Cannot play file", Toast.LENGTH_SHORT).show();
      return;
    }
    mp.setOnCompletionListener(
        new OnCompletionListener() {

          @Override
          public void onCompletion(MediaPlayer arg0) {
            stopPlayFile();
          }
        });
    sm.stop();
    mp.start();
    playButton.setText(R.string.stop);
    playButton.setBackgroundColor(0xFF009900);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // 월별 캘린더 뷰 객체 참조
    monthView = (CalendarMonthView) findViewById(R.id.monthView);
    monthViewAdapter = new CalendarMonthAdapter(this);
    monthView.setAdapter(monthViewAdapter);

    monthText = (TextView) findViewById(R.id.monthText);
    setMonthText();

    // 리스너 설정
    monthView.setOnDataSelectionListener(
        new OnDataSelectionListener() {
          public void onDataSelected(AdapterView parent, View v, int position, long id) {
            // 현재 선택한 일자 정보 표시
            MonthItem curItem = (MonthItem) monthViewAdapter.getItem(position);
            int day = curItem.getDay();
            monthViewAdapter.setSelectedPosition(position);
            monthViewAdapter.notifyDataSetChanged();
            curPosition = position;
            schedule = monthViewAdapter.getSchedule(position);
            if (schedule == null) {
              schedule = new ArrayList<ScheduleTextItem>();
            }
            adapter.mSchedule = schedule;
            adapter.notifyDataSetChanged();
          }
        });

    // 이전 월로 넘어가는 이벤트 처리
    Button monthPrevious = (Button) findViewById(R.id.monthPrevious);
    monthPrevious.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            monthViewAdapter.setPreviousMonth();
            monthViewAdapter.notifyDataSetChanged();

            setMonthText();
          }
        });

    // 다음 월로 넘어가는 이벤트 처리
    Button monthNext = (Button) findViewById(R.id.monthNext);
    monthNext.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            monthViewAdapter.setNextMonth();
            monthViewAdapter.notifyDataSetChanged();

            setMonthText();
          }
        });

    listView = (ListView) findViewById(R.id.listView);
    adapter = new ScheduleTextListAdapter(this);
    listView.setAdapter(adapter);
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    // getMenuInflater().inflate(R.menu.quick_pay, menu);
    // return true;
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main, menu);

    if (numWalletInvites == null) {
      numWalletInvites = getData.getNumInvites();
    }

    View count = menu.findItem(R.id.badge).getActionView();
    Button notifWalletCount;
    notifWalletCount = (Button) count.findViewById(R.id.notif_count);
    notifWalletCount.setText(numWalletInvites.toString());
    notifWalletCount.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            showInvites();
          }
        });

    if (numWalletInvites == 0) {
      count.setVisibility(View.INVISIBLE);
    }

    return super.onCreateOptionsMenu(menu);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text_and_button);

    text = (TextView) findViewById(R.id.text);
    button = (Button) findViewById(R.id.button);

    text.setText("--");
    button.setText("Set Time");
    button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            FragmentManager fm = getSupportFragmentManager();
            DateTime now = DateTime.now();
            RadialTimePickerDialog timePickerDialog =
                RadialTimePickerDialog.newInstance(
                    SampleRadialTimeCustom.this,
                    now.getHourOfDay(),
                    now.getMinuteOfHour(),
                    DateFormat.is24HourFormat(SampleRadialTimeCustom.this));
            timePickerDialog.setThemeCustom(R.style.MyCustomBetterPickersRadialTimePickerDialog);
            timePickerDialog.show(fm, FRAG_TAG_TIME_PICKER);
          }
        });
  }
  @Override
  protected void setUpListeners() {
    btnDoSomeMath.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            JSONObject data = new JSONObject();
            try {
              ArrayList<Integer> values = new ArrayList<Integer>();
              values.add(1);
              values.add(3);
              data.put(kValues, new JSONArray(values));
              sendEvent(JSAddValues, data, JSValuesCallback);
            } catch (JSONException e) {
              e.printStackTrace();
            }
          }
        });

    btnTestAuto.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            mArrayTest = new ArrayList<Object>();
            mArrayTest.add(0, "quotes : it's working \"great\"");
            mArrayTest.add(1, "+ is nice.");
            mArrayTest.add(2, "url &eactue;é&12;\n3#23:%20'\\u0020hop");
            mArrayTest.add(3, "'{ obj_representation : \"test\"}'");
            mArrayTest.add(4, "emoji \ue415 \\ue415 u{1f604}");
            mArrayTest.add(5, "http://42.com?key=xbE%2B49MCgE7/WTKqnvwQ3f4zYmg%3D");

            launchTest(0);
          }
        });
  }
  /**
   * Inicializa las vistas de este Fragment
   *
   * @param layout el layout de este Fragment que contiene las vistas
   */
  private void initViews(View layout) {
    createButton = (Button) layout.findViewById(R.id.create_tokenly_fan_identity);
    mFanExternalUserName = (EditText) layout.findViewById(R.id.external_username);
    mFanExternalPassword = (EditText) layout.findViewById(R.id.tokenly_access_password);
    fanImage = (ImageView) layout.findViewById(R.id.tokenly_fan_image);
    mFanExternalPlatform = (Spinner) layout.findViewById(R.id.external_platform);
    relativeLayout = (RelativeLayout) layout.findViewById(R.id.user_image);
    createButton.setText((!isUpdate) ? "Create" : "Update");
    mFanExternalUserName.requestFocus();
    List<String> arraySpinner = ExternalPlatform.getArrayItems();
    ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, arraySpinner);
    mFanExternalPlatform.setAdapter(adapter);
    mFanExternalUserName.requestFocus();
    registerForContextMenu(fanImage);
    fanImage.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            CommonLogger.debug(TAG, "Entrando en fanImage.setOnClickListener");
            getActivity().openContextMenu(fanImage);
          }
        });

    createButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            CommonLogger.debug(TAG, "Entrando en createButton.setOnClickListener");

            int resultKey = createNewIdentity();
            switch (resultKey) {
              case CREATE_IDENTITY_SUCCESS:
                //
                // changeActivity(Activities.CCP_SUB_APP_INTRA_USER_IDENTITY.getCode(),
                // appSession.getAppPublicKey());
                if (!isUpdate) {
                  Toast.makeText(getActivity(), "Identity created", Toast.LENGTH_SHORT).show();
                } else {
                  Toast.makeText(getActivity(), "Changes saved", Toast.LENGTH_SHORT).show();
                }
                break;
              case CREATE_IDENTITY_FAIL_MODULE_EXCEPTION:
                Toast.makeText(getActivity(), "Error al crear la identidad", Toast.LENGTH_LONG)
                    .show();
                break;
              case CREATE_IDENTITY_FAIL_NO_VALID_DATA:
                Toast.makeText(getActivity(), "La data no es valida", Toast.LENGTH_LONG).show();
                break;
              case CREATE_IDENTITY_FAIL_MODULE_IS_NULL:
                Toast.makeText(
                        getActivity(),
                        "No se pudo acceder al module manager, es null",
                        Toast.LENGTH_LONG)
                    .show();
                break;
            }
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recommended);
    fb = new Firebase(getResources().getString(R.string.firebase_url));
    mArrayAdapter =
        new ArrayAdapter<>(
            this, R.layout.list_item, R.id.list_item_textview, new ArrayList<String>());
    ListView recentMovies = (ListView) findViewById(R.id.recommended_listView);
    majorfield = (EditText) findViewById(R.id.search_major_edittext);
    Button searchButton = (Button) findViewById(R.id.recommendation_search_button);
    ratingbar = (RatingBar) findViewById(R.id.search_ratingbar);

    searchButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            int rating = Math.round(ratingbar.getRating());
            String major = majorfield.getText().toString();
            getRecommendations(major, rating);
          }
        });

    recentMovies.setAdapter(mArrayAdapter);
  }
 @Override
 public void onClick(View v) {
   // we'll just display a simple toast on a button click
   Button b = (Button) v;
   Toast.makeText(this.anchor.getContext(), b.getText(), Toast.LENGTH_SHORT).show();
   this.dismiss();
 }
Example #19
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_top);

    mBtCancel = (Button) findViewById(R.id.bt_cancel);
    mBtOk = (Button) findViewById(R.id.bt_OK);

    mBtOk.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            setResult(RESULT_OK);
            finish();
          }
        });

    mBtCancel.setOnClickListener(
        new Button.OnClickListener() {
          @Override
          public void onClick(View v) {
            setResult(RESULT_CANCELED);
            finish();
          }
        });
  }
Example #20
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.photo_gallery_activity);

    Button galleryButton = (Button) findViewById(R.id.gallary_button);

    headerText1 = (TextView) findViewById(R.id.header_text_1);
    headerText2 = (TextView) findViewById(R.id.header_text_2);
    footerText1 = (TextView) findViewById(R.id.footer_text_1);
    footerText2 = (TextView) findViewById(R.id.footer_text_2);
    setupStatusBar();
    Typeface myTypeface = Typeface.createFromAsset(getAssets(), "fonts/keepclam.ttf");
    headerText1.setTypeface(myTypeface);
    headerText2.setTypeface(myTypeface);
    footerText1.setTypeface(myTypeface);
    footerText2.setTypeface(myTypeface);
    galleryButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.v("PhotoActivity", "Clicked Gallery");
            startActivityForResult(
                new Intent(
                    Intent.ACTION_PICK,
                    android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI),
                GET_FROM_GALLERY);
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    drawer = (MaterialNavigationDrawer) getActivity();

    Button button = new Button(this.getActivity());
    button.setText("start child fragment");
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    button.setLayoutParams(params);
    button.setGravity(Gravity.CENTER);

    button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            drawer.changeFragment(new ChildFragment(), "Child Title");
            // normally currentSection gets unselect on setCustomFragment call
            // in the next relase, i will add a new method without unselect
            drawer.getCurrentSectionFragment().select();

            // call on current git head. drawer.getCurrentSectionFragment().select(); is not needed
            // drawer.setCustomFragment(drawer.getCurrentSectionFragment().getTargetFragment(),
            // drawer.getCurrentSectionFragment().getFragmentTitle(), true, false);
          }
        });

    return button;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Log.v(TAG, "onCreate called");
    txtfirtsname = (EditText) findViewById(R.id.editText_fname);
    txtlastname = (EditText) findViewById(R.id.editText_lname);
    txtaddress = (EditText) findViewById(R.id.editText_address);
    txtemail = (EditText) findViewById(R.id.editText_email);
    txtto = (EditText) findViewById(R.id.editText_to);
    txtsubj = (EditText) findViewById(R.id.editText_subj);
    txttextmsg = (EditText) findViewById(R.id.editText_text);

    btnexport = (Button) findViewById(R.id.button_export);
    btnexport.setOnClickListener(this);
    btninsertdata = (Button) findViewById(R.id.button_Insert);
    btninsertdata.setOnClickListener(this);
    btnsendmail = (Button) findViewById(R.id.button_sendmail);
    btnsendmail.setOnClickListener(this);
    btnimport = (Button) findViewById(R.id.button_import);
    btnimport.setOnClickListener(this);

    dbhelper = new DatabaseHelper(getApplicationContext());
  }
Example #23
0
 private void drawApplicationMode(Canvas canvas) {
   ApplicationMode appMode = view.getSettings().getApplicationMode();
   if (appMode != cacheApplicationMode) {
     modeShadow.setBounds(
         backToMenuButton.getLeft() + (int) (2 * scaleCoefficient),
         backToMenuButton.getTop() - (int) (20 * scaleCoefficient),
         backToMenuButton.getRight() - (int) (4 * scaleCoefficient),
         backToMenuButton.getBottom());
     if (appMode == ApplicationMode.CAR) {
       cacheAppModeIcon = view.getResources().getDrawable(R.drawable.car_small);
     } else if (appMode == ApplicationMode.BICYCLE) {
       cacheAppModeIcon = view.getResources().getDrawable(R.drawable.bicycle_small);
     } else if (appMode == ApplicationMode.PEDESTRIAN) {
       cacheAppModeIcon = view.getResources().getDrawable(R.drawable.pedestrian_small);
     } else {
       cacheAppModeIcon = view.getResources().getDrawable(R.drawable.default_mode_small);
     }
     int l =
         modeShadow.getBounds().left
             + (modeShadow.getBounds().width() - cacheAppModeIcon.getMinimumWidth()) / 2;
     int t = (int) (modeShadow.getBounds().top + 5 * scaleCoefficient);
     cacheAppModeIcon.setBounds(
         l, t, l + cacheAppModeIcon.getMinimumWidth(), t + cacheAppModeIcon.getMinimumHeight());
   }
   modeShadow.draw(canvas);
   if (cacheAppModeIcon != null) {
     cacheAppModeIcon.draw(canvas);
   }
 }
Example #24
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    overridePendingTransition(R.anim.pull_in_from_left, R.anim.pull_out_to_left);
    setContentView(R.layout.pass);

    close = (Button) findViewById(R.id.pass_cl);
    login = (Button) findViewById(R.id.pass_yes);
    forget = (Button) findViewById(R.id.pass_no);
    uName = (EditText) findViewById(R.id.pass_username);
    pass = (EditText) findViewById(R.id.pass_pwd);
    tView = (TextView) findViewById(R.id.pass_title);

    close.setOnClickListener(this);
    login.setOnClickListener(this);
    forget.setOnClickListener(this);

    db.open();
    Cursor mCursor = db.getAllRecords();
    mCursor.moveToFirst();
    rName = mCursor.getString(1);
    if (mCursor.getCount() > 0) {
      uName.setClickable(false);
      uName.setBackgroundResource(R.drawable.keypad1);
    }
    db.close();
    tView.setText(rName + " @ MoneyMan");
    uName.setText(rName);
  } // end onCreate()
  public void displayPopup(View view) {
    LayoutInflater inflater =
        (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View popView = (View) inflater.inflate(R.layout.add_popup, null, false);
    Button okButton = (Button) popView.findViewById(R.id.okButton);
    okButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            addRow(v);
          }
        });

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

          @Override
          public void onClick(View v) {
            _popPopupWindow.dismiss();
            _popPopupWindow = null;
          }
        });

    _popPopupWindow = new PopupWindow(popView, 400, 300, true);
    _popPopupWindow.setBackgroundDrawable(new BitmapDrawable());
    _popPopupWindow.setOutsideTouchable(false);
    _popPopupWindow.setFocusable(true);

    _popPopupWindow.showAtLocation(this.findViewById(R.id.LinearLayout1), Gravity.CENTER, 0, 0);
  }
Example #26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    initializeList();
    inDrawerLayout();
    btnsearch = (Button) findViewById(R.id.btn_main_search);
    btnproduct = (Button) findViewById(R.id.btn_product);
    btnstory = (Button) findViewById(R.id.btn_story);
    btnintroduce = (Button) findViewById(R.id.btn_introduce);
    btnsearch.setOnClickListener(this);
    btnproduct.setOnClickListener(this);
    btnstory.setOnClickListener(this);
    btnintroduce.setOnClickListener(this);

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

          @Override
          public void onClick(View v) {
            switch (v.getId()) {
              case R.id.btn_drawer:
                drawer.openDrawer(drawerList);
                break;
              default:
                break;
            }
          }
        });
  }
 protected void onCreate(Bundle paramBundle)
 {
   kkxxkk.b041E041EОО041EО(getApplicationContext());
   xkkkxk.b041E041EООО041E(getApplicationContext());
   super.onCreate(paramBundle);
   setContentView(2130968686);
   a = ((AbsListView)findViewById(2131362386));
   b = new mr(this);
   c = ((Button)findViewById(2131362385));
   c.setOnClickListener(new View.OnClickListener()
   {
     public final void onClick(View paramAnonymousView)
     {
       abp.a(HttpMetricsActivity.this);
     }
   });
   d = ((Button)findViewById(2131362381));
   d.setOnClickListener(this);
   e = ((Button)findViewById(2131362382));
   e.setOnClickListener(this);
   f = ((Button)findViewById(2131362384));
   f.setOnClickListener(this);
   g = ((Button)findViewById(2131362383));
   g.setOnClickListener(this);
   a.setAdapter(b);
   getSupportLoaderManager().initLoader$71be8de6(900, this);
 }
  private void showRefund() {
    refund = (Button) findViewById(getResourseIdByName(getPackageName(), "id", "refund"));
    refund.setVisibility(View.VISIBLE);
    refund.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("message/rfc822");
            intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"support@bitpay.com"});
            intent.putExtra(Intent.EXTRA_SUBJECT, "Refund Request");
            intent.putExtra(
                Intent.EXTRA_TEXT,
                "Invoice: "
                    + mInvoice.getUrl()
                    + ((mInvoice.getRefundAddresses() != null
                            && mInvoice.getRefundAddresses().size() > 0)
                        ? "\nRefund Address:" + mInvoice.getRefundAddresses()
                        : "")
                    + "\nReason: Overpaid invoice");

            startActivity(Intent.createChooser(intent, "Send Email"));
          }
        });
  }
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRootView = inflater.inflate(R.layout.fragment_protocol, container, false);
    ProtocolDataBaseHelper db =
        new ProtocolDataBaseHelper(this.getActivity(), DB_NAME, null, DB_VERSION);
    question = (TextView) mRootView.findViewById(R.id.exerciseQuestion);
    mCardView = (RelativeLayout) mRootView.findViewById(R.id.card);
    rg = new RadioGroup(getActivity());
    addAnswerRadioButtons();
    seeSolution = (Button) mRootView.findViewById(R.id.seesolution);
    check = (Button) mRootView.findViewById(R.id.checkbutton);
    // Manejador del evento de mostrar solución (solo en modo entrenamiento).
    seeSolution.setOnClickListener(
        new OnClickListener() {
          private Object TAG;

          @Override
          public void onClick(View arg0) {

            flag = false;
            int i = 0;
            while (i < NUMBER_OF_ANSWERS) {
              if ((respRadioButton[i].getText().equals(test.getResponse())) && (!flag)) {
                respRadioButton[i].setChecked(true);
                flag = true;
              }
              i++;
            }
          }
        });
    // Manejador del botón de comprobación de respuesta.
    check.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            flag = false;
            int index = 0;
            while ((index < NUMBER_OF_ANSWERS) && (!flag)) {
              if (respRadioButton[index].isChecked()) {
                checkIfButtonClickedIsCorrectAnswer(index);
                flag = true;
              }
              index++;
            }
            if (!gameMode) newQuestion();
          }
        });
    try {
      db.createDataBase();
      db.openDataBase();
    } catch (IOException e) {
      // TODO: extraer cadenas a recursos
      Toast.makeText(this.getActivity(), "Error al abrir la base de datos", Toast.LENGTH_LONG)
          .show();
    }

    testList = db.loadData();
    newQuestion();
    return mRootView;
  }
Example #30
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final getDataDB db = new getDataDB();
    final Button login_button = (Button) findViewById(R.id.login_button);
    final TextView error_message = (TextView) findViewById(R.id.error_message);
    final EditText password = (EditText) findViewById(R.id.password_field);
    final EditText username = (EditText) findViewById(R.id.username_field);
    login_button.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            error_message.setText("confirming logging information");

            int k = db.confirmLogin(username.getText().toString(), password.getText().toString());
            if (k == 0) {
              startActivity(new Intent(MainActivity.this, main_menu.class));

            } else if (k == 1) {
              error_message.setText("incorrect password");
            } else if (k == 2) {
              error_message.setText("username or password incorrect");
            }
          }
        });
  }