Exemplo n.º 1
0
  /**
   * Restore game state if our process is being relaunched
   *
   * @param icicle a Bundle containing the game state
   */
  public void restoreState(Bundle icicle) {
    setMode(PAUSE);

    mAppleList = coordArrayToArrayList(icicle.getIntArray("mAppleList"));
    mDirection = icicle.getInt("mDirection");
    mNextDirection = icicle.getInt("mNextDirection");
    mMoveDelay = icicle.getLong("mMoveDelay");
    mScore = icicle.getLong("mScore");
    mSnakeTrail = coordArrayToArrayList(icicle.getIntArray("mSnakeTrail"));
  }
Exemplo n.º 2
0
  public void loadInstanceState(Bundle bundle) {

    float[] locationX = bundle.getFloatArray(LOCATIONX);
    float[] locationY = bundle.getFloatArray(LOCATIONY);
    int[] weights = bundle.getIntArray(WEIGHT);
    PlayerTurn = bundle.getInt(Turn);
    player1Score = bundle.getInt(Score1);
    player2Score = bundle.getInt(Score2);
    int Turn = bundle.getInt(First);
    blocks = new ArrayList<Block>();
    for (int i = 0; i < locationX.length - 1; i++) {
      if (Turn == 1) {
        blocks.add(new Block(red, weights[i], locationX[i], locationY[i]));
        Turn = 2;
      } else {
        Turn = 1;
        blocks.add(new Block(brown, weights[i], locationX[i], locationY[i]));
      }
    }
    yPositionTracker = locationY[locationY.length - 1];
    if (PlayerTurn == 1)
      tempBlock =
          new Block(
              red, weights[weights.length - 1], locationX[locationY.length - 1], yPositionTracker);
    else
      tempBlock =
          new Block(
              brown,
              weights[weights.length - 1],
              locationX[locationY.length - 1],
              yPositionTracker);
    view.updateScore(String.valueOf(player1Score), String.valueOf(player2Score));
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.panes_layout);

    panesLayout = (PanesLayout) findViewById(R.id.panes);
    panesLayout.setOnIndexChangedListener(this);

    if (savedInstanceState != null) {
      int[] panesType = savedInstanceState.getIntArray("PanesLayout_panesType");
      boolean[] panesFocused = savedInstanceState.getBooleanArray("PanesLayout_panesFocused");
      int currentIndex = savedInstanceState.getInt("PanesLayout_currentIndex");
      for (int i = 0; i < panesType.length; i++) {
        panesLayout.addPane(panesType[i], panesFocused[i]);
      }
      panesLayout.setIndex(currentIndex);
    }

    if (savedInstanceState != null) {
      FragmentManager fm = getSupportFragmentManager();

      for (int index = 0; index < panesLayout.getNumPanes(); index++) {
        int id = panesLayout.getPane(index).getInnerId();
        Fragment f = fm.findFragmentById(id);

        fragmentStack.add(f);
        updateFragment(f);
      }
    }
  }
Exemplo n.º 4
0
  @Override
  public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.setMyLocationEnabled(true);

    Bundle extras = getIntent().getExtras();
    float[] lats = {}, lngs = {};
    String[] titles = {}, snippets = {};
    int[] beers = {};

    if (null != extras) {
      lats = extras.getFloatArray("Latitudes");
      lngs = extras.getFloatArray("Longitudes");
      titles = extras.getStringArray("Titles");
      snippets = extras.getStringArray("Snippets");
      beers = extras.getIntArray("Beers");
    }
    googleMap.setInfoWindowAdapter(new CustomInfoWindowAdapter());

    LatLng ll = null;
    for (int i = 0; i < titles.length; i++) {
      ll = new LatLng(lats[i], lngs[i]);

      MarkerOptions mark = new MarkerOptions().position(ll).title(titles[i]).snippet(snippets[i]);

      // Other color if beer has been drunk.
      // The argument to defaultMarker() takes a float between 0-360.0,
      // check BitmapDescriptorFactory.HUE_*.
      // It is possible to create a BitmapDescriptor from drawables etc.
      BitmapDescriptor icon;
      if (i < beers.length && 0 < beers[i]) {
        icon = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN);
      } else {
        icon = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED);
      }
      mark.icon(icon);

      // Add a marker and set the number of beers drunk
      Marker marker = mMap.addMarker(mark);
      beerMap.put(marker, (beers.length > i ? beers[i] : 0));
    }

    /* Add propellern */
    BitmapDrawable bd = (BitmapDrawable) getResources().getDrawable(R.drawable.proppeller);
    Bitmap b = bd.getBitmap();
    Bitmap bhalfsize = Bitmap.createScaledBitmap(b, b.getWidth() / 2, b.getHeight() / 2, false);
    MarkerOptions propellern =
        new MarkerOptions()
            .position(PROPELLERN)
            .icon(BitmapDescriptorFactory.fromBitmap(bhalfsize));
    mMap.addMarker(propellern);

    /* See zoom */
    if (null == ll || 1 < titles.length) {
      // Zoom from far 2.0 (zoomed out) to close 21.0 (zoomed in)
      mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(PROPELLERN, 12.2f));
    } else {
      mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ll, 12.2f));
    }
  }
 @Override
 public void onReceive(Context context, Intent intent) {
   // TODO Auto-generated method stub
   String action = intent.getAction();
   if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action) || action.equals(_myaction)) {
     int[] IDs = null;
     if (action.equals(_myaction)) {
       ComponentName provdier = new ComponentName(context, this.getClass());
       IDs = AppWidgetManager.getInstance(context).getAppWidgetIds(provdier);
     }
     Bundle extras = intent.getExtras();
     int[] appWidgetIds;
     if (extras != null || IDs != null) {
       if (extras != null) appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
       else appWidgetIds = IDs;
       if (appWidgetIds != null && appWidgetIds.length > 0) {
         if (appWidgetIds.length == 1) {
           this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds);
         } else if (appWidgetIds[0] < appWidgetIds[1]) {
           for (int i = 0; i < appWidgetIds.length; i++) {
             int[] tempappWidgetIds = {appWidgetIds[i]};
             this.onUpdate(context, AppWidgetManager.getInstance(context), tempappWidgetIds);
           }
         } else {
           for (int i = appWidgetIds.length - 1; i > -1; i--) {
             int[] tempappWidgetIds = {appWidgetIds[i]};
             this.onUpdate(context, AppWidgetManager.getInstance(context), tempappWidgetIds);
           }
         }
       }
     }
   } else {
     super.onReceive(context, intent);
   }
 }
Exemplo n.º 6
0
  // Tries to load an existing analysis.
  public static ExperimentAnalysis.AnalysisEntry loadSensorAnalysis(
      File storageDir, List<ISensorData> allSensorData) {
    // try to load old analysis
    File projectFile = new File(storageDir, IDataAnalysis.EXPERIMENT_ANALYSIS_FILE_NAME);
    Bundle bundle = loadBundleFromFile(projectFile);
    if (bundle == null) return null;

    Bundle analysisDataBundle = bundle.getBundle(USED_DATA_KEY);
    if (analysisDataBundle == null) return null;

    int[] integerList = bundle.getIntArray(SENSOR_DATA_LIST_KEY);
    ISensorData[] dataList = new ISensorData[integerList.length];
    for (int i = 0; i < dataList.length; i++) dataList[i] = allSensorData.get(integerList[i]);

    String analysisPluginId = bundle.getString(PLUGIN_ID_KEY);
    ExperimentPluginFactory factory = ExperimentPluginFactory.getFactory();
    IAnalysisPlugin plugin = factory.findAnalysisPlugin(analysisPluginId);
    IDataAnalysis dataAnalysis = plugin.createDataAnalysis(dataList);

    if (!dataAnalysis.loadAnalysisData(analysisDataBundle, storageDir)) return null;

    String analysisUid = bundle.getString(ANALYSIS_UID_KEY);

    return new ExperimentAnalysis.AnalysisEntry(dataAnalysis, analysisUid, plugin, storageDir);
  }
      @Override
      public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();

        if (action.equals("android.intent.action.ServiceToLineChart")) {

          Bundle bundle = intent.getExtras();
          int cmd = bundle.getInt("cmd");

          if (cmd == CMD_RETURN_DATA) {
            templeValue = bundle.getInt("value");
            templeValue = templeValue / (float) 10;

            realTempleTextView.setText("当前温度 " + templeValue + "℃");

            // System.out.println("当前温度 " + templeValue + "℃ " + realButtonRecord.getText());

            generateLineData(nowColor, 0, (float) templeValue);

            sendCmdBroadcast(CMD_GET_DATA, 0); // 请求数据
          } else if (cmd == CMD_FAILED_GET_DATA) {
            sendCmdBroadcast(CMD_GET_DATA, 0); // 请求数据
          } else if (cmd == CMD_RETURN_RECORD_DATA) {
            System.out.println("ooooKK");
            int[] recordMsgBuffer = bundle.getIntArray("buffer");
            // showRecoedData(recordMsgBuffer);
            saveRecordData(recordMsgBuffer);
          }
        }
      }
Exemplo n.º 8
0
    @Override
    public void onReceive(Context content, Intent intent) {

      Bundle bundle = intent.getExtras();
      int[] blogIdArr = bundle.getIntArray("blogIdArray");
      for (int i = 0, len = listView.getChildCount(); i < len; i++) {
        View view = listView.getChildAt(i);
        TextView tvId = (TextView) view.findViewById(R.id.recommend_text_id);
        if (tvId != null) {
          /*int blogId=Integer.parseInt(tvId.getText().toString());

          ImageView icoDown=(ImageView)view.findViewById(R.id.icon_downloaded);
          TextView tvTitle=(TextView)view.findViewById(R.id.recommend_text_title);

          for(int j=0,size=blogIdArr.length;j<size;j++){
          	if(blogId==blogIdArr[j]){
          		icoDown.setVisibility(View.VISIBLE);//已经离线
          		tvTitle.setTextColor(R.color.gray);//已读
          	}
          }*/
        }
      }
      for (int i = 0, len = blogIdArr.length; i < len; i++) {
        for (int j = 0, size = listBlog.size(); j < size; j++) {
          if (blogIdArr[i] == listBlog.get(j).GetBlogId()) {
            listBlog.get(i).SetIsFullText(true);
            listBlog.get(i).SetIsReaded(true);
          }
        }
      }
    }
Exemplo n.º 9
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   Bundle args = getArguments();
   if (args != null) {
     int[] l = args.getIntArray("LOCATION");
     if (l != null && l.length == 2) location = l;
   }
 }
Exemplo n.º 10
0
 private void restoreFragmentsStack(Bundle savedInstanceState) {
   try {
     int[] stack = savedInstanceState.getIntArray(FRAGMENTS_STACK_KEY);
     for (int id : stack) {
       fragmentsStack.push(id);
     }
   } catch (Throwable e) {
     // silent recovering, stack is't not really important
   }
 }
Exemplo n.º 11
0
        @Override
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case MSG_PUSH_DATA:
              Bundle bundle = (Bundle) msg.obj;
              int sensor = bundle.getInt(BUNDLE_SENSOR);
              SeedNode seed = mSeedNodeMap.get(sensor);

              if (seed == null) {
                // throw new UnsupportedOperationException("No SeedNode for SensorType: " + sensor);
                DebugHelper.log(TAG, "No SeedNode for SensorType: " + sensor);
                return;
              }

              int deviceID = bundle.getInt(BUNDLE_DEVICE_ID);

              if (seed.getAttachedDevice() != mDeviceMap.get(deviceID)) {
                DebugHelper.log(
                    TAG,
                    "Unmatched seed node and attached device(sensor: "
                        + sensor
                        + ", attempted device ID: "
                        + deviceID);
                return;
              }

              String type = bundle.getString(BUNDLE_TYPE);
              int length = bundle.getInt(BUNDLE_LENGTH);
              String name = SensorType.getSensorName(sensor);
              long timestamp = bundle.getLong(BUNDLE_TIMESTAMP);

              // show notification
              showNotification(sensor, name);

              if (type.equals("double[]")) {
                seed.input(name, type, bundle.getDoubleArray(BUNDLE_DATA), length, timestamp);
              } else if (type.equals("double")) {
                seed.input(name, type, bundle.getDouble(BUNDLE_DATA), length, timestamp);
              } else if (type.equals("int[]")) {
                seed.input(name, type, bundle.getIntArray(BUNDLE_DATA), length, timestamp);
              } else if (type.equals("int")) {
                seed.input(name, type, bundle.getInt(BUNDLE_DATA), length, timestamp);
              } else if (type.equals("String")) {
                seed.input(name, type, bundle.getString(BUNDLE_DATA), length, timestamp);
              } else {
                throw new IllegalArgumentException("Unknown data_type: " + type);
              }
              break;

            default:
              super.handleMessage(msg);
              break;
          }
        }
Exemplo n.º 12
0
 protected void onRestoreInstanceState(Bundle savedInstanceState) {
   super.onRestoreInstanceState(savedInstanceState);
   final int[] position = savedInstanceState.getIntArray("ARTICLE_SCROLL_POSITION");
   if (position != null)
     sv.post(
         new Runnable() {
           public void run() {
             sv.scrollTo(position[0], position[1]);
           }
         });
 }
Exemplo n.º 13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AppSettings.initialize(this, this);
    dataManager = new NewsManager(this);
    permissionHandler = new StoragePermissionHandler(this);

    if (AppSettings.firstStart()) {
      Intent intent = new Intent(this, SelectSitesActivity.class);
      intent.putExtra(AppCode.SEND_PURPOSE, SelectSitesActivity.For.APP_FIRST_START);
      startActivity(intent);
      finish();
      return;
    }

    setContentView(R.layout.a_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle =
        new ActionBarDrawerToggle(
            this,
            drawer,
            toolbar,
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    assert navigationView != null : "Navigation view is null";
    navigationView.setNavigationItemSelectedListener(this);

    fragmentManager = new FragmentManager(this, navigationView, R.id.main_content);

    updateDrawer(true);

    Bundle extras = getIntent().getExtras();
    if (extras != null && extras.containsKey(AppCode.SEND_NEWS_IDS)) {
      int[] news_codes = extras.getIntArray(AppCode.SEND_NEWS_IDS);
      newsFragment = NewsListFragment.instanceForNotification(news_codes);
    } else newsFragment = NewsListFragment.instanceFor(-1);

    if (extras != null && extras.containsKey(AppCode.RESTART)) {
      ScheduledDownloadReceiver.scheduleDownloads(
          this, new ScheduleManager(this).getDownloadSchedules());
    }

    newsFragment.setRetainInstance(true);

    fragmentManager.addFragment(newsFragment, R.id.nav_my_news);
  }
  protected void readArguments() {
    final Bundle args = getArguments();

    pickerId = args.getInt(ARG_PICKER_ID);
    title = args.getString(ARG_TITLE);
    positiveButtonText = args.getString(ARG_POSITIVE_BUTTON_TEXT);
    negativeButtonText = args.getString(ARG_NEGATIVE_BUTTON_TEXT);
    enableMultipleSelection = args.getBoolean(ARG_ENABLE_MULTIPLE_SELECTION);

    setSelectedItems(args.getIntArray(ARG_SELECTED_ITEMS_INDICES));
  }
  @Override
  void restoreState(Bundle inState) {
    super.restoreState(inState);

    int[] rows = inState.getIntArray("rows");
    int[] cols = inState.getIntArray("cols");
    String[] notes = inState.getStringArray("notes");

    for (int i = 0; i < rows.length; i++) {
      mOldNotes.add(new NoteEntry(rows[i], cols[i], CellNote.deserialize(notes[i])));
    }
  }
Exemplo n.º 16
0
 private void readIntent() {
   final Bundle extras = getIntent().getExtras();
   mDifficulty = extras.getInt("difficulty");
   mPlayerNumber = extras.getInt("players");
   mRounds = extras.getInt("rounds");
   final int colors[] = extras.getIntArray("buzzercolors");
   for (int i = 0; i < colors.length; i++) {
     mBuzzer.get(i).setColor(colors[i]);
     mBuzzer.get(i).setAllowUserChangeColor(false);
   }
   // Log.v("tag", mRounds + "");
 }
Exemplo n.º 17
0
  private synchronized void updateWidget(Intent intent) {
    String action = intent.getAction();
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this);
    if (ANIMATION_WIDGET_ENABLED.equals(action)) {
      // just initialize the service, nothing should be done here

      // makeAnimationWidgetViewSlide(appWidgetManager);
      Toast.makeText(this, "WidgetEnable", Toast.LENGTH_SHORT).show();
    } else if (ANIMATION_WIDGET_START.equals(action)) {
      Toast.makeText(this, "WidgetStart", Toast.LENGTH_SHORT).show();
      // a widget is created, init its layout here
      Bundle params = intent.getExtras();
      if (params != null) {
        int[] widgetId = params.getIntArray(AnimationWidget.APP_ID);
        makeAnimationWidgetViewSlide(appWidgetManager, widgetId);
        // DebugLog.log("widgetId: " + Integer.toString(widgetId));
      }

    } else if (ANIMATION_WIDGET_DELETED.equals(action)) {
      // mqWidgetIdList.clear();
      Toast.makeText(this, "WidgetDelete", Toast.LENGTH_SHORT).show();
      if (droidDB != null) {
        droidDB.removeDB();
      }
      this.stopSelf();
    } else if (ANIMATION_WIDGET_UPDATE.equals(action)) {

      Bundle params = intent.getExtras();
      if (params != null) {
        Toast.makeText(this, "WidgetUpdate", Toast.LENGTH_SHORT).show();
        int[] widgetId = params.getIntArray(AnimationWidget.APP_ID);
        makeAnimationWidgetViewSlide(appWidgetManager, widgetId);
        // DebugLog.log("widgetId: " + Integer.toString(widgetId));
      }

    } else if (ANIMATION_WIDGET_SHOW.equals(action)) {
      serviceHandler.removeMessages(HANDLER_MSG_SHOW_ANIMATION);
      serviceHandler.sendEmptyMessage(HANDLER_MSG_SHOW_ANIMATION);
    }
  }
    private void _handleMessage(Message msg) {
      Bundle b;
      boolean aborted;

      switch (msg.what) {
        case TYPE_ON_SCAN:
          b = (Bundle) msg.obj;
          int tunedFrequency = b.getInt("tunedFrequency");
          int signalStrength = b.getInt("signalStrength");
          int scanDirection = b.getInt("scanDirection");
          aborted = b.getBoolean("aborted");
          mListener.onScan(tunedFrequency, signalStrength, scanDirection, aborted);
          break;
        case TYPE_ON_FULLSCAN:
          b = (Bundle) msg.obj;
          int[] frequency = b.getIntArray("frequency");
          int[] signalStrengths = b.getIntArray("signalStrength");
          aborted = b.getBoolean("aborted");
          mListener.onFullScan(frequency, signalStrengths, aborted);
          break;
      }
    }
Exemplo n.º 19
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    isTablet = getResources().getBoolean(R.bool.isTablet);
    isPortrait = getResources().getBoolean(R.bool.isPortrait);

    if (savedInstanceState != null) {
      detailItemPosition = savedInstanceState.getInt(DETAIL_ITEM_POSITION, -1);
      isDetailShowing = savedInstanceState.getBoolean(IS_DETAIL_SHOWING, false);
      contentNames = savedInstanceState.getStringArray(MainActivity.EXTRA_CONTENT_NAMES);
      contentImages = savedInstanceState.getIntArray(MainActivity.EXTRA_CONTENT_IMAGES);
    } else {
      contentNames = getArguments().getStringArray(MainActivity.EXTRA_CONTENT_NAMES);
      contentImages = getArguments().getIntArray(MainActivity.EXTRA_CONTENT_IMAGES);
    }
  }
Exemplo n.º 20
0
 @Override
 protected void onRestoreInstanceState(Parcelable state) {
   if (state instanceof Bundle) {
     Bundle bundle = (Bundle) state;
     mBitmapAlpha = bundle.getFloatArray(STATUS_ALPHAS);
     mMessageNumber = bundle.getIntArray(STATUS_MESSAGENUMBER);
     mNews = bundle.getBooleanArray(STATUS_NEWS);
     for (int i = 0; i < mBitmapAlpha.length; i++) {
       mTabstrips.get(i).setBitmapAlpha(mBitmapAlpha[i]);
       mTabstrips.get(i).setNews(mNews[i]);
       mTabstrips.get(i).setMessageNumber(mMessageNumber[i]);
     }
     super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATUS));
     return;
   }
   super.onRestoreInstanceState(state);
 }
Exemplo n.º 21
0
  @Override
  public void onRestoreInstanceState(Bundle sis) {

    super.onRestoreInstanceState(sis);

    if (sis != null) {
      int numStrings = sis.getInt("numStrings");
      int firstFret = sis.getInt("firstFret");
      String tuning = sis.getString("tuning");
      int[] posMap = sis.getIntArray("posMap");

      this._fretboard.setNumberOfStringsNoDraw(numStrings);
      this._fretboard.setFirstDisplayFretNoDraw(firstFret);
      this._fretboard.setTuningNoDraw(tuning);
      // TODO: erring out
      // this._fretboard.setSelectedPositionsNoDraw(posMap);
    }
  }
Exemplo n.º 22
0
 public void load(Bundle bundle) {
   lastMoveTime = System.currentTimeMillis();
   cost = 0;
   if (bundle == null) return;
   int x[] = bundle.getIntArray("x");
   int y[] = bundle.getIntArray("y");
   long[] d = bundle.getLongArray("d");
   cost = bundle.getLong("cost", 0);
   if (x == null || y == null || d == null) return;
   for (int n = 0; n < x.length; n++) {
     Item item = new Item();
     item.x = x[n];
     item.y = y[n];
     item.duration = d[n];
     cost += d[n];
     items.add(item);
   }
 }
Exemplo n.º 23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.relatorio_final);
    View decorView = getWindow().getDecorView();
    decorView.setSystemUiVisibility(
        View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

    Bundle b = this.getIntent().getExtras();
    int[] valores = b.getIntArray("score");

    TextView myAwesomeTextView = (TextView) findViewById(R.id.relatorio);
    String texto =
        "FINAL\nTeste A: "
            + valores[0]
            + "\nTeste B: "
            + valores[1]
            + "\nTeste C: "
            + valores[2]
            + "\nTeste D: "
            + valores[3]
            + "\nTeste E: "
            + valores[4]
            + "\nTeste F: "
            + valores[5]
            + "\nTeste G: "
            + valores[6]
            + "\nTeste H: "
            + valores[7]
            + "\nTeste I: "
            + valores[8]
            + "\nTeste J: "
            + valores[9];

    myAwesomeTextView.setText(texto);
  }
Exemplo n.º 24
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment

    setHasOptionsMenu(true);
    View rootView = inflater.inflate(R.layout.fragment_temperature, container, false);

    chart = (LineChartView) rootView.findViewById(R.id.chart);
    previewChart = (PreviewLineChartView) rootView.findViewById(R.id.chart_preview);

    // Generate data for previewed chart and copy of that data for preview chart.

    if (getArguments() != null) {
      temperatureData = getArguments();
      latitude = temperatureData.getFloat("latitude");
      longitude = temperatureData.getFloat("longitude");
      temperatures = temperatureData.getDoubleArray("temperatureArr");
      times = temperatureData.getIntArray("timeArr");
      numData = temperatureData.getInt("numData");
      Log.d("ARRAY", Arrays.toString(temperatures));
      Log.d("ARRAY", Arrays.toString(times));
      getForecastData();

      Log.d("receiver", "OK");
    } else {
      generateDefaultData();
    }
    chart.setLineChartData(data);
    // Disable zoom/scroll for previewed chart, visible chart ranges depends on preview chart
    // viewport so
    // zoom/scroll is unnecessary.
    chart.setZoomEnabled(false);
    chart.setScrollEnabled(false);

    previewChart.setLineChartData(previewData);
    previewChart.setViewportChangeListener(new ViewportListener());

    previewX(false);

    return rootView;
  }
Exemplo n.º 25
0
  public static void getFromIntent(Context context, Intent intent) {

    if (Preferences.logging) Log.d(MetaWatch.TAG, "WidgetManager.getFromIntent()");

    synchronized (lock) {
      WidgetData widget = new WidgetData();

      Bundle b = intent.getExtras();

      if (!b.containsKey("id")
          || !b.containsKey("desc")
          || !b.containsKey("width")
          || !b.containsKey("height")
          || !b.containsKey("priority")
          || !b.containsKey("array")) {
        if (Preferences.logging) Log.d(MetaWatch.TAG, "Malformed WIDGET_UPDATE intent");
        return;
      }

      widget.id = b.getString("id");
      widget.description = b.getString("desc");
      widget.width = b.getInt("width");
      widget.height = b.getInt("height");
      widget.priority = b.getInt("priority");

      int[] buffer = b.getIntArray("array");

      widget.bitmap = Bitmap.createBitmap(widget.width, widget.height, Bitmap.Config.RGB_565);
      widget.bitmap.setPixels(buffer, 0, widget.width, 0, 0, widget.width, widget.height);

      if (dataCache == null) dataCache = new HashMap<String, WidgetData>();

      dataCache.put(widget.id, widget);
      if (Preferences.logging)
        Log.d(MetaWatch.TAG, "Received widget " + widget.id + " successfully");

      Idle.updateIdle(context, false); // false as we don't want to trigger another UPDATE broadcast
    }
  }
Exemplo n.º 26
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.result);

    Button btn_home = (Button) findViewById(R.id.btn_home);

    Button btn_fav = (Button) findViewById(R.id.btn_fav);

    Button btn_score = (Button) findViewById(R.id.btn_score);

    Button btn_tutorial = (Button) findViewById(R.id.btn_tutorial);

    Button btn_about = (Button) findViewById(R.id.btn_about);
    Button btn_help = (Button) findViewById(R.id.btn_help);

    btn_help.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View view) {

            Intent i = new Intent(getApplicationContext(), Help.class);

            startActivity(i);
          }
        });

    btn_home.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View view) {

            Intent i = new Intent(getApplicationContext(), AndroidDashboardDesignActivity.class);
            i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(i);
          }
        });

    btn_fav.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View view) {

            Intent i = new Intent(getApplicationContext(), FavPage.class);

            startActivity(i);
          }
        });

    btn_score.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View view) {

            Intent i = new Intent(getApplicationContext(), scoremenu.class);
            startActivity(i);
          }
        });

    btn_tutorial.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View view) {

            Intent i = new Intent(getApplicationContext(), Tutorialpage.class);
            startActivity(i);
          }
        });

    btn_about.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View view) {

            Intent i = new Intent(getApplicationContext(), AboutUs.class);
            startActivity(i);
          }
        });
    Bundle bundle = getIntent().getExtras();
    String id1 = bundle.getString("ComingFrom");
    id = Integer.parseInt(id1);
    String curr = bundle.getString("current");
    current = Integer.parseInt(curr);
    cat = bundle.getString("Category");
    yourans = bundle.getIntArray("yourans");
    givenans = bundle.getIntArray("givenans");
    allid = bundle.getIntArray("allid");

    VLTable q = db.getVL(id, cat);

    final Button btn_next = (Button) findViewById(R.id.btn_next);
    final Button btn_prev = (Button) findViewById(R.id.btn_prev);
    final Button btn_finish = (Button) findViewById(R.id.btn_finish);
    String j = q.getQues();
    String opt1 = q.getOption1();
    String opt2 = q.getOption2();
    String opt3 = q.getOption3();
    String opt4 = q.getOption4();
    String sol = q.getSol();

    t1 = (TextView) findViewById(R.id.quest1);
    t2 = (TextView) findViewById(R.id.op1);
    t3 = (TextView) findViewById(R.id.op2);
    t4 = (TextView) findViewById(R.id.op3);
    t5 = (TextView) findViewById(R.id.op4);
    t6 = (TextView) findViewById(R.id.selans);
    t7 = (TextView) findViewById(R.id.corrans);
    t8 = (TextView) findViewById(R.id.timer);
    t1.setText(j);
    t2.setText("1." + opt1);
    t3.setText("2." + opt2);
    t4.setText("3." + opt3);
    t5.setText("4." + opt4);
    int p = yourans[current];
    String j1 = p + "";
    if (p == 0) j1 = "-";
    if (sol.equalsIgnoreCase("a")) sol = 1 + "";
    else if (sol.equalsIgnoreCase("b")) sol = 2 + "";
    else if (sol.equalsIgnoreCase("c")) sol = 3 + "";
    else if (sol.equalsIgnoreCase("d")) sol = 4 + "";
    else {
    }
    t6.setText("Selected Answer " + j1 + "");
    t7.setText("Correct Answer " + sol + "" + "\n" + "\t\t");
    t8.setText((current + 1) + "/20");

    btn_next.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View view) {
            if (current == 19) {
              btn_next.setEnabled(false);
            } else {
              btn_next.setEnabled(true);
              btn_prev.setEnabled(true);
              current = current + 1;
              id = allid[current];
              VLTable q = db.getVL(id, cat);
              String j = q.getQues();
              String opt1 = q.getOption1();
              String opt2 = q.getOption2();
              String opt3 = q.getOption3();
              String opt4 = q.getOption4();

              t1 = (TextView) findViewById(R.id.quest1);
              t2 = (TextView) findViewById(R.id.op1);
              t3 = (TextView) findViewById(R.id.op2);
              t4 = (TextView) findViewById(R.id.op3);
              t5 = (TextView) findViewById(R.id.op4);
              t6 = (TextView) findViewById(R.id.selans);
              t7 = (TextView) findViewById(R.id.corrans);
              String sol = q.getSol();
              t1.setText(j);
              t2.setText("1." + opt1);
              t3.setText("2." + opt2);
              t4.setText("3." + opt3);
              t5.setText("4." + opt4);
              int p = yourans[current];
              String j1 = p + "";
              if (p == 0) j1 = "-";

              if (sol.equalsIgnoreCase("a")) sol = 1 + "";
              else if (sol.equalsIgnoreCase("b")) sol = 2 + "";
              else if (sol.equalsIgnoreCase("c")) sol = 3 + "";
              else if (sol.equalsIgnoreCase("d")) sol = 4 + "";
              else {
              }
              t6.setText("Selected Answer " + j1 + "");
              t7.setText("Correct Answer " + sol + "" + "\n" + "\t\t");
              t8.setText((current + 1) + "/20");
            }
          }
        });

    btn_prev.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View view) {
            if (current == 0) {
              btn_prev.setEnabled(false);
            } else {
              btn_next.setEnabled(true);
              btn_prev.setEnabled(true);
              current = current - 1;
              id = allid[current];
              VLTable q = db.getVL(id, cat);
              String j = q.getQues();
              String opt1 = q.getOption1();
              String opt2 = q.getOption2();
              String opt3 = q.getOption3();
              String opt4 = q.getOption4();
              String sol = q.getSol();
              t1 = (TextView) findViewById(R.id.quest1);
              t2 = (TextView) findViewById(R.id.op1);
              t3 = (TextView) findViewById(R.id.op2);
              t4 = (TextView) findViewById(R.id.op3);
              t5 = (TextView) findViewById(R.id.op4);
              t6 = (TextView) findViewById(R.id.selans);
              t7 = (TextView) findViewById(R.id.corrans);

              t1.setText(j);
              t2.setText("1." + opt1);
              t3.setText("2." + opt2);
              t4.setText("3." + opt3);
              t5.setText("4." + opt4);
              int p = yourans[current];
              String j1 = p + "";
              if (p == 0) j1 = "-";
              t6.setText("Selected Answer " + j1 + "");

              if (sol.equalsIgnoreCase("a")) sol = 1 + "";
              else if (sol.equalsIgnoreCase("b")) sol = 2 + "";
              else if (sol.equalsIgnoreCase("c")) sol = 3 + "";
              else if (sol.equalsIgnoreCase("d")) sol = 4 + "";
              else {
              }
              t7.setText("Correct answer " + sol + "" + "\n" + "\t\t");
              t8.setText((current + 1) + "/20");
            }
          }
        });

    btn_finish.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {

            AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);

            TextView title = new TextView(context);
            title.setText("Aptitude App");
            title.setBackgroundColor(Color.DKGRAY);
            title.setPadding(10, 10, 10, 10);
            title.setGravity(Gravity.CENTER);
            title.setTextColor(Color.WHITE);
            title.setTextSize(20);
            alertDialogBuilder.setCustomTitle(title);

            // set dialog message
            alertDialogBuilder
                .setMessage("Click yes to exit!")
                .setCancelable(false)
                .setPositiveButton(
                    "Yes",
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int id) {

                        Resultvl.this.finish();
                      }
                    })
                .setNegativeButton(
                    "No",
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int id) {

                        dialog.cancel();
                      }
                    });

            AlertDialog alertDialog = alertDialogBuilder.create();

            alertDialog.show();
          }
        });
  }
  @SmallTest
  @MediumTest
  @LargeTest
  public void testAllTypes() {
    Bundle originalBundle = new Bundle();

    putBoolean(BOOLEAN_KEY, originalBundle);
    putBooleanArray(BOOLEAN_ARRAY_KEY, originalBundle);
    putByte(BYTE_KEY, originalBundle);
    putByteArray(BYTE_ARRAY_KEY, originalBundle);
    putShort(SHORT_KEY, originalBundle);
    putShortArray(SHORT_ARRAY_KEY, originalBundle);
    putInt(INT_KEY, originalBundle);
    putIntArray(INT_ARRAY_KEY, originalBundle);
    putLong(LONG_KEY, originalBundle);
    putLongArray(LONG_ARRAY_KEY, originalBundle);
    putFloat(FLOAT_KEY, originalBundle);
    putFloatArray(FLOAT_ARRAY_KEY, originalBundle);
    putDouble(DOUBLE_KEY, originalBundle);
    putDoubleArray(DOUBLE_ARRAY_KEY, originalBundle);
    putChar(CHAR_KEY, originalBundle);
    putCharArray(CHAR_ARRAY_KEY, originalBundle);
    putString(STRING_KEY, originalBundle);
    putStringList(STRING_LIST_KEY, originalBundle);
    originalBundle.putSerializable(SERIALIZABLE_KEY, AccessTokenSource.FACEBOOK_APPLICATION_WEB);

    ensureApplicationContext();

    SharedPreferencesTokenCachingStrategy cache =
        new SharedPreferencesTokenCachingStrategy(getContext());
    cache.save(originalBundle);

    SharedPreferencesTokenCachingStrategy cache2 =
        new SharedPreferencesTokenCachingStrategy(getContext());
    Bundle cachedBundle = cache2.load();

    Assert.assertEquals(
        originalBundle.getBoolean(BOOLEAN_KEY), cachedBundle.getBoolean(BOOLEAN_KEY));
    assertArrayEquals(
        originalBundle.getBooleanArray(BOOLEAN_ARRAY_KEY),
        cachedBundle.getBooleanArray(BOOLEAN_ARRAY_KEY));
    Assert.assertEquals(originalBundle.getByte(BYTE_KEY), cachedBundle.getByte(BYTE_KEY));
    assertArrayEquals(
        originalBundle.getByteArray(BYTE_ARRAY_KEY), cachedBundle.getByteArray(BYTE_ARRAY_KEY));
    Assert.assertEquals(originalBundle.getShort(SHORT_KEY), cachedBundle.getShort(SHORT_KEY));
    assertArrayEquals(
        originalBundle.getShortArray(SHORT_ARRAY_KEY), cachedBundle.getShortArray(SHORT_ARRAY_KEY));
    Assert.assertEquals(originalBundle.getInt(INT_KEY), cachedBundle.getInt(INT_KEY));
    assertArrayEquals(
        originalBundle.getIntArray(INT_ARRAY_KEY), cachedBundle.getIntArray(INT_ARRAY_KEY));
    Assert.assertEquals(originalBundle.getLong(LONG_KEY), cachedBundle.getLong(LONG_KEY));
    assertArrayEquals(
        originalBundle.getLongArray(LONG_ARRAY_KEY), cachedBundle.getLongArray(LONG_ARRAY_KEY));
    Assert.assertEquals(originalBundle.getFloat(FLOAT_KEY), cachedBundle.getFloat(FLOAT_KEY));
    assertArrayEquals(
        originalBundle.getFloatArray(FLOAT_ARRAY_KEY), cachedBundle.getFloatArray(FLOAT_ARRAY_KEY));
    Assert.assertEquals(originalBundle.getDouble(DOUBLE_KEY), cachedBundle.getDouble(DOUBLE_KEY));
    assertArrayEquals(
        originalBundle.getDoubleArray(DOUBLE_ARRAY_KEY),
        cachedBundle.getDoubleArray(DOUBLE_ARRAY_KEY));
    Assert.assertEquals(originalBundle.getChar(CHAR_KEY), cachedBundle.getChar(CHAR_KEY));
    assertArrayEquals(
        originalBundle.getCharArray(CHAR_ARRAY_KEY), cachedBundle.getCharArray(CHAR_ARRAY_KEY));
    Assert.assertEquals(originalBundle.getString(STRING_KEY), cachedBundle.getString(STRING_KEY));
    assertListEquals(
        originalBundle.getStringArrayList(STRING_LIST_KEY),
        cachedBundle.getStringArrayList(STRING_LIST_KEY));
    Assert.assertEquals(
        originalBundle.getSerializable(SERIALIZABLE_KEY),
        cachedBundle.getSerializable(SERIALIZABLE_KEY));
  }
Exemplo n.º 28
0
  @Override
  protected Dialog onCreateDialog(int ignore, Bundle args) {

    // TODO set values from "flags" to messagebox dialog

    // get colors

    int[] colors = args.getIntArray("colors");
    int backgroundColor;
    int textColor;
    int buttonBorderColor;
    int buttonBackgroundColor;
    int buttonSelectedColor;
    if (colors != null) {
      int i = -1;
      backgroundColor = colors[++i];
      textColor = colors[++i];
      buttonBorderColor = colors[++i];
      buttonBackgroundColor = colors[++i];
      buttonSelectedColor = colors[++i];
    } else {
      backgroundColor = Color.TRANSPARENT;
      textColor = Color.TRANSPARENT;
      buttonBorderColor = Color.TRANSPARENT;
      buttonBackgroundColor = Color.TRANSPARENT;
      buttonSelectedColor = Color.TRANSPARENT;
    }

    // create dialog with title and a listener to wake up calling thread

    final Dialog dialog = new Dialog(this);
    dialog.setTitle(args.getString("title"));
    dialog.setCancelable(false);
    dialog.setOnDismissListener(
        new DialogInterface.OnDismissListener() {
          @Override
          public void onDismiss(DialogInterface unused) {
            synchronized (messageboxSelection) {
              messageboxSelection.notify();
            }
          }
        });

    // create text

    TextView message = new TextView(this);
    message.setGravity(Gravity.CENTER);
    message.setText(args.getString("message"));
    if (textColor != Color.TRANSPARENT) {
      message.setTextColor(textColor);
    }

    // create buttons

    int[] buttonFlags = args.getIntArray("buttonFlags");
    int[] buttonIds = args.getIntArray("buttonIds");
    String[] buttonTexts = args.getStringArray("buttonTexts");

    final SparseArray<Button> mapping = new SparseArray<Button>();

    LinearLayout buttons = new LinearLayout(this);
    buttons.setOrientation(LinearLayout.HORIZONTAL);
    buttons.setGravity(Gravity.CENTER);
    for (int i = 0; i < buttonTexts.length; ++i) {
      Button button = new Button(this);
      final int id = buttonIds[i];
      button.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              messageboxSelection[0] = id;
              dialog.dismiss();
            }
          });
      if (buttonFlags[i] != 0) {
        // see SDL_messagebox.h
        if ((buttonFlags[i] & 0x00000001) != 0) {
          mapping.put(KeyEvent.KEYCODE_ENTER, button);
        }
        if ((buttonFlags[i] & 0x00000002) != 0) {
          mapping.put(111, button); /* API 11: KeyEvent.KEYCODE_ESCAPE */
        }
      }
      button.setText(buttonTexts[i]);
      if (textColor != Color.TRANSPARENT) {
        button.setTextColor(textColor);
      }
      if (buttonBorderColor != Color.TRANSPARENT) {
        // TODO set color for border of messagebox button
      }
      if (buttonBackgroundColor != Color.TRANSPARENT) {
        Drawable drawable = button.getBackground();
        if (drawable == null) {
          // setting the color this way removes the style
          button.setBackgroundColor(buttonBackgroundColor);
        } else {
          // setting the color this way keeps the style (gradient, padding, etc.)
          drawable.setColorFilter(buttonBackgroundColor, PorterDuff.Mode.MULTIPLY);
        }
      }
      if (buttonSelectedColor != Color.TRANSPARENT) {
        // TODO set color for selected messagebox button
      }
      buttons.addView(button);
    }

    // create content

    LinearLayout content = new LinearLayout(this);
    content.setOrientation(LinearLayout.VERTICAL);
    content.addView(message);
    content.addView(buttons);
    if (backgroundColor != Color.TRANSPARENT) {
      content.setBackgroundColor(backgroundColor);
    }

    // add content to dialog and return

    dialog.setContentView(content);
    dialog.setOnKeyListener(
        new Dialog.OnKeyListener() {
          @Override
          public boolean onKey(DialogInterface d, int keyCode, KeyEvent event) {
            Button button = mapping.get(keyCode);
            if (button != null) {
              if (event.getAction() == KeyEvent.ACTION_UP) {
                button.performClick();
              }
              return true; // also for ignored actions
            }
            return false;
          }
        });

    return dialog;
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_day, container, false);
   // Retrieve Data
   Bundle getBundle = getArguments();
   int dayCountMax = dayCount + 125;
   editableCells =
       Arrays.copyOfRange(getBundle.getBooleanArray("editableCells"), dayCount, dayCountMax);
   editableHours =
       Arrays.copyOfRange(getBundle.getBooleanArray("editableHours"), dayCount, dayCountMax);
   items = Arrays.copyOfRange(getBundle.getStringArray("items"), dayCount, dayCountMax);
   textColor = Arrays.copyOfRange(getBundle.getIntArray("textColor"), dayCount, dayCountMax);
   backgroundColor =
       Arrays.copyOfRange(getBundle.getIntArray("backgroundColor"), dayCount, dayCountMax);
   textBold = Arrays.copyOfRange(getBundle.getBooleanArray("textBold"), dayCount, dayCountMax);
   // Set GridView
   gridView = (GridView) rootView.findViewById(R.id.gridView);
   gridView.setAdapter(
       new gridView_adapter(getContext(), items, textColor, backgroundColor, textBold));
   // Set on Item Click Listener for the GridView
   gridView.setOnItemClickListener(
       new AdapterView.OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
           if (editableCells[position] || editableHours[position]) {
             View editedView = new changeTextValues().getItemViewIfVisible(parent, position);
             int x = position + dayCount;
             new changeTextValues()
                 .changeText(
                     getContext(),
                     parent,
                     editedView,
                     x,
                     position,
                     items,
                     textColor,
                     backgroundColor,
                     textBold,
                     editableHours);
           }
         }
       });
   // Set on Drag
   gridView.setOnItemLongClickListener(
       new AdapterView.OnItemLongClickListener() {
         @Override
         public boolean onItemLongClick(
             AdapterView<?> parent, View dragView, int dragPosition, long id) {
           if (editableCells[dragPosition]) {
             ClipData data = ClipData.newPlainText("", "");
             View.DragShadowBuilder itemShadow = new View.DragShadowBuilder(dragView);
             dragView.startDrag(data, itemShadow, dragView, 0);
             for (int dropPosition = parent.getFirstVisiblePosition();
                 dropPosition <= parent.getLastVisiblePosition();
                 dropPosition++) {
               if (editableCells[dropPosition] || editableHours[dropPosition]) {
                 dropView[dropPosition] =
                     new changeTextValues().getItemViewIfVisible(parent, dropPosition);
                 dropView[dropPosition].setOnDragListener(
                     new myDragListener(
                         parent,
                         getContext(),
                         items,
                         textColor,
                         backgroundColor,
                         textBold,
                         editableCells,
                         editableHours,
                         dragPosition,
                         dropPosition,
                         dayCount));
               }
             }
             return true;
           } else return false;
         }
       });
   return rootView;
 }
    @Override
    public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      setHasOptionsMenu(true);
      View rootView = inflater.inflate(R.layout.fragment_line_column_dependency, container, false);
      rootView.setFocusable(true);
      rootView.setFocusableInTouchMode(true);
      rootView.setOnKeyListener(backlistener);

      // *** TOP LINE recordChart ***
      realeChartTop = (LineChartView) rootView.findViewById(R.id.chart_top);
      generateInitialLineData();
      recordChart = (LineChartView) rootView.findViewById(R.id.chart_temple);
      recordPreviewChart = (PreviewLineChartView) rootView.findViewById(R.id.chart_preview_temple);

      realTempleTextView = (TextView) rootView.findViewById(R.id.TempletextView);
      realTempleTextView.setTextColor(nowColor);

      recordState = (TextView) rootView.findViewById(R.id.blank);
      realButtonRecord = (Button) rootView.findViewById(R.id.buttonRecord);
      buttonRecordState = false;
      clearButton = (Button) rootView.findViewById(R.id.clear);
      readButton = (Button) rootView.findViewById(R.id.read);
      lookRecordButton = (Button) rootView.findViewById(R.id.look_record);

      maxmunTextView = (TextView) rootView.findViewById(R.id.maxmun_text);
      maxmumTextView_num = (TextView) rootView.findViewById(R.id.maxmun_num);
      minmunTextView = (TextView) rootView.findViewById(R.id.minimum_text);
      minmunTextView_num = (TextView) rootView.findViewById(R.id.minimun_num);
      lookRecordButton1 = (Button) rootView.findViewById(R.id.look_record_1);
      deleteFilesButton = (Button) rootView.findViewById(R.id.delete_file);

      StartTime = (TextView) rootView.findViewById(R.id.start_time);
      EndTime = (TextView) rootView.findViewById(R.id.end_time);

      // recordButtonReturnReal=(Button)rootView.findViewById(R.id.buttonReturnReal);
      // recordButtonReturnReal.setOnClickListener(new returnRealeButtonListener());

      Intent intent = getIntent();
      String string_data1 = intent.getStringExtra("param1");
      String string_data2 = intent.getStringExtra("param2");
      Bundle bundle = intent.getExtras();
      int[] stateBuffer = bundle.getIntArray("trans_state");

      if (stateBuffer[2] != 1) {
        buttonRecordState = false;
        recordState.setText("●");
        recordState.setTextColor(getResources().getColor(R.color.holo_blue_light));
      } else {
        buttonRecordState = true;
        recordState.setText("●");
        recordState.setTextColor(getResources().getColor(R.color.holo_blue_light));
      }

      if (Integer.parseInt(string_data1) != 1) {
        initBluetoothReciver();

        disReadHideRecord();

        sendCmdBroadcast(CMD_GET_DATA, 0); // 请求数据
      } else {
        File file = new File(string_data2);
        if (file.exists()) {
          // System.out.println("binggo");

          FileReader fr = null;
          try {

            fr = new FileReader(file);
            BufferedReader br = new BufferedReader(fr);
            String temp = null;
            String s = "";
            while ((temp = br.readLine()) != null) s += temp + "\n";
            String[] ss = s.split("\n");

            // System.out.println("LONG "+ss.length);

            int[] recordMsgBuffer = new int[ss.length];
            for (int i = 0; i < ss.length; i++) {
              // System.out.println(ss[i]);
              recordMsgBuffer[i] = Integer.parseInt(ss[i]);
            }

            int max = recordMsgBuffer[0];
            int min = recordMsgBuffer[0];

            SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日HH:mm:ss");
            String[] filenamelist = string_data2.split("/");
            String filename = filenamelist[6];
            String filename1 = filename.substring(0, filename.length() - 8);
            ParsePosition pos = new ParsePosition(0);
            Date endDate = sdf.parse(filename1, pos);
            Date startDate = new Date(endDate.getTime() - ss.length * 1 * 1000);
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String EndDataString = formatter.format(endDate);
            String StartDateString = formatter.format(startDate);

            for (int i = 0; i < recordMsgBuffer.length; i++) {
              if (recordMsgBuffer[i] > max) {
                max = recordMsgBuffer[i];
              }

              if (recordMsgBuffer[i] < min) {
                min = recordMsgBuffer[i];
              }
            }

            maxmumTextView_num.setText(" " + max / 10.0f + "℃");
            minmunTextView_num.setText(" " + min / 10.0f + "℃");

            showRecoedData(recordMsgBuffer);

          } catch (FileNotFoundException e) {
            e.printStackTrace();
          } catch (IOException e) {
            e.printStackTrace();
          }
        }

        disRecordHideReal();
      }

      realButtonRecord.setOnClickListener(
          new Button.OnClickListener() {
            @Override
            public void onClick(View v) {
              // 选项数组
              String[] choices = {"5秒", "10秒", "30秒", "60秒", "5分钟", "10分钟", "30分钟", "1小时", "2小时"};
              // 包含多个选项的对话框
              AlertDialog dialog =
                  new AlertDialog.Builder(LineColumnDependencyActivity.this)
                      // .setIcon(android.R.drawable.btn_star)
                      .setTitle("参数选择")
                      .setItems(choices, onselect)
                      .create();
              dialog.show();
              //
            }
          });

      readButton.setOnClickListener(
          new Button.OnClickListener() {
            @Override
            public void onClick(View v) {
              sendCmdBroadcast(CMD_REQUES_RECORD, 0);
              buttonRecordState = false;
            }
          });

      lookRecordButton.setOnClickListener(
          new Button.OnClickListener() {
            @Override
            public void onClick(View v) {
              String[] fileName = new String[0];
              String[] filePath = new String[0];
              String path = "";

              if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {

                File sdcardDir = Environment.getExternalStorageDirectory();
                // 得到一个路径,内容是sdcard的文件夹路径和名字

                path = sdcardDir.getPath() + "/wukongSenser/templeSenser";
                File path1 = new File(path);
                if (!path1.exists()) path1.mkdirs();

                File[] files = new File(path).listFiles();
                fileName = new String[files.length];
                filePath = new String[files.length];

                for (int i = 0; i < files.length; i++) {
                  if (files[i].isFile()) {
                    filePath[i] = files[i].getAbsolutePath();
                    fileName[i] = filePath[i].substring(filePath[i].lastIndexOf("/") + 1);
                  }
                }
              }

              if (fileName.length == 0) {
                new AlertDialog.Builder(LineColumnDependencyActivity.this)
                    .setTitle("警告")
                    .setMessage("您没有记录过数据")
                    .setPositiveButton("确定", null)
                    .show();
              } else {
                final String[] finalFilePath = filePath;
                final String finalPath = path;
                new AlertDialog.Builder(LineColumnDependencyActivity.this)
                    .setTitle("请选择文件")
                    .setItems(
                        fileName,
                        new DialogInterface.OnClickListener() {

                          @Override
                          public void onClick(DialogInterface dialog, int which) {
                            Toast.makeText(
                                    LineColumnDependencyActivity.this,
                                    finalFilePath[which],
                                    Toast.LENGTH_SHORT)
                                .show();

                            File file = new File(finalFilePath[which]);
                            if (file.exists()) {

                              FileReader fr = null;
                              try {
                                fr = new FileReader(file);
                                BufferedReader br = new BufferedReader(fr);
                                String temp = null;
                                String s = "";
                                while ((temp = br.readLine()) != null) s += temp + "\n";
                                String[] ss = s.split("\n");

                                int[] recordMsgBuffer = new int[ss.length];
                                for (int i = 0; i < ss.length; i++) {
                                  // System.out.println(ss[i]);
                                  recordMsgBuffer[i] = Integer.parseInt(ss[i]);
                                }

                                int max = recordMsgBuffer[0];
                                int min = recordMsgBuffer[0];

                                for (int i = 0; i < recordMsgBuffer.length; i++) {
                                  if (recordMsgBuffer[i] > max) {
                                    max = recordMsgBuffer[i];
                                  }

                                  if (recordMsgBuffer[i] < min) {
                                    min = recordMsgBuffer[i];
                                  }
                                }

                                maxmumTextView_num.setText(" " + max / 10.0f + "℃");
                                minmunTextView_num.setText(" " + min / 10.0f + "℃");

                                showRecoedData(recordMsgBuffer);

                              } catch (FileNotFoundException e) {
                                e.printStackTrace();
                              } catch (IOException e) {
                                e.printStackTrace();
                              }
                            } else {

                            }
                          }
                        })
                    .setNegativeButton("取消", null)
                    .show();
              }
            }
          });

      lookRecordButton1.setOnClickListener(
          new Button.OnClickListener() {
            @Override
            public void onClick(View v) {
              String[] fileName = new String[0];
              String[] filePath = new String[0];
              String path = "";

              if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {

                File sdcardDir = Environment.getExternalStorageDirectory();
                // 得到一个路径,内容是sdcard的文件夹路径和名字

                path = sdcardDir.getPath() + "/wukongSenser/templeSenser";
                File path1 = new File(path);
                if (!path1.exists()) path1.mkdirs();

                File[] files = new File(path).listFiles();
                fileName = new String[files.length];
                filePath = new String[files.length];

                for (int i = 0; i < files.length; i++) {

                  if (files[i].isFile()) {
                    filePath[i] = files[i].getAbsolutePath();
                    fileName[i] = filePath[i].substring(filePath[i].lastIndexOf("/") + 1);
                  }
                }
              }

              if (fileName.length == 0) {
                new AlertDialog.Builder(LineColumnDependencyActivity.this)
                    .setTitle("警告")
                    .setMessage("您没有记录过数据")
                    .setPositiveButton("确定", null)
                    .show();
              } else {
                final String[] finalFilePath = filePath;
                final String finalPath = path;
                new AlertDialog.Builder(LineColumnDependencyActivity.this)
                    .setTitle("请选择文件")
                    // .setIcon(R.drawable.ic_launcher)
                    .setItems(
                        fileName,
                        new DialogInterface.OnClickListener() {

                          @Override
                          public void onClick(DialogInterface dialog, int which) {
                            Toast.makeText(
                                    LineColumnDependencyActivity.this,
                                    finalFilePath[which],
                                    Toast.LENGTH_SHORT)
                                .show();

                            // String filepath = finalPath + "/qq.txt";

                            System.out.println("pS " + finalFilePath[which]);

                            File file = new File(finalFilePath[which]);
                            if (file.exists()) {
                              // System.out.println("binggo");

                              FileReader fr = null;
                              try {
                                fr = new FileReader(file);
                                BufferedReader br = new BufferedReader(fr);
                                String temp = null;
                                String s = "";
                                while ((temp = br.readLine()) != null) s += temp + "\n";
                                String[] ss = s.split("\n");

                                // System.out.println("LONG "+ss.length);

                                int[] recordMsgBuffer = new int[ss.length];
                                for (int i = 0; i < ss.length; i++) {
                                  // System.out.println(ss[i]);
                                  recordMsgBuffer[i] = Integer.parseInt(ss[i]);
                                }

                                int max = recordMsgBuffer[0];
                                int min = recordMsgBuffer[0];

                                for (int i = 0; i < recordMsgBuffer.length; i++) {
                                  if (recordMsgBuffer[i] > max) {
                                    max = recordMsgBuffer[i];
                                  }

                                  if (recordMsgBuffer[i] < min) {
                                    min = recordMsgBuffer[i];
                                  }
                                }

                                maxmumTextView_num.setText(" " + max / 10.0f + "℃");
                                minmunTextView_num.setText(" " + min / 10.0f + "℃");

                                showRecoedData(recordMsgBuffer);

                              } catch (FileNotFoundException e) {
                                e.printStackTrace();
                              } catch (IOException e) {
                                e.printStackTrace();
                              }
                            } else {

                            }
                          }
                        })
                    .setNegativeButton("取消", null)
                    .show();
              }
            }
          });

      return rootView;
    }