/** Setup the tab host and create all necessary tabs. */
  @Override
  protected void onFinishInflate() {
    // Setup the tab host
    setup();

    final ViewGroup tabsContainer = (ViewGroup) findViewById(R.id.tabs_container);
    final TabWidget tabs = getTabWidget();
    final AppsCustomizePagedView appsCustomizePane =
        (AppsCustomizePagedView) findViewById(R.id.apps_customize_pane_content);
    mTabs = tabs;
    mTabsContainer = tabsContainer;
    mAppsCustomizePane = appsCustomizePane;
    mAnimationBuffer = (FrameLayout) findViewById(R.id.animation_buffer);
    mContent = (LinearLayout) findViewById(R.id.apps_customize_content);
    LayoutParams params = (LayoutParams) mContent.getLayoutParams();
    params.topMargin += Utils.getStatusBarSize(getResources());
    mContent.setLayoutParams(params);
    if (tabs == null || mAppsCustomizePane == null) throw new Resources.NotFoundException();

    // Configure the tabs content factory to return the same paged view (that we change the
    // content filter on)
    TabContentFactory contentFactory =
        new TabContentFactory() {
          public View createTabContent(String tag) {
            return appsCustomizePane;
          }
        };

    // Create the tabs
    TextView tabView;
    String label;
    label = getContext().getString(R.string.all_apps_button_label);
    tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
    tabView.setText(label);
    tabView.setContentDescription(label);
    addTab(newTabSpec(APPS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
    label = getContext().getString(R.string.widgets_tab_label);
    tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
    tabView.setText(label);
    tabView.setContentDescription(label);
    addTab(newTabSpec(WIDGETS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
    setOnTabChangedListener(this);

    // Setup the key listener to jump between the last tab view and the market icon
    AppsCustomizeTabKeyEventListener keyListener = new AppsCustomizeTabKeyEventListener();
    View lastTab = tabs.getChildTabViewAt(tabs.getTabCount() - 1);
    lastTab.setOnKeyListener(keyListener);
    View shopButton = findViewById(R.id.market_button);
    shopButton.setOnKeyListener(keyListener);

    // Hide the tab bar until we measure
    mTabsContainer.setAlpha(0f);
  }
Пример #2
0
  /**
   * Update the Start/Stop text. The button is within a view group with a transition that is needed
   * to animate the button moving. The transition also animates the the text changing, but that
   * animation does not provide a good look and feel. Temporarily disable the view group transition
   * while the text is changing and restore it afterwards.
   *
   * @param parent - View Group holding the start/stop button
   * @param textView - The start/stop button
   * @param text - Start or Stop id
   */
  private void setStartStopText(final ViewGroup parent, TextView textView, int text) {
    final LayoutTransition layoutTransition = parent.getLayoutTransition();
    // Tap into the parent layout->draw flow just before the draw
    ViewTreeObserver viewTreeObserver = parent.getViewTreeObserver();
    if (viewTreeObserver != null) {
      viewTreeObserver.addOnPreDrawListener(
          new ViewTreeObserver.OnPreDrawListener() {
            /**
             * Re-establish the transition handler Remove this listener
             *
             * @return true so that onDraw() is called
             */
            @Override
            public boolean onPreDraw() {
              parent.setLayoutTransition(layoutTransition);
              ViewTreeObserver viewTreeObserver = parent.getViewTreeObserver();
              if (viewTreeObserver != null) {
                viewTreeObserver.removeOnPreDrawListener(this);
              }
              return true;
            }
          });
    }
    // Remove the transition while the text is updated
    parent.setLayoutTransition(null);

    String textStr = getActivity().getResources().getString(text);
    textView.setText(textStr);
    textView.setContentDescription(textStr);
  }
Пример #3
0
  private void displayTags(SessionDetailModel data) {
    if (data.getTagMetadata() == null || data.getTagsString() == null) {
      mTagsContainer.setVisibility(View.GONE);
      return;
    }

    if (TextUtils.isEmpty(data.getTagsString())) {
      mTagsContainer.setVisibility(View.GONE);
    } else {
      mTagsContainer.setVisibility(View.VISIBLE);
      mTags.removeAllViews();
      LayoutInflater inflater = LayoutInflater.from(getContext());
      String[] tagIds = data.getTagsString().split(",");

      List<TagMetadata.Tag> tags = new ArrayList<TagMetadata.Tag>();
      for (String tagId : tagIds) {
        if (Config.Tags.SESSIONS.equals(tagId) || Config.Tags.SPECIAL_KEYNOTE.equals(tagId)) {
          continue;
        }

        TagMetadata.Tag tag = data.getTagMetadata().getTag(tagId);
        if (tag == null) {
          continue;
        }

        tags.add(tag);
      }

      if (tags.size() == 0) {
        mTagsContainer.setVisibility(View.GONE);
        return;
      }

      Collections.sort(tags, TagMetadata.TAG_DISPLAY_ORDER_COMPARATOR);

      for (final TagMetadata.Tag tag : tags) {
        TextView chipView =
            (TextView) inflater.inflate(R.layout.include_session_tag_chip, mTags, false);
        chipView.setText(tag.getName());
        chipView.setContentDescription(getString(R.string.talkback_button, tag.getName()));
        chipView.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                Intent intent =
                    new Intent(getContext(), ExploreSessionsActivity.class)
                        .putExtra(ExploreSessionsActivity.EXTRA_FILTER_TAG, tag.getId())
                        .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
                startActivity(intent);
              }
            });

        mTags.addView(chipView);
      }
    }
  }
Пример #4
0
  /** Clock views can call this to refresh their date. * */
  public static void updateDate(String dateFormat, String dateFormatForAccessibility, View clock) {
    Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(System.currentTimeMillis());

    CharSequence newDate = DateFormat.format(dateFormat, cal);
    TextView dateDisplay;
    dateDisplay = (TextView) clock.findViewById(R.id.date);
    if (dateDisplay != null) {
      dateDisplay.setVisibility(View.VISIBLE);
      dateDisplay.setText(newDate);
      dateDisplay.setContentDescription(DateFormat.format(dateFormatForAccessibility, cal));
    }
  }
Пример #5
0
  private void findViews() {
    root.setup();
    tabs = (TabWidget) root.getTabWidget();
    ivw_theme_icon = (ImageView) root.findViewById(R.id.ivw_theme_icon);
    tabcontent = (FrameLayout) root.findViewById(android.R.id.tabcontent);
    grid_themes = (GridView) root.findViewById(R.id.grid_themes);
    grid_translations = (GridView) root.findViewById(R.id.grid_translations);

    BaseAdapter themesAdapter = new ThemesAdapter(themesTitleArray, themesIconIdArray);
    BaseAdapter translationsAdapter =
        new ThemesAdapter(translationsTitleArray, translationsIconIdArray);

    grid_themes.setAdapter(themesAdapter);
    grid_translations.setAdapter(translationsAdapter);

    TabContentFactory contentFactory =
        new TabContentFactory() {
          public View createTabContent(String tag) {
            if ("Theme".equals(tag)) {
              return grid_themes;
            } else {
              return grid_translations;
            }
          }
        };
    TextView tab = (TextView) mLayoutInflater.inflate(R.layout.popup_themes_tab, tabs, false);
    tab.setText("Theme");
    tab.setContentDescription("Theme");
    Log.d("aaron", "tabs " + tabs);
    root.addTab(root.newTabSpec("Theme").setIndicator(tab).setContent(contentFactory));

    tab = (TextView) mLayoutInflater.inflate(R.layout.popup_themes_tab, tabs, false);
    tab.setText("Transiton");
    tab.setContentDescription("Transiton");
    root.addTab(root.newTabSpec("Transiton").setIndicator(tab).setContent(contentFactory));

    grid_translations.setOnItemClickListener(mThemeItemClick);
  }
Пример #6
0
 /** Clock views can call this to refresh their alarm to the next upcoming value. * */
 public static void refreshAlarm(Context context, View clock) {
   String nextAlarm =
       Settings.System.getString(
           context.getContentResolver(), Settings.System.NEXT_ALARM_FORMATTED);
   TextView nextAlarmView;
   nextAlarmView = (TextView) clock.findViewById(R.id.nextAlarm);
   if (!TextUtils.isEmpty(nextAlarm) && nextAlarmView != null) {
     nextAlarmView.setText(context.getString(R.string.control_set_alarm_with_existing, nextAlarm));
     nextAlarmView.setContentDescription(
         context.getResources().getString(R.string.next_alarm_description, nextAlarm));
     nextAlarmView.setVisibility(View.VISIBLE);
   } else {
     nextAlarmView.setVisibility(View.GONE);
   }
 }
Пример #7
0
 public static void a(TextView paramTextView, float paramFloat) {
   Drawable[] arrayOfDrawable = paramTextView.getCompoundDrawables();
   int j = arrayOfDrawable.length;
   int i = 0;
   while (i < j) {
     Drawable localDrawable = arrayOfDrawable[i];
     if (localDrawable != null) {
       localDrawable.setLevel((int) (10.0F * paramFloat) / 5);
     }
     i += 1;
   }
   paramTextView.setContentDescription(
       String.format(
           "%s,%s",
           new Object[] {a(paramTextView.getContext(), paramFloat), paramTextView.getText()}));
 }
  /** Method that initializes the titlebar of the activity. */
  private void initTitleActionBar() {
    // Configure the action bar options
    getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.bg_holo_titlebar));
    getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    View customTitle = getLayoutInflater().inflate(R.layout.simple_customtitle, null, false);

    TextView title = (TextView) customTitle.findViewById(R.id.customtitle_title);
    title.setText(R.string.search);
    title.setContentDescription(getString(R.string.search));
    ButtonItem configuration = (ButtonItem) customTitle.findViewById(R.id.ab_button1);
    configuration.setImageResource(R.drawable.ic_holo_light_config);
    configuration.setVisibility(View.VISIBLE);

    getActionBar().setCustomView(customTitle);
  }
Пример #9
0
  /** Method that initializes the titlebar of the activity. */
  private void initTitleActionBar() {
    // Configure the action bar options
    getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.bg_holo_titlebar));
    getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    View customTitle = getLayoutInflater().inflate(R.layout.simple_customtitle, null, false);
    TextView title = (TextView) customTitle.findViewById(R.id.customtitle_title);
    title.setText(R.string.history);
    title.setContentDescription(getString(R.string.history));
    ButtonItem configuration = (ButtonItem) customTitle.findViewById(R.id.ab_button1);
    configuration.setImageResource(R.drawable.ic_holo_light_overflow);
    configuration.setContentDescription(getString(R.string.actionbar_button_overflow_cd));

    View status = findViewById(R.id.history_status);
    boolean showOptionsMenu = AndroidHelper.showOptionsMenu(getApplicationContext());
    configuration.setVisibility(showOptionsMenu ? View.VISIBLE : View.GONE);
    this.mOptionsAnchorView = showOptionsMenu ? configuration : status;

    getActionBar().setCustomView(customTitle);
  }
Пример #10
0
  void resetLayout() {
    mContent.removeAllViewsInLayout();

    if (!AppsCustomizePagedView.DISABLE_ALL_APPS) {
      // Add the Apps button
      Context context = getContext();

      LayoutInflater inflater = LayoutInflater.from(context);
      TextView allAppsButton =
          (TextView) inflater.inflate(R.layout.all_apps_button, mContent, false);
      Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);
      Utilities.resizeIconDrawable(d);
      allAppsButton.setCompoundDrawables(null, d, null, null);

      allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
      if (mLauncher != null) {
        allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
      }
      allAppsButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(android.view.View v) {
              if (mLauncher != null) {
                mLauncher.onClickAllAppsButton(v);
              }
            }
          });

      // Note: We do this to ensure that the hotseat is always laid out in the orientation of
      // the hotseat in order regardless of which orientation they were added
      int x = getCellXFromOrder(mAllAppsButtonRank);
      int y = getCellYFromOrder(mAllAppsButtonRank);
      CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x, y, 1, 1);
      lp.canReorder = false;
      mContent.addViewToCellLayout(allAppsButton, -1, 0, lp, true);
    }
  }
Пример #11
0
 public View getView(int position, View convertView, ViewGroup parent) {
   TextView myView = (TextView) super.getView(position, convertView, parent);
   myView.setContentDescription(myView.getText());
   return myView;
 }
  /**
   * Create the Contact Details menu activity (non-Javadoc)
   *
   * @see org.easyaccess.EasyAccessActivity#onCreate(android.os.Bundle)
   */
  @SuppressLint("HandlerLeak")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.contactsotheroptions);
    super.onCreate(savedInstanceState);

    // get UI elements
    contactName = (TextView) findViewById(R.id.txtContactsName);
    btnDelete = (Button) findViewById(R.id.btnDelete);
    btnCopyToSD = (Button) findViewById(R.id.btnCopyToSD);
    btnImport = (Button) findViewById(R.id.btnImportFromSD);
    btnExport = (Button) findViewById(R.id.btnExportToSD);

    // get the details of the contact from the number
    if (getIntent().getExtras() != null) {
      this.id = getIntent().getExtras().getString("id");
      this.contactNumber = getIntent().getExtras().getString("number");
    }

    HashMap<String, ArrayList<String>> contactDetails =
        new ContactManager(getApplicationContext()).getDetailsFromId(this.id);

    contactName.setText(contactDetails.get("name").get(0));
    contactName.setContentDescription(
        contactDetails.get("name").get(0).replaceAll(".(?=[0-9])", "$0 "));

    contactName.setOnFocusChangeListener(
        new OnFocusChangeListener() {

          @Override
          public void onFocusChange(View view, boolean hasFocus) {
            if (hasFocus) {
              giveFeedback(((TextView) view).getText().toString());
            }
          }
        });

    attachListener(btnDelete);
    attachListener(btnCopyToSD);
    attachListener(btnImport);
    attachListener(btnExport);

    attachKeyListener(btnDelete, 1);

    btnDelete.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            confirmDelete("Are you sure you want to delete the contact?");
          }
        });

    attachKeyListener(btnCopyToSD, 2);

    btnCopyToSD.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View view) {
            copyToSDcard();
          }
        });

    btnExport.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View view) {
            export();
          }
        });

    attachKeyListener(btnExport, 3);

    btnImport.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View view) {
            importContact();
          }
        });

    attachKeyListener(btnImport, 4);

    handler =
        new Handler() {
          public void handleMessage(Message message) {
            if (message.getData().getInt("type") == EXPORTONECONTACT) {
              if (message.getData().getBoolean("success") == true) {
                TTS.stop();
                // check if keyboard is connected but accessibility
                // services are disabled
                if (!Utils.isAccessibilityEnabled(getApplicationContext())
                    && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS)
                  TTS.speak(getResources().getString(R.string.copycontactsuccess));
                Toast.makeText(
                        getApplicationContext(),
                        getResources().getString(R.string.copycontactsuccess),
                        Toast.LENGTH_SHORT)
                    .show();
              } else {
                TTS.stop();
                // check if keyboard is connected but accessibility
                // services are disabled
                if (!Utils.isAccessibilityEnabled(getApplicationContext())
                    && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS)
                  TTS.speak(getResources().getString(R.string.copycontactfailure));
                Toast.makeText(
                        getApplicationContext(),
                        getResources().getString(R.string.copycontactfailure),
                        Toast.LENGTH_SHORT)
                    .show();
              }
            } else if (message.getData().getInt("type") == EXPORTALLCONTACTS) {
              if (message.getData().getBoolean("success") == true) {
                TTS.stop();
                // check if keyboard is connected but accessibility
                // services are disabled
                if (!Utils.isAccessibilityEnabled(getApplicationContext())
                    && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS)
                  TTS.speak(getResources().getString(R.string.copyallcontactssuccess));
                Toast.makeText(
                        getApplicationContext(),
                        getResources().getString(R.string.copyallcontactssuccess),
                        Toast.LENGTH_SHORT)
                    .show();
              } else {
                TTS.stop();
                // check if keyboard is connected but accessibility
                // services are disabled
                if (!Utils.isAccessibilityEnabled(getApplicationContext())
                    && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS)
                  TTS.speak(getResources().getString(R.string.copyallcontactsfailure));
                Toast.makeText(
                        getApplicationContext(),
                        getResources().getString(R.string.copyallcontactsfailure),
                        Toast.LENGTH_SHORT)
                    .show();
              }
            }
          }
        };
  }
Пример #13
0
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    if (data != null && data.moveToFirst()) {
      // Read weather condition ID from cursor
      int weatherId = data.getInt(COL_WEATHER_CONDITION_ID);

      // Use weather art image
      Glide.with(this)
          .load(Utility.getArtUrlForWeatherCondition(getActivity(), weatherId))
          .error(Utility.getArtResourceForWeatherCondition(weatherId))
          .crossFade()
          .into(mIconView);

      // Read date from cursor and update views for day of week and date
      long date = data.getLong(COL_WEATHER_DATE);
      String friendlyDateText = Utility.getDayName(getActivity(), date);
      String dateText = Utility.getFormattedMonthDay(getActivity(), date);
      mFriendlyDateView.setText(friendlyDateText);
      mDateView.setText(dateText);

      // Read description from cursor and update view
      String description = data.getString(COL_WEATHER_DESC);
      mDescriptionView.setText(description);

      // For accessibility, add a content description to the icon field
      mIconView.setContentDescription(getString(R.string.a11y_forecast_icon, description));

      // Read high temperature from cursor and update view
      boolean isMetric = Utility.isMetric(getActivity());

      double high = data.getDouble(COL_WEATHER_MAX_TEMP);
      String highString = Utility.formatTemperature(getActivity(), high);
      mHighTempView.setText(highString);
      mHighTempView.setContentDescription(getString(R.string.a11y_high_temp, high));

      // Read low temperature from cursor and update view
      double low = data.getDouble(COL_WEATHER_MIN_TEMP);
      String lowString = Utility.formatTemperature(getActivity(), low);
      mLowTempView.setText(lowString);
      mLowTempView.setContentDescription(getString(R.string.a11y_low_temp, low));

      // Read humidity from cursor and update view
      float humidity = data.getFloat(COL_WEATHER_HUMIDITY);
      mHumidityView.setText(getActivity().getString(R.string.format_humidity, humidity));
      mHumidityView.setContentDescription(mHumidityView.getText());

      // Read wind speed and direction from cursor and update view
      float windSpeedStr = data.getFloat(COL_WEATHER_WIND_SPEED);
      float windDirStr = data.getFloat(COL_WEATHER_DEGREES);
      mWindView.setText(Utility.getFormattedWind(getActivity(), windSpeedStr, windDirStr));
      mWindView.setContentDescription(mWindView.getText());

      // Read pressure from cursor and update view
      float pressure = data.getFloat(COL_WEATHER_PRESSURE);
      mPressureView.setText(getActivity().getString(R.string.format_pressure, pressure));
      mPressureView.setContentDescription(mPressureView.getText());

      // We still need this for the share intent
      mForecast = String.format("%s - %s - %s/%s", dateText, description, high, low);

      // If onCreateOptionsMenu has already happened, we need to update the share intent now.
      if (mShareActionProvider != null) {
        mShareActionProvider.setShareIntent(createShareForecastIntent());
      }
    }
  }
Пример #14
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Remove title bar
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    // Remove notification bar
    this.getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    // set content view AFTER ABOVE sequence (to avoid crash)
    setContentView(R.layout.player);

    decorView = getWindow().getDecorView();
    uiOption = getWindow().getDecorView().getSystemUiVisibility();

    surfaceView = (SurfaceView) this.findViewById(R.id.SurfaceView);
    surfaceHolder = surfaceView.getHolder();
    surfaceHolder.addCallback(this);

    mediaPlayer = new MediaPlayer();
    mediaPlayer.setOnCompletionListener(this);
    mediaPlayer.setOnErrorListener(this);
    mediaPlayer.setOnInfoListener(this);
    mediaPlayer.setOnPreparedListener(this);
    mediaPlayer.setOnSeekCompleteListener(this);
    mediaPlayer.setOnVideoSizeChangedListener(this);

    mMenuBar = (RelativeLayout) findViewById(R.id.menuBar);
    mMenuButton = (ImageView) findViewById(R.id.menuButton);
    mVideoList = (LinearLayout) findViewById(R.id.videoList);
    mTitle = (TextView) findViewById(R.id.MovieTitle);
    mMenuButton.setOnClickListener(this);
    mVideoList.setOnClickListener(this);

    /*
     * String filePath = Environment.getExternalStorageDirectory().getPath()
     * + "/Movies/Spanglish_H264_AAC_800x432.mp4";
     */

    // POINT: sdcard 의 동영상 파일 목록을 구하기
    String sdPath = Environment.getExternalStorageDirectory().getAbsolutePath();
    File sdRoot = new File(sdPath);
    FileList(sdRoot);

    for (int i = 0; i < mFileList.size(); i++) {
      if ((mFileList.get(i).endsWith(".mp4")) || (mFileList.get(i).endsWith(".mkv"))) {
        Log.e("TAT", mFileList.get(i));
        mVideoFileList.add(mFileList.get(i));
      }
    }

    if (mVideoFileList.isEmpty()) {
      Toast.makeText(this, "재생할 파일이 없습니다.", 1).show();
    }

    for (int i = 0; i < mVideoFileList.size(); i++) {
      final String path = mVideoFileList.get(i);
      final String filename = path.substring(path.lastIndexOf("/") + 1);
      final TextView text = new TextView(this);
      text.setContentDescription(i + "");
      text.setSingleLine();
      text.setPadding(
          text.getPaddingLeft() + 10,
          text.getPaddingTop() + 10,
          text.getPaddingRight(),
          text.getPaddingBottom());
      text.setHeight(80);
      text.setText(filename);
      text.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              try {
                if (mediaPlayer.isPlaying()) mediaPlayer.stop();
                mediaPlayer.reset();
                mediaPlayer.setDataSource(path);
                mediaPlayer.prepare();
                idx = Integer.parseInt(text.getContentDescription().toString());
                mTitle.setText("[ " + filename + " ]");
              } catch (IllegalArgumentException e) {
                Log.v(LOGTAG, e.getMessage());
                finish();
              } catch (IllegalStateException e) {
                Log.v(LOGTAG, e.getMessage());
                finish();
              } catch (SecurityException e) {
                e.printStackTrace();
              } catch (IOException e) {
                e.printStackTrace();
              }
            }
          });
      mVideoList.addView(text);
    }

    /* TODO : intend를 통해 클릭한 동영상 path 넘겨주기 */
    // Intent intent = getIntent();
    // mmList = intent.getStringArrayListExtra("vList");

    String filePath = mVideoFileList.get(0);

    try {
      mediaPlayer.setDataSource(filePath);
      String filename = filePath.substring(filePath.lastIndexOf("/") + 1);
      mTitle.setText("[ " + filename + " ]");
    } catch (IllegalArgumentException e) {
      Log.v(LOGTAG, e.getMessage());
      finish();
    } catch (IllegalStateException e) {
      Log.v(LOGTAG, e.getMessage());
      finish();
    } catch (IOException e) {
      Log.v(LOGTAG, e.getMessage());
      finish();
    }

    controller =
        new MediaController(this) {
          @Override
          public void show() {
            super.show(0);
            mMenuBar.setVisibility(View.VISIBLE);
          }

          @Override
          public void hide() {
            super.hide();
            mMenuBar.setVisibility(View.INVISIBLE);
            ((ScrollView) mVideoList.getParent()).setVisibility(View.INVISIBLE);
          }
        };
    currentDisplay = getWindowManager().getDefaultDisplay();

    //
    // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    // uiOption |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
  }
Пример #15
0
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    if (!data.moveToFirst()) {
      Toast.makeText(this, R.string.response_info_response_deleted, Toast.LENGTH_SHORT).show();
      finish();
      return;
    }

    final String surveyName = data.getString(ResponseQuery.SURVEY_TITLE);
    final Long completedDate = data.getLong(ResponseQuery.TIME);
    mStatus = data.getInt(ResponseQuery.STATUS);

    if (mStatus == Response.STATUS_STANDBY)
      uploadButton.setContentDescription(
          getString(R.string.response_info_entity_action_button_upload_description));
    else if (mStatus == Response.STATUS_WAITING_FOR_LOCATION)
      uploadButton.setContentDescription(
          getString(R.string.response_info_entity_action_button_upload_force_description));
    else
      uploadButton.setContentDescription(
          getString(R.string.response_info_entity_action_button_upload_error_description));

    mHeadertext.setText(surveyName);
    mSubtext.setText(data.getString(ResponseQuery.CAMPAIGN_NAME));
    // If we aren't in single campaign mode, show the campaign name
    mSubtext.setVisibility((ConfigHelper.isSingleCampaignMode()) ? View.GONE : View.VISIBLE);
    SimpleDateFormat df = new SimpleDateFormat();
    mNotetext.setText(df.format(new Date(completedDate)));

    final String iconUrl = data.getString(ResponseQuery.CAMPAIGN_ICON);
    if (iconUrl == null
        || mImageLoader.bind(mIconView, iconUrl, null) != ImageLoader.BindResult.OK) {
      mIconView.setImageResource(R.drawable.apple_logo);
    }

    mEntityHeader.setVisibility(View.VISIBLE);

    // Make the map view button status aware so it can provide some useful info about the gps state
    if (mStatus == Response.STATUS_WAITING_FOR_LOCATION) {
      mapViewButton.setText(R.string.response_info_gps_wait);
      mapViewButton.setEnabled(false);
    } else if (!(SurveyGeotagService.LOCATION_VALID.equals(
        data.getString(ResponseQuery.LOCATION_STATUS)))) {
      mapViewButton.setText(R.string.response_info_no_location);
      mapViewButton.setEnabled(false);
    } else {
      mapViewButton.setText(R.string.response_info_view_map);
      mapViewButton.setEnabled(true);
    }

    // Make upload button visible if applicable
    uploadButton.setVisibility(View.VISIBLE);
    switch (mStatus) {
      case Response.STATUS_DOWNLOADED:
      case Response.STATUS_UPLOADED:
        uploadButton.setVisibility(View.GONE);
        break;
      case Response.STATUS_STANDBY:
      case Response.STATUS_WAITING_FOR_LOCATION:
        uploadButton.setText(R.string.response_info_upload);
        uploadButton.setEnabled(true);
        break;
      case Response.STATUS_QUEUED:
      case Response.STATUS_UPLOADING:
        uploadButton.setText(R.string.response_info_uploading);
        uploadButton.setEnabled(false);
        break;
      default:
        // Error
        uploadButton.setText(R.string.response_info_upload_error);
        uploadButton.setEnabled(true);
    }
  }