This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void onBackPressed() { | |
| //for testing purpose | |
| //returns the number of fragments on the Activity | |
| int count = fragmentManager.getBackStackEntryCount(); | |
| //displays the fragments that are present on the activity with their names | |
| for (int i=count-1;i>=0;i--){ | |
| String name = fragmentManager.getBackStackEntryAt(i).getName(); | |
| Config.l("Count :"+i+" name :"+name); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:shape="rectangle" > | |
| <gradient | |
| android:angle="90" | |
| android:endColor="@android:color/transparent" | |
| android:startColor="@android:color/black" /> | |
| <corners android:radius="0dp" /> | |
| </shape> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void setTime(String time) { | |
| if (!TextUtils.isEmpty(time)) { | |
| CharSequence relativeTimeSpanString = DateUtils.getRelativeTimeSpanString(Long.valueOf(time), System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS, DateUtils.FORMAT_ABBREV_RELATIVE); | |
| this.time = relativeTimeSpanString.toString(); | |
| } else { | |
| this.time = ""; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Will contain the raw JSON response as a string. | |
| String forecastJsonStr = null; | |
| String format = "json"; | |
| String units = "metric"; | |
| int numDays = 7; | |
| // Construct the URL for the OpenWeatherMap query | |
| // Possible parameters are avaiable at OWM's forecast API page, at | |
| // http://openweathermap.org/API#forecast |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <EditText | |
| android:id="@+id/editText" | |
| android:layout_width="match_parent" | |
| android:layout_height="0dp" | |
| android:layout_weight="1" | |
| android:background="@android:color/transparent" | |
| android:focusable="true" | |
| android:gravity="top" | |
| android:hint="@string/post_update" | |
| android:inputType="textCapSentences" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String str_text = "<a href=http://www.google.com >Google</a>"; | |
| textView.setMovementMethod(LinkMovementMethod.getInstance()); | |
| textView.setText(Html.fromHtml(str_text)); | |
| textView.setLinkTextColor(Color.BLUE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void onBindViewHolder(ViewHolderDetail holder, int position) { | |
| DataModel item = items.get(position); | |
| if (item.getHeight() != 0 && item.getWidth() != 0) { | |
| float width = activity.getWindowManager().getDefaultDisplay().getWidth(); | |
| float margin = ConvertionUtil.convertDpToPixel(8, activity); | |
| width = (width - (3 * margin)) / 2; | |
| float i = width / ((float) item.getWidth()); | |
| float imageHeight = i * (item.getHeight()); | |
| RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) holder.image.getLayoutParams(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.app.Activity; | |
| import android.support.design.widget.TextInputLayout; | |
| import android.view.View; | |
| import android.view.WindowManager; | |
| import android.widget.EditText; | |
| import java.util.regex.Matcher; | |
| import java.util.regex.Pattern; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Simple GET request example: | |
| $http({ | |
| method: 'GET', | |
| url: '/someUrl' | |
| }).then(function successCallback(response) { | |
| // this callback will be called asynchronously | |
| // when the response is available | |
| }, function errorCallback(response) { | |
| // called asynchronously if an error occurs | |
| // or server returns response with an error status. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.content.Context; | |
| import android.graphics.Bitmap; | |
| import android.graphics.BitmapFactory; | |
| import android.graphics.Matrix; | |
| import android.net.Uri; | |
| import android.util.Log; | |
| import java.io.ByteArrayOutputStream; | |
| import java.io.FileNotFoundException; |