Created
February 10, 2016 18:00
-
-
Save pareshchouhan/39b041f1dbba94c7a9aa to your computer and use it in GitHub Desktop.
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 RemoteViews getViewAt(int i) { | |
RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.scores_list_widget_item); | |
//rv.setTextViewText(R.id.widget_item, mWidgetItems.get(position).text); | |
mScoresData.moveToPosition(i); | |
//Toast.makeText(mContext,"Score : " + Utilies.getScores(mScoresData.getInt(scoresAdapter.COL_HOME_GOALS),mScoresData.getInt(scoresAdapter.COL_AWAY_GOALS)),Toast.LENGTH_SHORT).show(); | |
rv.setTextViewText(R.id.home_name,mScoresData.getString(scoresAdapter.COL_HOME)); | |
//rv.setTextViewText(R.id.home_name,"WTF??"); | |
rv.setTextViewText(R.id.away_name,mScoresData.getString(scoresAdapter.COL_AWAY)); | |
rv.setTextViewText(R.id.data_textview,mScoresData.getString(scoresAdapter.COL_DATE)); | |
rv.setTextViewText(R.id.score_textview, Utilies.getScores(mScoresData.getInt(scoresAdapter.COL_HOME_GOALS),mScoresData.getInt(scoresAdapter.COL_AWAY_GOALS))); | |
rv.setImageViewResource(R.id.home_crest,Utilies.getTeamCrestByTeamName( | |
mScoresData.getString(scoresAdapter.COL_HOME))); | |
rv.setImageViewResource(R.id.away_crest,Utilies.getTeamCrestByTeamName( | |
mScoresData.getString(scoresAdapter.COL_AWAY))); | |
// Return the remote views object. | |
return rv; | |
//return null; | |
} | |
------------ | |
list_widget_item | |
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:elevation="4dp" | |
android:background="@drawable/list_item" | |
> | |
<LinearLayout | |
android:orientation="horizontal" android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:paddingTop="5dp" | |
> | |
<LinearLayout | |
android:layout_width="wrap_content" | |
android:layout_height="match_parent" | |
android:layout_weight="1" | |
android:orientation="vertical"> | |
<ImageView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_gravity="center" | |
android:id="@+id/home_crest"/> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_gravity="center" | |
android:textSize="@dimen/TeamNames" | |
android:gravity="center" | |
android:text="@string/test_text" | |
android:id="@+id/home_name"/> | |
</LinearLayout> | |
<LinearLayout | |
android:layout_width="wrap_content" | |
android:layout_height="match_parent" | |
android:layout_weight="1" | |
android:orientation="vertical"> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
android:text="@string/test_text" | |
android:layout_gravity="center" | |
android:gravity="center" | |
android:textSize="@dimen/Score" | |
android:id="@+id/score_textview"/> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
android:text="@string/test_text" | |
android:layout_gravity="center" | |
android:gravity="center" | |
android:id="@+id/data_textview"/> | |
</LinearLayout> | |
<LinearLayout | |
android:layout_width="wrap_content" | |
android:layout_height="match_parent" | |
android:layout_weight="1" | |
android:orientation="vertical"> | |
<ImageView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_gravity="center" | |
android:id="@+id/away_crest"/> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_gravity="center" | |
android:gravity="center" | |
android:text="@string/test_text" | |
android:textSize="@dimen/TeamNames" | |
android:id="@+id/away_name"/> | |
</LinearLayout> | |
</LinearLayout> | |
</LinearLayout> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment