Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.foler.appname;
- import android.content.DialogInterface;
- import android.content.Intent;
- import android.media.MediaPlayer;
- import android.net.Uri;
- import android.support.design.widget.TabLayout;
- import android.support.design.widget.Snackbar;
- import android.support.v7.app.AlertDialog;
- import android.support.v7.app.AppCompatActivity;
- import android.support.v7.widget.Toolbar;
- import android.support.v4.app.Fragment;
- import android.support.v4.app.FragmentManager;
- import android.support.v4.app.FragmentPagerAdapter;
- import android.support.v4.view.ViewPager;
- import android.os.Bundle;
- import android.view.LayoutInflater;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.Button;
- import android.widget.ImageView;
- import android.widget.TextView;
- import java.util.Map;
- import net.rithms.riot.constant.Region;
- import net.rithms.riot.dto.Stats.RankedStats;
- import net.rithms.riot.dto.Summoner.Summoner;
- import net.rithms.riot.api.RiotApi;
- import net.rithms.riot.api.RiotApiException;
- import net.rithms.riot.dto.Static.Champion;
- import net.rithms.riot.dto.Stats.AggregatedStats;
- import net.rithms.riot.dto.Stats.ChampionStats;
- import com.google.gson.*;
- import net.rithms.riot.constant.PlayerStatSummaryType;
- import net.rithms.riot.constant.Season;
- import net.rithms.riot.dto.Stats.PlayerStatsSummary;
- import net.rithms.riot.dto.Stats.PlayerStatsSummaryList;
- public class NewLayoutActivity extends AppCompatActivity {
- /**
- * The {@link android.support.v4.view.PagerAdapter} that will provide
- * fragments for each of the sections. We use a
- * {@link FragmentPagerAdapter} derivative, which will keep every
- * loaded fragment in memory. If this becomes too memory intensive, it
- * may be best to switch to a
- * {@link android.support.v4.app.FragmentStatePagerAdapter}.
- */
- private SectionsPagerAdapter mSectionsPagerAdapter;
- /**
- * The {@link ViewPager} that will host the section contents.
- */
- private ViewPager mViewPager;
- private Intromanager intromanager;
- private MediaPlayer mp;
- private Boolean streamon = false;
- ImageView streamView;
- private String tier, division;
- static int points, wins, losses, ratio, BOtarget, BOwins, BOlosses, BOprogress;
- static TextView ratioView;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_new_layout);
- intromanager = new Intromanager(this);
- intromanager.setFirst(true);
- Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
- // Create the adapter that will return a fragment for each of the three
- // primary sections of the activity.
- mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
- // Set up the ViewPager with the sections adapter.
- mViewPager = (ViewPager) findViewById(R.id.container);
- mViewPager.setAdapter(mSectionsPagerAdapter);
- TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
- tabLayout.setupWithViewPager(mViewPager);
- ratioView = (TextView)findViewById(R.id.ratioView);
- checkStats(null);
- }
- public static void checkStats(String[] args) throws RiotApiException {
- RiotApi api = new RiotApi("DEVELOPER KEY REDACTED");
- Summoner summoner = api.getSummonerById(Region.EUW, "ID REDACTED");
- RankedStats statsRanked = api.getRankedStats(Region.EUW, summoner.getId());
- AggregatedStats rankedStats = statsRanked.getChampions().get(0).getStats();
- wins = rankedStats.getTotalSessionsWon();
- losses = rankedStats.getTotalSessionsLost();
- ratio = wins / losses;
- ratioView.setText(wins + " / " + losses + " | " + "Ratio : " + ratio);
- }
- public void onOOHClick(View v) {
- mp = MediaPlayer.create(this, R.raw.ooooooh);
- mp.start();
- }
- public void onbClick(View v) { // not used yet
- mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
- mp.start();
- }
- public void onAAHClick(View v) {
- mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
- mp.start();
- }
- public void oncClick(View v) { // not used yet
- mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
- mp.start();
- }
- public void ondClick(View v) { // not used yet
- mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
- mp.start();
- }
- public void onwhatClick(View v) { // not used yet
- mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
- mp.start();
- }
- public void onfClick(View v) { // not used yet
- mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
- mp.start();
- }
- public void ongClick(View v) { // not used yet
- mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
- mp.start();
- }
- public void onTwitterClick(View v) {
- Uri twitter = Uri.parse("https://twitter.com/REDACTED");
- Intent tweet = new Intent(Intent.ACTION_VIEW, twitter);
- startActivity(tweet);
- }
- public void onDiscordClick(View v) {
- Uri discord = Uri.parse("https://discordapp.com/invite/REDACTED");
- Intent discordin = new Intent(Intent.ACTION_VIEW, discord);
- startActivity(discordin);
- }
- public void onTwitchClick(View v) {
- Uri twitch = Uri.parse("https://www.twitch.tv/REDACTED");
- Intent twitchin = new Intent(Intent.ACTION_VIEW, twitch);
- startActivity(twitchin);
- }
- public void onOPGGclick(View v) {
- Uri OPGG = Uri.parse("https://euw.op.gg/summoner/userName=REDACTED");
- Intent OPGGin = new Intent(Intent.ACTION_VIEW, OPGG);
- startActivity(OPGGin);
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.menu_new_layout, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
- //noinspection SimplifiableIfStatement
- if (id == R.id.action_settings) {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- /**
- * A placeholder fragment containing a simple view.
- public static class PlaceholderFragment extends Fragment {
- // The fragment argument representing the section number for this
- // fragment.
- private static final String ARG_SECTION_NUMBER = "section_number";
- public PlaceholderFragment() {
- }
- // Returns a new instance of this fragment for the given section
- // number.
- public static PlaceholderFragment newInstance(int sectionNumber) {
- PlaceholderFragment fragment = new PlaceholderFragment();
- Bundle args = new Bundle();
- args.putInt(ARG_SECTION_NUMBER, sectionNumber);
- fragment.setArguments(args);
- return fragment;
- }
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.tab1, container, false);
- TextView textView = (TextView) rootView.findViewById(R.id.section_label);
- textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER)));
- return rootView;
- }
- } */
- /**
- * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
- * one of the sections/tabs/pages.
- */
- public class SectionsPagerAdapter extends FragmentPagerAdapter {
- public SectionsPagerAdapter(FragmentManager fm) {
- super(fm);
- }
- @Override
- public Fragment getItem(int position) {
- /** getItem is called to instantiate the fragment for the given page.
- // Return a PlaceholderFragment (defined as a static inner class below).
- return PlaceholderFragment.newInstance(position + 1); */
- switch(position) {
- case 0:
- Tab1 tab1 = new Tab1();
- return tab1;
- case 1:
- Tab2 tab2 = new Tab2();
- return tab2;
- case 2:
- Tab3 tab3 = new Tab3();
- return tab3;
- default:
- return null;
- }
- }
- @Override
- public int getCount() {
- // Show 3 total pages.
- return 3;
- }
- @Override
- public CharSequence getPageTitle(int position) {
- switch (position) {
- case 0:
- return "Soundboard";
- case 1:
- return "Profil";
- case 2:
- return "Social";
- }
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement