use of com.klinker.android.twitter.views.HoloTextView in project Talon-for-Twitter by klinker24.
the class ConversationFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
settings = AppSettings.getInstance(getActivity());
tweetId = getArguments().getLong("tweet_id", 0l);
isRunning = true;
layout = inflater.inflate(R.layout.conversation_fragment, null, false);
final AsyncListView replyList = (AsyncListView) layout.findViewById(R.id.listView);
final LinearLayout progressSpinner = (LinearLayout) layout.findViewById(R.id.list_progress);
final HoloTextView none = (HoloTextView) layout.findViewById(R.id.no_conversation);
none.setText(getResources().getString(R.string.no_tweets));
BitmapLruCache cache = App.getInstance(context).getBitmapCache();
ArrayListLoader loader = new ArrayListLoader(cache, context);
ItemManager.Builder builder = new ItemManager.Builder(loader);
builder.setPreloadItemsEnabled(true).setPreloadItemsCount(50);
builder.setThreadPoolSize(4);
replyList.setItemManager(builder.build());
getReplies(replyList, tweetId, progressSpinner, none);
return layout;
}
use of com.klinker.android.twitter.views.HoloTextView in project Talon-for-Twitter by klinker24.
the class DirectMessageConversation method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down);
countHandler = new Handler();
int currentOrientation = getResources().getConfiguration().orientation;
if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
}
context = this;
sharedPrefs = getSharedPreferences("com.klinker.android.twitter_world_preferences", 0);
settings = AppSettings.getInstance(this);
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if (menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception ex) {
// Ignore
}
if (settings.advanceWindowed) {
setUpWindow();
}
Utils.setUpPopupTheme(this, settings);
actionBar = getActionBar();
actionBar.setTitle(getResources().getString(R.string.lists));
setContentView(R.layout.dm_conversation);
attachImage = (ImageView) findViewById(R.id.attached_image);
if (!settings.isTwitterLoggedIn) {
Intent login = new Intent(context, LoginActivity.class);
startActivity(login);
finish();
}
listView = (AsyncListView) findViewById(R.id.listView);
sendButton = (ImageButton) findViewById(R.id.send_button);
composeBar = (HoloEditText) findViewById(R.id.tweet_content);
charRemaining = (HoloTextView) findViewById(R.id.char_remaining);
charRemaining.setVisibility(View.GONE);
BitmapLruCache cache = App.getInstance(context).getBitmapCache();
CursorListLoader loader = new CursorListLoader(cache, context);
ItemManager.Builder builder = new ItemManager.Builder(loader);
builder.setPreloadItemsEnabled(true).setPreloadItemsCount(50);
builder.setThreadPoolSize(4);
listView.setItemManager(builder.build());
listName = getIntent().getStringExtra("screenname");
actionBar.setTitle(getIntent().getStringExtra("name"));
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
new GetList().execute();
charRemaining.setText(140 - composeBar.getText().length() + "");
composeBar.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void afterTextChanged(Editable editable) {
countHandler.removeCallbacks(getCount);
countHandler.postDelayed(getCount, 300);
}
});
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String status = composeBar.getText().toString();
new SendDirectMessage().execute(status);
composeBar.setText("");
attachImage.setVisibility(View.GONE);
Toast.makeText(context, getString(R.string.sending), Toast.LENGTH_SHORT).show();
}
});
Utils.setActionBar(context);
}
use of com.klinker.android.twitter.views.HoloTextView in project Talon-for-Twitter by klinker24.
the class MainDrawerArrayAdapter method getView.
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View rowView = convertView;
String settingName = text.get(position);
if (rowView == null) {
LayoutInflater inflater = context.getLayoutInflater();
rowView = inflater.inflate(R.layout.drawer_list_item, null);
ViewHolder viewHolder = new ViewHolder();
viewHolder.name = (HoloTextView) rowView.findViewById(R.id.title);
viewHolder.icon = (ImageView) rowView.findViewById(R.id.icon);
rowView.setTag(viewHolder);
}
ViewHolder holder = (ViewHolder) rowView.getTag();
holder.name.setText(settingName);
holder.name.setTextSize(18);
try {
if (text.get(position).equals(context.getResources().getString(R.string.timeline))) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.timelineItem });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getResources().getString(R.string.mentions)) || text.get(position).equals(AppSettings.getInstance(context).secondScreenName)) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.mentionItem });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getResources().getString(R.string.direct_messages))) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.directMessageItem });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getResources().getString(R.string.retweets))) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.retweetButton });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getResources().getString(R.string.favorite_tweets))) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.favoritedButton });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getResources().getString(R.string.favorite_users)) || text.get(position).equals(context.getString(R.string.favorite_users_tweets))) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.favUser });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getResources().getString(R.string.discover)) || text.get(position).equals(context.getString(R.string.world_trends)) || text.get(position).equals(context.getString(R.string.local_trends))) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.links });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getResources().getString(R.string.search))) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.search_icon });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getResources().getString(R.string.lists))) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.listIcon });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getResources().getString(R.string.saved_searches)) || pageTypes.get(position) == AppSettings.PAGE_TYPE_SAVED_SEARCH) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.search_icon });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getResources().getString(R.string.links))) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.links });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getResources().getString(R.string.pictures))) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.picturePlaceholder });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else if (text.get(position).equals(context.getString(R.string.activity))) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.notification_button });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
} else {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.listIcon });
int resource = a.getResourceId(0, 0);
a.recycle();
holder.icon.setImageResource(resource);
}
} catch (OutOfMemoryError e) {
}
if (highlightedCurrent == position) {
if (!DrawerActivity.settings.addonTheme) {
holder.icon.setColorFilter(context.getResources().getColor(R.color.app_color));
holder.name.setTextColor(context.getResources().getColor(R.color.app_color));
} else {
holder.icon.setColorFilter(DrawerActivity.settings.accentInt);
holder.name.setTextColor(DrawerActivity.settings.accentInt);
}
} else {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.textColor });
int resource = a.getResourceId(0, 0);
holder.icon.setColorFilter(context.getResources().getColor(resource));
holder.name.setTextColor(context.getResources().getColor(resource));
}
return rowView;
}
Aggregations