Exemplo n.º 1
1
 public void updateTitleView() {
   if (activeWindow != 0) {
     if (deviceMac.length() > 0) ((Activity) context).setTitle(getViewName(activeWindow));
     else ((Activity) context).setTitle("Grupo " + activeWindow);
   } else {
     if (name.length() > 0) {
       ((Activity) context).setTitle(name);
     } else ((Activity) context).setTitle(R.string.title_panel_general);
   }
 }
 @Override
 public void setTitle(CharSequence newTitle) {
   if (APPEND_TITLES) {
     CharSequence oldTitle = super.getTitle();
     if (oldTitle != null) {
       super.setTitle(oldTitle + ", " + newTitle);
     } else {
       super.setTitle(newTitle);
     }
   } else {
     super.setTitle(newTitle);
   }
 }
Exemplo n.º 3
1
 protected void updateTitle(String title) {
   Activity mActivity = getActivity();
   if (mActivity != null && mActivity instanceof ActionBarActivity) {
     mActivity.setTitle(title);
     ((ActionBarActivity) mActivity).getSupportActionBar().setTitle(title);
   }
 }
Exemplo n.º 4
1
  private void selectItem(int position, int currentPosition) {

    String tag = "";
    switch (position) {
      case POSITION_DISCOVERY:
        mFragment = new MainFragment();
        currentPosition = POSITION_DISCOVERY;
        tag = "discovery";
        break;
    }

    if (mFragment != null) {
      mFragmentManager
          .beginTransaction()
          .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
          .replace(R.id.content_frame, mFragment, tag)
          .commit();
      FragmentTransaction ft = mFragmentManager.beginTransaction();
      ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
      ft.replace(R.id.content_frame, mFragment, tag);
      ft.commit();
      mFragmentManager.executePendingTransactions();
    }
    mDrawerList.setItemChecked(position, true);
    mActivity.setTitle(mDrawerOptions[position]);
    mDrawerLayout.closeDrawer(mDrawerList);
  }
Exemplo n.º 5
1
    @Override
    public void handleMessage(Message msg) {
      Context context = getContext();
      if (context == null) {
        Log.e(TAG, "error handling message, getContext() returned null");
        return;
      }
      switch (msg.arg1) {
        case COMMAND_CHANGE_TITLE:
          if (context instanceof Activity) {
            ((Activity) context).setTitle((String) msg.obj);
          } else {
            Log.e(TAG, "error handling message, getContext() returned no Activity");
          }
          break;
        case COMMAND_TEXTEDIT_HIDE:
          if (mTextEdit != null) {
            mTextEdit.setVisibility(View.GONE);

            InputMethodManager imm =
                (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
          }
          break;

        default:
          if ((context instanceof SDLActivity)
              && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) {
            Log.e(TAG, "error handling message, command is " + msg.arg1);
          }
      }
    }
Exemplo n.º 6
1
          public void handleMessage(Message msg) {
            AddNewShape();
            status = PLAY;
            invalidate();

            String title;
            title = "MemoryPower - " + arShape.size() + " 단계";
            mParent.setTitle(title);
          }
  public void onAttach(Activity activity) {
    super.onAttach(activity);

    activity.setTitle(R.string.app_name);

    lectureList = new LectureListFragment();
    examList = new ExamListFragment();
    examDateList = new ExamDateListFragment();
  }
Exemplo n.º 8
1
 private void showTime() {
   Activity activity = (Activity) this.getContext();
   String title = activity.getTitle().toString();
   int pos = title.indexOf(" - ");
   if (pos >= 0) {
     title = title.substring(0, pos);
   }
   String dyntext = mDynDrawView != null ? (mDynDrawView.getDrawnTime() + "/") : "";
   activity.setTitle(title + " - " + dyntext + mDrawnTime + " ms");
 }
 public void onProgressChanged(WebView webView, int progress) {
   if (!mActivity.isFinishing()) {
     mActivity.setTitle(webView.getTitle());
   }
   if (progress == 100) {
     mProgressBar.setVisibility(View.GONE);
   } else {
     mProgressBar.setVisibility(View.VISIBLE);
     mProgressBar.setProgress(progress);
   }
 }
Exemplo n.º 10
1
  @Override
  public void onPageStarted(WebView view, String url, Bitmap favicon) {
    // TODO Auto-generated method stub

    // 手機程式可以在標題列顯示橫式進度列
    // 平板電腦只能顯示環狀等待迴圈
    //		mActivity.setProgressBarVisibility(true);
    mActivity.setProgressBarIndeterminateVisibility(true);
    mActivity.setTitle("正在下載網頁...");

    mBtnReload.setEnabled(false);
    mBtnStop.setEnabled(true);

    super.onPageStarted(view, url, favicon);
  }
Exemplo n.º 11
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    main = getActivity();
    View rootView = inflater.inflate(R.layout.pager, container, false);
    int siteNumber = getArguments().getInt(ARG_SITE_NUMBER);

    ForecastPagerAdapter mPagerAdapter =
        new ForecastPagerAdapter(main.getFragmentManager(), siteNumber);
    ViewPager mViewPager = (ViewPager) rootView.findViewById(R.id.pager);
    mViewPager.setAdapter(mPagerAdapter);

    String site = SharedPref.getSharedPref(getActivity()).getSiteList()[0][siteNumber];
    main.setTitle(site);
    return rootView;
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    Activity activity = getActivity();
    if (activity == null) {
      return;
    }

    if (Utils.isCurrentLogined()) {
      Toast.makeText(activity, R.string.sign_up_already_login, Toast.LENGTH_LONG).show();
      updateStatus();
    }

    activity.setTitle(R.string.sign_up);
  }
Exemplo n.º 13
0
  @Override
  public void onPageFinished(WebView view, String url) {
    // TODO Auto-generated method stub

    // 平板電腦程式 - 隱藏環狀等待迴圈
    mActivity.setProgressBarIndeterminateVisibility(false);
    mActivity.setTitle(R.string.app_name);
    mBtnReload.setEnabled(true);
    mBtnStop.setEnabled(false);

    if (mWebView.canGoBack()) mBtnGoBack.setEnabled(true);
    else mBtnGoBack.setEnabled(false);

    if (mWebView.canGoForward()) mBtnGoForward.setEnabled(true);
    else mBtnGoForward.setEnabled(false);

    super.onPageFinished(view, url);
  }
Exemplo n.º 14
0
    @Override
    public void handleMessage(Message msg) {
      Context context = getContext();
      if (context == null) {
        Log.e(TAG, "error handling message, getContext() returned null");
        return;
      }
      switch (msg.arg1) {
        case COMMAND_CHANGE_TITLE:
          if (context instanceof Activity) {
            ((Activity) context).setTitle((String) msg.obj);
          } else {
            Log.e(TAG, "error handling message, getContext() returned no Activity");
          }
          break;
        case COMMAND_TEXTEDIT_HIDE:
          if (mTextEdit != null) {
            mTextEdit.setVisibility(View.GONE);

            InputMethodManager imm =
                (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
          }
          break;
        case COMMAND_SET_KEEP_SCREEN_ON:
          {
            Window window = ((Activity) context).getWindow();
            if (window != null) {
              if ((msg.obj instanceof Integer) && (((Integer) msg.obj).intValue() != 0)) {
                window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
              } else {
                window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
              }
            }
            break;
          }
        default:
          if ((context instanceof SDLActivity)
              && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) {
            Log.e(TAG, "error handling message, command is " + msg.arg1);
          }
      }
    }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_collect, container, false);
    mContext = this.getActivity().getApplicationContext();
    dbManager = new ShixiDatabaseManager(mContext);

    listView = (ListView) rootView.findViewById(R.id.collect_list);

    final Activity MainActivity = this.getActivity();
    MainActivity.setTitle("我的收藏");
    listView.setDividerHeight(0);

    items = dbManager.queryMultipleItemsOnline();
    List<ShixiItemInSqlite> collectedList = new ArrayList<ShixiItemInSqlite>();
    for (ShixiItemInSqlite it : items) {
      if (it.getIs_collected() == 1) collectedList.add(it);
    }
    smList = MyUtils.ItemListInSql2MessageList(collectedList);

    mAdapter = new MessageAdapter(mContext, smList);
    listView.setAdapter(mAdapter);

    listView.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {

            System.out.println("DIANJI");
            Intent intent = new Intent();
            intent.setClass(MainActivity, DetailActivity.class);
            Bundle bundle = new Bundle();
            bundle.putInt("item_id", smList.get(arg2).getMessage_id());
            intent.putExtras(bundle);
            startActivity(intent);
          }
        });

    // setListView(items);

    return rootView;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_uevent_detail);

    // Show the Up button in the action bar.
    getActionBar().setDisplayHomeAsUpEnabled(true);

    // savedInstanceState is non-null when there is fragment state
    // saved from previous configurations of this activity
    // (e.g. when rotating the screen from portrait to landscape).
    // In this case, the fragment will automatically be re-added
    // to its container so we don't need to manually add it.
    // For more information, see the Fragments API guide at:
    //
    // http://developer.android.com/guide/components/fragments.html
    //
    if (savedInstanceState == null) {
      // Create the detail fragment and add it to the activity
      // using a fragment transaction.
      Bundle arguments = new Bundle();
      arguments.putString(
          uEventDetailFragment.ARG_ITEM_ID,
          getIntent().getStringExtra(uEventDetailFragment.ARG_ITEM_ID));

      uEventDetailFragment fragment = new uEventDetailFragment();
      fragment.setArguments(arguments);
      getSupportFragmentManager()
          .beginTransaction()
          .add(R.id.uevent_detail_container, fragment)
          .commit();
      ///////////////////////////////////////////////////////////////////////////////////////////////////////////
      String cityname =
          DummyContent.ITEM_MAP.get(getIntent().getStringExtra(uEventDetailFragment.ARG_ITEM_ID))
              .city;
      Activity test = (Activity) this;
      test.setTitle(cityname);
      ///////////////////////////////////////////////////////////////////////////////////////////////////////////
    }
  }
  @SuppressWarnings("deprecation")
  public CafeteriaDetailsSectionsPagerAdapter(
      Activity mainActivity, FragmentManager fm, String cafeteriaId, String cafeteriaName) {
    super(fm);
    this.activity = mainActivity;
    this.cafeteriaId = cafeteriaId;
    this.cafeteriaName = cafeteriaName;

    // get all (distinct) dates having menus available
    CafeteriaMenuManager cmm = new CafeteriaMenuManager(activity);
    cursorCafeteriaDates = cmm.getDatesFromDb();
    activity.startManagingCursor(cursorCafeteriaDates);

    mainActivity.setTitle(cafeteriaName);

    for (int position = 0; position < getCount(); position++) {
      cursorCafeteriaDates.moveToPosition(position);
      dates.add(
          cursorCafeteriaDates.getString(cursorCafeteriaDates.getColumnIndex(Const.ID_COLUMN)));
    }

    // reset new items counter
    CafeteriaMenuManager.lastInserted = 0;
  }
  @SuppressLint("NewApi")
  @Override
  protected void onPostExecute(JSONObject jsonO) {
    super.onPostExecute(null);
    profUser.setInitData(jsonO);
    Log.i("Task", "Open Others Profile,...");
    if (!HttpConnections.goToLoginIfneed()) {
      activity.setTitle(profUser.getName() + "' Profile");
      OthersProfileFragment fragment = new OthersProfileFragment();
      fragment.setProfileData(profUser);

      activity
          .getFragmentManager()
          .beginTransaction()
          .addToBackStack("otherProfile")
          .replace(R.id.content_frame, fragment)
          .commit();
      activity.findViewById(R.id.loading).setVisibility(View.GONE);
      activity.findViewById(R.id.content_frame).setVisibility(View.VISIBLE);

      new GetFollowsAsyncTaskProfile(profUser, activity, fragment).execute();
      new GetFollowedAsyncTaskProfile(profUser, activity, fragment).execute();
    }
  }
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   activity.setTitle(R.drawable.search_title);
 }
Exemplo n.º 20
0
 @Override
 public void setTitle(CharSequence title) {
   super.setTitle(getString(R.string.menu_title_login));
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_banda);

    final Button bt2 = (Button) findViewById(R.id.button2);
    final Button bt3 = (Button) findViewById(R.id.button3);

    bt2.setVisibility(View.GONE);
    bt3.setVisibility(View.GONE);

    inicio = Calendar.getInstance();
    fin = Calendar.getInstance();

    bundle = getIntent().getExtras();

    TextView dia = (TextView) findViewById(R.id.dia);
    TextView horario = (TextView) findViewById(R.id.horario);
    TextView escenario = (TextView) findViewById(R.id.escenario);

    TextView ritmo = (TextView) findViewById(R.id.ritmo);
    TextView info = (TextView) findViewById(R.id.info);
    TextView mas = (TextView) findViewById(R.id.mas);

    values = getResources().getStringArray(R.array.bandasSabado);

    String nombreBanda = values[Integer.parseInt(bundle.getString("pos"))];
    String[] s_values = nombreBanda.split("\\|");
    name = s_values[0].toString();

    int res = db.getBanda(name);
    if (res > 0) {
      bt3.setVisibility(View.VISIBLE);
    } else {
      bt2.setVisibility(View.VISIBLE);
    }

    super.setTitle(name);
    dia.setText(s_values[1].toString());
    horario.setText(s_values[2].toString() + "-" + s_values[3].toString());
    escenario.setText(s_values[4].toString());
    ritmo.setText(s_values[5].toString());
    info.setText(s_values[6].toString());
    mas.setText(s_values[7].toString());

    txt_escenario = "Escenario: " + s_values[4].toString();
    place = s_values[4].toString();
    String start = s_values[2].toString();
    String end = s_values[3].toString();
    String[] array_start = start.split("\\:");
    String[] array_end = end.split("\\:");
    diaB = s_values[1].toString();
    schedule = s_values[2].toString() + "-" + s_values[3].toString();

    inicio.set(
        2013,
        2,
        16,
        Integer.parseInt(array_start[0].toString()),
        Integer.parseInt(array_start[1].toString()));
    fin.set(
        2013,
        2,
        16,
        Integer.parseInt(array_end[0].toString()),
        Integer.parseInt(array_end[1].toString()));

    Button bt = (Button) findViewById(R.id.button1);
    bt.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View arg0) {
            ContentResolver cr = getContentResolver();
            ContentValues values = new ContentValues();
            values.put(Events.DTSTART, inicio.getTimeInMillis());
            values.put(Events.DTEND, fin.getTimeInMillis());
            values.put(Events.TITLE, name);
            values.put(Events.DESCRIPTION, "Presentación de " + name + " en el festival VL 2013.");
            values.put(Events.CALENDAR_ID, 1);
            values.put(Events.EVENT_TIMEZONE, Time.getCurrentTimezone());
            values.put(Events.EVENT_LOCATION, txt_escenario);
            values.put(Events.ALL_DAY, false);
            values.put(Events.STATUS, 1);
            values.put(Events.HAS_ALARM, 1);
            Uri uri = cr.insert(Events.CONTENT_URI, values);

            values = new ContentValues();
            values.put("event_id", Long.parseLong(uri.getLastPathSegment()));
            values.put("method", 4);
            values.put("minutes", 15);
            cr.insert(Reminders.CONTENT_URI, values);

            Toast.makeText(
                    getApplicationContext(),
                    "Recordatorio agregado correctamente.",
                    Toast.LENGTH_LONG)
                .show();
          }
        });

    bt2.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View arg0) {
            db.addBanda(new Banda(name, diaB, schedule, place));
            Toast.makeText(
                    getApplicationContext(), "Banda agregada correctamente.", Toast.LENGTH_LONG)
                .show();
            bt2.setVisibility(View.GONE);
            bt3.setVisibility(View.VISIBLE);
          }
        });

    bt3.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View arg0) {
            db.borraBanda(new Banda(name, diaB, schedule, place));
            Toast.makeText(
                    getApplicationContext(), "Banda borrada correctamente.", Toast.LENGTH_LONG)
                .show();
            bt3.setVisibility(View.GONE);
            bt2.setVisibility(View.VISIBLE);
          }
        });
  }
Exemplo n.º 22
0
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   activity.setTitle(R.string.scan);
 }
Exemplo n.º 23
0
  public static void displayDatabaseError(Activity a) {
    if (a.isFinishing()) {
      // When switching tabs really fast, we can end up with a null
      // cursor (not sure why), which will bring us here.
      // Don't bother showing an error message in that case.
      return;
    }

    String status = Environment.getExternalStorageState();
    int title, message;

    if (android.os.Environment.isExternalStorageRemovable()) {
      title = R.string.sdcard_error_title;
      message = R.string.sdcard_error_message;
    } else {
      title = R.string.sdcard_error_title_nosdcard;
      message = R.string.sdcard_error_message_nosdcard;
    }

    if (status.equals(Environment.MEDIA_SHARED) || status.equals(Environment.MEDIA_UNMOUNTED)) {
      if (android.os.Environment.isExternalStorageRemovable()) {
        title = R.string.sdcard_busy_title;
        message = R.string.sdcard_busy_message;
      } else {
        title = R.string.sdcard_busy_title_nosdcard;
        message = R.string.sdcard_busy_message_nosdcard;
      }
    } else if (status.equals(Environment.MEDIA_REMOVED)) {
      if (android.os.Environment.isExternalStorageRemovable()) {
        title = R.string.sdcard_missing_title;
        message = R.string.sdcard_missing_message;
      } else {
        title = R.string.sdcard_missing_title_nosdcard;
        message = R.string.sdcard_missing_message_nosdcard;
      }
    } else if (status.equals(Environment.MEDIA_MOUNTED)) {
      // The card is mounted, but we didn't get a valid cursor.
      // This probably means the mediascanner hasn't started scanning the
      // card yet (there is a small window of time during boot where this
      // will happen).
      a.setTitle("");
      Intent intent = new Intent();
      intent.setClass(a, ScanningProgress.class);
      a.startActivityForResult(intent, Defs.SCAN_DONE);
    } else if (!TextUtils.equals(mLastSdStatus, status)) {
      mLastSdStatus = status;
      Log.d(TAG, "sd card: " + status);
    }

    a.setTitle(title);
    View v = a.findViewById(R.id.sd_message);
    if (v != null) {
      v.setVisibility(View.VISIBLE);
    }
    v = a.findViewById(R.id.sd_icon);
    if (v != null) {
      v.setVisibility(View.VISIBLE);
    }
    v = a.findViewById(android.R.id.list);
    if (v != null) {
      v.setVisibility(View.GONE);
    }
    v = a.findViewById(R.id.buttonbar);
    if (v != null) {
      v.setVisibility(View.GONE);
    }
    TextView tv = (TextView) a.findViewById(R.id.sd_message);
    tv.setText(message);
  }
Exemplo n.º 24
0
 public void updateTitle() {
   m_Activity.setTitle("andRoc " + m_RocrailService.m_Model.m_Title);
 }
Exemplo n.º 25
0
 public void updateTitle(String title) {
   m_Activity.setTitle("andRoc " + title);
 }
Exemplo n.º 26
0
 @Override
 // 设置应用程序的标题title
 public void onReceivedTitle(WebView view, String title) {
   activity.setTitle(title);
   super.onReceivedTitle(view, title);
 }