use of se.alexanderblom.delicious.helpers.TitleFetcher in project android-delicious by lexs.
the class AddBookmarkActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_bookmark);
setTitle(R.string.activity_add_bookmark_title);
// Enable up button
getActionBar().setHomeButtonEnabled(true);
errorDrawable = DeliciousApplication.getErrorDrawable();
titleFetcher = new TitleFetcher(this);
receiver = new DetachableResultReceiver(new Handler());
urlView = (EditText) findViewById(R.id.url);
titleView = (EditText) findViewById(R.id.title);
notesView = (EditText) findViewById(R.id.notes);
tagsView = (MultiAutoCompleteTextView) findViewById(R.id.tags);
privateView = (CheckBox) findViewById(R.id.mark_private);
// TODO: Implement tag suggestion
/*ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_dropdown_item, TAGS);
tagsView.setAdapter(adapter);
tagsView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());*/
// Enable user to press enter when done
tagsView.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
saveBookmark();
return true;
} else {
return false;
}
}
});
Intent intent = getIntent();
if (Intent.ACTION_SEND.equals(intent.getAction())) {
String url = intent.getStringExtra(Intent.EXTRA_TEXT);
String title = intent.getStringExtra(Intent.EXTRA_SUBJECT);
urlView.setText(url);
titleView.setText(title);
// Check were focus should go
if (TextUtils.isEmpty(url)) {
urlView.requestFocus();
} else if (TextUtils.isEmpty(title)) {
titleView.requestFocus();
} else {
// Focus tags because it can't be prefilled
tagsView.requestFocus();
}
}
// Fetch title if necessary
titleFetcher.maybeFetchTitle();
}
Aggregations