【GAMEMAKER】 follow player

Information about object: obj_player
Sprite: spr_player
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Step Event:
execute code:



///movement
if (keyboard_check(vk_left))  && !place_meeting(x-4,y,obj_obstacle)
{
    x-=4;
}
if (keyboard_check(vk_right))  && !place_meeting(x+4,y,obj_obstacle)
{
    x+=4;
}
if (keyboard_check(vk_up)) && !place_meeting(x,y-4,obj_obstacle)
{
    y-=4;
}
if (keyboard_check(vk_down))  && !place_meeting(x,y+4,obj_obstacle)
{
    y+=4;
}

Information about object: obj_obstacle
Sprite: spr_solid_base
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

Information about object: obj_enemy
Sprite: spr_enemy
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

///Create Grid
size = 16;
grid = mp_grid_create(0,0,ceil(room_width/size),ceil(room_height/size),size,size);

///Add obstacles to grid
mp_grid_add_instances(grid,obj_obstacle,1);

//create initial path
path=path_add();

mp_grid_path(grid,path,x,y,obj_player.x,obj_player.y,1);
path_start(path,2,path_action_stop,true);
Step Event:
execute code:

///reset path at end
if path_position==1
{
    path_clear_points(path);
    mp_grid_path(grid,path,x,y,obj_player.x,obj_player.y,1);
    path_start(path,2,path_action_stop,true);
}
Draw Event:
execute code:

///For Drawing Grid
draw_path(path,x,y,true);
draw_self();

【vuejs】 image moving and scaling effect

【GAMEMAKER】 MINER destroy sprite or object

Information about object: obj_hero
Sprite: spr_hero
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

global.toolspeed = 1
Step Event:
execute code:

//movement code
dx = (keyboard_check(vk_right) - keyboard_check(vk_left)) * 4;
dy = (keyboard_check(vk_down) - keyboard_check(vk_up)) * 4;
if place_free(x + dx, y + dy)//check if direction clear
{
    x += dx;//move 
    y += dy;
}

//create a block

if mouse_check_button_pressed(mb_right) && !position_meeting(mouse_x, mouse_y, obj_block)
&& !position_meeting(mouse_x, mouse_y, obj_hero)//check if positon empty
{
    instance_create(32 * (mouse_x div 32), 32 * (mouse_y div 32), obj_stone);//create stone
}


Information about object: obj_block
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

dury = 10;//strength
durc = 0;
Step Event:
execute code:

if mouse_check_button(mb_left) && position_meeting(mouse_x,mouse_y,id)
{
    if (dury == 0) exit;
    durc += global.toolspeed / dury;
    if (durc > 1) instance_destroy();
}
if mouse_check_button_released(mb_left)
{
    durc = 0;
}
Mouse Event for Mouse Leave:
execute code:

durc = 0
Draw Event:
execute code:

draw_sprite(sprite_index, image_index, x, y)
// cracking-texture
if (durc > 0)
{
    draw_sprite(spr_damage, floor(10 * durc), x, y);
}

Information about object: obj_stone
Sprite: spr_stone
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

event_inherited()
dury = 20

【GAMEMAKER】 Pixelate Image

Information about object: obj_image
Sprite: spr_image
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

global.draw = 0
Draw Event:
execute code:

draw_self();

if(global.draw == 1){
global.cell=0;//set a counter to keep track of how many cells
for (i = 0; i < sprite_get_width(spr_image); i += 10)//create a loop 10 pixels a time
{
for (j = 0; j  < sprite_get_height(spr_image); j += 10)
{

col=draw_getpixel(i,j);//get colour at position
global.data[global.cell,0]=col;//write colour to array
global.data[global.cell,1]=i;//write x cord
global.data[global.cell,2]=j;//write y cord
global.cell++;//increase counter
}
}
global.draw = 0    
room_goto(room_show_image);
}

Information about object: obj_show
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Draw Event:
execute code:

for (i = 0; i < global.cell;  i+=1;)//create loop
{

draw_set_colour(global.data[i,0]);//get colour from position in array
x_pos=global.data[i,1];//get x cords
y_pos=global.data[i,2];//get y cords
draw_rectangle(x_pos,y_pos,x_pos+10,y_pos+10,false);//draw rectangle
}

Information about object: obj_draw
Sprite: spr_button
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

global.draw = 0
Mouse Event for Left Released:
execute code:

global.draw = 1

【GAMEMAKER】 moon lander

Information about object: obj_ship
Sprite: spr_ship
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Step Event:
execute code:

//Set no keypress
ship_is_h="";
ship_is_v="";
//keyboard input
if (keyboard_check(vk_left))  {ship_is_h="left";} 
if (keyboard_check(vk_right))  {ship_is_h="right";} 
if (keyboard_check(vk_up))  {ship_is_v="up";} 

//move in direction
if ship_is_h=="right" hspeed+=0.16;
if ship_is_h=="left"  hspeed-=0.16;
//friction
hspeed=hspeed*0.99;
if abs(hspeed)<0.05 hspeed=0;
//up and down movement
dist=obj_platform.y-y;
if obj_platform.y<y ship_is_v="up";
if ship_is_v=="up" vspeed-=0.16;
//gravity
vspeed+=0.02;
//check if on platform and moving slowly
if position_meeting(x,y,obj_platform) && abs(vspeed)<1 and abs(hspeed)<1
{
    show_message("Landed");
    game_restart();
}

【ANDROID STUDIO】 Create Fragment

package com.example.createfragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.fragment.app.Fragment;

public class FragmentOne extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_one, container, false);
}
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<fragment android:name="com.example.createfragment.FragmentOne"
android:id="@+id/fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />


</androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Fragment One" />
</RelativeLayout>

【ANDROID STUDIO】 Runtime Menu

package com.example.runtimemenu;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
private final int MENU_DOWNLOAD = 1;
private final int MENU_SETTINGS = 2;
private boolean showDownloadMenu = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void toggleMenu(View view) {
showDownloadMenu = !showDownloadMenu;
invalidateOptionsMenu();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, MENU_DOWNLOAD, 0, R.string.menu_download);
menu.add(0, MENU_SETTINGS, 0, R.string.menu_settings);
return true;
}

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem menuItem = menu.findItem(MENU_DOWNLOAD);
menuItem.setVisible(showDownloadMenu);
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_DOWNLOAD:
Toast.makeText(this, R.string.menu_download, Toast.LENGTH_LONG).show();
break;
case MENU_SETTINGS:
Toast.makeText(this, R.string.menu_settings, Toast.LENGTH_LONG).show();
break;
default:
return super.onContextItemSelected(item);
}
return true;
}
}

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<Button android:id="@+id/buttonToggleMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Toggle Menu"
android:onClick="toggleMenu"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

【GAMEMAKER】 1945 game remake




Information about object: obj_player
Sprite: spr_player
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Step Event:
execute code:


//movement
if (keyboard_check(vk_left))  {x-=5;} 
if (keyboard_check(vk_right))  {x+=5;}
if (keyboard_check_pressed(ord('Z')))//Fire Bullet
{
    instance_create(x,y,obj_player_bullet);//create a bullet
}
Collision Event with object obj_enemy_bullet:
execute code:

health-=1;//reduce health
with (other) instance_destroy();//destroy bullet
Draw GUI Event:
execute code:

draw_text(10,10,"Score"+string(score));//draw_score
draw_text(10,30,"Health"+string(health));//draw health

Information about object: obj_enemy_1
Sprite: spr_enemy_1
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_enemy_parent
Children:
Mask:
No Physics Object
Destroy Event:
execute code:

instance_create(x,y,obj_enemy_1);//create new enemy
Step Event:
execute code:

if y>room_height instance_destroy();//destroy if outside room

Information about object: obj_enemy_2
Sprite: spr_enemy_2
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_enemy_parent
Children:
Mask:
No Physics Object
Destroy Event:
execute code:

instance_create(x,y,obj_enemy_2);//create new instance
Step Event:
execute code:

if y>room_height instance_destroy();//destroy if outside room

diff=abs(x-obj_player.x);//get difference between self and plpayer x
if diff<5 instance_create(x,y,obj_enemy_bullet);//if less than 5 fire a bullet

Information about object: obj_enemy_bullet
Sprite: spr_enemy_bullet
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

motion_set(270,6);//set direction and speed
Information about object: obj_player_bullet
Sprite: spr_player_bullet
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

motion_set(90,3);//set direction and speed
Collision Event with object obj_enemy_parent:
execute code:

score+=10;//increase score
with (other) instance_destroy();//destroy other
Information about object: obj_enemy_parent
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children
obj_enemy_1
obj_enemy_2
Mask:
No Physics Object
Create Event:
execute code:

x=random(room_width);//jump to random position
y=-50;//create just off top of screen
motion_set(270,2+random(3));//set direction and speed



















【ANDROID STUDIO】 recycler view action mode

package com.example.recyclerviewactionmode;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.view.ActionMode;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity implements SelectMode {
MyAdapter myAdapter;
ActionMode mActionMode;


private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mode.getMenuInflater().inflate(R.menu.context_menu, menu);
return true;
}

@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}

@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()) {
case R.id.delete_all:
myAdapter.deleteAllSelected();
mode.finish();
return true;
default:
return false;
}
}

@Override
public void onDestroyActionMode(ActionMode mode) {
mActionMode = null;
}
};


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

List<String> list = new ArrayList<>();
list.add("China");
list.add("France");
list.add("Germany");
list.add("India");
list.add("Russia");
list.add("United Kingdom");
list.add("United States");

RecyclerView recyclerView = findViewById(R.id.recyclerView);

recyclerView.setHasFixedSize(true);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(linearLayoutManager);

myAdapter = new MyAdapter(list, this);
recyclerView.setAdapter(myAdapter);
}

@Override
public void onSelect() {
if (mActionMode != null) return;
mActionMode = startSupportActionMode(mActionModeCallback);
}

}
package com.example.recyclerviewactionmode;

import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder>
implements SelectMode { //Added implements

private SelectMode mListener;
private List<String> nameList;
//Added following list
private SparseArray<Boolean> selectedList = new SparseArray<>();

public MyAdapter(List<String> list, SelectMode listener) { //Added listener to parameters
nameList = list;
mListener = listener;
}

@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View view = inflater.inflate(R.layout.item, parent, false);
MyViewHolder myViewHolder = new MyViewHolder(view);
return myViewHolder;
}

@Override
public void onBindViewHolder(@NonNull final MyViewHolder holder, final int position) {
final String name = nameList.get(position);
holder.textView.setText(name);
holder.itemView.setSelected(selectedList.get(position, false)); //New (for There's more)

holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
holder.itemView.setSelected(!holder.itemView.isSelected());
if (holder.itemView.isSelected()) {
selectedList.put(position, true);
} else {
selectedList.remove(position);
}
onSelect();
}
});
}

@Override
public int getItemCount() {
if (nameList == null) {
return 0;
} else {
return nameList.size();
}
}

private void remove(int position) {
nameList.remove(position);
notifyItemRemoved(position);
}

//New method
public void deleteAllSelected() {
if (selectedList.size() == 0) {
return;
}
for (int index = nameList.size() - 1; index >= 0; index--) {
if (selectedList.get(index, false)) {
remove(index);
}
}
selectedList.clear();
}

@Override
public void onSelect() {
if (mListener != null) {
mListener.onSelect();
}
}

public class MyViewHolder extends RecyclerView.ViewHolder {
public TextView textView;

public MyViewHolder(View itemVieww) {
super(itemVieww);
textView = itemView.findViewById(R.id.textView);
}
}

}
package com.example.recyclerviewactionmode;

public interface SelectMode {
void onSelect();
}

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>


</androidx.constraintlayout.widget.ConstraintLayout>

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/delete_all"
android:title="@string/delete_all" />
</menu>

【ANDROID STUDIO】 Popup Menu

package com.example.popup;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.PopupMenu;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

private PopupMenu.OnMenuItemClickListener mOnMenuItemClickListener = new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_reply:
Toast.makeText(MainActivity.this, "Reply", Toast.LENGTH_SHORT).show();
return true;
case R.id.menu_reply_all:
Toast.makeText(MainActivity.this, "Reply All", Toast.LENGTH_SHORT).show();
return true;
case R.id.menu_forward:
Toast.makeText(MainActivity.this, "Forward", Toast.LENGTH_SHORT).show();
return true;
default:
return false;
}
}
};

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void showPopupMenu(View view) {
PopupMenu popupMenu = new PopupMenu(MainActivity.this, view);
popupMenu.inflate(R.menu.menu_popup);
popupMenu.setOnMenuItemClickListener(mOnMenuItemClickListener);
popupMenu.show();
}
}

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<ImageButton android:id="@+id/imageButtonReply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@android:drawable/ic_menu_revert"
android:onClick="showPopupMenu"
android:layout_marginLeft="8dp" />

</androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/menu_reply"
android:title="@string/menu_reply" />
<item android:id="@+id/menu_reply_all"
android:title="@string/menu_reply_all" />
<item android:id="@+id/menu_forward"
android:title="@string/menu_forward" />
</menu>

【ANDROID STUDIO】 Options Menu

package com.example.optionmemu;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_settings) {
Toast.makeText(this, "Settings", Toast.LENGTH_LONG).show();
} else {
return super.onContextItemSelected(item);
}
return true;
}
}
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_settings"
android:title="@string/menu_settings"
app:showAsAction="never">
<menu>
<item android:id="@+id/menu_sub1"
android:title="Storage Settings" />
<item android:id="@+id/menu_sub2"
android:title="Screen Settings" />
</menu>
</item>
</menu>

【ANDROID STUDIO】 Contextual Menu

package com.example.contextualmenu;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.view.ActionMode;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

ActionMode mActionMode;

private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mode.getMenuInflater().inflate(R.menu.context_menu, menu);
return true;
}

@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}

@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_cast:
Toast.makeText(MainActivity.this, "Cast", Toast.LENGTH_SHORT).show();
mode.finish();
return true;
case R.id.menu_print:
Toast.makeText(MainActivity.this, "Print", Toast.LENGTH_SHORT).show();
mode.finish();
return true;
default:
return false;
}
}

@Override
public void onDestroyActionMode(ActionMode mode) {
mActionMode = null;
}
};

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

ImageView imageView = findViewById(R.id.imageView);
imageView.setOnLongClickListener(new View.OnLongClickListener() {
public boolean onLongClick(View view) {
if (mActionMode != null) return false;
mActionMode = startSupportActionMode(mActionModeCallback);
((ActionMode) mActionMode).setTitle("New Title");
return true;
}
});
}
}

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<ImageView android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_launcher" />

</androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_cast"
android:title="@string/menu_cast" />>
<item android:id="@+id/menu_print"
android:title="@string/menu_print" />>
</menu>

【ANDROID STUDIO】 Runtime Widget

package com.example.runtimewidget;

import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;

import android.os.Bundle;
import android.widget.DatePicker;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
ConstraintLayout layout = new ConstraintLayout(this);
DatePicker datePicker = new DatePicker(this);
layout.addView(datePicker);
setContentView(layout);
}
}

【ANDROID STUDIO】 Custom View

package com.example.custom;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

public class Custom extends View {

final Paint mPaint = new Paint();

public Custom(Context context) {
super(context);
mPaint.setColor(Color.BLACK);
mPaint.setTextSize(30);
}

@Override
protected
void onDraw(Canvas canvas) {
super.onDraw(canvas);
setBackgroundColor(Color.CYAN);
canvas.drawText("Custom Text", 100, 100, mPaint);
invalidate();
}
}
package com.example.custom;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new Custom(this));
}
}

【GAMEMAKER】 add more sprite or object instance

Information about object: obj_builder
Sprite: spr_road
Solid: false
Visible: true
Depth: -2
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

//
can_build = false;
cursor_x = 0;
cursor_y = 0;
Step Event:
execute code:

var road;
road = obj_road;
//
cursor_x = (mouse_x div 32) << 5;
cursor_y = (mouse_y div 32) << 5;
can_build = (
    place_meeting(cursor_x - 1, cursor_y, road) ||
    place_meeting(cursor_x + 1, cursor_y, road) ||
    place_meeting(cursor_x, cursor_y + 1, road) ||
    place_meeting(cursor_x, cursor_y - 1, road) )
    && !place_meeting(cursor_x, cursor_y, road)
Mouse Event for Glob Left Button:
execute code:

if (can_build)
{
    instance_create(cursor_x, cursor_y, obj_road);
}
Draw Event:
execute code:

var sub;
sub = 0
if (!can_build) sub = 1;
draw_sprite(spr_cursor, sub, cursor_x, cursor_y);

Information about object: obj_road
Sprite: spr_road
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

【ANDROID STUDIO】 Table View

<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A1"
android:id="@+id/textView1" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="B1"
android:id="@+id/textView2" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="C1"
android:id="@+id/textView3" />
</TableRow>
<TableRow android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A2"
android:id="@+id/textView4" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="B2"
android:id="@+id/textView5" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="C2"
android:id="@+id/textView6" />
</TableRow>
<TableRow android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A3"
android:id="@+id/textView7" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="B3"
android:id="@+id/textView8" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="C3"
android:id="@+id/textView9" />
</TableRow>
</TableLayout>

I Quit AeroMedLab

Watch now (2 mins) | Today is my last day at AeroMedLab ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­...

Contact Form

Name

Email *

Message *