Esempio n. 1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scrollview);

    // Create new PullToRefreshAttacher
    mPullToRefreshAttacher = PullToRefreshAttacher.get(this);

    // Retrieve the PullToRefreshLayout from the content view
    PullToRefreshLayout ptrLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);

    // Give the PullToRefreshAttacher to the PullToRefreshLayout, along with the refresh
    // listener (this).
    ptrLayout.setPullToRefreshAttacher(mPullToRefreshAttacher, this);

    // As we haven't set an explicit HeaderTransformer, we can safely cast the result of
    // getHeaderTransformer() to DefaultHeaderTransformer
    DefaultHeaderTransformer ht =
        (DefaultHeaderTransformer) mPullToRefreshAttacher.getHeaderTransformer();

    // As we're using a DefaultHeaderTransformer we can change the text which is displayed.
    // You should load these values from localised resources, but we'll just use static strings.
    ht.setPullText("Swipe Me!!!");
    ht.setRefreshingText("Refreshing :)");
  }
Esempio n. 2
0
  @Override
  public void onCreate(Bundle b) {
    // Must do this before super.onCreate
    ActivityHelper.readAndSetSettings(this);
    super.onCreate(b);

    syncStatusReceiver = new SyncStatusMonitor();

    // First load, then don't add to backstack
    shouldAddToBackStack = false;

    // To know if we should animate exits
    if (getIntent() != null && getIntent().getBooleanExtra(ANIMATEEXIT, false)) {
      mAnimateExit = true;
    }

    // If user has donated some other time
    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    mHasPremiumAccess = prefs.getBoolean(PREMIUMSTATUS, false);
    mDonatedInApp = prefs.getBoolean(SKU_INAPP_PREMIUM, false);

    alreadyShowcased = prefs.getBoolean(SHOWCASED_MAIN, false);
    alreadyShowcasedDrawer = prefs.getBoolean(SHOWCASED_DRAWER, false);

    // To listen on fragment changes
    getSupportFragmentManager()
        .addOnBackStackChangedListener(
            new FragmentManager.OnBackStackChangedListener() {
              public void onBackStackChanged() {
                if (showingEditor && !isNoteIntent(getIntent())) {
                  setHomeAsDrawer(true);
                }
                // Always update menu
                invalidateOptionsMenu();
              }
            });

    if (b != null) {
      Log.d("nononsenseapps list", "Activity Saved not null: " + b);
      this.state = b;
    }

    // Create a PullToRefreshAttacher instance
    pullToRefreshAttacher = PullToRefreshAttacher.get(this);

    // Clear possible notifications, schedule future ones
    final Intent intent = getIntent();
    // Clear notification if present
    clearNotification(intent);
    // Schedule notifications
    NotificationHelper.schedule(this);
  }
Esempio n. 3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_timeline);

    /* INICIA CONFIGURACION DEL DRAWERLAYOUT*/
    pull_to_refresh_attacher = PullToRefreshAttacher.get(this);
    drawer_list = (ListView) findViewById(R.id.left_drawer);
    drawer_layout = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer_layout == null) {
      Log.d("Response", "Respuesta se encontro objeto null");
    } else {
      Log.d("Response", "Respuesta objeto drawer_layout diferente a nulo");
    }
    ArrayAdapter<String> drawer_adapter =
        new ArrayAdapter<String>(
            this,
            R.layout.drawerlistitem,
            getResources().getStringArray(R.array.array_drawer_options));
    drawer_list.setAdapter(drawer_adapter);
    drawer_list.setOnItemClickListener(this);

    drawer_toggle =
        new ActionBarDrawerToggle(
            this,
            drawer_layout,
            R.drawable.ic_drawer,
            R.string.drawer_open,
            R.string.drawer_close) {
          public void onDrawerClosed(View view) {
            invalidateOptionsMenu();
          }

          public void onDrawerOpened(View drawerView) {
            invalidateOptionsMenu();
          }
        };
    drawer_layout.setDrawerListener(drawer_toggle);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);

    /* FINAL CONFIGURACION DEL DRAWERLAYOUT*/

    lvTimeline = (ListView) findViewById(R.id.lv_timeline);
    String URL =
        "http://api.rottentomatoes.com/api/public/v1.0/lists/movies/in_theaters.json?apikey="
            + API_KEY
            + "&page_limit=20";
    Log.d("Response", "Respuesta: " + URL);
    new RequestTask().execute(URL);
  }
Esempio n. 4
0
 @Override
 public void onPause() {
   super.onPause();
   // deactivate monitor
   if (syncStatusReceiver != null) {
     syncStatusReceiver.stopMonitoring();
   }
   // deactivate any progress bar
   if (pullToRefreshAttacher != null) {
     pullToRefreshAttacher.setRefreshComplete();
   }
   // Pause sync monitors
   OrgSyncService.pause(this);
 }
Esempio n. 5
0
 @Override
 public void loadFinish() {
   helper.setRefreshComplete();
 }
Esempio n. 6
0
 @Override
 public void startLoad() {
   if (!helper.isRefreshing()) helper.setRefreshing(true);
 }
Esempio n. 7
0
  @Override
  public void registRefreshableView(View view, PullToRefreshAttacher.OnRefreshListener listener) {

    helper.setRefreshableView(view, listener);
  }
Esempio n. 8
0
 @UiThread
 @Override
 public void onSyncStartStop(final boolean ongoing) {
   // Notify PullToRefreshAttacher of the refresh state
   pullToRefreshAttacher.setRefreshing(ongoing);
 }
Esempio n. 9
0
 public void removeRefreshableView(View view) {
   pullToRefreshAttacher.removeRefreshableView(view);
 }
Esempio n. 10
0
 public void addRefreshableView(View view) {
   // TODO Only if some sync is enabled
   pullToRefreshAttacher.addRefreshableView(view, getPullToRefreshListener());
 }