android.widget.ListView#getCheckedItemPosition ( )源码实例Demo

下面列出了android.widget.ListView#getCheckedItemPosition ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: BotLibre   文件: BrowseCategoriesActivity.java
@Override
public void selectInstance(View view) {
       ListView list = (ListView) findViewById(R.id.instancesList);
       int index = list.getCheckedItemPosition();
       if (index < 0) {
       	MainActivity.showMessage("Select a category", this);
       	return;
       }
       this.instance = instances.get(index);
       
	BrowseConfig config = new BrowseConfig();
	config.typeFilter = "Public";
	config.category = this.instance.name;
	config.type = getType();
	config.contentRating = MainActivity.contentRating;
	
	HttpAction action = new HttpGetInstancesAction(this, config, MainActivity.browsing);
	action.execute();
}
 
源代码2 项目: BotLibre   文件: WebMediumUsersActivity.java
public void removeUser(View view) {
	UserAdminConfig config = new UserAdminConfig();
       config.instance = MainActivity.instance.id;
       config.type = getType();
       
       config.operation = "RemoveUser";
       ListView list = (ListView) findViewById(R.id.usersList);
       int index = list.getCheckedItemPosition();
	if (index < 0) {
		MainActivity.error("Select user to remove", null, this);
		return;
	}
       config.operationUser = (String)this.users.get(index);
       
	HttpUserAdminAction action = new HttpUserAdminAction(this, config);
	action.execute();
}
 
源代码3 项目: BotLibre   文件: BrowseActivity.java
public void selectInstance(View view) {
       ListView list = (ListView) findViewById(R.id.instancesList);
       int index = list.getCheckedItemPosition();
       if (index < 0) {
       	MainActivity.showMessage("Select a bot", this);
       	return;
       }
       this.instance = instances.get(index);
	if (MainActivity.browsing) {
		MainActivity.instance = this.instance;
		finish();
		return;
	}
       InstanceConfig config = new InstanceConfig();
       config.id = this.instance.id;
       config.name = this.instance.name;
	
       HttpAction action = new HttpFetchAction(this, config);
   	action.execute();
}
 
源代码4 项目: BotLibre   文件: WebMediumUsersActivity.java
public void removeAdmin(View view) {
	UserAdminConfig config = new UserAdminConfig();
       config.instance = MainActivity.instance.id;
       config.type = getType();
       
       config.operation = "RemoveAdmin";
       
       ListView list = (ListView) findViewById(R.id.adminList);
       int index = list.getCheckedItemPosition();
	if (index < 0) {
		MainActivity.error("Select admin to remove", null, this);
		return;
	}
       config.operationUser = (String)this.admins.get(index);

	HttpUserAdminAction action = new HttpUserAdminAction(this, config);
	action.execute();
}
 
源代码5 项目: BotLibre   文件: BrowseCategoriesActivity.java
@Override
public void selectInstance(View view) {
       ListView list = (ListView) findViewById(R.id.instancesList);
       int index = list.getCheckedItemPosition();
       if (index < 0) {
       	MainActivity.showMessage("Select a category", this);
       	return;
       }
       this.instance = instances.get(index);
       
	BrowseConfig config = new BrowseConfig();
	config.typeFilter = "Public";
	config.category = this.instance.name;
	config.type = getType();
	config.contentRating = MainActivity.contentRating;
	
	HttpAction action = new HttpGetInstancesAction(this, config, MainActivity.browsing);
	action.execute();
}
 
源代码6 项目: BotLibre   文件: WebMediumUsersActivity.java
public void removeAdmin(View view) {
	UserAdminConfig config = new UserAdminConfig();
       config.instance = MainActivity.instance.id;
       config.type = getType();
       
       config.operation = "RemoveAdmin";
       
       ListView list = (ListView) findViewById(R.id.adminList);
       int index = list.getCheckedItemPosition();
	if (index < 0) {
		MainActivity.error("Select admin to remove", null, this);
		return;
	}
       config.operationUser = (String)this.admins.get(index);

	HttpUserAdminAction action = new HttpUserAdminAction(this, config);
	action.execute();
}
 
源代码7 项目: BotLibre   文件: BotScriptsActivity.java
public void deleteBotScript() {
	ListView list = (ListView)findViewById(R.id.botScriptList);
	int index = list.getCheckedItemPosition();
	
	if (index < 0) {
		MainActivity.showMessage("Select a script to delete", this);
		return;
	}
	
	ScriptConfig script = this.scripts.get(index);
	ScriptSourceConfig botScript = new ScriptSourceConfig();
	InstanceConfig bot = this.instance;
	botScript.id = script.id;
	botScript.instance = bot.id;
	
	scripts.remove(index);
	
	HttpDeleteBotScriptAction action = new HttpDeleteBotScriptAction(this, botScript);
	action.execute();
	
	
}
 
源代码8 项目: BotLibre   文件: TrainingActivity.java
public ResponseConfig getSelectedResponse() {
	Spinner spin = (Spinner) findViewById(R.id.responseTypeSpin);
	String type = (String)spin.getSelectedItem();
       ListView list = (ListView) findViewById(R.id.responseList);
       int index = list.getCheckedItemPosition();
	if (index < 0) {
		return null;
	}
	
	if (type.equals("conversations")) {
		Object selected = this.conversationInput.get(index);
		if (selected instanceof ConversationConfig) {
			return null;
		} else {
			ResponseConfig response = new ResponseConfig();
			response.response = ((InputConfig)selected).value;
			if (index > 1) {
				Object previous = this.conversationInput.get(index - 1);
				if (previous instanceof InputConfig) {
					response.question = ((InputConfig)previous).value;
				}
			}
			return response;
		}
	} else {
		return this.responses.get(index);
	}
}
 
源代码9 项目: BotLibre   文件: ForumPostActivity.java
public void viewReply() {
	ListView list = (ListView) findViewById(R.id.repliesList);
       int index = list.getCheckedItemPosition();
       if (index < 0) {
       	MainActivity.showMessage("Select reply", this);
       	return;
       }
       ForumPostConfig reply = this.instance.replies.get(index);

       ForumPostConfig config = new ForumPostConfig();
       config.id = reply.id;
	        
       HttpAction action = new HttpFetchForumPostAction(this, config);
   	action.execute();
}
 
源代码10 项目: BotLibre   文件: BrowseChannelActivity.java
public void selectInstance(View view) {
       ListView list = (ListView) findViewById(R.id.instancesList);
       int index = list.getCheckedItemPosition();
       if (index < 0) {
       	MainActivity.showMessage("Select a channel", this);
       	return;
       }
       this.instance = instances.get(index);
       ChannelConfig config = new ChannelConfig();
       config.id = this.instance.id;
       config.name = this.instance.name;
	
       HttpAction action = new HttpFetchAction(this, config);
   	action.execute();
}
 
源代码11 项目: BotLibre   文件: BrowseDomainActivity.java
@Override
public void selectInstance(View view) {
       ListView list = (ListView) findViewById(R.id.instancesList);
       int index = list.getCheckedItemPosition();
       this.instance = instances.get(index);
       DomainConfig config = new DomainConfig();
       config.id = this.instance.id;
       HttpAction action = new HttpFetchAction(this, config);
   	action.execute();
}
 
源代码12 项目: BotLibre   文件: ForumPostActivity.java
public void viewReply() {
	ListView list = (ListView) findViewById(R.id.repliesList);
       int index = list.getCheckedItemPosition();
       if (index < 0) {
       	MainActivity.showMessage("Select reply", this);
       	return;
       }
       ForumPostConfig reply = this.instance.replies.get(index);

       ForumPostConfig config = new ForumPostConfig();
       config.id = reply.id;
	        
       HttpAction action = new HttpFetchForumPostAction(this, config);
   	action.execute();
}
 
源代码13 项目: BotLibre   文件: BrowseForumActivity.java
public void selectInstance(View view) {
       ListView list = (ListView) findViewById(R.id.instancesList);
       int index = list.getCheckedItemPosition();
       this.instance = this.instances.get(index);
       ForumConfig config = new ForumConfig();
       config.id = this.instance.id;
	
       HttpAction action = new HttpFetchAction(this, config);
   	action.execute();
}
 
源代码14 项目: BotLibre   文件: AvatarEditorActivity.java
public void tagMedia() {
    ListView list = (ListView) findViewById(R.id.mediaList);
    int index = list.getCheckedItemPosition();
    if (index < 0) {
    	MainActivity.showMessage("Select the media to tag", this);
    	return;
    }
    MainActivity.avatarMedia = this.media.get(index);
            
    Intent intent = new Intent(this, AvatarMediaActivity.class);		
    startActivity(intent);
}
 
源代码15 项目: BotLibre   文件: BrowseActivity.java
public void chat(View view) {
       ListView list = (ListView) findViewById(R.id.instancesList);
       int index = list.getCheckedItemPosition();
       if (index < 0) {
       	MainActivity.showMessage("Select a bot", this);
       	return;
       }
       this.instance = instances.get(index);
       InstanceConfig config = new InstanceConfig();
       config.id = this.instance.id;
       config.name = this.instance.name;
	
       HttpAction action = new HttpFetchAction(this, config, true);
   	action.execute();
}
 
源代码16 项目: BotLibre   文件: BotScriptsActivity.java
public void upScript() {
	ListView list = (ListView)findViewById(R.id.botScriptList);
	int index = list.getCheckedItemPosition();
	if (index < 0) {
		System.out.println("The other index: " + index);
		MainActivity.showMessage("Select a script to move up in precedence", this);
		return;
	}

	if (index != 0) {
		ScriptConfig script = this.scripts.get(index);
		
		
		ScriptSourceConfig botScript = new ScriptSourceConfig();
		InstanceConfig bot = this.instance;
		botScript.id = script.id;
		botScript.instance = bot.id;
		
		System.out.println("Bot id: " + bot.id + "Bot instance: " + bot.instance 
				+ "ScriptConfig id: " + script.id + "ScriptConfig instance: " + script.instance);
		//This code should change the index of the thing?
		Collections.swap(scripts, index, index-1);

		HttpUpBotScriptAction action = new HttpUpBotScriptAction(this, botScript);
		action.execute();

	}

}
 
源代码17 项目: BotLibre   文件: TrainingActivity.java
public ResponseConfig getSelectedResponse() {
	Spinner spin = (Spinner) findViewById(R.id.responseTypeSpin);
	String type = (String)spin.getSelectedItem();
       ListView list = (ListView) findViewById(R.id.responseList);
       int index = list.getCheckedItemPosition();
	if (index < 0) {
		return null;
	}
	
	if (type.equals("conversations")) {
		Object selected = this.conversationInput.get(index);
		if (selected instanceof ConversationConfig) {
			return null;
		} else {
			ResponseConfig response = new ResponseConfig();
			response.response = ((InputConfig)selected).value;
			if (index > 1) {
				Object previous = this.conversationInput.get(index - 1);
				if (previous instanceof InputConfig) {
					response.question = ((InputConfig)previous).value;
				}
			}
			return response;
		}
	} else {
		return this.responses.get(index);
	}
}
 
源代码18 项目: BotLibre   文件: BrowseForumActivity.java
public void selectInstance(View view) {
       ListView list = (ListView) findViewById(R.id.instancesList);
       int index = list.getCheckedItemPosition();
       this.instance = this.instances.get(index);
       ForumConfig config = new ForumConfig();
       config.id = this.instance.id;
	
       HttpAction action = new HttpFetchAction(this, config);
   	action.execute();
}
 
源代码19 项目: BotLibre   文件: AvatarEditorActivity.java
public void deleteMedia() {
    ListView list = (ListView) findViewById(R.id.mediaList);
    int index = list.getCheckedItemPosition();
    if (index < 0) {
    	MainActivity.showMessage("Select the media to delete", this);
    	return;
    }
    AvatarMedia config = this.media.get(index);
    AvatarMedia config2 = new AvatarMedia();
    config2.mediaId = config.mediaId;
    config2.instance = this.instance.id;
    
    HttpAction action = new HttpDeleteAvatarMediaAction(AvatarEditorActivity.this, config2);
	action.execute();
}
 
源代码20 项目: BotLibre   文件: BrowseActivity.java
public void chat(View view) {
       ListView list = (ListView) findViewById(R.id.instancesList);
       int index = list.getCheckedItemPosition();
       if (index < 0) {
       	MainActivity.showMessage("Select a bot", this);
       	return;
       }
       this.instance = instances.get(index);
       InstanceConfig config = new InstanceConfig();
       config.id = this.instance.id;
       config.name = this.instance.name;
	
       HttpAction action = new HttpFetchAction(this, config, true);
   	action.execute();
}