List of usage examples for android.graphics Color TRANSPARENT
int TRANSPARENT
To view the source code for android.graphics Color TRANSPARENT.
Click Source Link
From source file:arc.noaa.weather.activities.MainActivity.java
private void aboutDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Forecastie"); final WebView webView = new WebView(this); String about = "<p>A lightweight, opensource weather app.</p>" + "<p>Developed by <a href='mailto:t.martykan@gmail.com'>Tomas Martykan</a></p>" + "<p>Data provided by <a href='http://openweathermap.org/'>OpenWeatherMap</a>, under the <a href='http://creativecommons.org/licenses/by-sa/2.0/'>Creative Commons license</a>" + "<p>Icons are <a href='https://erikflowers.github.io/weather-icons/'>Weather Icons</a>, by <a href='http://www.twitter.com/artill'>Lukas Bischoff</a> and <a href='http://www.twitter.com/Erik_UX'>Erik Flowers</a>, under the <a href='http://scripts.sil.org/OFL'>SIL OFL 1.1</a> licence."; TypedArray ta = obtainStyledAttributes(new int[] { android.R.attr.textColorPrimary, R.attr.colorAccent }); String textColor = String.format("#%06X", (0xFFFFFF & ta.getColor(0, Color.BLACK))); String accentColor = String.format("#%06X", (0xFFFFFF & ta.getColor(1, Color.BLUE))); ta.recycle();//from w w w.j av a2s . c o m about = "<style media=\"screen\" type=\"text/css\">" + "body {\n" + " color:" + textColor + ";\n" + "}\n" + "a:link {color:" + accentColor + "}\n" + "</style>" + about; webView.setBackgroundColor(Color.TRANSPARENT); webView.loadData(about, "text/html", "UTF-8"); alert.setView(webView, 32, 0, 32, 0); alert.setPositiveButton(R.string.dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); }
From source file:com.master.metehan.filtereagle.AdapterRule.java
@Override public void onBindViewHolder(final ViewHolder holder, final int position) { // Get rule//from w w w . j a v a 2 s. co m final Rule rule = listFiltered.get(position); // Handle expanding/collapsing holder.llApplication.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { rule.expanded = !rule.expanded; notifyItemChanged(position); } }); // Show if non default rules holder.itemView.setBackgroundColor(rule.changed ? colorChanged : Color.TRANSPARENT); // Show expand/collapse indicator holder.ivExpander.setImageLevel(rule.expanded ? 1 : 0); // Show application icon if (rule.info.applicationInfo == null || rule.info.applicationInfo.icon == 0) Picasso.with(context).load(android.R.drawable.sym_def_app_icon).into(holder.ivIcon); else { Uri uri = Uri .parse("android.resource://" + rule.info.packageName + "/" + rule.info.applicationInfo.icon); Picasso.with(context).load(uri).resize(iconSize, iconSize).into(holder.ivIcon); } // Show application label holder.tvName.setText(rule.name); holder.tvDescription.setVisibility(rule.description == null ? View.GONE : View.VISIBLE); holder.tvDescription.setText(rule.description); // Show application state int color = rule.system ? colorOff : colorText; if (!rule.internet || !rule.enabled) color = Color.argb(128, Color.red(color), Color.green(color), Color.blue(color)); holder.tvName.setTextColor(color); // Show rule count new AsyncTask<Object, Object, Long>() { @Override protected void onPreExecute() { holder.tvHosts.setVisibility(View.GONE); } @Override protected Long doInBackground(Object... objects) { return DatabaseHelper.getInstance(context).getRuleCount(rule.info.applicationInfo.uid); } @Override protected void onPostExecute(Long rules) { if (rules > 0) { holder.tvHosts.setVisibility(View.VISIBLE); holder.tvHosts.setText(Long.toString(rules)); } } }.execute(); // Wi-Fi settings holder.cbWifi.setAlpha(wifiActive ? 1 : 0.5f); holder.cbWifi.setOnCheckedChangeListener(null); holder.cbWifi.setChecked(rule.wifi_blocked); holder.cbWifi.setEnabled(rule.apply); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(CompoundButtonCompat.getButtonDrawable(holder.cbWifi)); DrawableCompat.setTint(wrap, rule.apply ? (rule.wifi_blocked ? colorOff : colorOn) : colorGrayed); } holder.cbWifi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { rule.wifi_blocked = isChecked; updateRule(rule, true, listAll); } }); holder.ivScreenWifi.setEnabled(rule.apply); holder.ivScreenWifi.setAlpha(wifiActive ? 1 : 0.5f); holder.ivScreenWifi.setVisibility(rule.screen_wifi && rule.wifi_blocked ? View.VISIBLE : View.INVISIBLE); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(holder.ivScreenWifi.getDrawable()); DrawableCompat.setTint(wrap, rule.apply ? colorOn : colorGrayed); } // Mobile settings holder.cbOther.setAlpha(otherActive ? 1 : 0.5f); holder.cbOther.setOnCheckedChangeListener(null); holder.cbOther.setChecked(rule.other_blocked); holder.cbOther.setEnabled(rule.apply); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(CompoundButtonCompat.getButtonDrawable(holder.cbOther)); DrawableCompat.setTint(wrap, rule.apply ? (rule.other_blocked ? colorOff : colorOn) : colorGrayed); } holder.cbOther.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { rule.other_blocked = isChecked; updateRule(rule, true, listAll); } }); holder.ivScreenOther.setEnabled(rule.apply); holder.ivScreenOther.setAlpha(otherActive ? 1 : 0.5f); holder.ivScreenOther.setVisibility(rule.screen_other && rule.other_blocked ? View.VISIBLE : View.INVISIBLE); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(holder.ivScreenOther.getDrawable()); DrawableCompat.setTint(wrap, rule.apply ? colorOn : colorGrayed); } holder.tvRoaming.setTextColor(rule.apply ? colorOff : colorGrayed); holder.tvRoaming.setAlpha(otherActive ? 1 : 0.5f); holder.tvRoaming.setVisibility( rule.roaming && (!rule.other_blocked || rule.screen_other) ? View.VISIBLE : View.INVISIBLE); // Expanded configuration section holder.llConfiguration.setVisibility(rule.expanded ? View.VISIBLE : View.GONE); // Show application details holder.tvUid .setText(rule.info.applicationInfo == null ? "?" : Integer.toString(rule.info.applicationInfo.uid)); holder.tvPackage.setText(rule.info.packageName); holder.tvVersion.setText(rule.info.versionName + '/' + rule.info.versionCode); // Show application state holder.tvDisabled.setVisibility(rule.enabled ? View.GONE : View.VISIBLE); holder.tvInternet.setVisibility(rule.internet ? View.GONE : View.VISIBLE); // Apply holder.cbApply .setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? View.GONE : View.VISIBLE); holder.cbApply.setEnabled(rule.pkg); holder.cbApply.setOnCheckedChangeListener(null); holder.cbApply.setChecked(rule.apply); holder.cbApply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { rule.apply = isChecked; updateRule(rule, true, listAll); } }); // Show related holder.btnRelated.setVisibility(rule.relateduids ? View.VISIBLE : View.GONE); holder.btnRelated.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent main = new Intent(context, ActivityMain.class); main.putExtra(ActivityMain.EXTRA_SEARCH, Integer.toString(rule.info.applicationInfo.uid)); context.startActivity(main); } }); // Launch application settings final Intent settings = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); settings.setData(Uri.parse("package:" + rule.info.packageName)); holder.ibSettings.setVisibility( settings.resolveActivity(context.getPackageManager()) == null ? View.GONE : View.VISIBLE); holder.ibSettings.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { context.startActivity(settings); } }); // Launch application holder.ibLaunch.setVisibility(rule.intent == null ? View.GONE : View.VISIBLE); holder.ibLaunch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { context.startActivity(rule.intent); } }); // Show Wi-Fi screen on condition holder.cbScreenWifi.setOnCheckedChangeListener(null); holder.cbScreenWifi.setChecked(rule.screen_wifi); holder.cbScreenWifi.setEnabled(rule.wifi_blocked && rule.apply); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(holder.ivWifiLegend.getDrawable()); DrawableCompat.setTint(wrap, colorOn); } holder.cbScreenWifi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { rule.screen_wifi = isChecked; updateRule(rule, true, listAll); } }); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(holder.ivOtherLegend.getDrawable()); DrawableCompat.setTint(wrap, colorOn); } // Show mobile screen on condition holder.cbScreenOther.setOnCheckedChangeListener(null); holder.cbScreenOther.setChecked(rule.screen_other); holder.cbScreenOther.setEnabled(rule.other_blocked && rule.apply); holder.cbScreenOther.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { rule.screen_other = isChecked; updateRule(rule, true, listAll); } }); // Show roaming condition holder.cbRoaming.setOnCheckedChangeListener(null); holder.cbRoaming.setChecked(rule.roaming); holder.cbRoaming.setEnabled((!rule.other_blocked || rule.screen_other) && rule.apply); holder.cbRoaming.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @TargetApi(Build.VERSION_CODES.M) public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { rule.roaming = isChecked; updateRule(rule, true, listAll); // Request permissions if (isChecked && !Util.hasPhoneStatePermission(context)) context.requestPermissions(new String[] { Manifest.permission.READ_PHONE_STATE }, ActivityMain.REQUEST_ROAMING); } }); // Reset rule holder.btnClear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Util.areYouSure(view.getContext(), R.string.msg_clear_rules, new Util.DoubtListener() { @Override public void onSure() { holder.cbApply.setChecked(true); holder.cbWifi.setChecked(rule.wifi_default); holder.cbOther.setChecked(rule.other_default); holder.cbScreenWifi.setChecked(rule.screen_wifi_default); holder.cbScreenOther.setChecked(rule.screen_other_default); holder.cbRoaming.setChecked(rule.roaming_default); } }); } }); // Show access rules if (rule.expanded) { // Access the database when expanded only final AdapterAccess badapter = new AdapterAccess(context, DatabaseHelper.getInstance(context).getAccess(rule.info.applicationInfo.uid)); if (filter) holder.lvAccess.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, final int bposition, long bid) { PackageManager pm = context.getPackageManager(); Cursor cursor = (Cursor) badapter.getItem(bposition); final long id = cursor.getLong(cursor.getColumnIndex("ID")); int version = cursor.getInt(cursor.getColumnIndex("version")); int protocol = cursor.getInt(cursor.getColumnIndex("protocol")); String daddr = cursor.getString(cursor.getColumnIndex("daddr")); int dport = cursor.getInt(cursor.getColumnIndex("dport")); long time = cursor.getLong(cursor.getColumnIndex("time")); int block = cursor.getInt(cursor.getColumnIndex("block")); PopupMenu popup = new PopupMenu(context, context.findViewById(R.id.vwPopupAnchor)); popup.inflate(R.menu.access); popup.getMenu().findItem(R.id.menu_host) .setTitle(Util.getProtocolName(protocol, version, false) + " " + daddr + (dport > 0 ? "/" + dport : "")); // Whois final Intent lookupIP = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.tcpiputils.com/whois-lookup/" + daddr)); if (pm.resolveActivity(lookupIP, 0) == null) popup.getMenu().removeItem(R.id.menu_whois); else popup.getMenu().findItem(R.id.menu_whois) .setTitle(context.getString(R.string.title_log_whois, daddr)); // Lookup port final Intent lookupPort = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.speedguide.net/port.php?port=" + dport)); if (dport <= 0 || pm.resolveActivity(lookupPort, 0) == null) popup.getMenu().removeItem(R.id.menu_port); else popup.getMenu().findItem(R.id.menu_port) .setTitle(context.getString(R.string.title_log_port, dport)); popup.getMenu().findItem(R.id.menu_time) .setTitle(SimpleDateFormat.getDateTimeInstance().format(time)); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.menu_whois: context.startActivity(lookupIP); return true; case R.id.menu_port: context.startActivity(lookupPort); return true; case R.id.menu_allow: if (IAB.isPurchased(ActivityPro.SKU_FILTER, context)) { DatabaseHelper.getInstance(context).setAccess(id, 0); ServiceSinkhole.reload("allow host", context); } else context.startActivity(new Intent(context, ActivityPro.class)); return true; case R.id.menu_block: if (IAB.isPurchased(ActivityPro.SKU_FILTER, context)) { DatabaseHelper.getInstance(context).setAccess(id, 1); ServiceSinkhole.reload("block host", context); } else context.startActivity(new Intent(context, ActivityPro.class)); return true; case R.id.menu_reset: DatabaseHelper.getInstance(context).setAccess(id, -1); ServiceSinkhole.reload("reset host", context); return true; } return false; } }); if (block == 0) popup.getMenu().removeItem(R.id.menu_allow); else if (block == 1) popup.getMenu().removeItem(R.id.menu_block); popup.show(); } }); else holder.lvAccess.setOnItemClickListener(null); holder.lvAccess.setAdapter(badapter); } else { holder.lvAccess.setAdapter(null); holder.lvAccess.setOnItemClickListener(null); } // Show logging is disabled final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean log_app = prefs.getBoolean("log_app", false); holder.tvNolog.setVisibility(log_app ? View.GONE : View.VISIBLE); holder.tvNolog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { context.startActivity(new Intent(context, ActivitySettings.class)); } }); // Show disable access notifications setting holder.cbNotify.setOnCheckedChangeListener(null); holder.cbNotify.setEnabled(prefs.getBoolean("notify_access", false) && rule.apply); holder.cbNotify.setChecked(rule.notify); holder.cbNotify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { rule.notify = isChecked; updateRule(rule, true, listAll); } }); // Clear access log holder.btnClearAccess.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Util.areYouSure(view.getContext(), R.string.msg_reset_access, new Util.DoubtListener() { @Override public void onSure() { DatabaseHelper.getInstance(context).clearAccess(rule.info.applicationInfo.uid, true); if (rv != null) rv.scrollToPosition(position); } }); } }); // Show traffic statistics holder.tvStatistics.setText(context.getString(R.string.msg_mbday, rule.upspeed, rule.downspeed)); }
From source file:com.appeaser.sublimepickerlibrary.utilities.SUtils.java
private static Drawable createOverflowButtonBgBC(int pressedStateColor) { StateListDrawable sld = new StateListDrawable(); sld.addState(new int[] { android.R.attr.state_pressed }, createBgDrawable(pressedStateColor, 0, CORNER_RADIUS, 0, 0)); sld.addState(new int[] {}, new ColorDrawable(Color.TRANSPARENT)); return sld;/*from www.j av a 2 s. c o m*/ }
From source file:com.google.samples.apps.topeka.activity.QuizActivity.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void prepareCircularReveal(View startView, FrameLayout targetView) { int centerX = (startView.getLeft() + startView.getRight()) / 2; // Subtract the start view's height to adjust for relative coordinates on screen. int centerY = (startView.getTop() + startView.getBottom()) / 2 - startView.getHeight(); float endRadius = (float) Math.hypot(centerX, centerY); mCircularReveal = ViewAnimationUtils.createCircularReveal(targetView, centerX, centerY, startView.getWidth(), endRadius); mCircularReveal.setInterpolator(new FastOutLinearInInterpolator()); mCircularReveal.addListener(new AnimatorListenerAdapter() { @Override/*from www . j a va 2s .c o m*/ public void onAnimationEnd(Animator animation) { mIcon.setVisibility(View.GONE); mCircularReveal.removeListener(this); } }); // Adding a color animation from the FAB's color to transparent creates a dissolve like // effect to the circular reveal. int accentColor = ContextCompat.getColor(this, mCategory.getTheme().getAccentColor()); mColorChange = ObjectAnimator.ofInt(targetView, ViewUtils.FOREGROUND_COLOR, accentColor, Color.TRANSPARENT); mColorChange.setEvaluator(new ArgbEvaluator()); mColorChange.setInterpolator(mInterpolator); }
From source file:com.lcl.thumbweather.MainActivity.java
private void aboutDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("ThumbWeather"); final WebView webView = new WebView(this); String about = "<p>A light,open source App.</p>" + "<p>Data provided by <a href='http://openweathermap.org/'>OpenWeatherMap</a>, under the <a href='http://creativecommons.org/licenses/by-sa/2.0/'>Creative Commons license</a>" + "<p>Icons are <a href='https://erikflowers.github.io/weather-icons/'>Weather Icons</a>, by <a href='http://www.twitter.com/artill'>Lukas Bischoff</a> and <a href='http://www.twitter.com/Erik_UX'>Erik Flowers</a>, under the <a href='http://scripts.sil.org/OFL'>SIL OFL 1.1</a> licence."; if (darkTheme) { // Style text color for dark theme about = "<style media=\"screen\" type=\"text/css\">" + "body {\n" + " color:white;\n" + "}\n" + "a:link {color:cyan}\n" + "</style>" + about; }/*from w ww . j a va 2 s . co m*/ webView.setBackgroundColor(Color.TRANSPARENT); webView.loadData(about, "text/html", "UTF-8"); alert.setView(webView, 32, 0, 32, 0); alert.setPositiveButton(R.string.dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); }
From source file:com.ramzcalender.WeekFragment.java
@Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); /**//from ww w . j a va2 s.c o m * Reset date to first day of week when week goes from the view */ if (isVisibleToUser) { if (dateInWeekArray.size() > 0) RWeekCalendar.getInstance().getSelectedDate(dateInWeekArray.get(0), true); } else { if (mSelectedDate != null) { if (RWeekCalendar.calenderType == RWeekCalendar.NORMAL_CALENDER) { //Resetting the day when current week scrolled or hidden if (datePosition != RWeekCalendar.CURRENT_WEEK_POSITION) { textViewArray[0].setBackgroundResource(selectorDateIndicatorValue); textViewArray[1].setBackgroundColor(Color.TRANSPARENT); textViewArray[2].setBackgroundColor(Color.TRANSPARENT); textViewArray[3].setBackgroundColor(Color.TRANSPARENT); textViewArray[4].setBackgroundColor(Color.TRANSPARENT); textViewArray[5].setBackgroundColor(Color.TRANSPARENT); textViewArray[6].setBackgroundColor(Color.TRANSPARENT); } else { //if the scrolled week is the current week then reset the selection to the current date int position = new LocalDateTime().dayOfWeek().get(); textViewArray[position].setBackgroundResource(selectorDateIndicatorValue); mDateSelectedBackground(position); } } else { //if the scrolled week is the current week then reset the selection to the current date for FDFcalender textViewArray[0].setBackgroundResource(selectorDateIndicatorValue); textViewArray[1].setBackgroundColor(Color.TRANSPARENT); textViewArray[2].setBackgroundColor(Color.TRANSPARENT); textViewArray[3].setBackgroundColor(Color.TRANSPARENT); textViewArray[4].setBackgroundColor(Color.TRANSPARENT); textViewArray[5].setBackgroundColor(Color.TRANSPARENT); textViewArray[6].setBackgroundColor(Color.TRANSPARENT); } } } }
From source file:com.google.samples.apps.topeka.view.quiz.QuizActivity.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void prepareCircularReveal(View startView, FrameLayout targetView, int themeAccentColor) { int centerX = (startView.getLeft() + startView.getRight()) / 2; // Subtract the start view's height to adjust for relative coordinates on screen. int centerY = (startView.getTop() + startView.getBottom()) / 2 - startView.getHeight(); float endRadius = (float) Math.hypot(centerX, centerY); mCircularReveal = ViewAnimationUtils.createCircularReveal(targetView, centerX, centerY, startView.getWidth(), endRadius); mCircularReveal.setInterpolator(new FastOutLinearInInterpolator()); mCircularReveal.addListener(new AnimatorListenerAdapter() { @Override//from w ww .j a v a 2s . co m public void onAnimationEnd(Animator animation) { mIcon.setVisibility(View.GONE); mCircularReveal.removeListener(this); } }); // Adding a color animation from the FAB's color to transparent creates a dissolve like // effect to the circular reveal. mColorChange = ObjectAnimator.ofInt(targetView, ViewUtils.FOREGROUND_COLOR, themeAccentColor, Color.TRANSPARENT); mColorChange.setEvaluator(new ArgbEvaluator()); mColorChange.setInterpolator(mInterpolator); }
From source file:com.eeshana.icstories.activities.UploadVideoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // this will copy the license file and the demo video file. // to the videokit work folder location. // without the license file the library will not work. //copyLicenseAndDemoFilesFromAssetsToSDIfNeeded(); setContentView(R.layout.upload_video_activity); height = SignInActivity.getScreenHeight(UploadVideoActivity.this); width = SignInActivity.getScreenWidth(UploadVideoActivity.this); mProgressDialog = new ProgressDialog(UploadVideoActivity.this); pDialog = new ProgressDialog(UploadVideoActivity.this); showCustomToast = new ShowCustomToast(); connectionDetector = new ConnectionDetector(UploadVideoActivity.this); // mProgressDialog=new ProgressDialog(UploadVideoActivity.this,AlertDialog.THEME_HOLO_LIGHT); // mProgressDialog.setFeatureDrawableResource(height,R.drawable.rounded_toast); prefs = getSharedPreferences("PREF", MODE_PRIVATE); regId = prefs.getString("regid", "NA"); SharedPreferences pref = getSharedPreferences("DB", 0); userid = pref.getString("userid", "1"); SharedPreferences assign_prefs = getSharedPreferences("ASSIGN", 0); assignment_id = assign_prefs.getString("ASSIGN_ID", ""); videoPath = getIntent().getStringExtra("VIDEOPATH"); // iCTextView=(TextView) findViewById(R.id.tvIC); // iCTextView.setTypeface(CaptureVideoActivity.ic_typeface,Typeface.BOLD); // storiesTextView=(TextView) findViewById(R.id.tvStories); // storiesTextView.setTypeface(CaptureVideoActivity.stories_typeface,Typeface.BOLD); // watsStoryTextView=(TextView) findViewById(R.id.tvWhatsStory); // watsStoryTextView.setTypeface(CaptureVideoActivity.stories_typeface,Typeface.ITALIC); // logoImageView=(ImageView) findViewById(R.id.ivLogo); // RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams((int) (width/1.9), (int) (height/9.5)); // lp.addRule(RelativeLayout.CENTER_HORIZONTAL); // lp.setMargins(0, 0, 0, 0); // logoImageView.setLayoutParams(lp); uploadtTextView = (TextView) findViewById(R.id.tvUpload); uploadtTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); // extension=getIntent().getStringExtra("EXTENSION"); // folderPath = Environment.getExternalStorageDirectory().getPath()+"/ICStoriesFolder"; // if (!FileUtils.checkIfFolderExists(folderPath)) { // boolean isFolderCreated = FileUtils.createFolder(folderPath); // Log.i(Prefs.TAG, folderPath + " created? " + isFolderCreated); // if (isFolderCreated) { ////from w ww . j av a2 s .c o m // } // } //command for rotating video 90 degree //String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -vf transpose=1 -s 160x120 -r 30 -aspect 4:3 -ab 48000 -ac 2 -ar 22050 -b 2097k "+folderPath+"/out."+extension; //Change Video Resolution: //String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -vf transpose=3 -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 "+folderPath+"/res."+extension; //command for compressing video // String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 "+folderPath+"/test."+extension; // setCommand(commandStr); // runTranscoing(); thumb = ThumbnailUtils.createVideoThumbnail(videoPath, MediaStore.Images.Thumbnails.MINI_KIND); System.out.println("THUMB IMG in uplaod== " + thumb); titleEditText = (EditText) findViewById(R.id.etTitle); titleEditText.setTypeface(CaptureVideoActivity.stories_typeface); descriptionEditText = (EditText) findViewById(R.id.etDescripton); descriptionEditText.setTypeface(CaptureVideoActivity.stories_typeface); locationEditText = (EditText) findViewById(R.id.etLocation); locationEditText.setTypeface(CaptureVideoActivity.stories_typeface); isAssignmentButton = (Button) findViewById(R.id.buttonCheck); isAssignmentButton.setTypeface(CaptureVideoActivity.stories_typeface); isAssignmentButton.setOnClickListener(this); dailyAssignTextView = (TextView) findViewById(R.id.tvDailyAssignment); dailyAssignTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); uploadButton = (Button) findViewById(R.id.buttonUpload); uploadButton.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); RelativeLayout uploadRelativeLayout = (RelativeLayout) findViewById(R.id.rlUpload); RelativeLayout.LayoutParams lp9 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, height / 17); lp9.addRule(RelativeLayout.BELOW, R.id.rlDailyAssignment); lp9.setMargins(width / 7, 30, width / 7, 0); uploadRelativeLayout.setLayoutParams(lp9); uploadButton.setOnClickListener(this); //bottom bar homeRelativeLayout = (RelativeLayout) findViewById(R.id.rlHome); homeRelativeLayout.setBackgroundResource(R.drawable.press_border); homeRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); homeTextView = (TextView) homeRelativeLayout.findViewById(R.id.tvHome); homeTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); homeTextView.setTextColor(Color.parseColor("#fffffe")); RelativeLayout.LayoutParams lp4 = new RelativeLayout.LayoutParams(width / 3, width / 5); lp4.addRule(RelativeLayout.ALIGN_LEFT); homeRelativeLayout.setLayoutParams(lp4); homeRelativeLayout.setOnClickListener(this); wallRelativeLayout = (RelativeLayout) findViewById(R.id.rlWall); wallRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); wallTextView = (TextView) wallRelativeLayout.findViewById(R.id.tvWall); wallTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); RelativeLayout.LayoutParams lp5 = new RelativeLayout.LayoutParams(width / 3, width / 5); lp5.addRule(RelativeLayout.RIGHT_OF, R.id.rlHome); wallRelativeLayout.setLayoutParams(lp5); wallRelativeLayout.setOnClickListener(this); settingsRelativeLayout = (RelativeLayout) findViewById(R.id.rlSettings); settingsRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); settingsTextView = (TextView) settingsRelativeLayout.findViewById(R.id.tvSettings); settingsTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); RelativeLayout.LayoutParams lp6 = new RelativeLayout.LayoutParams(width / 3, width / 5); lp6.addRule(RelativeLayout.RIGHT_OF, R.id.rlWall); settingsRelativeLayout.setLayoutParams(lp6); settingsRelativeLayout.setOnClickListener(this); // current location locationDialog = new Dialog(UploadVideoActivity.this); locationDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); locationDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); locationDialog.setContentView(R.layout.location_dialog); locationDialog.setCancelable(true); LinearLayout dialogLayout = (LinearLayout) locationDialog.findViewById(R.id.ll1); okButton = (Button) dialogLayout.findViewById(R.id.OkBtn); okButton.setOnClickListener(this); cancelButton = (Button) dialogLayout.findViewById(R.id.cancelBtn); cancelButton.setOnClickListener(this); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); boolean network_enabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (network_enabled) { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this); } else { showCustomToast.showToast(UploadVideoActivity.this, "Could not find current location. Please enable location services of your device."); } // else if(gps_enabled == false){ // locationDialog.show(); // } }