Advertisement
Guest User

Untitled

a guest
Feb 15th, 2017
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.32 KB | None | 0 0
  1. package com.example.foler.appname;
  2.  
  3. import android.content.DialogInterface;
  4. import android.content.Intent;
  5. import android.media.MediaPlayer;
  6. import android.net.Uri;
  7. import android.support.design.widget.TabLayout;
  8. import android.support.design.widget.Snackbar;
  9. import android.support.v7.app.AlertDialog;
  10. import android.support.v7.app.AppCompatActivity;
  11. import android.support.v7.widget.Toolbar;
  12.  
  13. import android.support.v4.app.Fragment;
  14. import android.support.v4.app.FragmentManager;
  15. import android.support.v4.app.FragmentPagerAdapter;
  16. import android.support.v4.view.ViewPager;
  17. import android.os.Bundle;
  18. import android.view.LayoutInflater;
  19. import android.view.Menu;
  20. import android.view.MenuItem;
  21. import android.view.View;
  22. import android.view.ViewGroup;
  23.  
  24. import android.widget.Button;
  25. import android.widget.ImageView;
  26. import android.widget.TextView;
  27.  
  28. import java.util.Map;
  29. import net.rithms.riot.constant.Region;
  30. import net.rithms.riot.dto.Stats.RankedStats;
  31. import net.rithms.riot.dto.Summoner.Summoner;
  32. import net.rithms.riot.api.RiotApi;
  33. import net.rithms.riot.api.RiotApiException;
  34. import net.rithms.riot.dto.Static.Champion;
  35. import net.rithms.riot.dto.Stats.AggregatedStats;
  36. import net.rithms.riot.dto.Stats.ChampionStats;
  37. import com.google.gson.*;
  38. import net.rithms.riot.constant.PlayerStatSummaryType;
  39. import net.rithms.riot.constant.Season;
  40. import net.rithms.riot.dto.Stats.PlayerStatsSummary;
  41. import net.rithms.riot.dto.Stats.PlayerStatsSummaryList;
  42.  
  43. public class NewLayoutActivity extends AppCompatActivity {
  44.  
  45. /**
  46. * The {@link android.support.v4.view.PagerAdapter} that will provide
  47. * fragments for each of the sections. We use a
  48. * {@link FragmentPagerAdapter} derivative, which will keep every
  49. * loaded fragment in memory. If this becomes too memory intensive, it
  50. * may be best to switch to a
  51. * {@link android.support.v4.app.FragmentStatePagerAdapter}.
  52. */
  53. private SectionsPagerAdapter mSectionsPagerAdapter;
  54.  
  55. /**
  56. * The {@link ViewPager} that will host the section contents.
  57. */
  58. private ViewPager mViewPager;
  59.  
  60. private Intromanager intromanager;
  61.  
  62. private MediaPlayer mp;
  63. private Boolean streamon = false;
  64. ImageView streamView;
  65.  
  66. private String tier, division;
  67. static int points, wins, losses, ratio, BOtarget, BOwins, BOlosses, BOprogress;
  68. static TextView ratioView;
  69.  
  70. @Override
  71. protected void onCreate(Bundle savedInstanceState) {
  72. super.onCreate(savedInstanceState);
  73. setContentView(R.layout.activity_new_layout);
  74.  
  75. intromanager = new Intromanager(this);
  76. intromanager.setFirst(true);
  77.  
  78. Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  79. setSupportActionBar(toolbar);
  80. // Create the adapter that will return a fragment for each of the three
  81. // primary sections of the activity.
  82. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
  83.  
  84. // Set up the ViewPager with the sections adapter.
  85. mViewPager = (ViewPager) findViewById(R.id.container);
  86. mViewPager.setAdapter(mSectionsPagerAdapter);
  87.  
  88. TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
  89. tabLayout.setupWithViewPager(mViewPager);
  90.  
  91. ratioView = (TextView)findViewById(R.id.ratioView);
  92.  
  93. checkStats(null);
  94. }
  95.  
  96. public static void checkStats(String[] args) throws RiotApiException {
  97. RiotApi api = new RiotApi("DEVELOPER KEY REDACTED");
  98. Summoner summoner = api.getSummonerById(Region.EUW, "ID REDACTED");
  99. RankedStats statsRanked = api.getRankedStats(Region.EUW, summoner.getId());
  100. AggregatedStats rankedStats = statsRanked.getChampions().get(0).getStats();
  101. wins = rankedStats.getTotalSessionsWon();
  102. losses = rankedStats.getTotalSessionsLost();
  103. ratio = wins / losses;
  104.  
  105. ratioView.setText(wins + " / " + losses + " | " + "Ratio : " + ratio);
  106. }
  107.  
  108. public void onOOHClick(View v) {
  109. mp = MediaPlayer.create(this, R.raw.ooooooh);
  110. mp.start();
  111. }
  112.  
  113. public void onbClick(View v) { // not used yet
  114. mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
  115. mp.start();
  116. }
  117.  
  118. public void onAAHClick(View v) {
  119. mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
  120. mp.start();
  121. }
  122.  
  123. public void oncClick(View v) { // not used yet
  124. mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
  125. mp.start();
  126. }
  127.  
  128. public void ondClick(View v) { // not used yet
  129. mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
  130. mp.start();
  131. }
  132.  
  133. public void onwhatClick(View v) { // not used yet
  134. mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
  135. mp.start();
  136. }
  137.  
  138. public void onfClick(View v) { // not used yet
  139. mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
  140. mp.start();
  141. }
  142.  
  143. public void ongClick(View v) { // not used yet
  144. mp = MediaPlayer.create(this, R.raw.aaaaaaaaaa);
  145. mp.start();
  146. }
  147.  
  148. public void onTwitterClick(View v) {
  149. Uri twitter = Uri.parse("https://twitter.com/REDACTED");
  150. Intent tweet = new Intent(Intent.ACTION_VIEW, twitter);
  151. startActivity(tweet);
  152. }
  153.  
  154. public void onDiscordClick(View v) {
  155. Uri discord = Uri.parse("https://discordapp.com/invite/REDACTED");
  156. Intent discordin = new Intent(Intent.ACTION_VIEW, discord);
  157. startActivity(discordin);
  158. }
  159.  
  160. public void onTwitchClick(View v) {
  161. Uri twitch = Uri.parse("https://www.twitch.tv/REDACTED");
  162. Intent twitchin = new Intent(Intent.ACTION_VIEW, twitch);
  163. startActivity(twitchin);
  164. }
  165.  
  166. public void onOPGGclick(View v) {
  167. Uri OPGG = Uri.parse("https://euw.op.gg/summoner/userName=REDACTED");
  168. Intent OPGGin = new Intent(Intent.ACTION_VIEW, OPGG);
  169. startActivity(OPGGin);
  170. }
  171.  
  172.  
  173. @Override
  174. public boolean onCreateOptionsMenu(Menu menu) {
  175. // Inflate the menu; this adds items to the action bar if it is present.
  176. getMenuInflater().inflate(R.menu.menu_new_layout, menu);
  177. return true;
  178. }
  179.  
  180. @Override
  181. public boolean onOptionsItemSelected(MenuItem item) {
  182. // Handle action bar item clicks here. The action bar will
  183. // automatically handle clicks on the Home/Up button, so long
  184. // as you specify a parent activity in AndroidManifest.xml.
  185. int id = item.getItemId();
  186.  
  187. //noinspection SimplifiableIfStatement
  188. if (id == R.id.action_settings) {
  189. return true;
  190. }
  191.  
  192. return super.onOptionsItemSelected(item);
  193. }
  194.  
  195. /**
  196. * A placeholder fragment containing a simple view.
  197.  
  198. public static class PlaceholderFragment extends Fragment {
  199. // The fragment argument representing the section number for this
  200. // fragment.
  201. private static final String ARG_SECTION_NUMBER = "section_number";
  202.  
  203. public PlaceholderFragment() {
  204. }
  205.  
  206. // Returns a new instance of this fragment for the given section
  207. // number.
  208.  
  209. public static PlaceholderFragment newInstance(int sectionNumber) {
  210. PlaceholderFragment fragment = new PlaceholderFragment();
  211. Bundle args = new Bundle();
  212. args.putInt(ARG_SECTION_NUMBER, sectionNumber);
  213. fragment.setArguments(args);
  214. return fragment;
  215. }
  216.  
  217. @Override
  218. public View onCreateView(LayoutInflater inflater, ViewGroup container,
  219. Bundle savedInstanceState) {
  220. View rootView = inflater.inflate(R.layout.tab1, container, false);
  221. TextView textView = (TextView) rootView.findViewById(R.id.section_label);
  222. textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER)));
  223. return rootView;
  224. }
  225. } */
  226.  
  227. /**
  228. * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
  229. * one of the sections/tabs/pages.
  230. */
  231. public class SectionsPagerAdapter extends FragmentPagerAdapter {
  232.  
  233. public SectionsPagerAdapter(FragmentManager fm) {
  234. super(fm);
  235. }
  236.  
  237. @Override
  238. public Fragment getItem(int position) {
  239. /** getItem is called to instantiate the fragment for the given page.
  240. // Return a PlaceholderFragment (defined as a static inner class below).
  241. return PlaceholderFragment.newInstance(position + 1); */
  242. switch(position) {
  243. case 0:
  244. Tab1 tab1 = new Tab1();
  245. return tab1;
  246. case 1:
  247. Tab2 tab2 = new Tab2();
  248. return tab2;
  249. case 2:
  250. Tab3 tab3 = new Tab3();
  251. return tab3;
  252. default:
  253. return null;
  254. }
  255. }
  256.  
  257. @Override
  258. public int getCount() {
  259. // Show 3 total pages.
  260. return 3;
  261. }
  262.  
  263. @Override
  264. public CharSequence getPageTitle(int position) {
  265. switch (position) {
  266. case 0:
  267. return "Soundboard";
  268. case 1:
  269. return "Profil";
  270. case 2:
  271. return "Social";
  272. }
  273. return null;
  274. }
  275. }
  276. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement