List of usage examples for android.graphics Color parseColor
@ColorInt public static int parseColor(@Size(min = 1) String colorString)
From source file:net.evecom.androidecssp.activity.event.ContinueAddActivity.java
/** * // www . jav a 2 s . c o m * * * @author Stark Zhou * @created 2016-4-5 10:27:57 */ private void initGallery() { mGallery = (GalleryFlow) findViewById(R.id.continue_add_gallery_flow); mGallery.setBackgroundColor(Color.parseColor("#ffffff")); // mGallery.setSpacing(90);// mGallery.setMaxRotationAngle(20);// mGallery.setFadingEdgeLength(10); // mGallery.setGravity(Gravity.CENTER_VERTICAL); // mGallery.setAdapter(new GalleryAdapter()); mGallery.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(getApplicationContext(), AfnailPictureActivity.class); BaseActivity.pushObjData("filebean", filebeans.get(position), intent); startActivityForResult(intent, R.layout.afnail_picture_activity); } }); }
From source file:com.elekso.potfix.MainActivity.java
@SuppressWarnings("StatementWithEmptyBody") @Override//from w w w . jav a 2 s .c o m public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); Fragment newFragment = null; if (id == R.id.nav_profile) { currentFragment = 1; newFragment = new ProfileFragment(); fab.setRippleColor(Color.parseColor("#99ff66")); fab.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#00CC33"))); fab.setImageResource(R.drawable.ic_autorenew_white_36dp); } else if (id == R.id.nav_map) { currentFragment = 2; newFragment = new MapsFragment(); fab.setRippleColor(Color.parseColor("#78D6F3")); fab.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#039FDC"))); fab.setImageResource(R.drawable.ic_gps_fixed_white_24dp); // } else if (id == R.id.nav_news) { // newFragment = new NewsFragment(); // fab.setImageResource(android.R.drawable.ic_dialog_info); // } else if (id == R.id.nav_setting) { // newFragment = new SettingFragment(); // fab.setImageResource(R.drawable.ic_settings_white_24dp); } else if (id == R.id.nav_share) { currentFragment = 3; newFragment = new ShareFragment(); fab.setRippleColor(Color.parseColor("#FF7F50")); fab.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#FF2400"))); fab.setImageResource(android.R.drawable.ic_dialog_email); } else if (id == R.id.nav_license) { currentFragment = 4; newFragment = new LicenseFragment(); fab.setRippleColor(Color.parseColor("#FFFFFF")); fab.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#808080"))); fab.setImageResource(R.drawable.ic_done_white_24dp); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.frame_containerone, newFragment); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); // transaction.addToBackStack(null); transaction.commit(); return true; }
From source file:com.ofalvai.bpinfo.api.bkkinfo.BkkInfoClient.java
/** * Parses affected routes found in the alert detail API response * This structure is different than the alert list API response * @param routesNode Details of routes. Some of them are not affected by the alert, only * recommended alternative routes * @param affectedRouteIds IDs of only the affected routes *///from ww w. j a va 2 s . c om @NonNull private List<Route> parseDetailedAffectedRoutes(JSONObject routesNode, Iterator<String> affectedRouteIds) throws JSONException { List<Route> routes = new ArrayList<>(); while (affectedRouteIds.hasNext()) { String routeId = affectedRouteIds.next(); JSONObject routeNode = routesNode.getJSONObject(routeId); String id = routeNode.getString("forte"); String shortName = routeNode.getString("szam"); String description = routeNode.getString("utvonal"); RouteType routeType = parseRouteType(routeNode.getString("tipus")); int color = Color.parseColor("#" + routeNode.getString("szin")); int textColor = Color.parseColor("#" + routeNode.getString("betu")); Route route = new Route(id, shortName, null, description, routeType, color, textColor); routes.add(route); } Collections.sort(routes); return routes; }
From source file:com.example.android.bluepayandroidsdk.MainActivity.java
public void initializeUI() { btnSwipeCard = (Button) findViewById(R.id.btn_swipeCard); //textAreaTop = (TextView)findViewById(R.id.text_area_top); //textAreaBottom = (EditText)findViewById(R.id.text_area_bottom); connectStatusTextView = (TextView) findViewById(R.id.status_text); //headerTextView = (TextView)findViewById(R.id.header_text); connectStatusTextView.setText("DISCONNECTED"); connectStatusTextView.setTextColor(Color.parseColor("#FFF0250A")); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Set Listener for "Swipe Card" Button btnSwipeCard.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { if (!LaunchSwipeSection.getAmount().matches("^(?!\\.?$)\\d{0,6}(\\.\\d{0,2})?$")) { LaunchSwipeSection.amount.setError("Invalid Amount"); return; }//from w w w . j a va2s .co m } catch (Exception e) { LaunchSwipeSection.amount.setError("Invalid Amount"); return; } if (myUniMagReader != null) { if (!isWaitingForCommandResult) { //while (KSN == null) { if (true == myUniMagReader.sendCommandGetNextKSN()) prepareToSendCommand(uniMagReaderMsg.cmdGetNextKSN); //} beginTime = getCurrentTime(); if (myUniMagReader.startSwipeCard()) { //textAreaTop.setText("Please wait for reader to be ready"); //textAreaBottom.setText(""); } } } } }); }
From source file:cn.oddcloud.www.navigationtabbar.ntb.NavigationTabBar.java
@SuppressWarnings("ResourceAsColor") public NavigationTabBar(final Context context, final AttributeSet attrs, final int defStyleAttr) { super(context, attrs, defStyleAttr); //Init NTB/* ww w.jav a 2 s. com*/ // Always draw setWillNotDraw(false); // Speed and fix for pre 17 API ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, null); setLayerType(LAYER_TYPE_SOFTWARE, null); final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.NavigationTabBar); try { setIsTitled(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_titled, false)); setIsBadged(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_badged, false)); setIsScaled(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_scaled, true)); setIsTinted(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_tinted, true)); setIsSwiped(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_swiped, true)); setTitleSize(typedArray.getDimension(R.styleable.NavigationTabBar_ntb_title_size, AUTO_SIZE)); setIsBadgeUseTypeface( typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_badge_use_typeface, false)); setTitleMode(typedArray.getInt(R.styleable.NavigationTabBar_ntb_title_mode, TitleMode.ALL_INDEX)); setBadgeSize(typedArray.getDimension(R.styleable.NavigationTabBar_ntb_badge_size, AUTO_SIZE)); setBadgePosition( typedArray.getInt(R.styleable.NavigationTabBar_ntb_badge_position, BadgePosition.RIGHT_INDEX)); setBadgeGravity( typedArray.getInt(R.styleable.NavigationTabBar_ntb_badge_gravity, BadgeGravity.TOP_INDEX)); setBadgeBgColor(typedArray.getColor(R.styleable.NavigationTabBar_ntb_badge_bg_color, AUTO_COLOR)); setBadgeTitleColor(typedArray.getColor(R.styleable.NavigationTabBar_ntb_badge_title_color, AUTO_COLOR)); setTypeface(typedArray.getString(R.styleable.NavigationTabBar_ntb_typeface)); setInactiveColor( typedArray.getColor(R.styleable.NavigationTabBar_ntb_inactive_color, DEFAULT_INACTIVE_COLOR)); setActiveColor( typedArray.getColor(R.styleable.NavigationTabBar_ntb_active_color, DEFAULT_ACTIVE_COLOR)); setBgColor(typedArray.getColor(R.styleable.NavigationTabBar_ntb_bg_color, DEFAULT_BG_COLOR)); setAnimationDuration(typedArray.getInteger(R.styleable.NavigationTabBar_ntb_animation_duration, DEFAULT_ANIMATION_DURATION)); setCornersRadius(typedArray.getDimension(R.styleable.NavigationTabBar_ntb_corners_radius, 0.0F)); setIconSizeFraction( typedArray.getFloat(R.styleable.NavigationTabBar_ntb_icon_size_fraction, AUTO_SCALE)); // Init animator mAnimator.setFloatValues(MIN_FRACTION, MAX_FRACTION); mAnimator.setInterpolator(new LinearInterpolator()); mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(final ValueAnimator animation) { updateIndicatorPosition((Float) animation.getAnimatedValue()); } }); // Set preview models if (isInEditMode()) { // Get preview colors String[] previewColors = null; try { final int previewColorsId = typedArray .getResourceId(R.styleable.NavigationTabBar_ntb_preview_colors, 0); previewColors = previewColorsId == 0 ? null : typedArray.getResources().getStringArray(previewColorsId); } catch (Exception exception) { previewColors = null; exception.printStackTrace(); } finally { if (previewColors == null) previewColors = typedArray.getResources().getStringArray(R.array.default_preview); for (String previewColor : previewColors) mModels.add(new Model.Builder(null, Color.parseColor(previewColor)).build()); requestLayout(); } } } finally { typedArray.recycle(); } }
From source file:com.cocoa.cocoautils.widget.navigationtabbar.ntb.NavigationTabBar.java
@SuppressWarnings("ResourceAsColor") public NavigationTabBar(final Context context, final AttributeSet attrs, final int defStyleAttr) { super(context, attrs, defStyleAttr); //Init NTB//from w w w. j a va 2 s . c om // Always draw setWillNotDraw(false); // Speed and fix for pre 17 API ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, null); setLayerType(LAYER_TYPE_SOFTWARE, null); final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.NavigationTabBar); try { setIsTitled(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_titled, false)); setIsBadged(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_badged, false)); setIsScaled(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_scaled, true)); setIsTinted(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_tinted, true)); setIsSwiped(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_swiped, true)); setTitleSize(typedArray.getDimension(R.styleable.NavigationTabBar_ntb_title_size, -2f)); setIsBadgeUseTypeface( typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_badge_use_typeface, false)); setTitleMode(typedArray.getInt(R.styleable.NavigationTabBar_ntb_title_mode, TitleMode.ALL_INDEX)); setBadgeSize(typedArray.getDimension(R.styleable.NavigationTabBar_ntb_badge_size, -2f)); setBadgePosition( typedArray.getInt(R.styleable.NavigationTabBar_ntb_badge_position, BadgePosition.RIGHT_INDEX)); setBadgeGravity( typedArray.getInt(R.styleable.NavigationTabBar_ntb_badge_gravity, BadgeGravity.TOP_INDEX)); setBadgeBgColor(typedArray.getColor(R.styleable.NavigationTabBar_ntb_badge_bg_color, AUTO_COLOR)); setBadgeTitleColor(typedArray.getColor(R.styleable.NavigationTabBar_ntb_badge_title_color, AUTO_COLOR)); setTypeface(typedArray.getString(R.styleable.NavigationTabBar_ntb_typeface)); setInactiveColor( typedArray.getColor(R.styleable.NavigationTabBar_ntb_inactive_color, DEFAULT_INACTIVE_COLOR)); setActiveColor( typedArray.getColor(R.styleable.NavigationTabBar_ntb_active_color, DEFAULT_ACTIVE_COLOR)); setBgColor(typedArray.getColor(R.styleable.NavigationTabBar_ntb_bg_color, DEFAULT_BG_COLOR)); setAnimationDuration(typedArray.getInteger(R.styleable.NavigationTabBar_ntb_animation_duration, DEFAULT_ANIMATION_DURATION)); setCornersRadius(typedArray.getDimension(R.styleable.NavigationTabBar_ntb_corners_radius, 0.0F)); setIconSizeFraction( typedArray.getFloat(R.styleable.NavigationTabBar_ntb_icon_size_fraction, AUTO_SCALE)); // Init animator mAnimator.setFloatValues(MIN_FRACTION, MAX_FRACTION); mAnimator.setInterpolator(new LinearInterpolator()); mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(final ValueAnimator animation) { updateIndicatorPosition((Float) animation.getAnimatedValue()); } }); // Set preview models if (isInEditMode()) { // Get preview colors String[] previewColors = null; try { final int previewColorsId = typedArray .getResourceId(R.styleable.NavigationTabBar_ntb_preview_colors, 0); previewColors = previewColorsId == 0 ? null : typedArray.getResources().getStringArray(previewColorsId); } catch (Exception exception) { previewColors = null; exception.printStackTrace(); } finally { if (previewColors == null) previewColors = typedArray.getResources().getStringArray(R.array.default_preview); for (String previewColor : previewColors) mModels.add(new Model.Builder(null, Color.parseColor(previewColor)).build()); requestLayout(); } } } finally { typedArray.recycle(); } }
From source file:com.entradahealth.entrada.android.app.personal.activities.job_list.JobListActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); activity = this; application = (EntradaApplication) EntradaApplication.getAppContext(); sp = getSharedPreferences("Entrada", Context.MODE_WORLD_READABLE); if (sp.getBoolean("SECURE_MSG", true)) getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); else//www . j a va 2 s . co m getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE); final JobListActivity thisActivity = this; //Custom view as action bar LayoutInflater mInflater = LayoutInflater.from(this); View mCustomView = mInflater.inflate(R.layout.acbar_job_list, null); tvAcTitle = (TextView) mCustomView.findViewById(R.id.tvAcTitle); ivInbox = (ImageView) mCustomView.findViewById(R.id.ivInbox); ivAddJob = (ImageView) mCustomView.findViewById(R.id.ivAddJob); ivSync = (ImageView) mCustomView.findViewById(R.id.ivSync); ivSchedule = (ImageView) mCustomView.findViewById(R.id.ivSchedule); tvAcTitle.setText(BundleKeys.title); //Sample icon badger on Action bar item badge = new BadgeView(this, ivInbox); if (BundleKeys.fromSecureMessaging || !application.isJobListEnabled()) { startActivity(new Intent(JobListActivity.this, SecureMessaging.class)); finish(); } ivInbox.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity(new Intent(JobListActivity.this, SecureMessaging.class)); finish(); } }); ivAddJob.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent addJobIntent = new Intent(JobListActivity.this, AddJobActivity.class); addJobIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(addJobIntent); finish(); } }); ivSync.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub ns = new NetworkState(getApplicationContext()); isConnected = ns.isConnectingToInternet(); if (isConnected) { running = false; ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if ("com.entradahealth.entrada.android.app.personal.sync.SyncService" .equals(service.service.getClassName()) || "com.entradahealth.entrada.android.app.personal.sync.DictationUploadService" .equals(service.service.getClassName())) { running = true; } } if (!running) { etSearch.setText(null); if (!isFinishing()) { //retryUploads(); boolean canSync = true; try { List<Job> jobs = AndroidState.getInstance().getUserState() .getProvider(currentAccount).getJobs(); for (Job j : jobs) { if (j.isPending()) { canSync = false; UserState state = AndroidState.getInstance().getUserState(); Log.e("", "onOptionsItemSelected-syncMenuItem--" + j.id); DictationUploadService.startUpload(JobListActivity.this, state, currentAccount, j); } } } catch (Exception ex) { ACRA.getErrorReporter().handleSilentException(ex); canSync = false; } if (!canSync) { Toast.makeText(JobListActivity.this, "Please wait for all uploads to complete before syncing.", Toast.LENGTH_SHORT).show(); } else { rlSyncError.setVisibility(View.GONE); rlUpdated.setVisibility(View.INVISIBLE); tvUpdating.setVisibility(View.VISIBLE); Intent i = new Intent(JobListActivity.this, SyncService.class); startService(i); } isSyncing = true; BundleKeys.SYNC_FOR_ACC = currentAccount.getDisplayName(); //BundleKeys.SYNC_FOR_CLINIC = currentAccount.getClinicCode(); /*task1 = buildMinderTask(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { task1.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { task1.execute(); }*/ } } else { if (!isResumed) Toast.makeText(JobListActivity.this, "Please wait for all uploads to complete before syncing.", Toast.LENGTH_SHORT) .show(); } isResumed = false; } else { rlSyncError.setVisibility(View.VISIBLE); rlUpdated.setVisibility(View.GONE); tvUpdating.setVisibility(View.GONE); } } }); ivSchedule.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(JobListActivity.this, ScheduleActivity.class)); finish(); } }); getActionBar().setCustomView(mCustomView); getActionBar().setDisplayShowCustomEnabled(true); //ActionBar ab = getActionBar(); //ab.setTitle(BundleKeys.title); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); registerReceiver(broadcastReceiver, new IntentFilter("CONNECTIVITY_CHANGED")); jobIds = new ArrayList<Long>(); BundleKeys.fromImageDisplay = false; BundleKeys.fromCaputreImages = false; BundleKeys.fromSecureMessaging = false; /*Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread paramThread, Throwable paramThrowable) { Log.e("Job-List-Activity","Uncaught-Exception"); System.exit(2); } });*/ setBehindContentView(R.layout.job_list_sliding_menu); tvListTitle = (TextView) findViewById(R.id.tvListTitle); tvListTitle.setText("Jobs"); lvSliding = (ListView) findViewById(R.id.lvSlidingMenu); lvSliding.setBackgroundColor(Color.parseColor("#262b38")); // Get screen width and set sliding width to 3/4 Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int req_width = width * 3 / 4; slidingMenu = getSlidingMenu(); slidingMenu.setFadeEnabled(true); slidingMenu.setFadeDegree(0.35f); slidingMenu.setBehindWidth(req_width); slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN); setContentView(R.layout.job_list); ivDrawer = (ImageView) findViewById(R.id.ivDrawer); ivDrawer.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub slidingMenu.toggle(); // JobCountTask(); } }); rlUpdated = (RelativeLayout) findViewById(R.id.rlDateTime); rlSyncError = (RelativeLayout) findViewById(R.id.rlSyncError); rlSyncError.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub AlertDialog.Builder builder = new AlertDialog.Builder(JobListActivity.this); builder.setTitle(R.string.title_sync_error); builder.setMessage(R.string.msg_sync_error); builder.setPositiveButton("OK", null); dgSyncError = builder.create(); dgSyncError.show(); } }); tvDate = (TextView) findViewById(R.id.tvDate); tvTime = (TextView) findViewById(R.id.tvTime); tvUpdating = (TextView) findViewById(R.id.lblUpdating); tvSyncFailed = (TextView) findViewById(R.id.lblSyncError); handler = new Handler(); handler.postDelayed(runnable, BundleKeys.mins_to_sync * 60 * 1000); handler.postDelayed(runnable_logs, 5 * 60 * 1000); jobListView = (ListView) findViewById(R.id.jobListView); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); jobListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { // TODO: evaluate whether to save search text in // UserState to repopulate on back press. itemClicked = true; if (searchTask != null) { searchTask.cancel(true); } Log.d("", "-- Job ItemClick --"); List<Long> jobList = thisActivity.getJobIdList(); Preconditions.checkNotNull(jobList, "null List<Job> when adapter view clicked."); Job job = AndroidState.getInstance().getUserState().getProvider(currentAccount) .getJob(jobList.get(position)); if (job != null) { Preconditions.checkNotNull(job, "null item in List<Job> when adapter view clicked."); if (job.isFlagSet(Job.Flags.UPLOAD_COMPLETED) || job.isFlagSet(Job.Flags.UPLOAD_IN_PROGRESS) || (job.isFlagSet(Job.Flags.UPLOAD_PENDING) && BundleKeys.which == 6)) { Toast.makeText(thisActivity, "Cannot open a completed dictation.", Toast.LENGTH_SHORT) .show(); return; } else if (job.isFlagSet(Job.Flags.LOCALLY_DELETED)) { return; } Intent intent = new Intent(thisActivity, JobDisplayActivity.class); Bundle b = new Bundle(); if (!job.isFlagSet(Flags.HOLD)) job = job.setFlag(Flags.IS_FIRST); else job = job.clearFlag(Flags.IS_FIRST); try { AndroidState.getInstance().getUserState().getProvider(currentAccount).updateJob(job); } catch (DomainObjectWriteException e) { // TODO Auto-generated catch block e.printStackTrace(); } b.putBoolean("isFirst", true); b.putBoolean("isFromList", true); b.putBoolean("isNew", false); b.putLong(BundleKeys.SELECTED_JOB, job.id); b.putString(BundleKeys.SELECTED_JOB_ACCOUNT, currentAccount.getName()); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtras(b); thisActivity.startActivity(intent); thisActivity.finish(); } } }); jobListView.setMultiChoiceModeListener(new JobListMultiChoiceModeListener(this)); slidingMenu.setOnOpenListener(new OnOpenListener() { @Override public void onOpen() { // TODO Auto-generated method stub openSlide(); } }); lvSliding.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) { // TODO Auto-generated method stub switch (pos) { case 1: //getActionBar().setTitle("Today's Jobs"); tvAcTitle.setText("Today's Jobs"); BundleKeys.title = "Today's Jobs"; BundleKeys.which = 1; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); etSearch.setText(""); break; case 2: //getActionBar().setTitle("Tomorrow's Jobs"); tvAcTitle.setText("Tomorrow's Jobs"); BundleKeys.which = 2; BundleKeys.title = "Tomorrow's Jobs"; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); etSearch.setText(""); break; case 3: //getActionBar().setTitle("Stat Jobs"); tvAcTitle.setText("Stat Jobs"); BundleKeys.which = 3; BundleKeys.title = "Stat Jobs"; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); etSearch.setText(""); break; case 4: //getActionBar().setTitle("All Jobs"); tvAcTitle.setText("All Jobs"); BundleKeys.which = 4; BundleKeys.title = "All Jobs"; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); etSearch.setText(""); break; case 6: //getActionBar().setTitle("Hold Jobs"); tvAcTitle.setText("Hold Jobs"); BundleKeys.which = 5; BundleKeys.title = "Hold Jobs"; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); etSearch.setText(""); break; case 7: //getActionBar().setTitle("Deleted Jobs"); tvAcTitle.setText("Deleted Jobs"); BundleKeys.which = 7; BundleKeys.title = "Deleted Jobs"; // Hide "Add Job" menu item //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(false); ivAddJob.setVisibility(View.GONE); jobListView.setChoiceMode(ListView.CHOICE_MODE_NONE); etSearch.setText(""); break; case 8: //getActionBar().setTitle("Completed Jobs"); tvAcTitle.setText("Completed Jobs"); BundleKeys.which = 6; BundleKeys.title = "Completed Jobs"; // Hide "Add Job" menu item //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(false); ivAddJob.setVisibility(View.GONE); jobListView.setChoiceMode(ListView.CHOICE_MODE_NONE); etSearch.setText(""); break; case 10: isSetting = true; //getActionBar().setTitle("Settings"); tvAcTitle.setText("Settings Jobs"); startActivity(new Intent(JobListActivity.this, EntradaSettings.class) .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); finish(); break; case 11: // Check if there are any held jobs or any uploads in // progress boolean isHeld = true, isPending = true; try { List<Job> jobs = AndroidState.getInstance().getUserState().getProvider(currentAccount) .getJobs(); for (Job j : jobs) { if (j.isPending()) isPending = false; if (j.isFlagSet(Job.Flags.HOLD)) isHeld = false; } } catch (Exception ex) { ACRA.getErrorReporter().handleSilentException(ex); isPending = false; isHeld = false; } if (SyncService.isRunning()) { AlertDialog.Builder builder = new AlertDialog.Builder(JobListActivity.this); builder.setTitle(R.string.del_acc_err_title); builder.setMessage(R.string.manage_q_upload_error); builder.setPositiveButton("OK", null); builder.setCancelable(true); dgManageQ = builder.create(); dgManageQ.show(); } else if (isPending && isHeld) { Intent qIntent = new Intent(JobListActivity.this, ManageQueuesActivity.class); qIntent.putExtra("from_settings", false); qIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(qIntent); finish(); } else if (!isHeld) { AlertDialog.Builder builder = new AlertDialog.Builder(JobListActivity.this); builder.setTitle(R.string.del_acc_err_title); builder.setMessage(R.string.manage_q_hold_error); builder.setPositiveButton("OK", null); builder.setCancelable(true); dgManageQ = builder.create(); dgManageQ.show(); } else if (!isPending) { AlertDialog.Builder builder = new AlertDialog.Builder(JobListActivity.this); builder.setTitle(R.string.del_acc_err_title); builder.setMessage(R.string.manage_q_upload_error); builder.setPositiveButton("OK", null); builder.setCancelable(true); dgManageQ = builder.create(); dgManageQ.show(); } break; default: //getActionBar().setTitle("Today's Jobs"); tvAcTitle.setText("Today's Jobs"); BundleKeys.title = "Today's Jobs"; BundleKeys.which = 1; //menuItem = j_Menu.findItem(R.id.addJobMenuItem); //menuItem.setVisible(true); ivAddJob.setVisibility(View.VISIBLE); jobListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); } Log.e(LOG_NAME, Integer.toString(BundleKeys.which) + " - " + BundleKeys.title); isSync = false; slidingMenu.toggle(true); /* * Log.e("isSetting", Boolean.toString(isSetting)); * if(BundleKeys.which != 8 && BundleKeys.which != 9 && * !isSetting) etSearch.setText(""); */ } }); rlSearch = (RelativeLayout) findViewById(R.id.rlSearch); etSearch = (EditText) findViewById(R.id.etSearch); etSearch.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { //launchSearchTask(); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub try { Thread.sleep(200); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } launchSearchTask(); } }); GetResourcesTask task = new GetResourcesTask(); task.execute(); }
From source file:com.amaze.carbonfilemanager.fragments.MainFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(false);//w w w.j a v a 2 s . c o m //MAIN_ACTIVITY = (MainActivity) getActivity(); initNoFileLayout(); SHOW_HIDDEN = sharedPref.getBoolean("showHidden", false); COLORISE_ICONS = sharedPref.getBoolean("coloriseIcons", true); mFolderBitmap = BitmapFactory.decodeResource(res, R.drawable.ic_grid_folder_new); goback = res.getString(R.string.goback); folder = new BitmapDrawable(res, mFolderBitmap); getSortModes(); DARK_IMAGE = new BitmapDrawable(res, BitmapFactory.decodeResource(res, R.drawable.ic_doc_image_dark)); DARK_VIDEO = new BitmapDrawable(res, BitmapFactory.decodeResource(res, R.drawable.ic_doc_video_dark)); this.setRetainInstance(false); HFile f = new HFile(OpenMode.UNKNOWN, CURRENT_PATH); f.generateMode(getActivity()); MAIN_ACTIVITY.initiatebbar(); ic = new IconHolder(getActivity(), SHOW_THUMBS, !IS_LIST); if (utilsProvider.getAppTheme().equals(AppTheme.LIGHT) && !IS_LIST) { listView.setBackgroundColor(Utils.getColor(getContext(), R.color.grid_background_light)); } else { listView.setBackgroundDrawable(null); } listView.setHasFixedSize(true); columns = Integer.parseInt(sharedPref.getString("columns", "-1")); if (IS_LIST) { mLayoutManager = new LinearLayoutManager(getActivity()); listView.setLayoutManager(mLayoutManager); } else { if (columns == -1 || columns == 0) mLayoutManagerGrid = new GridLayoutManager(getActivity(), 3); else mLayoutManagerGrid = new GridLayoutManager(getActivity(), columns); listView.setLayoutManager(mLayoutManagerGrid); } // use a linear layout manager //View footerView = getActivity().getLayoutInflater().inflate(R.layout.divider, null);// TODO: 23/5/2017 use or delete dividerItemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST, false, SHOW_DIVIDERS); listView.addItemDecoration(dividerItemDecoration); mSwipeRefreshLayout.setColorSchemeColors(Color.parseColor(fabSkin)); DefaultItemAnimator animator = new DefaultItemAnimator(); listView.setItemAnimator(animator); mToolbarContainer.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if ((columns == 0 || columns == -1)) { int screen_width = listView.getWidth(); int dptopx = Utils.dpToPx(115, getContext()); columns = screen_width / dptopx; if (columns == 0 || columns == -1) columns = 3; if (!IS_LIST) mLayoutManagerGrid.setSpanCount(columns); } if (savedInstanceState != null && !IS_LIST) retrieveFromSavedInstance(savedInstanceState); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { mToolbarContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { mToolbarContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this); } } }); if (savedInstanceState == null) { loadlist(CURRENT_PATH, false, openMode); } else { if (IS_LIST) retrieveFromSavedInstance(savedInstanceState); } }
From source file:com.grass.caishi.cc.activity.RegisterActivity.java
/** * onActivityResult/* ww w. j a v a 2s . co m*/ */ public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == USERPIC_REQUEST_CODE_CAMERA) { // ? if (cameraFile != null && cameraFile.exists()) { // Log.d("cameraFile"+cameraFile.getAbsolutePath()); // ?uri imageUri = Uri.fromFile(cameraFile); cropImageUri(Uri.fromFile(cameraFile), 300, 300, USERPIC_REQUEST_CODE_CUT); } } else if (requestCode == USERPIC_REQUEST_CODE_LOCAL) { // ? if (data != null) { Uri selectedImage = data.getData(); if (selectedImage != null) { cropImageUri(selectedImage, 300, 300, USERPIC_REQUEST_CODE_CUT); // Log.d("log","selectedImage"+selectedImage); } } } else if (requestCode == USERPIC_REQUEST_CODE_CUT) {// ? // ? if (data != null) { Bitmap bitmap = data.getParcelableExtra("data"); if (bitmap == null) { Toast.makeText(RegisterActivity.this, "??", Toast.LENGTH_SHORT).show(); } else { user_logo.setBackgroundColor(Color.parseColor("#00000000")); user_logo.setImageBitmap(bitmap); lastFile = saveJPGE_After(bitmap, cameraFile); // ???? } } else { // Log.e(TAG, "CHOOSE_SMALL_PICTURE: data = " + data); } } }
From source file:com.filemanager.free.fragments.Main.java
void switchToGrid() { IS_LIST = false;//from ww w . j a v a2 s . co m ic = new IconHolder(getActivity(), SHOW_THUMBS, !IS_LIST); folder = ContextCompat.getDrawable(getContext(), R.drawable.ic_grid_folder_new); fixIcons(); if (theme1 == 1) { listView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.holo_dark_background)); } else { if (IS_LIST) listView.setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.background_light)); else listView.setBackgroundColor(Color.parseColor("#f2f2f2")); } if (mLayoutManagerGrid == null) if (columns == -1 || columns == 0) mLayoutManagerGrid = new GridLayoutManager(getActivity(), 3); else mLayoutManagerGrid = new GridLayoutManager(getActivity(), columns); listView.setLayoutManager(mLayoutManagerGrid); adapter = null; }