コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    LocaleUtil.initLocale(this);

    boolean shouldRefresh = getIntent().getBooleanExtra(EXTRA_SHOULD_REFRESH, false);

    binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
    DataBindingUtil.bind(binding.navView.getHeaderView(0));

    MainApplication.getComponent(this).inject(this);

    subscription.add(
        brokerProvider
            .get()
            .observe()
            .subscribe(
                page -> {
                  toggleToolbarElevation(page.shouldToggleToolbar());
                  changePage(page.getTitleResId(), page.createFragment());
                  binding.navView.setCheckedItem(page.getMenuId());
                }));

    initView();
    AppUtil.setTaskDescription(
        this, getString(R.string.all_sessions), AppUtil.getThemeColorPrimary(this));

    if (savedInstanceState == null) {
      replaceFragment(SessionsFragment.newInstance(shouldRefresh));
    } else {
      binding.toolbar.setTitle(savedInstanceState.getString(EXTRA_TITLE));
    }
    getSupportFragmentManager().addOnBackStackChangedListener(this);
  }
コード例 #2
0
  @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);
          }
        });
  }
コード例 #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_info);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

    // Back button
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setDisplayHomeAsUpEnabled(true);
    }

    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(mViewPager);

    // Set title if object exists.
    MalwareObject malwareObject = getIntent().getExtras().getParcelable("malware");
    if (malwareObject != null) {
      getSupportActionBar().setTitle(malwareObject.getName());
    }
  }
コード例 #4
0
  @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);
  }
コード例 #5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    downloadedImage = (ImageView) findViewById(R.id.imageView);
  }
コード例 #6
0
ファイル: PhotoActivity.java プロジェクト: msaadq/Face_Flag
  @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);
          }
        });
  }
コード例 #7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    editText = (EditText) findViewById(R.id.input);
    textView = (TextView) findViewById(R.id.textview);
    findViewById(R.id.send)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                String name = editText.getText().toString();
                startConnection(name);
                //				HttpGetTask getTask = new HttpGetTask(new HttpGetTask.IAsyncResponseListener()
                // {
                //					@Override public void onResult(String string) {
                //						if (string == null) {
                //							textView.setText("No response received");
                //						}
                //						else {
                //							textView.setText(string);
                //						}
                //					}
                //				});
              }
            });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    addListenerButton();
  }
コード例 #9
0
  /**
   * Creates the select parking options page.
   *
   * @param savedInstanceState Saved instance state
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_select_parking_options);

    // Retrieve screen inputs
    whereToLabel_ = (TextView) findViewById(R.id.whereToLabel);
    whereToSpinner_ = (Spinner) findViewById(R.id.whereToList);
    findParkingButton_ = (Button) findViewById(R.id.findParkingButton);

    // Populate the Where To? spinner - reuse TOC text view layout
    List<Building> buildingList = Session.getCurrentBuildings();
    int numBuildings = buildingList.size();
    String[] buildingNames = new String[numBuildings];
    for (int i = 0; i < numBuildings; i++) {
      buildingNames[i] = buildingList.get(i).getName();
    }

    ArrayAdapter whereToAdapter =
        new ArrayAdapter<String>(this, R.layout.activity_toclistview, buildingNames);

    // Specify dropdown layout
    whereToAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);

    // Apply adapter to spinner
    whereToSpinner_.setAdapter(whereToAdapter);
  }
コード例 #10
0
ファイル: Do.java プロジェクト: skortabeast/myirregularverbs
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_do);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(false);

    if (android.os.Build.VERSION.SDK_INT < 19) {
      FrameLayout statusBar = (FrameLayout) findViewById(R.id.fragment_container);
      statusBar.setVisibility(View.GONE);
    }

    mContext = this;

    mSoundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
    mAssetManager = getAssets();

    mDoSound = loadSound("do.ogg");
    mDidSound = loadSound("did.ogg");
    mDoneSound = loadSound("done.ogg");

    ImageButton imageButtonDo = (ImageButton) this.findViewById(R.id.imageButtonDo);
    imageButtonDo.setOnClickListener(onClickListener);

    ImageButton imageButtonDid = (ImageButton) this.findViewById(R.id.imageButtonDid);
    imageButtonDid.setOnClickListener(onClickListener);

    ImageButton imageButtonDone = (ImageButton) this.findViewById(R.id.imageButtonDone);
    imageButtonDone.setOnClickListener(onClickListener);
  }
コード例 #11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    im1 = (ImageView) findViewById(R.id.im1);
    setSupportActionBar(toolbar);

    new AsyncTask<Void, Void, Void>() {
      @Override
      protected Void doInBackground(Void... params) {
        try {
          bitmap = Glide.with(MainActivity.this).load(url).asBitmap().into(500, 500).get();
        } catch (InterruptedException e) {
          e.printStackTrace();
        } catch (ExecutionException e) {
          e.printStackTrace();
        }
        return null;
      }
    }.execute();
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            im1.setImageBitmap(bitmap);
          }
        });
  }
コード例 #12
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(getContentView());
   initializeToolBar();
   initializeDB();
 }
コード例 #13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_vertical_stepper_form);

    initializeActivity();
  }
コード例 #14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    TabHost host = (TabHost) findViewById(R.id.tab_host);
    host.setup();

    // Tab 1
    TabHost.TabSpec spec = host.newTabSpec("Timeline");
    spec.setContent(R.id.tab1);
    spec.setIndicator("Timeline");
    host.addTab(spec);

    // Tab 2
    spec = host.newTabSpec("Direct Message");
    spec.setContent(R.id.tab2);
    spec.setIndicator("Direct Message");
    host.addTab(spec);

    // Tab 3
    spec = host.newTabSpec("Profile");
    spec.setContent(R.id.tab3);
    spec.setIndicator("Profile");
    host.addTab(spec);
  }
コード例 #15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    generateShuffle();

    mainLayout = (LinearLayout) findViewById(R.id.activity_main_linear_layout);
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    params.weight = 1f;
    for (int i = 0; i < 4; i++) {
      LinearLayout row = new LinearLayout(this);
      // row.setOrientation(LinearLayout.HORIZONTAL);
      for (int j = 0; j < 3; j++) {
        ImageView imageView = new ImageView(this);
        imageView.setTag(tag++);
        imageView.setOnClickListener(this);
        imageView.setImageResource(R.drawable.card_back);
        row.addView(imageView, params);
      }
      mainLayout.addView(row, params);
    }
  }
コード例 #16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    overridePendingTransition(R.anim.right_in, R.anim.right_out);
    super.onCreate(savedInstanceState);

    setTranslucentStatus(true);
    setSystemBarTintDrawable(getResources().getDrawable(R.drawable.dwPrimary));

    mContext = this;
    BaseAppManager.getInstance().addActivity(this);

    DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);

    mScreenDensity = displayMetrics.density;
    mScreenHeight = displayMetrics.heightPixels;
    mScreenWidth = displayMetrics.widthPixels;

    if (getContentViewLayoutID() != 0) {
      setContentView(getContentViewLayoutID());
    } else {
      throw new IllegalArgumentException("You must return a right contentView layout resource Id");
    }

    initViewsAndEvents();
  }
コード例 #17
0
ファイル: MainActivity.java プロジェクト: Lovis/hemul-Android
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    drawerItems = getResources().getStringArray(R.array.drawerItems);
    drawer = (DrawerLayout) findViewById(R.id.drawerLayout);
    drawerList = (ListView) findViewById(R.id.left_drawer);

    // Set the adapter for the list view
    drawerList.setAdapter(new ArrayAdapter<>(this, R.layout.item_row, drawerItems));
    // Set the list's click listener, and expose first view
    drawerList.setOnItemClickListener(new DrawerItemClickListener());
    selectItem(0);

    drawerToggle =
        new ActionBarDrawerToggle(this, drawer, toolbar, R.string.app_name, R.string.app_name) {

          @Override
          public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
          }

          @Override
          public void onDrawerClosed(View drawerView) {
            super.onDrawerClosed(drawerView);
          }
        };
    drawer.setDrawerListener(drawerToggle);
    drawerToggle.syncState();
  }
コード例 #18
0
ファイル: second.java プロジェクト: Moataz-hesham/Hopa
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.second);

    TextView tv = (TextView) findViewById(R.id.textView);
    tv.setText("Hello, " + getIntent().getExtras().getString("t"));
  }
コード例 #19
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.chase_activity_result);
   playerData =
       (PlayerData)
           this.getIntent()
               .getExtras()
               .getSerializable(GameSettings.CHASE_GAME_PLAYER_TO_RESULT_TAG);
   gameData =
       (GameData)
           this.getIntent().getExtras().getSerializable(GameSettings.CHASE_GAME_TO_RESULT_TAG);
   new ToolbarSetter(this);
   try {
     Results.setForChase(gameData, playerData);
   } catch (RestException e) {
     e.printStackTrace();
     e.getErrorAlert(this).show();
   }
   TextView result = (TextView) findViewById(R.id.resultsTextView);
   if (gameData.getChases().get(playerData.getUserID()).getStatus().equals(ChaseStatus.DEAD)) {
     result.setText("You LOSE!\n You're character is dead");
   } else {
     result.setText("You WIN!\n Hunter didn't catch you!");
   }
 }
コード例 #20
0
ファイル: StartActivity.java プロジェクト: DustRaven/PipCal
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_start);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    this.setTitle(R.string.title_activity_start);

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle =
        new ActionBarDrawerToggle(
            this,
            drawer,
            toolbar,
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    checkSD();
  }
コード例 #21
0
ファイル: EditProfile.java プロジェクト: codelicius/jodi
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_profile);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    db = new SQLiteController(getApplicationContext());
    sessions = new sessionmanager(getApplicationContext());

    Bundle bundle = getIntent().getExtras();
    if (bundle != null) fromActivity = bundle.getString("fromActivity");

    HashMap<String, String> profile = db.getUserDetails();
    String id = profile.get("id");
    String gender = profile.get("gender");
    String age = profile.get("age");
    String race = profile.get("race");
    String religion = profile.get("religion");
    String height = profile.get("height");
    String location = profile.get("location");
    String horoscope = profile.get("horoscope");
    String job = profile.get("job");
    String userDetail = profile.get("user_detail");
    String roko = profile.get("merokok");
    String alkohol = profile.get("alkohol");
    String tps = profile.get("tipe_pasangan");
    String kgt = profile.get("kegiatan");
    String interest = profile.get("interest");
    String satnite = profile.get("satnite");

    deskripsi = (EditText) findViewById(R.id.deskripsi);
    tipe_pasangan = (EditText) findViewById(R.id.tipe_pasangan);
    kegiatan = (EditText) findViewById(R.id.kegiatan);
    halsuka = (EditText) findViewById(R.id.halsuka);
    malming = (EditText) findViewById(R.id.malming);
    tinggi = (EditText) findViewById(R.id.tinggi);
    txtReligion = (Spinner) findViewById(R.id.agama);
    txtRokok = (Spinner) findViewById(R.id.merokok);
    txtAlkohol = (Spinner) findViewById(R.id.alkohol);
    txtRace = (Spinner) findViewById(R.id.suku);
    txtLocation = (Spinner) findViewById(R.id.lokasi);
    txtHoroscope = (Spinner) findViewById(R.id.horoskop);
    txtJob = (Spinner) findViewById(R.id.pekerjaan);
    getSpinner("suku");
    getSpinner("pekerjaan");
    getSpinner("lokasi");
    tinggi.setText(height);
    deskripsi.setText(userDetail);
    tipe_pasangan.setText(tps);
    kegiatan.setText(kgt);
    halsuka.setText(interest);
    malming.setText(satnite);
    getIndex(txtRokok, roko);
    getIndex(txtAlkohol, alkohol);
    getIndex(txtRace, race);
    getIndex(txtLocation, location);
    getIndex(txtHoroscope, horoscope);
    getIndex(txtJob, job);
    getIndex(txtReligion, religion);
  }
コード例 #22
0
ファイル: Activity2.java プロジェクト: enif17/TaskThree
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_2);
   Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
   setSupportActionBar(toolbar);
 }
コード例 #23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_viewpager);

    mViewPager = (ViewPager) findViewById(R.id.v_scroll);
    StickHeaderLayout shl_root = (StickHeaderLayout) findViewById(R.id.shl_root);
    mViewPager.setOffscreenPageLimit(4);

    manager = new StickHeaderViewPagerManager(shl_root, mViewPager);

    viewList = new ArrayList<ViewPagerBean>();

    SimpleRecyclerView simpleRecyclerView = new SimpleRecyclerView(this);
    viewList.add(
        new ViewPagerBean(simpleRecyclerView, simpleRecyclerView.getPlaceHoderHeaderLayout()));

    SimpleScrollView simpleScrollView = new SimpleScrollView(this);
    viewList.add(new ViewPagerBean(simpleScrollView, simpleScrollView.getPlaceHoderHeaderLayout()));

    SimpleListView simpleListView = new SimpleListView(this);
    viewList.add(new ViewPagerBean(simpleListView, simpleListView.getPlaceHoderHeaderLayout()));

    SimpleWebView simpleWebView = new SimpleWebView(this);
    viewList.add(new ViewPagerBean(simpleWebView, simpleWebView.getPlaceHoderHeaderLayout()));

    mViewPager.setAdapter(pagerAdapter);

    initTabBar();
  }
コード例 #24
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_line_chart);
    mLineChart = (LineChart) findViewById(R.id.line_chart_view);

    LineChartConfig config = new LineChartConfig(getApplicationContext());

    ArrayList<String> xValues = new ArrayList<>();
    for (int i = 0; i < 15; i++) {
      xValues.add("" + (i));
    }
    config.xAxisValues = xValues;

    for (int j = 0; j < 3; j++) { // 循环产生三条曲

      BaseLineChartData baseLineChartData = new BaseLineChartData();

      ArrayList<Float> yValues = new ArrayList<>();
      for (int i = 0;
          i < 12;
          i++) { // 注意y的数据不能比x的多否则会One or more of the DataSet Entry arrays are longer than the
        // x-values array of this ChartData object.
        yValues.add((float) (Math.random() * 100 - 20));
      }
      baseLineChartData.yAxisValues = yValues;
      baseLineChartData.mDrawFilled = true;
      config.yAxisValuesArray.add(baseLineChartData);
    }

    ChartUtil.getInstance().initLineChart(mLineChart, config);
  }
コード例 #25
0
ファイル: Pants.java プロジェクト: bonopi07/Codimaker3
  @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();
          }
        });
  }
コード例 #26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_page);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                .setAction("Action", null)
                .show();
          }
        });

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle =
        new ActionBarDrawerToggle(
            this,
            drawer,
            toolbar,
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
  }
コード例 #27
0
ファイル: MainActivity.java プロジェクト: lqn/YunMeet
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //
    ButterKnife.bind(this);
    getSupportActionBar().hide();
    final ViewPagerAdapter adap = new ViewPagerAdapter(getSupportFragmentManager());
    viewpager.setAdapter(adap);
    viewpager.addOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageScrolled(
              int position, float positionOffset, int positionOffsetPixels) {}

          @Override
          public void onPageSelected(int position) {
            updateTotal(position, PIC_LINKS.length);
          }

          @Override
          public void onPageScrollStateChanged(int state) {}
        });
    updateTotal(0, PIC_LINKS.length);
  }
コード例 #28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_album);
    lv = (ListView) this.findViewById(R.id.listView);

    Proveedor proveedor = new Proveedor();

    Cursor c = proveedor.query(Contrato.TablaDisco.CONTENT_URI, null, null, null, null);
    c.moveToFirst();

    ad = new AdaptadorCursorDisco(this, c);

    lv.setAdapter(ad);

    lv.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent i = new Intent(AlbumActivity.this, CancionesActivity.class);
            Bundle bun = new Bundle();
            bun.putLong("id", id);
            i.putExtras(bun);
            startActivity(i);
          }
        });
  }
コード例 #29
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_weather_pager);

    UUID weatherId = (UUID) getIntent().getSerializableExtra(WEATHER_FORECAST_ID);

    mViewPager = (ViewPager) findViewById(R.id.activity_weather_pager_view_pager);

    mWeather = WeatherStation.get(this).getWeather();
    FragmentManager fragmentManager = getSupportFragmentManager();
    mViewPager.setAdapter(
        new FragmentStatePagerAdapter(fragmentManager) {

          @Override
          public Fragment getItem(int position) {
            Weather weather = mWeather.get(position);
            return WeatherDetailsFragment.newInstance(weather.getId());
          }

          @Override
          public int getCount() {
            return mWeather.size();
          }
        });
  }
コード例 #30
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    setupToolbar();
  }