List of usage examples for android.widget ProgressBar setProgress
@android.view.RemotableViewMethod public synchronized void setProgress(int progress)
From source file:com.bt.download.android.gui.adapters.TransferListAdapter.java
private void populateSoundcloudDownload(View view, SoundcloudDownload download) { TextView title = findView(view, R.id.view_transfer_list_item_title); ProgressBar progress = findView(view, R.id.view_transfer_list_item_progress); TextView status = findView(view, R.id.view_transfer_list_item_status); TextView speed = findView(view, R.id.view_transfer_list_item_speed); TextView size = findView(view, R.id.view_transfer_list_item_size); TextView seeds = findView(view, R.id.view_transfer_list_item_seeds); TextView peers = findView(view, R.id.view_transfer_list_item_peers); ImageView buttonAction = findView(view, R.id.view_transfer_list_item_button_action); seeds.setText(""); peers.setText(""); title.setText(download.getDisplayName()); progress.setProgress(download.getProgress()); status.setText(getStatusFromResId(download.getStatus())); speed.setText(UIUtils.getBytesInHuman(download.getDownloadSpeed()) + "/s"); size.setText(UIUtils.getBytesInHuman(download.getSize())); buttonAction.setTag(download);/*from w ww . j a v a 2 s . co m*/ buttonAction.setOnClickListener(viewOnClickListener); }
From source file:com.lgallardo.qbittorrentclient.TorrentDetailsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Tell the host activity that your fragment has menu options that it // wants to add/replace/delete using the onCreateOptionsMenu method. setHasOptionsMenu(true);/*from ww w .j a v a2s .c om*/ View rootView; if (MainActivity.qb_version.equals("3.2.x")) { rootView = inflater.inflate(R.layout.torrent_details, container, false); } else { rootView = inflater.inflate(R.layout.torrent_details_old, container, false); } mRecyclerView = (RecyclerView) rootView.findViewById(R.id.RecyclerViewContentFiles); // Assigning the RecyclerView Object to the xml View rAdapter = new ContentFilesRecyclerViewAdapter((MainActivity) getActivity(), getActivity(), new ArrayList<TorrentDetailsItem>()); rAdapter.notifyDataSetChanged(); mRecyclerViewTrackers = (RecyclerView) rootView.findViewById(R.id.RecyclerViewTrackers); // Assigning the RecyclerView Object to the xml View trackerAdapter = new TrackersRecyclerViewAdapter((MainActivity) getActivity(), getActivity(), new ArrayList<TorrentDetailsItem>()); trackerAdapter.notifyDataSetChanged(); mRecyclerViewGeneralInfo = (RecyclerView) rootView.findViewById(R.id.RecyclerViewGeneralInfo); // Assigning the RecyclerView Object to the xml View generalInfoAdapter = new GeneralInfoRecyclerViewAdapter((MainActivity) getActivity(), getActivity(), new ArrayList<GeneralInfoItem>()); generalInfoAdapter.notifyDataSetChanged(); if (mRecyclerView == null) { Log.d("Debug", "mRecyclerView is null"); } if (rAdapter == null) { Log.d("Debug", "rAdapter is null"); } try { mRecyclerView.setAdapter(rAdapter); mRecyclerViewTrackers.setAdapter(trackerAdapter); mRecyclerViewGeneralInfo.setAdapter(generalInfoAdapter); mLayoutManager = new LinearLayoutManager(rootView.getContext()); // Creating a layout Manager mLayoutManagerTrackers = new LinearLayoutManager(rootView.getContext()); // Creating a layout Manager mLayoutManagerGeneralInfo = new LinearLayoutManager(rootView.getContext()); // Creating a layout Manager mRecyclerView.setLayoutManager(mLayoutManager); // Setting the layout Manager mRecyclerViewTrackers.setLayoutManager(mLayoutManagerTrackers); // Setting the layout Manager mRecyclerViewGeneralInfo.setLayoutManager(mLayoutManagerGeneralInfo); // Setting the layout Manager } catch (Exception e) { Log.e("Debug", e.toString()); } // TODO: Check if this can be removed registerForContextMenu(mRecyclerView); // registerForContextMenu(mRecyclerViewTrackers); // registerForContextMenu(mRecyclerViewGeneralInfo); // Get Refresh Listener refreshListener = (RefreshListener) getActivity(); mSwipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.details_refresh_layout); if (mSwipeRefreshLayout != null) { mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { refreshListener.swipeRefresh(); } }); } // Hide herderInfo and title in phone's view if (getActivity().findViewById(R.id.one_frame) != null && MainActivity.headerInfo != null) { MainActivity.headerInfo.setVisibility(View.GONE); ((MainActivity) getActivity()).setTitle(""); } savePath = ""; creationDate = ""; comment = ""; uploadRateLimit = ""; downloadRateLimit = ""; totalWasted = ""; totalUploaded = ""; totalDownloaded = ""; timeElapsed = ""; nbConnections = ""; shareRatio = ""; try { if (savedInstanceState != null) { // Get saved values name = savedInstanceState.getString("torrentDetailName", ""); size = savedInstanceState.getString("torrentDetailSize", ""); hash = savedInstanceState.getString("torrentDetailHash", ""); ratio = savedInstanceState.getString("torrentDetailRatio", ""); state = savedInstanceState.getString("torrentDetailState", ""); leechs = savedInstanceState.getString("torrentDetailLeechs", ""); seeds = savedInstanceState.getString("torrentDetailSeeds", ""); progress = savedInstanceState.getString("torrentDetailProgress", ""); priority = savedInstanceState.getString("torrentDetailPriority", ""); eta = savedInstanceState.getString("torrentDetailEta", ""); uploadSpeed = savedInstanceState.getString("torrentDetailUploadSpeed", ""); downloadSpeed = savedInstanceState.getString("torrentDetailDownloadSpeed", ""); downloaded = savedInstanceState.getString("torrentDetailDownloaded", ""); addedOn = savedInstanceState.getString("torrentDetailsAddedOn", ""); completionOn = savedInstanceState.getString("torrentDetailsCompletionOn", ""); label = savedInstanceState.getString("torrentDetailsLabel", ""); hashToUpdate = hash; // Only for Pro version if (MainActivity.packageName.equals("com.lgallardo.qbittorrentclientpro")) { int index = progress.indexOf("."); if (index == -1) { index = progress.indexOf(","); if (index == -1) { index = progress.length(); } } percentage = progress.substring(0, index); } } else { // Get values from current activity name = this.torrent.getFile(); size = this.torrent.getSize(); hash = this.torrent.getHash(); ratio = this.torrent.getRatio(); state = this.torrent.getState(); leechs = this.torrent.getLeechs(); seeds = this.torrent.getSeeds(); progress = this.torrent.getProgress(); priority = this.torrent.getPriority(); eta = this.torrent.getEta(); uploadSpeed = this.torrent.getUploadSpeed(); downloadSpeed = this.torrent.getDownloadSpeed(); downloaded = this.torrent.getDownloaded(); addedOn = this.torrent.getAddedOn(); completionOn = this.torrent.getCompletionOn(); label = this.torrent.getLabel(); hashToUpdate = hash; // Only for Pro version if (MainActivity.packageName.equals("com.lgallardo.qbittorrentclientpro")) { int index = this.torrent.getProgress().indexOf("."); if (index == -1) { index = this.torrent.getProgress().indexOf(","); if (index == -1) { index = this.torrent.getProgress().length(); } } percentage = this.torrent.getProgress().substring(0, index); } } TextView nameTextView = (TextView) rootView.findViewById(R.id.torrentName); TextView sizeTextView = (TextView) rootView.findViewById(R.id.torrentSize); TextView ratioTextView = (TextView) rootView.findViewById(R.id.torrentRatio); TextView progressTextView = (TextView) rootView.findViewById(R.id.torrentProgress); TextView stateTextView = (TextView) rootView.findViewById(R.id.torrentState); TextView priorityTextView = (TextView) rootView.findViewById(R.id.torrentPriority); TextView leechsTextView = (TextView) rootView.findViewById(R.id.torrentLeechs); TextView seedsTextView = (TextView) rootView.findViewById(R.id.torrentSeeds); TextView hashTextView = (TextView) rootView.findViewById(R.id.torrentHash); TextView etaTextView = (TextView) rootView.findViewById(R.id.torrentEta); TextView uploadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentUploadSpeed); TextView downloadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentDownloadSpeed); CheckBox sequentialDownloadCheckBox; CheckBox firstLAstPiecePrioCheckBox; nameTextView.setText(name); ratioTextView.setText(ratio); stateTextView.setText(state); leechsTextView.setText(leechs); seedsTextView.setText(seeds); progressTextView.setText(progress); hashTextView.setText(hash); etaTextView.setText(eta); priorityTextView.setText(priority); if (MainActivity.qb_version.equals("3.2.x")) { sequentialDownloadCheckBox = (CheckBox) rootView.findViewById(R.id.torrentSequentialDownload); firstLAstPiecePrioCheckBox = (CheckBox) rootView.findViewById(R.id.torrentFirstLastPiecePrio); sequentialDownloadCheckBox.setChecked(this.torrent.getSequentialDownload()); firstLAstPiecePrioCheckBox.setChecked(this.torrent.getisFirstLastPiecePrio()); TextView addedOnTextView = (TextView) rootView.findViewById(R.id.torrentAddedOn); TextView completionOnTextView = (TextView) rootView.findViewById(R.id.torrentCompletionOn); TextView labelTextView = (TextView) rootView.findViewById(R.id.torrentLabel); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); if (addedOn != null && !(addedOn.equals("null")) && !(addedOn.equals("4294967295"))) { if (Integer.parseInt(MainActivity.qb_api) < 10) { // Old time format 2016-07-25T20:52:07 addedOnTextView .setText(new SimpleDateFormat("dd/MM/yyyy - HH:mm").format(sdf.parse(addedOn))); } else { // New unix timestamp format 4294967295 addedOnTextView.setText(Common.timestampToDate(addedOn)); } } else { addedOnTextView.setText(""); } if (completionOn != null && !(completionOn.equals("null")) && !(completionOn.equals("4294967295"))) { if (Integer.parseInt(MainActivity.qb_api) < 10) { // Old time format 2016-07-25T20:52:07 completionOnTextView.setText( new SimpleDateFormat("dd/MM/yyyy - HH:mm").format(sdf.parse(completionOn))); } else { // New unix timestamp format 4294967295 completionOnTextView.setText(Common.timestampToDate(completionOn)); } } else { completionOnTextView.setText(""); } if (label != null && !(label.equals("null"))) { labelTextView.setText(label); } else { labelTextView.setText(""); } } // Set Downloaded vs Total size sizeTextView.setText(downloaded + " / " + size); // Only for Pro version if (MainActivity.packageName.equals("com.lgallardo.qbittorrentclientpro")) { downloadSpeedTextView.setText(Character.toString('\u2193') + " " + downloadSpeed); uploadSpeedTextView.setText(Character.toString('\u2191') + " " + uploadSpeed); // Set progress bar ProgressBar progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar1); TextView percentageTV = (TextView) rootView.findViewById(R.id.percentage); progressBar.setProgress(Integer.parseInt(percentage)); percentageTV.setText(percentage + "%"); } else { downloadSpeedTextView.setText(downloadSpeed); uploadSpeedTextView.setText(uploadSpeed); } nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_recheck, 0, 0, 0); // Set status icon if ("pausedUP".equals(state) || "pausedDL".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.paused, 0, 0, 0); } if ("stalledUP".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalledup, 0, 0, 0); } if ("stalledDL".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalleddl, 0, 0, 0); } if ("downloading".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.downloading, 0, 0, 0); } if ("uploading".equals(state) || "forcedUP".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.uploading, 0, 0, 0); } if ("queuedDL".equals(state) || "queuedUP".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.queued, 0, 0, 0); } if ("checkingDL".equals(state) || "checkingUP".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_recheck, 0, 0, 0); } if ("error".equals(state) || "missingFiles".equals(state) || "unknown".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.error, 0, 0, 0); } // Get Content files in background ContentFileTask cft = new ContentFileTask(); cft.execute(new String[] { hash }); // Get trackers in background TrackersTask tt = new TrackersTask(); tt.execute(new String[] { hash }); // Get General info labels generalInfoItems = new ArrayList<GeneralInfoItem>(); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_save_path), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_created_date), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_comment), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_total_wasted), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_total_uploaded), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_total_downloaded), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_time_elapsed), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_num_connections), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_share_ratio), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_upload_rate_limit), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_download_rate_limit), null, GeneralInfoItem.GENERALINFO, "generalInfo")); // Get general info in background GeneralInfoTask git = new GeneralInfoTask(); git.execute(new String[] { hash }); } catch (Exception e) { Log.e("Debug", "TorrentDetailsFragment - onCreateView: " + e.toString()); } if (MainActivity.packageName.equals("com.lgallardo.qbittorrentclient")) { // Load banner loadBanner(); } return rootView; }
From source file:com.lgallardo.youtorrentcontroller.TorrentDetailsFragment.java
public void updateDetails(Torrent torrent) { try {/* w w w. j a v a 2 s.c o m*/ // Hide herderInfo in phone's view if (getActivity().findViewById(R.id.one_frame) != null) { MainActivity.headerInfo.setVisibility(View.GONE); } // Get values from current activity name = torrent.getFile(); size = torrent.getSize(); hash = torrent.getHash(); ratio = torrent.getRatio(); state = torrent.getState(); peersConnected = torrent.getPeersConnected(); peersInSwarm = torrent.getPeersInSwarm(); seedsConnected = torrent.getSeedsConnected(); seedsInSwarm = torrent.getSeedInSwarm(); progress = torrent.getProgress(); priority = torrent.getPriority(); eta = torrent.getEta(); uploadSpeed = torrent.getUploadSpeed(); downloadSpeed = torrent.getDownloadSpeed(); downloaded = torrent.getDownloaded(); int index = torrent.getProgress().indexOf("."); if (index == -1) { index = torrent.getProgress().indexOf(","); if (index == -1) { index = torrent.getProgress().length(); } } percentage = torrent.getProgress().substring(0, index); int donwloadSpeedWeigth = torrent.getDownloadSpeedWeight(); int uploadSpeedWeigth = torrent.getUploadSpeedWeight(); FragmentManager fragmentManager = getFragmentManager(); TorrentDetailsFragment detailsFragment = null; if (getActivity().findViewById(R.id.one_frame) != null) { detailsFragment = (TorrentDetailsFragment) fragmentManager.findFragmentByTag("firstFragment"); } else { detailsFragment = (TorrentDetailsFragment) fragmentManager.findFragmentByTag("secondFragment"); } View rootView = detailsFragment.getView(); TextView nameTextView = (TextView) rootView.findViewById(R.id.torrentName); TextView sizeTextView = (TextView) rootView.findViewById(R.id.torrentSize); TextView ratioTextView = (TextView) rootView.findViewById(R.id.torrentRatio); TextView priorityTextView = (TextView) rootView.findViewById(R.id.torrentPriority); TextView stateTextView = (TextView) rootView.findViewById(R.id.torrentState); TextView leechsTextView = (TextView) rootView.findViewById(R.id.torrentLeechs); TextView seedsTextView = (TextView) rootView.findViewById(R.id.torrentSeeds); TextView progressTextView = (TextView) rootView.findViewById(R.id.torrentProgress); TextView hashTextView = (TextView) rootView.findViewById(R.id.torrentHash); TextView etaTextView = (TextView) rootView.findViewById(R.id.torrentEta); TextView uploadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentUploadSpeed); TextView downloadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentDownloadSpeed); CheckBox sequentialDownloadCheckBox; CheckBox firstLAstPiecePrioCheckBox; nameTextView.setText(name); ratioTextView.setText(ratio); stateTextView.setText(state); leechsTextView.setText("" + peersConnected + " (" + peersInSwarm + ")"); seedsTextView.setText("" + seedsConnected + " (" + seedsInSwarm + ")"); progressTextView.setText(progress); hashTextView.setText(hash); priorityTextView.setText(priority); etaTextView.setText(eta); // Set Downloaded vs Total size sizeTextView.setText(downloaded + " / " + size); // Only for Pro version if (MainActivity.packageName.equals("com.lgallardo.youtorrentcontrollerpro")) { downloadSpeedTextView.setText(Character.toString('\u2193') + " " + downloadSpeed); uploadSpeedTextView.setText(Character.toString('\u2191') + " " + uploadSpeed); // Set progress bar ProgressBar progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar1); TextView percentageTV = (TextView) rootView.findViewById(R.id.percentage); progressBar.setProgress(Integer.parseInt(percentage)); percentageTV.setText(percentage + "%"); } else { downloadSpeedTextView.setText(downloadSpeed); uploadSpeedTextView.setText(uploadSpeed); } nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.error, 0, 0, 0); // Log.d("Debug", "TorrentDetailsFragment - state: " + state); if ("paused".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.paused, 0, 0, 0); } if ("downloading".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalleddl, 0, 0, 0); if (donwloadSpeedWeigth > 0 || seedsConnected > 0 || peersConnected > 0) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.downloading, 0, 0, 0); } } if ("seeding".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalledup, 0, 0, 0); if (uploadSpeedWeigth > 0 || seedsConnected > 0 || peersConnected > 0) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.uploading, 0, 0, 0); } } if ("queued".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.queued, 0, 0, 0); } if ("checking".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_recheck, 0, 0, 0); } if ("stopped".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_stopped, 0, 0, 0); } // // Get Content files in background // qBittorrentContentFile qcf = new qBittorrentContentFile(); // qcf.execute(new View[]{rootView}); // // // Get trackers in background // qBittorrentTrackers qt = new qBittorrentTrackers(); // qt.execute(new View[]{rootView}); // // // Get General info in background // qBittorrentGeneralInfoTask qgit = new qBittorrentGeneralInfoTask(); // qgit.execute(new View[]{rootView}); } catch (Exception e) { Log.e("Debug", "TorrentDetailsFragment - onCreateView: " + e.toString()); } }
From source file:im.neon.adapters.VectorMessagesAdapter.java
@Override protected void updateUploadProgress(View uploadProgressLayout, int progress) { ProgressBar progressBar = (ProgressBar) uploadProgressLayout.findViewById(R.id.media_progress_view); if (null != progressBar) { progressBar.setProgress(progress); }/*from w w w. j a v a 2 s .com*/ }
From source file:io.github.trulyfree.easyaspi.MainActivity.java
/** * Helper method which refreshes the module layout between module downloads/deletions. *///from w ww . j a v a 2 s . c o m private void refreshFilling() { LinearLayout dashboard = (LinearLayout) findViewById(R.id.dashboard); dashboard.removeAllViewsInLayout(); if (moduleHandler.getConfigs().length != 0) { final LinearLayout moduleList = (LinearLayout) ((LinearLayout) getLayoutInflater() .inflate(R.layout.modulelist, dashboard)).getChildAt(0); final Button refreshAll = (Button) findViewById(R.id.refresh_all); refreshAll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(MainActivity.this, "Refreshing jars...", Toast.LENGTH_SHORT).show(); executorService.submit(new Callable<Boolean>() { @Override public Boolean call() { boolean success = true; refreshAll.setClickable(false); final TextView stager = (TextView) findViewById(R.id.refresh_download_stage); final ProgressBar progressBar = (ProgressBar) findViewById(R.id.refresh_bar); try { moduleHandler.refreshAll(makeModuleCallback(stager, progressBar)); } catch (IOException e) { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, "Refresh failed. :(", Toast.LENGTH_SHORT) .show(); stager.setText(""); progressBar.setProgress(0); } }); success = false; } refreshAll.setClickable(true); return success; } }); } }); LinearLayout scrolledModuleList = (LinearLayout) ((ScrollView) moduleList.getChildAt(3)).getChildAt(0); for (int i = 0; i < moduleHandler.getConfigs().length; i++) { final int intermediary = i; final LinearLayout layout = (LinearLayout) ((LinearLayout) getLayoutInflater() .inflate(R.layout.module, scrolledModuleList)).getChildAt(i); executorService.submit(new Callable<Boolean>() { @Override public Boolean call() { final Button launcher = (Button) layout.getChildAt(1); final Button delete = (Button) layout.getChildAt(2); launcher.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent myIntent = new Intent(MainActivity.this, EAPDisplay.class); myIntent.putExtra("targetModule", moduleHandler.toJson(moduleHandler.getConfigs()[intermediary])); MainActivity.this.startActivityForResult(myIntent, intermediary); } }); delete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ModuleConfig config = moduleHandler.getConfigs()[intermediary]; boolean success = false; try { success = moduleHandler.remove(null, config); } catch (IOException e) { e.printStackTrace(); } final String toast = "Deletion of " + config.getName() + " was " + ((success) ? "successful." : "unsuccessful."); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, toast, Toast.LENGTH_SHORT).show(); refreshFilling(); } }); } }); launcher.setClickable(true); delete.setClickable(true); return true; } }); EditText moduleName = (EditText) layout.getChildAt(0); moduleName.setText(moduleHandler.getConfigs()[intermediary].getName()); } } else { getLayoutInflater().inflate(R.layout.no_module_modulelist, dashboard); } }
From source file:org.alfresco.mobile.android.application.fragments.node.browser.ProgressNodeAdapter.java
@Override protected void updateTopText(TwoLinesProgressViewHolder vh, Node item) { ProgressBar progressView = vh.progress; if (item instanceof NodePlaceHolder) { vh.topText.setText(item.getName()); vh.topText.setEnabled(false);/*from w w w. ja va 2 s . c o m*/ long totalSize = ((NodePlaceHolder) item).getLength(); if ((Integer) item.getPropertyValue(PublicAPIPropertyIds.REQUEST_STATUS) == Operation.STATUS_PAUSED || (Integer) item .getPropertyValue(PublicAPIPropertyIds.REQUEST_STATUS) == Operation.STATUS_PENDING) { progressView.setVisibility(View.GONE); } else { progressView.setVisibility(View.VISIBLE); progressView.setIndeterminate(false); if (totalSize == -1) { progressView.setMax(MAX_PROGRESS); progressView.setProgress(0); } else { long progress = ((NodePlaceHolder) item).getProgress(); float value = (((float) progress / ((float) totalSize)) * MAX_PROGRESS); int percentage = Math.round(value); if (percentage == MAX_PROGRESS) { if ((Integer) item .getPropertyValue(PublicAPIPropertyIds.REQUEST_TYPE) == DownloadRequest.TYPE_ID) { progressView.setVisibility(View.GONE); super.updateTopText(vh, item); vh.bottomText.setVisibility(View.VISIBLE); super.updateBottomText(vh, item); super.updateIcon(vh, item); } else { progressView.setIndeterminate(true); } } else { progressView.setIndeterminate(false); progressView.setMax(MAX_PROGRESS); progressView.setProgress(percentage); } } } } else { progressView.setVisibility(View.GONE); super.updateTopText(vh, item); } }
From source file:com.lgallardo.youtorrentcontroller.TorrentDetailsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Tell the host activity that your fragment has menu options that it // wants to add/replace/delete using the onCreateOptionsMenu method. setHasOptionsMenu(true);/*from www. java 2s .c o m*/ View rootView; rootView = inflater.inflate(R.layout.torrent_details, container, false); // Get Refresh Listener refreshListener = (RefreshListener) getActivity(); mSwipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.details_refresh_layout); if (mSwipeRefreshLayout != null) { mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { refreshListener.swipeRefresh(); } }); } // Hide herderInfo and title in phone's view if (getActivity().findViewById(R.id.one_frame) != null && MainActivity.headerInfo != null) { MainActivity.headerInfo.setVisibility(View.GONE); // ((MainActivity) getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(false); ((MainActivity) getActivity()).setTitle(""); } savePath = ""; creationDate = ""; comment = ""; uploadRateLimit = ""; downloadRateLimit = ""; totalWasted = ""; totalUploaded = ""; totalDownloaded = ""; timeElapsed = ""; nbConnections = ""; shareRatio = ""; try { if (savedInstanceState != null) { // Get saved values name = savedInstanceState.getString("torrentDetailName", ""); size = savedInstanceState.getString("torrentDetailSize", ""); hash = savedInstanceState.getString("torrentDetailHash", ""); ratio = savedInstanceState.getString("torrentDetailRatio", ""); state = savedInstanceState.getString("torrentDetailState", ""); peersConnected = savedInstanceState.getInt("torrentDetailPeersConnected", 0); peersInSwarm = savedInstanceState.getInt("torrentDetailPeersInSwarm", 0); seedsConnected = savedInstanceState.getInt("torrentDetailSeedsConnected", 0); seedsInSwarm = savedInstanceState.getInt("torrentDetailSeedsInSwarm", 0); progress = savedInstanceState.getString("torrentDetailProgress", ""); priority = savedInstanceState.getString("torrentDetailPriority", ""); eta = savedInstanceState.getString("torrentDetailEta", ""); uploadSpeed = savedInstanceState.getString("torrentDetailUploadSpeed", ""); downloadSpeed = savedInstanceState.getString("torrentDetailDownloadSpeed", ""); downloaded = savedInstanceState.getString("torrentDetailDownloaded", ""); hashToUpdate = hash; // Only for Pro version if (MainActivity.packageName.equals("com.lgallardo.youtorrentcontrollerpro")) { int index = progress.indexOf("."); if (index == -1) { index = progress.indexOf(","); if (index == -1) { index = progress.length(); } } percentage = progress.substring(0, index); } } else { // Get values from current activity name = this.torrent.getFile(); size = this.torrent.getSize(); hash = this.torrent.getHash(); ratio = this.torrent.getRatio(); state = this.torrent.getState(); peersConnected = this.torrent.getPeersConnected(); peersInSwarm = this.torrent.getPeersInSwarm(); seedsConnected = this.torrent.getSeedsConnected(); seedsInSwarm = this.torrent.getSeedInSwarm(); progress = this.torrent.getProgress(); priority = this.torrent.getPriority(); eta = this.torrent.getEta(); uploadSpeed = this.torrent.getUploadSpeed(); downloadSpeed = this.torrent.getDownloadSpeed(); hashToUpdate = hash; downloaded = this.torrent.getDownloaded(); // Only for Pro version if (MainActivity.packageName.equals("com.lgallardo.youtorrentcontrollerpro")) { int index = this.torrent.getProgress().indexOf("."); if (index == -1) { index = this.torrent.getProgress().indexOf(","); if (index == -1) { index = this.torrent.getProgress().length(); } } percentage = this.torrent.getProgress().substring(0, index); } } int donwloadSpeedWeigth = torrent.getDownloadSpeedWeight(); int uploadSpeedWeigth = torrent.getUploadSpeedWeight(); TextView nameTextView = (TextView) rootView.findViewById(R.id.torrentName); TextView sizeTextView = (TextView) rootView.findViewById(R.id.torrentSize); TextView ratioTextView = (TextView) rootView.findViewById(R.id.torrentRatio); TextView progressTextView = (TextView) rootView.findViewById(R.id.torrentProgress); TextView stateTextView = (TextView) rootView.findViewById(R.id.torrentState); TextView priorityTextView = (TextView) rootView.findViewById(R.id.torrentPriority); TextView leechsTextView = (TextView) rootView.findViewById(R.id.torrentLeechs); TextView seedsTextView = (TextView) rootView.findViewById(R.id.torrentSeeds); TextView hashTextView = (TextView) rootView.findViewById(R.id.torrentHash); TextView etaTextView = (TextView) rootView.findViewById(R.id.torrentEta); TextView uploadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentUploadSpeed); TextView downloadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentDownloadSpeed); CheckBox sequentialDownloadCheckBox; CheckBox firstLAstPiecePrioCheckBox; nameTextView.setText(name); ratioTextView.setText(ratio); stateTextView.setText(state); leechsTextView.setText("" + peersConnected + " (" + peersInSwarm + ")"); seedsTextView.setText("" + seedsConnected + " (" + seedsInSwarm + ")"); progressTextView.setText(progress); hashTextView.setText(hash); etaTextView.setText(eta); priorityTextView.setText(priority); // Set Downloaded vs Total size sizeTextView.setText(downloaded + " / " + size); // Only for Pro version if (MainActivity.packageName.equals("com.lgallardo.youtorrentcontrollerpro")) { downloadSpeedTextView.setText(Character.toString('\u2193') + " " + downloadSpeed); uploadSpeedTextView.setText(Character.toString('\u2191') + " " + uploadSpeed); // Set progress bar ProgressBar progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar1); TextView percentageTV = (TextView) rootView.findViewById(R.id.percentage); progressBar.setProgress(Integer.parseInt(percentage)); percentageTV.setText(percentage + "%"); } else { downloadSpeedTextView.setText(downloadSpeed); uploadSpeedTextView.setText(uploadSpeed); } nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.error, 0, 0, 0); // Log.d("Debug", "TorrentDetailsFragment - state: " + state); if ("paused".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.paused, 0, 0, 0); } if ("downloading".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalleddl, 0, 0, 0); if (donwloadSpeedWeigth > 0 || seedsConnected > 0 || peersConnected > 0) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.downloading, 0, 0, 0); } } if ("seeding".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalledup, 0, 0, 0); if (uploadSpeedWeigth > 0 || seedsConnected > 0 || peersConnected > 0) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.uploading, 0, 0, 0); } } if ("queued".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.queued, 0, 0, 0); } if ("checking".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_recheck, 0, 0, 0); } if ("stopped".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_stopped, 0, 0, 0); } // // Get Content files in background // qBittorrentContentFile qcf = new qBittorrentContentFile(); // qcf.execute(new View[]{rootView}); // // // Get trackers in background // qBittorrentTrackers qt = new qBittorrentTrackers(); // qt.execute(new View[]{rootView}); // // // Get general info in background // qBittorrentGeneralInfoTask qgit = new qBittorrentGeneralInfoTask(); // qgit.execute(new View[]{rootView}); } catch (Exception e) { Log.e("Debug", "TorrentDetailsFragment - onCreateView: " + e.toString()); } if (MainActivity.packageName.equals("com.lgallardo.youtorrentcontroller")) { // Load banner loadBanner(); } return rootView; }
From source file:com.bt.download.android.gui.adapters.TransferListAdapter.java
private void populateBittorrentDownload(View view, BittorrentDownload download) { TextView title = findView(view, R.id.view_transfer_list_item_title); ProgressBar progress = findView(view, R.id.view_transfer_list_item_progress); TextView status = findView(view, R.id.view_transfer_list_item_status); TextView speed = findView(view, R.id.view_transfer_list_item_speed); TextView size = findView(view, R.id.view_transfer_list_item_size); ImageView buttonAction = findView(view, R.id.view_transfer_list_item_button_action); TextView seeds = findView(view, R.id.view_transfer_list_item_seeds); TextView peers = findView(view, R.id.view_transfer_list_item_peers); seeds.setText(context.get().getString(R.string.seeds_n, download.getSeeds())); peers.setText(context.get().getString(R.string.peers_n, download.getPeers())); title.setText(download.getDisplayName()); progress.setProgress(download.getProgress()); status.setText(TRANSFER_STATE_STRING_MAP.get(download.getStatus())); speed.setText(UIUtils.getBytesInHuman(download.getDownloadSpeed()) + "/s"); size.setText(UIUtils.getBytesInHuman(download.getSize())); buttonAction.setTag(download);/*from w w w .ja va 2 s . c om*/ buttonAction.setOnClickListener(viewOnClickListener); }
From source file:im.neon.adapters.VectorMessagesAdapter.java
@Override protected void refreshUploadViews(final Event event, final IMXMediaUploadListener.UploadStats uploadStats, final View uploadProgressLayout) { if (null != uploadStats) { uploadProgressLayout.setVisibility(View.VISIBLE); TextView uploadProgressStatsTextView = (TextView) uploadProgressLayout .findViewById(R.id.media_progress_text_view); ProgressBar progressBar = (ProgressBar) uploadProgressLayout.findViewById(R.id.media_progress_view); if (null != uploadProgressStatsTextView) { uploadProgressStatsTextView.setText(formatUploadStats(mContext, uploadStats)); }/* w ww .ja v a 2s. c o m*/ if (null != progressBar) { progressBar.setProgress(uploadStats.mProgress); } final View cancelLayout = uploadProgressLayout.findViewById(R.id.media_progress_cancel); if (null != cancelLayout) { cancelLayout.setTag(event); cancelLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (event == cancelLayout.getTag()) { if (null != mVectorMessagesAdapterEventsListener) { mVectorMessagesAdapterEventsListener.onEventAction(event, "", R.id.ic_action_vector_cancel_upload); } } } }); } } else { uploadProgressLayout.setVisibility(View.GONE); } }
From source file:im.neon.adapters.VectorMessagesAdapter.java
@Override protected void refreshDownloadViews(final Event event, final IMXMediaDownloadListener.DownloadStats downloadStats, final View downloadProgressLayout) { if ((null != downloadStats) && isMediaDownloading(event, downloadStats.mDownloadId)) { downloadProgressLayout.setVisibility(View.VISIBLE); TextView downloadProgressStatsTextView = (TextView) downloadProgressLayout .findViewById(R.id.media_progress_text_view); ProgressBar progressBar = (ProgressBar) downloadProgressLayout.findViewById(R.id.media_progress_view); if (null != downloadProgressStatsTextView) { downloadProgressStatsTextView.setText(formatDownloadStats(mContext, downloadStats)); }//from w ww.ja v a 2s. co m if (null != progressBar) { progressBar.setProgress(downloadStats.mProgress); } final View cancelLayout = downloadProgressLayout.findViewById(R.id.media_progress_cancel); if (null != cancelLayout) { cancelLayout.setTag(event); cancelLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (event == cancelLayout.getTag()) { if (null != mVectorMessagesAdapterEventsListener) { mVectorMessagesAdapterEventsListener.onEventAction(event, "", R.id.ic_action_vector_cancel_download); } } } }); } } else { downloadProgressLayout.setVisibility(View.GONE); } }