Android Open Source - pinpoint-android Layout Configuration Activity






From Project

Back to project page pinpoint-android.

License

The source code is released under:

MIT License

If you think the Android project pinpoint-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package co.islovely.pinpoint;
// w  w w . j  a v  a  2s.  co  m
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;

public class LayoutConfigurationActivity extends Activity implements OnSeekBarChangeListener {
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.layoutconfiguration);

    int
        headerHeight = Configuration.getInstance().getHeaderHeight(),
        footerHeight = Configuration.getInstance().getFooterHeight();

    SeekBar seekBarFooter = (SeekBar) this.findViewById(R.id.seekBarFooter);
    seekBarFooter.setProgress(footerHeight);
    seekBarFooter.setOnSeekBarChangeListener(this);

    ((LinearLayout) this.findViewById(R.id.footer)).setLayoutParams(
      new LayoutParams(LayoutParams.MATCH_PARENT, footerHeight)
    );

    SeekBar seekBarHeader = (SeekBar) this.findViewById(R.id.seekBarHeader);
    seekBarHeader.setProgress(headerHeight);
    seekBarHeader.setOnSeekBarChangeListener(this);

    ((LinearLayout) this.findViewById(R.id.header)).setLayoutParams(
      new LayoutParams(LayoutParams.MATCH_PARENT, headerHeight)
    );
  }

  @Override
  public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    int targetId = 0;

    switch (seekBar.getId()) {
      case R.id.seekBarFooter:
        targetId = R.id.footer;
        break;
      case R.id.seekBarHeader:
        targetId = R.id.header;
        break;
    }

    // update layout with current value to see change
    ((LinearLayout) this.findViewById(targetId)).setLayoutParams(
      new LayoutParams(LayoutParams.MATCH_PARENT, progress)
    );
  }

  @Override
  public void onStartTrackingTouch(SeekBar seekBar) {
    // nothing to do
  }

  @Override
  public void onStopTrackingTouch(SeekBar seekBar) {
    Configuration configuration = Configuration.getInstance();

    // update configuration with final value
    switch (seekBar.getId()) {
      case R.id.seekBarFooter:
        configuration.setFooterHeight(seekBar.getProgress());
        break;
      case R.id.seekBarHeader:
        configuration.setHeaderHeight(seekBar.getProgress());
        break;
    }
  }
}




Java Source Code List

co.islovely.pinpoint.ColumnsActivity.java
co.islovely.pinpoint.Configuration.java
co.islovely.pinpoint.DeviceMetrics.java
co.islovely.pinpoint.GridActivity.java
co.islovely.pinpoint.HomescreenAdapter.java
co.islovely.pinpoint.HomescreenSelectActivity.java
co.islovely.pinpoint.Homescreen.java
co.islovely.pinpoint.IntermissionActivity.java
co.islovely.pinpoint.LauncherItem.java
co.islovely.pinpoint.LauncherReader.java
co.islovely.pinpoint.LayoutConfigurationActivity.java
co.islovely.pinpoint.MainActivity.java
co.islovely.pinpoint.MyApplication.java
co.islovely.pinpoint.PinpointActivity.java
co.islovely.pinpoint.Pinpoint.java
co.islovely.pinpoint.QuadrantsActivity.java
co.islovely.pinpoint.RowsActivity.java
co.islovely.pinpoint.StatisticsActivity.java
co.islovely.pinpoint.TaskLogEntry.java
co.islovely.pinpoint.TaskLog.java
co.islovely.pinpoint.TaskManager.java
co.islovely.pinpoint.Task.java
co.islovely.pinpoint.User.java
util.Base64.java