Exemplo n.º 1
0
  public Leaderboard(Context context, String kind, String selectedContest) {
    super(context, R.style.ThemeBeintoo);
    setContentView(R.layout.leaderboardlist);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    this.current = this;
    this.currentContext = context;
    this.leader_kind = kind;
    this.codeID = selectedContest;

    // GETTING DENSITY PIXELS RATIO
    ratio = (context.getApplicationContext().getResources().getDisplayMetrics().densityDpi / 160d);
    // SET UP LAYOUTS
    double pixels = ratio * 40;
    RelativeLayout beintooBar = (RelativeLayout) findViewById(R.id.beintoobarsmall);
    beintooBar.setBackgroundDrawable(
        new BDrawableGradient(0, (int) pixels, BDrawableGradient.BAR_GRADIENT));

    listView = (ListView) findViewById(R.id.listView);
    listView.setVisibility(LinearLayout.GONE);
    listView.setCacheColorHint(0);

    LinearLayout content = (LinearLayout) findViewById(R.id.goodcontent);
    content.addView(progressLoading());

    LinearLayout tip = (LinearLayout) findViewById(R.id.tip);
    tip.setBackgroundDrawable(
        new BDrawableGradient(0, (int) (ratio * 27), BDrawableGradient.LIGHT_GRAY_GRADIENT));
    if (!Beintoo.isLogged(
        context)) { // IF THE USER IS NOT LOGGED HIDE TIPS FOR CHALLENGE AND SHOW SIGNUP BUTTON
      tip.setVisibility(LinearLayout.GONE);
      LinearLayout signup = (LinearLayout) findViewById(R.id.signupPlayer);
      signup.addView(SignupLayouts.signupRow(context, Beintoo.FEATURE_LEADERBOARD));
      signup.setVisibility(View.VISIBLE);
    }

    if (leader_kind != null && leader_kind.equals("ALLIANCES")) {
      findViewById(R.id.tip).setVisibility(View.GONE);
      findViewById(R.id.spacer).setVisibility(View.GONE);
    }

    imageManager = new ImageManager(currentContext);
    usersExts = new ArrayList<String>();
    usersNicks = new ArrayList<String>();

    listView.setOnItemClickListener(this);
    listView.setOnScrollListener(this);

    this.firstLoading();
  }
 @Kroll.method
 public boolean isLogged() {
   Beintoo.currentContext = _tiContext.getAndroidContext();
   return Beintoo.isLogged(_tiContext.getAndroidContext());
 }