mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 14:07:55 +01:00
Android: tags autocompletion (in progress)
This commit is contained in:
parent
a181eac9a5
commit
a7987386e1
@ -105,6 +105,7 @@
|
||||
<orderEntry type="library" exported="" name="support-v4-21.0.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="eventbus-2.4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-query.0.26.8" level="project" />
|
||||
<orderEntry type="library" exported="" name="tokenautocomplete-1.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-21.0.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-async-http-1.4.6" level="project" />
|
||||
</component>
|
||||
|
BIN
docs-android/app/libs/tokenautocomplete-1.2.1.jar
Normal file
BIN
docs-android/app/libs/tokenautocomplete-1.2.1.jar
Normal file
Binary file not shown.
@ -36,8 +36,7 @@ public class DocumentEditActivity extends ActionBarActivity {
|
||||
|
||||
MultiAutoCompleteTextView tagsEditText = (MultiAutoCompleteTextView) findViewById(R.id.tagsEditText);
|
||||
tagsEditText.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item,
|
||||
new String[] { "Caluire", "Appartement", "Banque", "Assurance" }));
|
||||
tagsEditText.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
|
||||
new String[]{"Caluire", "Appartement", "Banque", "Assurance"}));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.sismics.docs.ui.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sismics.docs.R;
|
||||
import com.tokenautocomplete.TokenCompleteTextView;
|
||||
|
||||
public class TagsCompleteTextView extends TokenCompleteTextView {
|
||||
public TagsCompleteTextView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getViewForObject(Object object) {
|
||||
String p = (String)object;
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
|
||||
TextView view = (TextView) inflater.inflate(R.layout.tag_complete_item, (ViewGroup) getParent(), false);
|
||||
view.setText(p);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object defaultObject(String completionText) {
|
||||
return completionText;
|
||||
}
|
||||
}
|
@ -58,7 +58,7 @@
|
||||
android:layout_margin="8dp"
|
||||
android:padding="16dp"/>
|
||||
|
||||
<MultiAutoCompleteTextView
|
||||
<com.sismics.docs.ui.view.TagsCompleteTextView
|
||||
android:id="@+id/tagsEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
14
docs-android/app/src/main/res/layout/tag_complete_item.xml
Normal file
14
docs-android/app/src/main/res/layout/tag_complete_item.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/edtTxt1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ccc"
|
||||
android:drawablePadding="2dp"
|
||||
android:padding="8dp"
|
||||
android:shadowColor="#FFFFFF"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="0.01"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
Loading…
Reference in New Issue
Block a user