-
Notifications
You must be signed in to change notification settings - Fork 527
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
Showing
12 changed files
with
644 additions
and
26 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
67 changes: 67 additions & 0 deletions
67
app/src/main/java/nie/translator/rtranslator/tools/ImageActivity.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,67 @@ | ||
package nie.translator.rtranslator.tools; | ||
|
||
//This activity is used only to create the images of the conversation mode in the readme | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.fragment.app.FragmentActivity; | ||
import androidx.recyclerview.widget.LinearLayoutManager; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import java.util.ArrayList; | ||
|
||
import nie.translator.rtranslator.R; | ||
import nie.translator.rtranslator.bluetooth.Message; | ||
import nie.translator.rtranslator.bluetooth.Peer; | ||
import nie.translator.rtranslator.tools.gui.messages.GuiMessage; | ||
import nie.translator.rtranslator.tools.gui.messages.MessagesAdapter; | ||
|
||
public class ImageActivity extends Activity { | ||
protected MessagesAdapter mAdapter; | ||
protected RecyclerView mRecyclerView; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.image_conversation); | ||
|
||
View decorView = getWindow().getDecorView(); | ||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); | ||
} | ||
|
||
@Override | ||
protected void onStart() { | ||
super.onStart(); | ||
mRecyclerView = findViewById(R.id.recycler_view); | ||
|
||
ArrayList<GuiMessage> messages = new ArrayList<>(); | ||
/*messages.add(new GuiMessage(new Message(this, "m", "Hello, how are you?"), true, true)); | ||
messages.add(new GuiMessage(new Message(this, new Peer(null, "Carlos11", true), "m", "I'm fine"), false, true)); | ||
messages.add(new GuiMessage(new Message(this, new Peer(null, "Denise12", true), "m", "Me too"), false, true));*/ | ||
|
||
messages.add(new GuiMessage(new Message(this, new Peer(null, "Alice10", true), "m", "¿Hola, cómo estás?"), false, true)); | ||
messages.add(new GuiMessage(new Message(this, "m", "Estoy bien"), true, true)); | ||
messages.add(new GuiMessage(new Message(this, new Peer(null, "Denise12", true), "m", "Yo también"), false, true)); | ||
|
||
/*messages.add(new GuiMessage(new Message(this, new Peer(null, "Alice10", true), "m", "Bonjour comment allez-vous?"), false, true)); | ||
messages.add(new GuiMessage(new Message(this, new Peer(null, "Carlos11", true), "m", "Je vais bien"), false, true)); | ||
messages.add(new GuiMessage(new Message(this, "m", "Moi aussi"), true, true));*/ | ||
|
||
mAdapter = new MessagesAdapter(messages, new MessagesAdapter.Callback() { | ||
@Override | ||
public void onFirstItemAdded() { | ||
mRecyclerView.setVisibility(View.VISIBLE); | ||
} | ||
}); | ||
mRecyclerView.setAdapter(mAdapter); | ||
LinearLayoutManager layoutManager = new LinearLayoutManager(this); | ||
layoutManager.setStackFromEnd(true); | ||
mRecyclerView.setLayoutManager(layoutManager); | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.