Beispiel #1
1
  private void setupHistoryRow(View view, History history, User user) {
    final AsyncImageView pictureView = (AsyncImageView) view.findViewById(R.id.picture);
    {
      if (user.containsNonNullValue(USER_PICTURE)) {
        String pictureUrl = user.getPictureUrl(USER_PICTURE, RemoteModel.PICTURE_THUMB);
        pictureView.setUrl(pictureUrl);
      } else {
        pictureView.setUrl(null);
      }
      pictureView.setVisibility(View.VISIBLE);
    }

    final AsyncImageView commentPictureView =
        (AsyncImageView) view.findViewById(R.id.comment_picture);
    commentPictureView.setVisibility(View.GONE);

    final TextView nameView = (TextView) view.findViewById(R.id.title);
    {
      nameView.setText(
          getHistoryComment(
              (AstridActivity) fragment.getActivity(), history, user, linkColor, fromView));
      nameView.setTextColor(grayColor);
    }

    final TextView date = (TextView) view.findViewById(R.id.date);
    {
      CharSequence dateString =
          DateUtils.getRelativeTimeSpanString(
              history.getValue(History.CREATED_AT),
              DateUtilities.now(),
              DateUtils.MINUTE_IN_MILLIS,
              DateUtils.FORMAT_ABBREV_RELATIVE);
      date.setText(dateString);
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    final View view = inflater.inflate(R.layout.carbon_cycle_view, container, false);

    TextView diagramTxt = (TextView) view.findViewById(R.id.txt_diagram);
    TextView savedScoreTxt = (TextView) view.findViewById(R.id.score_saved);

    Button startBtn = (Button) view.findViewById(R.id.go_diagram_btn);

    diagramTxt.setTypeface(tfThin);
    startBtn.setTypeface(tfThin);
    savedScoreTxt.setText((int) ((score / GAME_SCORE) * 100) + "% Sucess");

    startBtn.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {

            Intent carbonIntent = new Intent(getActivity(), DiagramPlayCarbonCycle.class);
            carbonIntent.putExtra("SOURCE", "Fragment");
            carbonIntent.putExtra("TRY_CYCLE", 0);
            carbonIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            carbonIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            carbonIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            startActivity(carbonIntent);
          }
        });

    return view;
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Button btn = (Button) findViewById(R.id.btn_share);
    btn.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("text/plain");
            intent.putExtra(Intent.EXTRA_TEXT, "Test");
            startActivity(Intent.createChooser(intent, "¤À¨É"));
          }
        });

    TextView tv_msg = (TextView) findViewById(R.id.tv_message);
    Intent intent = getIntent();
    Log.d("LINCYU", "ACTION: " + intent.getAction());
    if (intent.getAction().equals(Intent.ACTION_SEND)) {

      tv_msg.setText(intent.getStringExtra(Intent.EXTRA_TEXT));
    }
  }
 protected void onStart() {
   super.onStart();
   this.a.updateHeader(
       "No current file!",
       R.string.pref_hardware_config_filename,
       R.id.active_filename,
       R.id.included_header);
   Intent intent = this.getIntent();
   Serializable serializable =
       intent.getSerializableExtra("Edit Servo ControllerConfiguration Activity");
   if (serializable != null) {
     this.b = (ServoControllerConfiguration) serializable;
     this.c = (ArrayList) this.b.getServos();
   }
   this.d.setText((CharSequence) this.b.getName());
   TextView textView = (TextView) this.findViewById(R.id.servo_controller_serialNumber);
   String string = this.b.getSerialNumber().toString();
   if (string.equalsIgnoreCase(ControllerConfiguration.NO_SERIAL_NUMBER.toString())) {
     string = "No serial number";
   }
   textView.setText((CharSequence) string);
   for (int i = 0; i < this.c.size(); ++i) {
     this.c(i + 1);
     this.a(i + 1);
     this.b(i + 1);
   }
 }
Beispiel #5
1
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    View v = convertView;

    if (v == null) {
      LayoutInflater vi;
      vi = LayoutInflater.from(getContext());
      v = vi.inflate(R.layout.itemlayout, null);
    }

    Item p = getItem(position);

    if (p != null) {
      TextView tt1 = (TextView) v.findViewById(R.id.name);
      TextView tt2 = (TextView) v.findViewById(R.id.content);

      if (tt1 != null) {
        tt1.setText(p.name);
      }

      if (tt2 != null) {
        tt2.setText(p.content);
      }
    }

    return v;
  }
  @Override
  public void onLocationChanged(Location location) {
    double lati, longi;
    lati = location.getLatitude();
    longi = location.getLongitude();

    textLati.setText(lati + "");
    textLong.setText(longi + "");
    String url =
        "https://www.google.co.in/maps/@"
            + textLati.getText().toString()
            + ","
            + textLong.getText().toString()
            + ",15z?hl=en";

    Toast.makeText(MainActivity.this, "hiiiiii", Toast.LENGTH_LONG).show();

    try {
      FileWriter writer = new FileWriter(filePath, false);
      writer.write(url);
      writer.flush();
      writer.close();

    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
 public void onRadioButtonClicked(View v) {
   if (v.getId() == R.id.group_closed_radio) {
     groupLogo.setImageResource(R.drawable.group_closed);
     groupLogo.setBackgroundColor(R.color.color_primary);
     groupTypeDescr.setText(R.string.group_closed_description);
     Log.e(
         TAG,
         "Cliccato: "
             + v.getId()
             + "! Setto: "
             + R.drawable.group_closed
             + ", "
             + R.color.color_primary
             + ", "
             + R.string.group_closed_description);
   } else if (v.getId() == R.id.group_open_radio) {
     groupLogo.setImageResource(R.drawable.group_open);
     groupLogo.setBackgroundColor(R.color.color_primary);
     groupTypeDescr.setText(R.string.group_open_description);
     Log.e(
         TAG,
         "Cliccato: "
             + v.getId()
             + "! Setto: "
             + R.drawable.group_open
             + ", "
             + R.color.color_primary
             + ", "
             + R.string.group_open_description);
   }
 }
  public void updateUI(boolean isSignedIn) {
    if (isSignedIn) {

      getActionBar().setTitle("My Profile");

      logo.setVisibility(View.GONE);
      header.setVisibility(View.GONE);
      title.setVisibility(View.GONE);
      // loginTwitter.setVisibility(View.GONE);
      btnLoginTwitter.setVisibility(View.GONE);
      btnSignIn.setVisibility(View.GONE);
      loginNormal.setVisibility(View.GONE);
      authButton.setVisibility(View.GONE);

      btnSignOut.setVisibility(View.GONE);
      btnRevokeAccess.setVisibility(View.VISIBLE);
      btnProceed.setVisibility(View.VISIBLE);
      llProfileLayout.setVisibility(View.VISIBLE);
    } else {
      logo.setVisibility(View.VISIBLE);
      header.setVisibility(View.VISIBLE);
      title.setVisibility(View.VISIBLE);
      // loginTwitter.setVisibility(View.VISIBLE);
      btnLoginTwitter.setVisibility(View.VISIBLE);
      btnSignIn.setVisibility(View.VISIBLE);
      loginNormal.setVisibility(View.VISIBLE);
      authButton.setVisibility(View.VISIBLE);

      btnSignOut.setVisibility(View.GONE);
      btnRevokeAccess.setVisibility(View.GONE);
      btnProceed.setVisibility(View.GONE);
      llProfileLayout.setVisibility(View.GONE);
    }
  }
  public void addRow(View view) {

    EditText editText = (EditText) _popPopupWindow.getContentView().findViewById(R.id.skillInput);

    if (!_newsTopics.contains(editText.getText().toString())) {
      LinearLayout linear = (LinearLayout) findViewById(R.id.LinearLayout1);

      LayoutInflater inflater =
          (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View rowView = (View) inflater.inflate(R.layout.row, null, false);

      TextView skillName = (TextView) rowView.findViewById(R.id.skillName);
      skillName.setText(editText.getText().toString());
      final Context mainActivity = this;

      rowView.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              Intent intent = new Intent(mainActivity, NewsActivity.class);

              TextView skillName = (TextView) v.findViewById(R.id.skillName);
              intent.putExtra(SKILL_NAME, skillName.getText().toString());
              startActivity(intent);
            }
          });

      linear.addView(rowView);
      linear.addView(getHorSep());
    }

    _popPopupWindow.dismiss();
    _popPopupWindow = null;
  }
 @Nullable
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   // Bind view with id
   View view = inflater.inflate(R.layout.detail_movie_fragment, container, false);
   titleView = (TextView) view.findViewById(R.id.title);
   releaseYearView = (TextView) view.findViewById(R.id.release_year);
   scoreView = (TextView) view.findViewById(R.id.score);
   overviewView = (TextView) view.findViewById(R.id.overview);
   imagePoster = (ImageView) view.findViewById(R.id.image);
   insertTrailerPoint = (ViewGroup) view.findViewById(R.id.insert_trailer_point);
   insertReviewPoint = (ViewGroup) view.findViewById(R.id.insert_review_point);
   trailerVideo = new ArrayList<>();
   reviewsList = new ArrayList<>();
   // Parse json movie from intent extra
   Gson gson = new Gson();
   String jsonMovie = getArguments().getString("movie");
   Movie movie = gson.fromJson(jsonMovie, Movie.class);
   // Set text and source picture.
   titleView.setText(movie.getTitle());
   releaseYearView.setText(movie.getRelease_date());
   scoreView.setText(movie.getscore() + "/10");
   String url = "http://image.tmdb.org/t/p/w185/" + movie.getimage_path();
   Picasso.with(getActivity()).load(url).into(imagePoster);
   overviewView.setText(movie.getOverview());
   // Start new thread
   FetchTrailerTask task = new FetchTrailerTask();
   task.execute(movie.getId());
   return view;
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    LayoutInflater vi;
    vi = LayoutInflater.from(mContext);
    v = vi.inflate(R.layout.categories_listview_items, null);
    Category c = getItem(position);

    if (c != null) {

      TextView name = (TextView) v.findViewById(R.id.categories_listview_items_name);
      ImageView icon = (ImageView) v.findViewById(R.id.categories_listview_items_icon);

      if (name != null) {

        name.setTypeface(typeface);
        name.setText(c.getName());
      }
      if (icon != null)
        icon.setImageResource(
            mContext
                .getResources()
                .getIdentifier(c.getIconFileName(), "drawable", mContext.getPackageName()));
    }

    return v;
  }
  public void setData(CalendarItem item) {
    mItem = item;
    float textsize = IN_MONTH_TEXT_SIZE_SP;
    int textColor = NUMBER_COLOR;
    if (!item.inMonth) {
      textsize = OUT_MONTH_TEXT_SIZE_SP;
      textColor = OUT_MONTH_TEXT_COLOR;
    } else {
      textsize = IN_MONTH_TEXT_SIZE_SP;
      switch (item.dayOfWeek) {
        case Calendar.SUNDAY:
          textColor = SUN_COLOR;
          break;
        case Calendar.SATURDAY:
          textColor = SAT_COLOR;
          break;
        default:
          textColor = NUMBER_COLOR;
          break;
      }
    }
    numberView.setTextSize(TypedValue.COMPLEX_UNIT_SP, textsize);
    numberView.setTextColor(textColor);
    numberView.setText("" + item.dayOfMonth);
    // contentView setting

    ArrayList items = item.items;
    int size = items.size();
    StringBuilder sb = new StringBuilder();
    sb.append("o");
    contentView.setText(sb.toString());
  }
Beispiel #13
0
  private static void AddTab(
      Activity_Tab activity,
      TabHost tabHost,
      TabHost.TabSpec tabSpec,
      TabInfo tabInfo,
      String label,
      int drawable) {
    tabSpec.setContent(activity.new TabFactory(activity));

    View tabIndicator =
        LayoutInflater.from(activity)
            .inflate(R.layout.tab_indicator, tabHost.getTabWidget(), false);
    TextView txtTitle = (TextView) tabIndicator.findViewById(R.id.title);
    ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);

    txtTitle.setText(label);
    txtTitle.setTextSize(
        Float.parseFloat(activity.getResources().getString(R.string.size_pointer)));
    txtTitle.setTypeface(StaticUtils.getTypeface(activity, Font.THSarabanNew));
    icon.setImageResource(drawable);

    tabSpec.setIndicator(tabIndicator);

    tabHost.addTab(tabSpec);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.info_layout);

    TextView devEmail, devName;

    devEmail = (TextView) findViewById(R.id.devEmail);
    devName = (TextView) findViewById(R.id.devName);

    OnClickListener listener =
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("text/html");
            intent.putExtra(Intent.EXTRA_EMAIL, "*****@*****.**");
            intent.putExtra(Intent.EXTRA_SUBJECT, "PAA-SP");

            startActivity(
                Intent.createChooser(intent, getResources().getString(R.string.send_email)));
          }
        };

    devEmail.setOnClickListener(listener);
    devName.setOnClickListener(listener);
  }
Beispiel #15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.photo_gallery_activity);

    Button galleryButton = (Button) findViewById(R.id.gallary_button);

    headerText1 = (TextView) findViewById(R.id.header_text_1);
    headerText2 = (TextView) findViewById(R.id.header_text_2);
    footerText1 = (TextView) findViewById(R.id.footer_text_1);
    footerText2 = (TextView) findViewById(R.id.footer_text_2);
    setupStatusBar();
    Typeface myTypeface = Typeface.createFromAsset(getAssets(), "fonts/keepclam.ttf");
    headerText1.setTypeface(myTypeface);
    headerText2.setTypeface(myTypeface);
    footerText1.setTypeface(myTypeface);
    footerText2.setTypeface(myTypeface);
    galleryButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.v("PhotoActivity", "Clicked Gallery");
            startActivityForResult(
                new Intent(
                    Intent.ACTION_PICK,
                    android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI),
                GET_FROM_GALLERY);
          }
        });
  }
  /**
   * Add notification (e.g., validation error) to this question.
   *
   * @param text Text of message.
   * @param strong If true, display a visually stronger, negative background.
   * @param requestFocus If true, bring focus to this question.
   */
  public void notifyOnScreen(String text, boolean strong, boolean requestFocus) {
    if (strong) {
      this.setBackgroundDrawable(
          this.getContext().getResources().getDrawable(R.drawable.bubble_invalid));
    } else {
      this.setBackgroundDrawable(
          this.getContext().getResources().getDrawable(R.drawable.bubble_warn));
    }

    if (this.toastView == null) {
      this.toastView =
          View.inflate(this.getContext(), R.layout.toast_view, this)
              .findViewById(R.id.toast_view_root);
      focusPending = requestFocus;
    } else {
      if (this.toastView.getVisibility() != View.VISIBLE) {
        this.toastView.setVisibility(View.VISIBLE);
        focusPending = requestFocus;
      }
    }
    TextView messageView = (TextView) this.toastView.findViewById(R.id.message);
    messageView.setText(text);

    // If the toastView already exists, we can just scroll to it right now
    // if not, we actually have to do it later, when we lay this all back out
    if (!focusPending && requestFocus) {
      requestChildViewOnScreen(messageView);
    }
  }
  public void showIssue(final String issue) {
    LayoutInflater inflate =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflate.inflate(R.layout.touzhu_succe, null);
    final AlertDialog dialog = new AlertDialog.Builder(context).create();
    TextView textContent = (TextView) view.findViewById(R.id.touzhu_succe_text);
    Button ok = (Button) view.findViewById(R.id.touzhu_succe_button_sure);
    Button cancel = (Button) view.findViewById(R.id.touzhu_succe_button_share);
    ok.setBackgroundResource(R.drawable.loginselecter);
    cancel.setBackgroundResource(R.drawable.loginselecter);
    ok.setText(context.getString(R.string.dialog_issue_text_ok));
    cancel.setText(context.getString(R.string.dialog_issue_text_cancel));
    textContent.setText(context.getString(R.string.dialog_issue_text_content) + issue + "期。");
    ok.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            dialog.cancel();
            touzhuIssue(issue);
          }
        });
    cancel.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            dialog.cancel();
            finish();
          }
        });

    dialog.show();
    dialog.getWindow().setContentView(view);
  }
  /**
   * Method for registering the user based on credentials placed into EditText views.
   *
   * @param view The view housing the EditTexts for simplicity.
   */
  private void registerUser(View view) {
    // ensure view isnt null
    if (view != null) {
      // retrieve the values within the edit texts
      // final TextView errorText = (TextView) view.findViewById(R.id.register_error_label);
      final EditText usernameField = (EditText) view.findViewById(R.id.register_username);
      final EditText password = (EditText) view.findViewById(R.id.register_password);
      final EditText passwordCheck = (EditText) view.findViewById(R.id.register_password_redo);

      String username = usernameField.getText().toString();
      String pwd = password.getText().toString();
      String pwdCheck = passwordCheck.getText().toString();

      // Ensure the fields are not empty and the passwords match
      if (username.length() != 0 && pwd.length() != 0 && pwd.equals(pwdCheck)) {
        // hash the password to increase security a bit
        String pwdHash = String.valueOf(password.getText().toString().hashCode());
        String regUrl = url;
        regUrl += "?username="******"&password="******"Attempting to Register Account!");
        new AddUserWebTask().execute(regUrl);
      }

      // a field is empty
      if (username.length() == 0 || pwd.length() == 0 || pwdCheck.length() == 0) {
        errorText.setText("Error: Cannot leave a field blank!");
      }

      // passwords do not match
      if (!pwd.equals(pwdCheck)) {
        errorText.setText("Error: Passwords do not match!");
      }
    }
  }
  public void RefreshTotalChecked(
      TextView totalCheckedTextView, TextView tvName, LinearLayout layout, int position) {
    ShoppingList shoppingList = shoppingLists.get(position);
    String text =
        DataManager.shoppingListGetChecked(shoppingList) + "/" + shoppingList.getItems().size();
    totalCheckedTextView.setText(text);

    boolean shoppingListIsChecked = DataManager.shoppingListIsChecked(shoppingList);
    if (shoppingListIsChecked) {
      DataManager.setShoppingListIsChecked(shoppingList, true);
      layout
          .getBackground()
          .setColorFilter(
              context.getResources().getColor(R.color.itemListBackgroundChecked),
              PorterDuff.Mode.MULTIPLY);
      tvName.setPaintFlags(tvName.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    } else {
      DataManager.setShoppingListIsChecked(shoppingList, false);
      layout
          .getBackground()
          .setColorFilter(
              context.getResources().getColor(R.color.itemListBackground),
              PorterDuff.Mode.MULTIPLY);
      tvName.setPaintFlags(tvName.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
    }
  }
  /** 自定义归属地浮窗 */
  private void showToast(String string) {
    windowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);

    WindowManager.LayoutParams params = new WindowManager.LayoutParams();
    params.height = WindowManager.LayoutParams.WRAP_CONTENT;
    params.width = WindowManager.LayoutParams.WRAP_CONTENT;
    params.flags =
        WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
            | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
            | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
    params.format = PixelFormat.TRANSLUCENT;
    params.type = WindowManager.LayoutParams.TYPE_TOAST;
    params.setTitle("Toast");

    view = View.inflate(this, R.layout.toast_layout, null);

    int[] bgs =
        new int[] {
          R.drawable.call_locate_white,
          R.drawable.call_locate_orange,
          R.drawable.call_locate_blue,
          R.drawable.call_locate_gray,
          R.drawable.call_locate_green
        };
    int style = getSharedPreferences("config", MODE_PRIVATE).getInt("address_style", 0);
    TextView textView = (TextView) view.findViewById(R.id.tv_number);
    view.setBackgroundResource(bgs[style]);
    textView.setText(string);
    windowManager.addView(view, params);
  }
    public View getView(int position, View convertView, ViewGroup parent) {

      View v = convertView;

      if (v == null) {
        LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = vi.inflate(R.layout.purchaselistrow, null);
      }
      PurchaseHistoryEntity watchListAllEntity = items.get(position);

      if (watchListAllEntity != null) {
        // TextView nt = (TextView)
        // v.findViewById(R.id.fileNameTextView);
        TextView tv1 = (TextView) v.findViewById(R.id.tvProductInfo1);
        TextView tv2 = (TextView) v.findViewById(R.id.tvProductInfo2);
        TextView tv3 = (TextView) v.findViewById(R.id.tvProductInfo3);
        TextView tv4 = (TextView) v.findViewById(R.id.tvProductInfo4);
        TextView tv5 = (TextView) v.findViewById(R.id.tvProductInfo5);

        /*STATUS
        注文日 (order date)
        納品日 (delivery date)
        依頼枚数(no. of request)
        納品枚数(no. of delivery)*/

        tv1.setText("STATUS: " + watchListAllEntity.get_status_ja());
        tv2.setText("注文日: " + watchListAllEntity.get_order_created_at());
        tv3.setText("納品日: " + watchListAllEntity.get_order_created_at());
        tv4.setText("依頼枚数: " + watchListAllEntity.get_order_amount());
        tv5.setText("納品枚数: " + watchListAllEntity.get_order_amount());
      }

      return v;
    }
Beispiel #22
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.chase_activity_result);
   playerData =
       (PlayerData)
           this.getIntent()
               .getExtras()
               .getSerializable(GameSettings.CHASE_GAME_PLAYER_TO_RESULT_TAG);
   gameData =
       (GameData)
           this.getIntent().getExtras().getSerializable(GameSettings.CHASE_GAME_TO_RESULT_TAG);
   new ToolbarSetter(this);
   try {
     Results.setForChase(gameData, playerData);
   } catch (RestException e) {
     e.printStackTrace();
     e.getErrorAlert(this).show();
   }
   TextView result = (TextView) findViewById(R.id.resultsTextView);
   if (gameData.getChases().get(playerData.getUserID()).getStatus().equals(ChaseStatus.DEAD)) {
     result.setText("You LOSE!\n You're character is dead");
   } else {
     result.setText("You WIN!\n Hunter didn't catch you!");
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xff359AC4));

    TextView textView_id = (TextView) findViewById(R.id.profile_id);
    TextView textView_pw = (TextView) findViewById(R.id.profile_pw);

    Intent intent_main = getIntent();

    String id = intent_main.getStringExtra("id");
    String pw = intent_main.getStringExtra("password");

    textView_id.setText(String.valueOf(id));
    textView_pw.setText(String.valueOf(pw));

    mNavigationDrawerFragment =
        (NavigationDrawerFragment)
            getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
    mTitle = getTitle();

    // Set up the drawer.
    mNavigationDrawerFragment.setUp(
        R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));
  }
  private void populateTabStrip() {
    final PagerAdapter adapter = mViewPager.getAdapter();
    final View.OnClickListener tabClickListener = new TabClickListener();

    for (int i = 0; i < adapter.getCount(); i++) {
      View tabView = null;
      TextView tabTitleView = null;

      if (mTabViewLayoutId != 0) {
        // If there is a custom tab view layout id set, try and inflate it
        tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false);
        tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
      }

      if (tabView == null) {
        tabView = createDefaultTabView(getContext());
      }

      if (tabTitleView == null && TextView.class.isInstance(tabView)) {
        tabTitleView = (TextView) tabView;
      }

      tabTitleView.setText(adapter.getPageTitle(i));
      tabView.setOnClickListener(tabClickListener);

      mTabStrip.addView(tabView);
    }
  }
 public void addTrailerView() {
   LayoutInflater vi =
       (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   Log.d("vi", "Null " + Boolean.toString(vi == null));
   for (int i = 0; i < trailerVideo.size(); i++) {
     View trailerView = vi.inflate(R.layout.trailer_view, null);
     final TextView trailerTitleView = (TextView) trailerView.findViewById(R.id.trailer_title);
     trailerTitleView.setText(trailerVideo.get(i).getName());
     ImageButton imageButton = (ImageButton) trailerView.findViewById(R.id.trailer_play_button);
     final String source = trailerVideo.get(i).getSource();
     imageButton.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + source));
             startActivity(intent);
           }
         });
     insertTrailerPoint.addView(
         trailerView,
         0,
         new ViewGroup.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
   }
 }
  private void updateView() {
    ImApp app = ImApp.getApplication((Activity) mContext);
    BrandingResources brandingRes = app.getBrandingResource(mProviderId);
    int status = PresenceUtils.convertStatus(mPresence.getStatus());
    mStatusDialogButton.setImageDrawable(
        brandingRes.getDrawable(PresenceUtils.getStatusIconId(status)));

    String statusText = mPresence.getStatusText();
    if (TextUtils.isEmpty(statusText)) {
      statusText = brandingRes.getString(PresenceUtils.getStatusStringRes(status));
    }
    mLastStatusText = statusText;

    if (mStatusBar == null) {
      mStatusBar = initStatusBar(mProviderId, false);
    }
    mStatusBar.setText(statusText);

    // Disable the user to edit the custom status text because
    // the AIM and MSN server don't support it now.
    ProviderDef provider = app.getProvider(mProviderId);
    String providerName = provider == null ? null : provider.mName;
    if (Imps.ProviderNames.AIM.equals(providerName)
        || Imps.ProviderNames.MSN.equals(providerName)) {
      mStatusBar.setFocusable(false);
    }
  }
Beispiel #27
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   convertView = getLayoutInflater().inflate(R.layout.activity_drower_item, null);
   TextView textView = (TextView) convertView.findViewById(R.id.tv_home);
   textView.setText(list.get(position));
   return convertView;
 }
  private void setupViewObjects(User user) {
    ivCoverPic = (ImageView) mFragmentView.findViewById(R.id.ivCoverPic);
    ivProfilePic = (ImageView) mFragmentView.findViewById(R.id.ivProfilePic);
    TextView tvProfileName = (TextView) mFragmentView.findViewById(R.id.tvProfileName);
    TextView tvProfileLocation = (TextView) mFragmentView.findViewById(R.id.tvProfileLocation);

    Picasso.with(getContext())
        .load(
            "https://graph.facebook.com/"
                + user.getAuthId()
                + "/picture?width="
                + String.valueOf(getContext().getResources().getDisplayMetrics().widthPixels))
        .into(ivProfilePic /*new Target() {
                    @Override
                    public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                        src = bitmap;
                        Resources res = getResources();
                        RoundedBitmapDrawable dr =
                                RoundedBitmapDrawableFactory.create(res, src);
                        dr.setCornerRadius(500f);
                        ivProfilePic.setImageDrawable(dr);
                    }

                    @Override
                    public void onBitmapFailed(Drawable errorDrawable) {

                    }

                    @Override
                    public void onPrepareLoad(Drawable placeHolderDrawable) {

                    }
                }*/);

    GraphRequest request =
        GraphRequest.newMeRequest(
            AccessToken.getCurrentAccessToken(),
            new GraphRequest.GraphJSONObjectCallback() {

              @Override
              public void onCompleted(JSONObject ret, GraphResponse graphResponse) {
                JSONObject cover = null;
                String url = null;
                try {
                  cover = ret.getJSONObject("cover");
                  url = cover.getString("source");
                } catch (JSONException e) {
                  e.printStackTrace();
                }
                Picasso.with(getContext()).load(url).into(ivCoverPic);
              }
            });

    Bundle parameters = new Bundle();
    parameters.putString("fields", "cover");
    request.setParameters(parameters);
    request.executeAsync();

    tvProfileName.setText(user.getName());
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_stories_view, container, false);
    getActivity().setTitle(getResources().getString(R.string.title_activity_news_home_screen));

    swipeLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
    swipeLayout.setOnRefreshListener(this);

    TextView noTopicsText = (TextView) rootView.findViewById(R.id.no_topics_textview);
    user = ValuesAndUtil.getInstance().loadUserData(getActivity().getApplicationContext());

    boolean hasTopics = false;
    try {
      hasTopics = user.has("topics") && user.getJSONArray("topics").length() > 0;
    } catch (JSONException e) {
      e.printStackTrace();
    }
    Log.d("SVF", "Has topics = " + hasTopics);
    if (!hasTopics) {
      noTopicsText.setText(getString(R.string.no_topics_available));
      swipeLayout.setVisibility(View.INVISIBLE);
    } else {
      Log.d("SVF", "Topics were not null");
      swipeLayout.setVisibility(View.VISIBLE);
      try {
        topics = user.getJSONArray("topics");
        setUpList(rootView, topics);
      } catch (JSONException e) {
        e.printStackTrace();
      }
    }

    return rootView;
  }
Beispiel #30
0
  private void setVisibility(int visibility) {

    if (visibility == CONNECT_VIEW) {
      rootview.setVisibility(View.GONE);
      connect_button_view.setVisibility(View.VISIBLE);
      textViewShowTime.setVisibility(View.GONE);
    } else if (visibility == TREATMENT_SERVICE_NOT_FOUND) {

      rootview.setVisibility(View.VISIBLE);
      connect_button_view.setVisibility(View.GONE);
      buttonStartTime.setVisibility(View.GONE);
      textViewShowTime.setVisibility(View.GONE);
      mProgressBar.setVisibility(View.GONE);
      delayCheckBox.setVisibility(View.GONE);

      // create progressdialog while connecting to the services
      progressDialog = new ProgressDialog(this);
      // show message
      progressDialog.setMessage("Connecting to the services");
      progressDialog.show();

    } else if (visibility == TREATMENT_SERVICE_FOUND) {
      rootview.setVisibility(View.VISIBLE);
      connect_button_view.setVisibility(View.GONE);
      buttonStartTime.setVisibility(View.VISIBLE);
      mProgressBar.setVisibility(View.VISIBLE);
      delayCheckBox.setVisibility(View.VISIBLE);

      // dismiss the progressdialog
      progressDialog.dismiss();
    }
  }