コード例 #1
0
  public void setUpLayout() {
    mHandler = new Handler();

    talonLayout = settings.layout;

    if (settings.addonTheme) {
      try {
        res = context.getPackageManager().getResourcesForApplication(settings.addonThemePackage);
        addonLayout =
            res.getLayout(res.getIdentifier("person", "layout", settings.addonThemePackage));
      } catch (Exception e) {
        e.printStackTrace();
        switch (talonLayout) {
          case AppSettings.LAYOUT_TALON:
            layout = R.layout.person;
            break;
          case AppSettings.LAYOUT_HANGOUT:
            layout = R.layout.person_hangouts;
            break;
          case AppSettings.LAYOUT_FULL_SCREEN:
            layout = R.layout.person_full_screen;
            break;
        }
      }
    } else {
      switch (talonLayout) {
        case AppSettings.LAYOUT_TALON:
          layout = R.layout.person;
          break;
        case AppSettings.LAYOUT_HANGOUT:
          layout = R.layout.person_hangouts;
          break;
        case AppSettings.LAYOUT_FULL_SCREEN:
          layout = R.layout.person_full_screen;
          break;
      }
    }

    TypedArray b;
    if (settings.roundContactImages) {
      b = context.getTheme().obtainStyledAttributes(new int[] {R.attr.circleBorder});
    } else {
      b = context.getTheme().obtainStyledAttributes(new int[] {R.attr.squareBorder});
    }
    border = b.getResourceId(0, 0);
    b.recycle();

    mCache = App.getInstance(context).getBitmapCache();
  }
コード例 #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down);

    slug = getIntent().getStringExtra("slug");

    context = this;
    sharedPrefs =
        context.getSharedPreferences(
            "com.klinker.android.twitter_world_preferences",
            Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE);
    settings = AppSettings.getInstance(this);

    setUpWindow();

    Utils.setUpPopupTheme(this, settings);

    actionBar = getActionBar();

    setContentView(R.layout.ptr_list_layout);

    if (!settings.isTwitterLoggedIn) {
      Intent login = new Intent(context, LoginActivity.class);
      startActivity(login);
      finish();
    }

    spinner = (LinearLayout) findViewById(R.id.list_progress);

    listView = (AsyncListView) findViewById(R.id.listView);

    BitmapLruCache cache = App.getInstance(context).getBitmapCache();
    ArrayListLoader loader = new ArrayListLoader(cache, context);

    ItemManager.Builder builder = new ItemManager.Builder(loader);
    builder.setPreloadItemsEnabled(true).setPreloadItemsCount(50);
    builder.setThreadPoolSize(4);

    listView.setItemManager(builder.build());

    getPeople();
  }