-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pedro Diaz
committed
Sep 29, 2016
1 parent
53c607b
commit 9dc90d2
Showing
4 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
61 changes: 61 additions & 0 deletions
61
app/src/main/java/com/icecream/snorlax/app/rename/RenameCompletionView.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (c) 2016. Pedro Diaz <igoticecream@gmail.com> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.icecream.snorlax.app.rename; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
|
||
import com.tokenautocomplete.TokenCompleteTextView; | ||
|
||
@SuppressWarnings({"unused", "WeakerAccess", "FieldCanBeLocal"}) | ||
public class RenameCompletionView extends TokenCompleteTextView<RenameOptions> { | ||
|
||
private final LayoutInflater mLayoutInflater; | ||
|
||
public RenameCompletionView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
mLayoutInflater = LayoutInflater.from(context); | ||
} | ||
|
||
@Override | ||
protected View getViewForObject(RenameOptions person) { | ||
/* | ||
TextView view = (TextView) mLayoutInflater.inflate(R.layout.contact_token, (ViewGroup) getParent(), false); | ||
view.setText(person.getOption()); | ||
return view; | ||
*/ | ||
return null; | ||
} | ||
|
||
@Override | ||
protected RenameOptions defaultObject(String completionText) { | ||
//Stupid simple example of guessing if we have an email or not | ||
/* | ||
int index = completionText.indexOf('@'); | ||
if (index == -1) { | ||
return new Person(completionText, completionText.replace(" ", "") + "@example.com"); | ||
} | ||
else { | ||
return new Person(completionText.substring(0, index), completionText); | ||
} | ||
*/ | ||
return RenameOptions.create("Dummy"); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/icecream/snorlax/app/rename/RenameOptions.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2016. Pedro Diaz <igoticecream@gmail.com> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.icecream.snorlax.app.rename; | ||
|
||
import java.io.Serializable; | ||
|
||
import com.google.auto.value.AutoValue; | ||
|
||
@AutoValue | ||
@SuppressWarnings({"unused", "WeakerAccess", "FieldCanBeLocal"}) | ||
abstract class RenameOptions implements Serializable { | ||
|
||
static RenameOptions create(String option) { | ||
return new AutoValue_RenameOptions(option); | ||
} | ||
|
||
abstract String getOption(); | ||
} |