diff options
Diffstat (limited to 'app/src')
47 files changed, 504 insertions, 164 deletions
diff --git a/app/src/main/java/layout/FragmentBoardItemList.java b/app/src/main/java/layout/FragmentBoardItemList.java index ba80ae5..feaf7a0 100644 --- a/app/src/main/java/layout/FragmentBoardItemList.java +++ b/app/src/main/java/layout/FragmentBoardItemList.java @@ -410,6 +410,11 @@ public class FragmentBoardItemList extends Fragment { void updateToolbar(String s); void hideActionButton(); void showActionButton(); + void onThreadList(); + + void onThread(); + + void onRecentPosts(); } public void scrollToBotton(){ @@ -459,7 +464,6 @@ public class FragmentBoardItemList extends Fragment { item.setFile(thread.getString("file")); item.setFilesize(thread.getInt("file_size")); item.setId(thread.getInt("id")); - item.setMessage(thread.getString("message")); item.setName(thread.getString("name")); item.setSubject(thread.getString("subject")); item.setThumb(thread.getString("thumb")); @@ -470,6 +474,7 @@ public class FragmentBoardItemList extends Fragment { item.setTotalReplies(thread.getInt("total_replies")); item.setTripcode(thread.getString("tripcode")); item.setTimeStampFormatted(thread.getString("timestamp_formatted")); + item.setLockStatus(thread.getInt("locked")); if (item.getTimeStampFormatted().contains("ID")){ item.setPosterId(item.getTimeStampFormatted().split(" ")[1].replace("ID :", "")); } @@ -479,6 +484,7 @@ public class FragmentBoardItemList extends Fragment { if (currentBoard.getBoardType() == 1){ item.setBbsId(1); } + item.setMessage(thread.getString("message")); boardItems.add(item); if (!repliesForCatalog.equals("0")){ JSONArray replies = thread.getJSONArray("replies"); @@ -495,7 +501,7 @@ public class FragmentBoardItemList extends Fragment { reply.setFilesize(jReply.getInt("file_size")); reply.setId(jReply.getInt("id")); reply.setParentId(item.getId()); - reply.setMessage(jReply.getString("message")); + reply.setLockStatus(item.isLocked ? 1 : 0); reply.setName(jReply.getString("name")); reply.setSubject(jReply.getString("subject")); reply.setThumb(jReply.getString("thumb")); @@ -512,10 +518,12 @@ public class FragmentBoardItemList extends Fragment { reply.setIdColor(addReplyID(reply.getPosterId())); // reply.setTotalReplies(item.getTotalReplies()); + reply.setMessage(jReply.getString("message")); }else{ reply.setTimeStamp(jReply.getLong("timestamp")); reply.setId(jReply.getInt("id")); reply.isReply = true; + reply.setLockStatus(item.isLocked ? 1 : 0); } boardItems.add(reply); } @@ -528,6 +536,7 @@ public class FragmentBoardItemList extends Fragment { } listViewAdapter.notifyDataSetChanged(); listViewAdapter.updateBoardItems(boardItems); + mListener.onThreadList(); loadingMoreThreads = false; if (boardItems.isEmpty()){ mListener.updateToolbar(currentBoard, currentThread); @@ -575,7 +584,6 @@ public class FragmentBoardItemList extends Fragment { item.setFile(reply.getString("file")); item.setFilesize(reply.getInt("file_size")); item.setId(reply.getInt("id")); - item.setMessage(reply.getString("message")); item.setName(reply.getString("name")); item.setSubject(reply.getString("subject")); item.setThumb(reply.getString("thumb")); @@ -583,6 +591,7 @@ public class FragmentBoardItemList extends Fragment { item.setThumbWidth(reply.getInt("thumb_width")); item.setTimeStamp(reply.getLong("timestamp")); item.setParentId(json.getInt("id")); + item.setLockStatus(json.getInt("locked")); item.setTripcode(reply.getString("tripcode")); item.setTimeStampFormatted(reply.getString("timestamp_formatted")); if (item.getTimeStampFormatted().contains("ID")){ @@ -599,6 +608,7 @@ public class FragmentBoardItemList extends Fragment { item.setBbsId((item.getTotalReplies() - finalLimit + i) + 2); } } + item.setMessage(reply.getString("message")); } else { item.setId(reply.getInt("id")); @@ -626,6 +636,7 @@ public class FragmentBoardItemList extends Fragment { listViewBoardItems.setSelection(boardItems.size()); mListener.showActionButton(); } + mListener.onThread(); hideProgressBar(); } }); @@ -658,7 +669,6 @@ public class FragmentBoardItemList extends Fragment { recentPost.setFile(jPost.getString("file")); recentPost.setFilesize(jPost.getInt("file_size")); recentPost.setId(jPost.getInt("id")); - recentPost.setMessage(jPost.getString("message")); recentPost.setName(jPost.getString("name")); recentPost.setSubject(jPost.getString("subject")); recentPost.setThumb(jPost.getString("thumb")); @@ -672,6 +682,7 @@ public class FragmentBoardItemList extends Fragment { } recentPost.setParentBoard(((MainActivity) getActivity()).getBoardFromDir(jPost.getString("dir"))); recentPost.setParentId(jPost.getInt("parentid")); + recentPost.setMessage(jPost.getString("message")); boardItems.add(recentPost); } } catch (JSONException e1) { @@ -680,6 +691,7 @@ public class FragmentBoardItemList extends Fragment { } } recentPostAdapter.notifyDataSetChanged(); + mListener.onRecentPosts(); } }); @@ -696,7 +708,13 @@ public class FragmentBoardItemList extends Fragment { if (!directory.exists()){ directory.mkdir(); } - final File mypath = new File(directory, currentBoard.getBoardDir() + "_" + bi.getThumb()); + final File mypath; + if (bi.youtubeLink){ + mypath = new File(directory, currentBoard.getBoardDir() + "_" + bi.youtubeID); + }else{ + mypath = new File(directory, currentBoard.getBoardDir() + "_" + bi.getThumb()); + } + if (mypath.exists()){ try { Bitmap b = BitmapFactory.decodeStream(new FileInputStream(mypath)); @@ -713,8 +731,12 @@ public class FragmentBoardItemList extends Fragment { Log.i("getThumb", "Not using wifi"); return; } + String imgURL = "http://bienvenidoainternet.org/" + bi.getParentBoard().getBoardDir() + "/thumb/" + bi.getThumb(); + if (bi.getThumb().startsWith("http")){ + imgURL = bi.getThumb(); + } Ion.with(getContext()) - .load("http://bienvenidoainternet.org/" + bi.getParentBoard().getBoardDir() + "/thumb/" + bi.getThumb()) + .load(imgURL) .setLogging("getThumbnail", Log.INFO) .asBitmap() .setCallback(new FutureCallback<Bitmap>() { @@ -778,8 +800,8 @@ public class FragmentBoardItemList extends Fragment { public int addReplyID(String s){ - if (!idList.contains(new ReplyID(s))){ - idList.add(new ReplyID(s)); + if (!idList.contains(new ReplyID(s, tm))){ + idList.add(new ReplyID(s, tm)); } for (ReplyID r : idList){ if (r.id.equals(s)){return r.color;} diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/MainActivity.java b/app/src/main/java/org/bienvenidoainternet/baiparser/MainActivity.java index 87ac15a..9a6a344 100644 --- a/app/src/main/java/org/bienvenidoainternet/baiparser/MainActivity.java +++ b/app/src/main/java/org/bienvenidoainternet/baiparser/MainActivity.java @@ -120,17 +120,37 @@ public class MainActivity extends AppCompatActivity fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - if (childFragment.currentBoard != null) { - if (!childFragment.boardItems.isEmpty()) { - try { - Intent in = new Intent(getApplicationContext(), ResponseActivity.class); - Bundle b = new Bundle(); - b.putParcelable("theReply", childFragment.boardItems.get(0)); - b.putBoolean("quoting", false); - in.putExtras(b); - startActivity(in); - } catch (Exception e) { - e.printStackTrace(); + if (pager.getCurrentItem() == 0){ + if (!mainFragment.getMode() && mainFragment.currentBoard != null){ + Intent in = new Intent(getApplicationContext(), ResponseActivity.class); + Bundle b = new Bundle(); + BoardItem temp = new BoardItem(); + temp.setParentBoard(mainFragment.currentBoard); + b.putParcelable("theReply", temp); + b.putBoolean("quoting", false); + b.putBoolean("newthread", true); + in.putExtras(b); + startActivity(in); + } + }else{ + if (childFragment.currentBoard != null) { + if (!childFragment.boardItems.isEmpty()) { + try { + Intent in = new Intent(getApplicationContext(), ResponseActivity.class); + Bundle b = new Bundle(); + BoardItem reply = childFragment.boardItems.get(0); + if (!reply.isLocked) { + b.putParcelable("theReply", reply); + b.putBoolean("quoting", false); + b.putBoolean("newthread", false); + in.putExtras(b); + startActivity(in); + }else{ + Toast.makeText(getApplicationContext(), "Error: Este hilo está cerrado", Toast.LENGTH_LONG).show(); + } + } catch (Exception e) { + e.printStackTrace(); + } } } } @@ -170,6 +190,7 @@ public class MainActivity extends AppCompatActivity @Override public void onPageSelected(int position) { if (position == 0){ + fab.setImageResource(R.drawable.ic_action_add); if (mainFragment.currentBoard != null) { toolbar.setTitle("Catálogo"); toolbar.setSubtitle(mainFragment.currentBoard.getBoardName()); @@ -178,14 +199,19 @@ public class MainActivity extends AppCompatActivity toolbar.setTitle("Post recientes"); toolbar.setSubtitle(""); } - fab.setVisibility(View.INVISIBLE); + if (mainFragment.getMode()){ + fab.hide(); + }else{ + fab.show(); + } }else if (position == 1){ + fab.setImageResource(R.drawable.ic_edit); if (childFragment.currentBoard != null) { toolbar.setTitle(childFragment.currentBoard.getBoardName()); if (!childFragment.boardItems.isEmpty()){ toolbar.setSubtitle(childFragment.boardItems.get(0).getSubject()); } - fab.setVisibility(View.VISIBLE); + fab.show(); } } } @@ -367,6 +393,32 @@ public class MainActivity extends AppCompatActivity } } + @Override + public void onThreadList() { + if (pager.getCurrentItem() == 0){ + getSupportActionBar().setTitle("Catálogo"); + getSupportActionBar().setSubtitle(mainFragment.currentBoard.getBoardName()); + fab.show(); + } + } + + @Override + public void onThread() { + if (pager.getCurrentItem() == 1){ + getSupportActionBar().setTitle(childFragment.currentBoard.getBoardName()); + getSupportActionBar().setSubtitle(childFragment.boardItems.get(0).getSubject()); + } + } + + @Override + public void onRecentPosts() { + if (pager.getCurrentItem() == 0){ + getSupportActionBar().setTitle("Post recientes"); + getSupportActionBar().setSubtitle(""); + fab.hide(); + } + } + private void getBoardList(){ Menu menu = navigationView.getMenu(); final SubMenu sub = menu.addSubMenu("Lista de Boards"); @@ -384,7 +436,7 @@ public class MainActivity extends AppCompatActivity JSONArray boards = new JSONObject(result).getJSONArray("boards"); for (int i = 0; i < boards.length(); i++) { JSONObject board = boards.getJSONObject(i); - Board parsedBoard = new Board(board.getString("name"), board.getString("dir"), board.getInt("board_type")); + Board parsedBoard = new Board(board.getString("name"), board.getString("dir"), board.getInt("board_type"), board.getInt("allow_image_replies") == 1 ? true : false); sub.add(parsedBoard.getBoardName()); boardList.add(parsedBoard); } @@ -395,6 +447,10 @@ public class MainActivity extends AppCompatActivity } } }); + + Board parsedBoard = new Board("Testing Field", "polka", 1, true); + sub.add(parsedBoard.getBoardName()); + boardList.add(parsedBoard); refreshNavigator(); } diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/ResponseActivity.java b/app/src/main/java/org/bienvenidoainternet/baiparser/ResponseActivity.java index 871aaf5..2a3ca24 100644 --- a/app/src/main/java/org/bienvenidoainternet/baiparser/ResponseActivity.java +++ b/app/src/main/java/org/bienvenidoainternet/baiparser/ResponseActivity.java @@ -54,7 +54,7 @@ public class ResponseActivity extends AppCompatActivity { private String password; private String selectedFile = ""; private final int PICK_IMAGE = 1; - private boolean quoting = false; + private boolean quoting = false, newthread = false; EditText filePath; @Override @@ -63,18 +63,34 @@ public class ResponseActivity extends AppCompatActivity { ThemeManager tm = new ThemeManager(this); this.setTheme(tm.getThemeForActivity()); setContentView(R.layout.activity_response); - getSupportActionBar().setTitle("Respondiendo"); + settings = PreferenceManager.getDefaultSharedPreferences(this); password = settings.getString("pref_password", "12345678"); if (savedInstanceState != null){ this.theReply = savedInstanceState.getParcelable("theReply"); this.quoting = savedInstanceState.getBoolean("quoting"); + this.newthread = savedInstanceState.getBoolean("newthread"); } if (getIntent().getExtras() != null){ this.theReply = getIntent().getParcelableExtra("theReply"); this.quoting = getIntent().getBooleanExtra("quoting", false); + this.newthread = getIntent().getBooleanExtra("newthread", false); + } + + if (newthread){ + getSupportActionBar().setTitle("Nuevo hilo"); + getSupportActionBar().setSubtitle(theReply.getParentBoard().getBoardName()); + }else{ + getSupportActionBar().setTitle("Respondiendo"); } + + TextView txtFilePath = (TextView) findViewById(R.id.txtFilePath); + Button btnSelectFile = (Button) findViewById(R.id.btnSelectFiles); + TextView txtThreadSubject = (TextView) findViewById(R.id.txtThreadSubject); + + txtThreadSubject.setVisibility(newthread ? View.VISIBLE : View.GONE); + if (theReply != null && quoting){ TextView txtMessage = (TextView) findViewById(R.id.txtResponse); if (theReply.getParentBoard().getBoardType() == 1){ // BBS @@ -82,6 +98,9 @@ public class ResponseActivity extends AppCompatActivity { }else{ txtMessage.setText(">>" + theReply.getId()); } + }else if (theReply != null){ + txtFilePath.setVisibility(theReply.getParentBoard().isCanAttachFiles() ? View.VISIBLE : View.GONE); + btnSelectFile.setVisibility(theReply.getParentBoard().isCanAttachFiles() ? View.VISIBLE : View.GONE); } LinearLayout layoutProcess = (LinearLayout)findViewById(R.id.layoutPostProcess); @@ -89,39 +108,49 @@ public class ResponseActivity extends AppCompatActivity { filePath = (EditText) findViewById(R.id.txtFilePath); Button bBold = (Button) findViewById(R.id.buttonBold); + Button bStrike = (Button) findViewById(R.id.buttonStrike); + Button bList = (Button) findViewById(R.id.buttonList); + Button bCode = (Button) findViewById(R.id.buttonCode); + Button bUnder = (Button) findViewById(R.id.buttonUnderline); + Button bItalic = (Button) findViewById(R.id.buttonItalic); + Button select = (Button) findViewById(R.id.btnSelectFiles); + bBold.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - TextView txtMessage = (TextView) findViewById(R.id.txtResponse); - if (txtMessage.getSelectionStart() == -1){ - txtMessage.setText(txtMessage.getText() + "<b></b>"); - }else{ - String s = txtMessage.getText().toString(); - String a = s.substring(0, txtMessage.getSelectionStart()); - String b = s.substring(txtMessage.getSelectionStart(), txtMessage.getSelectionEnd()); - String c = s.substring(txtMessage.getSelectionEnd(), txtMessage.getText().length()); - txtMessage.setText(a + "<b>" + b + "</b>" + c); - } + applyTag("b"); } }); - Button bItalic = (Button) findViewById(R.id.buttonItalic); bItalic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - TextView txtMessage = (TextView) findViewById(R.id.txtResponse); - if (txtMessage.getSelectionStart() == -1){ - txtMessage.setText(txtMessage.getText() + "<i></i>"); - }else{ - String s = txtMessage.getText().toString(); - String a = s.substring(0, txtMessage.getSelectionStart()); - String b = s.substring(txtMessage.getSelectionStart(), txtMessage.getSelectionEnd()); - String c = s.substring(txtMessage.getSelectionEnd(), txtMessage.getText().length()); - txtMessage.setText(a + "<i>" + b + "</i>" + c); - } + applyTag("i"); + } + }); + bStrike.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + applyTag("strike"); + } + }); + bList.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + applyTag("ul"); + } + }); + bCode.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + applyTag("code"); + } + }); + bUnder.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + applyTag("u"); } }); - - Button select = (Button) findViewById(R.id.btnSelectFiles); select.setOnClickListener(new View.OnClickListener() { @Override @@ -135,6 +164,19 @@ public class ResponseActivity extends AppCompatActivity { } + private void applyTag(String tag){ + TextView txtMessage = (TextView) findViewById(R.id.txtResponse); + if (txtMessage.getSelectionStart() == -1){ + txtMessage.setText(txtMessage.getText() + "<" + tag + "></" + tag +">"); + }else{ + String s = txtMessage.getText().toString(); + String a = s.substring(0, txtMessage.getSelectionStart()); + String b = s.substring(txtMessage.getSelectionStart(), txtMessage.getSelectionEnd()); + String c = s.substring(txtMessage.getSelectionEnd(), txtMessage.getText().length()); + txtMessage.setText(a + "<" + tag + ">" + b + "</" + tag + ">" + c); + } + } + @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_replyform, menu); @@ -147,7 +189,8 @@ public class ResponseActivity extends AppCompatActivity { TextView txtName = (TextView) findViewById(R.id.txtPosterName); TextView txtEmail = (TextView) findViewById(R.id.txtEmail); TextView txtMessage = (TextView) findViewById(R.id.txtResponse); - makePost(txtName.getText().toString(), txtEmail.getText().toString(), txtMessage.getText().toString()); + TextView txtThreadSubject = (TextView) findViewById(R.id.txtThreadSubject); + makePost(txtName.getText().toString(), txtEmail.getText().toString(), txtMessage.getText().toString(), txtThreadSubject.getText().toString()); } return super.onOptionsItemSelected(item); } @@ -168,10 +211,11 @@ public class ResponseActivity extends AppCompatActivity { super.onSaveInstanceState(outState); } - private void makePost(String name, String email, String message){ - int parentId = theReply.getParentId(); - if (theReply.getParentId() == 0 || theReply.getParentId() == -1){ - parentId = theReply.getId(); + private void makePost(String name, String email, String message, String subject){ + int parentId = theReply.realParentId(); + // Si el parentId = 0 && subject != "" ==> Nuevo hilo + if (newthread){ + parentId = 0; } LinearLayout layoutProcess = (LinearLayout)findViewById(R.id.layoutPostProcess); layoutProcess.setVisibility(View.VISIBLE); @@ -181,62 +225,146 @@ public class ResponseActivity extends AppCompatActivity { final TextView err = (TextView)findViewById(R.id.txtPostingState); err.setText(""); File up = new File(selectedFile); - if (selectedFile.isEmpty()) Ion.with(getApplicationContext()) - .load("http://bienvenidoainternet.org/cgi/post") - .setLogging("posting", Log.VERBOSE) - .uploadProgressBar(progess) - .setMultipartParameter("board", theReply.getParentBoard().getBoardDir()) - .setMultipartParameter("parent", String.valueOf(theReply.realParentId())) - .setMultipartParameter("password", password) - .setMultipartParameter("fielda", name) - .setMultipartParameter("fieldb", email) - .setMultipartParameter("name", "") - .setMultipartParameter("email", "") - .setMultipartParameter("message", message) - .asString() - .setCallback(new FutureCallback<String>() { - @Override - public void onCompleted(Exception e, String result) { - Log.v("sendPost", result); - if (e != null) { - Toast.makeText(getApplicationContext(), "Ha ocurrido un error! ;_;", Toast.LENGTH_LONG).show(); - formSendPost.setVisibility(View.VISIBLE); - err.setText("Error: " + e.getMessage()); - e.printStackTrace(); - } else { - Toast.makeText(getApplicationContext(), "Post enviado", Toast.LENGTH_LONG).show(); - finish(); - } - } - }); - else{ - Ion.with(getApplicationContext()) - .load("http://bienvenidoainternet.org/cgi/post") - .uploadProgressBar(progess) - .setMultipartParameter("board", theReply.getParentBoard().getBoardDir()) - .setMultipartParameter("parent", String.valueOf(parentId)) - .setMultipartParameter("password", password) - .setMultipartParameter("fielda", name) - .setMultipartParameter("fieldb", email) - .setMultipartParameter("name", "") - .setMultipartParameter("email", "") - .setMultipartParameter("message", message) - .setMultipartFile("file", up) - .asDocument() - .setCallback(new FutureCallback<Document>() { - @Override - public void onCompleted(Exception e, Document result) { - if (e != null){ - Toast.makeText(getApplicationContext(), "Ha ocurrido un error! ;_;", Toast.LENGTH_LONG).show(); - formSendPost.setVisibility(View.VISIBLE); - err.setText("Error: " + e.getMessage()); - e.printStackTrace(); - }else{ - Toast.makeText(getApplicationContext(), "Post enviado", Toast.LENGTH_LONG).show(); - finish(); + + if (newthread){ + if (selectedFile.isEmpty()){ + Ion.with(getApplicationContext()) + .load("http://bienvenidoainternet.org/cgi/post") + .setLogging("posting", Log.VERBOSE) + .uploadProgressBar(progess) + .setMultipartParameter("board", theReply.getParentBoard().getBoardDir()) + .setMultipartParameter("password", password) + .setMultipartParameter("fielda", name) + .setMultipartParameter("fieldb", email) + .setMultipartParameter("name", "") + .setMultipartParameter("email", "") + .setMultipartParameter("message", message) + .setMultipartParameter("subject", subject) + .setMultipartParameter("noimage", "on") + .asString() + .setCallback(new FutureCallback<String>() { + @Override + public void onCompleted(Exception e, String result) { + Log.v("sendPost", result); + if (e != null) { + Toast.makeText(getApplicationContext(), "Ha ocurrido un error! ;_;", Toast.LENGTH_LONG).show(); + formSendPost.setVisibility(View.VISIBLE); + err.setText("Error: " + e.getMessage()); + e.printStackTrace(); + } else { + if (result.contains("ERROR : Flood detectado.")){ + Toast.makeText(getApplicationContext(), "Error: Flood detectado.", Toast.LENGTH_LONG).show(); + }else{ + Toast.makeText(getApplicationContext(), "Post enviado", Toast.LENGTH_LONG).show(); + } + finish(); + } } - } - }); + }); + }else{ + Ion.with(getApplicationContext()) + .load("http://bienvenidoainternet.org/cgi/post") + .uploadProgressBar(progess) + .setMultipartParameter("board", theReply.getParentBoard().getBoardDir()) + .setMultipartParameter("password", password) + .setMultipartParameter("fielda", name) + .setMultipartParameter("fieldb", email) + .setMultipartParameter("name", "") + .setMultipartParameter("email", "") + .setMultipartParameter("message", message) + .setMultipartParameter("subject", subject) + .setMultipartFile("file", up) + .asString() + .setCallback(new FutureCallback<String>() { + @Override + public void onCompleted(Exception e, String result) { + Log.v("sendPost", result); + if (e != null){ + Toast.makeText(getApplicationContext(), "Ha ocurrido un error! ;_;", Toast.LENGTH_LONG).show(); + formSendPost.setVisibility(View.VISIBLE); + err.setText("Error: " + e.getMessage()); + e.printStackTrace(); + }else{ + if (result.contains("ERROR : Flood detectado.")){ + Toast.makeText(getApplicationContext(), "Error: Flood detectado.", Toast.LENGTH_LONG).show(); + }else{ + Toast.makeText(getApplicationContext(), "Post enviado", Toast.LENGTH_LONG).show(); + } + finish(); + } + } + }); + } + }else{ + if (selectedFile.isEmpty()){ + Ion.with(getApplicationContext()) + .load("http://bienvenidoainternet.org/cgi/post") + .setLogging("posting", Log.VERBOSE) + .uploadProgressBar(progess) + .setMultipartParameter("board", theReply.getParentBoard().getBoardDir()) + .setMultipartParameter("parent", String.valueOf(parentId)) + .setMultipartParameter("password", password) + .setMultipartParameter("fielda", name) + .setMultipartParameter("fieldb", email) + .setMultipartParameter("name", "") + .setMultipartParameter("email", "") + .setMultipartParameter("message", message) + .setMultipartParameter("subject", subject) + .asString() + .setCallback(new FutureCallback<String>() { + @Override + public void onCompleted(Exception e, String result) { + Log.v("sendPost", result); + if (e != null) { + Toast.makeText(getApplicationContext(), "Ha ocurrido un error! ;_;", Toast.LENGTH_LONG).show(); + formSendPost.setVisibility(View.VISIBLE); + err.setText("Error: " + e.getMessage()); + e.printStackTrace(); + } else { + if (result.contains("ERROR : Flood detectado.")){ + Toast.makeText(getApplicationContext(), "Error: Flood detectado.", Toast.LENGTH_LONG).show(); + }else{ + Toast.makeText(getApplicationContext(), "Post enviado", Toast.LENGTH_LONG).show(); + } + finish(); + } + } + }); + }else{ + Ion.with(getApplicationContext()) + .load("http://bienvenidoainternet.org/cgi/post") + .uploadProgressBar(progess) + .setMultipartParameter("board", theReply.getParentBoard().getBoardDir()) + .setMultipartParameter("parent", String.valueOf(parentId)) + .setMultipartParameter("password", password) + .setMultipartParameter("fielda", name) + .setMultipartParameter("fieldb", email) + .setMultipartParameter("name", "") + .setMultipartParameter("email", "") + .setMultipartParameter("message", message) + .setMultipartParameter("subject", subject) + .setMultipartFile("file", up) + .asString() + .setCallback(new FutureCallback<String>() { + @Override + public void onCompleted(Exception e, String result) { + Log.v("sendPost", result); + if (e != null){ + Toast.makeText(getApplicationContext(), "Ha ocurrido un error! ;_;", Toast.LENGTH_LONG).show(); + formSendPost.setVisibility(View.VISIBLE); + err.setText("Error: " + e.getMessage()); + e.printStackTrace(); + }else{ + if (result.contains("ERROR : Flood detectado.")){ + Toast.makeText(getApplicationContext(), "Error: Flood detectado.", Toast.LENGTH_LONG).show(); + }else{ + Toast.makeText(getApplicationContext(), "Post enviado", Toast.LENGTH_LONG).show(); + } + finish(); + } + } + }); + } } } } diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/ThreadListAdapter.java b/app/src/main/java/org/bienvenidoainternet/baiparser/ThreadListAdapter.java index 69c674e..6a23280 100644 --- a/app/src/main/java/org/bienvenidoainternet/baiparser/ThreadListAdapter.java +++ b/app/src/main/java/org/bienvenidoainternet/baiparser/ThreadListAdapter.java @@ -108,6 +108,7 @@ public class ThreadListAdapter extends ArrayAdapter<BoardItem>{ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this.getContext()); boolean useMonaFont = settings.getBoolean("setting_monafont", true); boolean monaBbsOnly = settings.getBoolean("setting_mona_bbsonly", true); + boolean resizeThumb = settings.getBoolean("setting_resize_thumbs", true); int marginColor = tm.getMarginColor(); int sageColor = tm.getSageColor(); int nameColor = tm.getNameColor(); @@ -126,12 +127,24 @@ public class ThreadListAdapter extends ArrayAdapter<BoardItem>{ ImageView ivMargin = (ImageView)listItemView.findViewById(R.id.ivMargin); ImageView ivThumb = (ImageView)listItemView.findViewById(R.id.ivThumb); +// Log.v("resize", resizeThumb + ""); + if (resizeThumb){ + ivThumb.setScaleType(ImageView.ScaleType.FIT_XY); + }else{ + ivThumb.setScaleType(ImageView.ScaleType.FIT_CENTER); + } + ivThumb.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!boardItem.getThumb().isEmpty() && convertView != null){ - if (boardItem.getFile().endsWith(".webm") || boardItem.getFile().endsWith(".ogg") || boardItem.getFile().endsWith(".opus") || boardItem.getFile().endsWith(".swf")){ - Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse("http://bienvenidoainternet.org/" + boardItem.getParentBoard().getBoardDir() + "/src/" + boardItem.getFile())); + if (boardItem.getFile().endsWith(".webm") || boardItem.getFile().endsWith(".ogg") || boardItem.getFile().endsWith(".opus") || boardItem.getFile().endsWith(".swf") || boardItem.youtubeLink){ + Intent in; + if (boardItem.youtubeLink){ + in = new Intent(Intent.ACTION_VIEW, Uri.parse(boardItem.youtubeURL)); + }else{ + in = new Intent(Intent.ACTION_VIEW, Uri.parse("http://bienvenidoainternet.org/" + boardItem.getParentBoard().getBoardDir() + "/src/" + boardItem.getFile())); + } in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); v.getContext().startActivity(in); }else { @@ -244,14 +257,20 @@ public class ThreadListAdapter extends ArrayAdapter<BoardItem>{ txtReplies.setText(boardItem.getTotalReplies() + " respuestas " + (boardItem.getTotalFiles() == 0 ? "" : ", " + boardItem.getTotalFiles() + " archivos")); String fileExt = ""; - if (!boardItem.getFile().isEmpty()){ - String[] pathSplit = boardItem.getFile().split("\\."); - if (pathSplit.length != 0){ - fileExt = pathSplit[1].toUpperCase(); + txtFileInfo.setVisibility(boardItem.getThumb().isEmpty() ? View.GONE : View.VISIBLE); + + if (!boardItem.getThumb().isEmpty() && boardItem.getThumb().startsWith("http")){ + txtFileInfo.setText("YOUTUBE"); + }else{ + if (!boardItem.getFile().isEmpty()){ + String[] pathSplit = boardItem.getFile().split("\\."); + if (pathSplit.length != 0){ + fileExt = pathSplit[1].toUpperCase(); + } } + txtFileInfo.setText(fileExt + " " + (boardItem.getFileSize() / 1024) + " KB " + boardItem.getThumbHeight() + "x" + boardItem.getThumbWidth()); } - txtFileInfo.setVisibility(boardItem.getThumb().isEmpty() ? View.GONE : View.VISIBLE); - txtFileInfo.setText(fileExt + " " + (boardItem.getFileSize() / 1024) + " KB " + boardItem.getThumbHeight() + "x" + boardItem.getThumbWidth()); + // Trasnparentar items con sage if (convertView != null){ diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/structure/Board.java b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/Board.java index cb95e63..536f476 100644 --- a/app/src/main/java/org/bienvenidoainternet/baiparser/structure/Board.java +++ b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/Board.java @@ -24,16 +24,28 @@ import android.os.Parcelable; public class Board implements Parcelable{ private String boardName, boardDir; private int boardType; - public Board(String boardName,String boardDir,int boardType){ + + public boolean isCanAttachFiles() { + return canAttachFiles; + } + + public void setCanAttachFiles(boolean canAttachFiles) { + this.canAttachFiles = canAttachFiles; + } + + private boolean canAttachFiles; + public Board(String boardName, String boardDir, int boardType, boolean canAttachFiles){ this.boardName = boardName; this.boardDir = boardDir; this.boardType = boardType; + this.canAttachFiles = canAttachFiles; } public Board(Parcel in){ this.boardName = in.readString(); this.boardDir = in.readString(); this.boardType = in.readInt(); + this.canAttachFiles = in.readByte() != 0; } public String getBoardDir() { @@ -70,5 +82,6 @@ public class Board implements Parcelable{ dest.writeString(boardName); dest.writeString(boardDir); dest.writeInt(boardType); + dest.writeByte((byte)(canAttachFiles ? 1 : 0)); } } diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/structure/BoardItem.java b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/BoardItem.java index b21d598..8eb55e5 100644 --- a/app/src/main/java/org/bienvenidoainternet/baiparser/structure/BoardItem.java +++ b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/BoardItem.java @@ -3,6 +3,12 @@ package org.bienvenidoainternet.baiparser.structure; import android.graphics.Bitmap; import android.os.Parcel; import android.os.Parcelable; +import android.util.Log; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.parser.Tag; /** * BaiApp - Bienvenido a internet Android Application @@ -31,12 +37,13 @@ public class BoardItem implements Parcelable { private String message = ""; private String subject = ""; private String posterId = ""; - private int parentid, id, idcolor, totalreplies = 0, totalfiles, thumb_height, thumb_weight, filesize, deleted_code, bbs_id = 1, parentPostCount; + public String youtubeURL = "", youtubeID = ""; + private int parentid = 0, id = 0, idcolor, totalreplies = 0, totalfiles, thumb_height, thumb_weight, filesize, deleted_code, bbs_id = 1, parentPostCount; private long timestamp = 0; private Bitmap thumbBitmap = null; public boolean downloadingThumb = false; - public boolean isReply = false; + public boolean isReply = false, isLocked = false, youtubeLink = false; private Board parentBoard = null; protected BoardItem(Parcel in) { @@ -49,6 +56,8 @@ public class BoardItem implements Parcelable { message = in.readString(); subject = in.readString(); posterId = in.readString(); + youtubeURL = in.readString(); + youtubeID = in.readString(); parentid = in.readInt(); id = in.readInt(); idcolor = in.readInt(); @@ -64,6 +73,8 @@ public class BoardItem implements Parcelable { thumbBitmap = in.readParcelable(Bitmap.class.getClassLoader()); downloadingThumb = in.readByte() != 0; isReply = in.readByte() != 0; + isLocked = in.readByte() != 0; + youtubeLink = in.readByte() != 0; parentBoard = in.readParcelable(Board.class.getClassLoader()); } @@ -124,12 +135,22 @@ public class BoardItem implements Parcelable { } public void setMessage(String message) { - // TODO: Dar formato a los mensajes de otra forma - this.message = message.replace("<span class=\"unkfunc\">", "<font color=#85c749><i>"); - this.message = this.message.replace("</span>", "</i></font>"); - if (this.message.contains("<hr")){ - this.message = this.message.replace("<hr />", "<br><br><small><font color=#FF8800><i>") + "</i></small></font>"; + Document msg = Jsoup.parse(message); + if (!msg.getElementsByClass("yt").isEmpty()){ + Element you = msg.getElementsByClass("yt").first(); + if (this.getFile().isEmpty()){ + this.thumb = you.getElementsByTag("img").attr("src"); + String[] parts = thumb.split("/"); + this.youtubeLink = true; + this.youtubeURL = "https://www.youtube.com/watch?v=" + parts[4]; + this.youtubeID = parts[4]; + Log.v("ID", youtubeID); + } } + msg.select("img[src]").remove(); + msg.select("span[class=unkfunc]").tagName("font").attr("color", "#8fb56c").wrap("<i></i>"); + msg.select("div[class=yt]").wrap("<font color=red'><i></i></font>"); + this.message = msg.html(); } public String getName() { @@ -288,6 +309,10 @@ public class BoardItem implements Parcelable { return this.email.equals("sage"); } + public void setLockStatus(int i){ + this.isLocked = i == 0 ? false : true; + } + @Override public int describeContents() { return 0; @@ -304,6 +329,8 @@ public class BoardItem implements Parcelable { dest.writeString(message); dest.writeString(subject); dest.writeString(posterId); + dest.writeString(youtubeURL); + dest.writeString(youtubeID); dest.writeInt(parentid); dest.writeInt(id); dest.writeInt(idcolor); @@ -319,6 +346,8 @@ public class BoardItem implements Parcelable { dest.writeParcelable(thumbBitmap, flags); dest.writeByte((byte) (downloadingThumb ? 1 : 0)); dest.writeByte((byte) (isReply ? 1 : 0)); + dest.writeByte((byte) (isLocked ? 1 : 0)); + dest.writeByte((byte) (youtubeLink ? 1 : 0)); dest.writeParcelable(parentBoard, flags); } } diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/structure/ReplyID.java b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/ReplyID.java index 2780e74..9cf2319 100644 --- a/app/src/main/java/org/bienvenidoainternet/baiparser/structure/ReplyID.java +++ b/app/src/main/java/org/bienvenidoainternet/baiparser/structure/ReplyID.java @@ -4,6 +4,8 @@ import android.graphics.Color; import android.os.Parcel; import android.os.Parcelable; +import org.bienvenidoainternet.baiparser.ThemeManager; + import java.util.Random; /** @@ -26,10 +28,14 @@ import java.util.Random; public class ReplyID implements Parcelable{ public String id; public int color; - public ReplyID(String id){ + public ReplyID(String id, ThemeManager tm){ this.id = id; Random r = new Random(); - this.color = Color.rgb(r.nextInt(125) + 127, r.nextInt(127) + 127, r.nextInt(127) + 127); + if (tm.isDarkTheme()){ + this.color = Color.rgb(r.nextInt(125) + 127, r.nextInt(127) + 127, r.nextInt(127) + 127); + }else{ + this.color = Color.rgb(r.nextInt(125), r.nextInt(127), r.nextInt(127)); + } } protected ReplyID(Parcel in) { diff --git a/app/src/main/res/drawable-hdpi/ic_action_add.png b/app/src/main/res/drawable-hdpi/ic_action_add.png Binary files differnew file mode 100644 index 0000000..7800ba3 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_action_add.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_font_underline.png b/app/src/main/res/drawable-hdpi/ic_action_font_underline.png Binary files differnew file mode 100644 index 0000000..7062cc7 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_action_font_underline.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_list_2.png b/app/src/main/res/drawable-hdpi/ic_action_list_2.png Binary files differnew file mode 100644 index 0000000..ac49d33 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_action_list_2.png diff --git a/app/src/main/res/drawable-hdpi/ic_code.png b/app/src/main/res/drawable-hdpi/ic_code.png Binary files differnew file mode 100644 index 0000000..1b2f778 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_code.png diff --git a/app/src/main/res/drawable-hdpi/ic_format_list_bulleted.png b/app/src/main/res/drawable-hdpi/ic_format_list_bulleted.png Binary files differnew file mode 100644 index 0000000..745283b --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_format_list_bulleted.png diff --git a/app/src/main/res/drawable-hdpi/ic_format_strikethrough.png b/app/src/main/res/drawable-hdpi/ic_format_strikethrough.png Binary files differnew file mode 100644 index 0000000..2c1a2e1 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_format_strikethrough.png diff --git a/app/src/main/res/drawable-hdpi/ic_format_underlined.png b/app/src/main/res/drawable-hdpi/ic_format_underlined.png Binary files differnew file mode 100644 index 0000000..1ac0ef2 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_format_underlined.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_add.png b/app/src/main/res/drawable-mdpi/ic_action_add.png Binary files differnew file mode 100644 index 0000000..ed40b2b --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_action_add.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_font_underline.png b/app/src/main/res/drawable-mdpi/ic_action_font_underline.png Binary files differnew file mode 100644 index 0000000..cb18abb --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_action_font_underline.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_list_2.png b/app/src/main/res/drawable-mdpi/ic_action_list_2.png Binary files differnew file mode 100644 index 0000000..3397ab3 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_action_list_2.png diff --git a/app/src/main/res/drawable-mdpi/ic_code.png b/app/src/main/res/drawable-mdpi/ic_code.png Binary files differnew file mode 100644 index 0000000..bbd2496 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_code.png diff --git a/app/src/main/res/drawable-mdpi/ic_format_list_bulleted.png b/app/src/main/res/drawable-mdpi/ic_format_list_bulleted.png Binary files differnew file mode 100644 index 0000000..a49367b --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_format_list_bulleted.png diff --git a/app/src/main/res/drawable-mdpi/ic_format_strikethrough.png b/app/src/main/res/drawable-mdpi/ic_format_strikethrough.png Binary files differnew file mode 100644 index 0000000..a836411 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_format_strikethrough.png diff --git a/app/src/main/res/drawable-mdpi/ic_format_underlined.png b/app/src/main/res/drawable-mdpi/ic_format_underlined.png Binary files differnew file mode 100644 index 0000000..d8eb278 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_format_underlined.png diff --git a/app/src/main/res/drawable-xhdpi/ic_action_add.png b/app/src/main/res/drawable-xhdpi/ic_action_add.png Binary files differnew file mode 100644 index 0000000..185be8a --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_action_add.png diff --git a/app/src/main/res/drawable-xhdpi/ic_action_font_underline.png b/app/src/main/res/drawable-xhdpi/ic_action_font_underline.png Binary files differnew file mode 100644 index 0000000..730ab79 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_action_font_underline.png diff --git a/app/src/main/res/drawable-xhdpi/ic_action_list_2.png b/app/src/main/res/drawable-xhdpi/ic_action_list_2.png Binary files differnew file mode 100644 index 0000000..319bbce --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_action_list_2.png diff --git a/app/src/main/res/drawable-xhdpi/ic_code.png b/app/src/main/res/drawable-xhdpi/ic_code.png Binary files differnew file mode 100644 index 0000000..42d620a --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_code.png diff --git a/app/src/main/res/drawable-xhdpi/ic_format_list_bulleted.png b/app/src/main/res/drawable-xhdpi/ic_format_list_bulleted.png Binary files differnew file mode 100644 index 0000000..0b10898 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_format_list_bulleted.png diff --git a/app/src/main/res/drawable-xhdpi/ic_format_strikethrough.png b/app/src/main/res/drawable-xhdpi/ic_format_strikethrough.png Binary files differnew file mode 100644 index 0000000..7cd4f13 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_format_strikethrough.png diff --git a/app/src/main/res/drawable-xhdpi/ic_format_underlined.png b/app/src/main/res/drawable-xhdpi/ic_format_underlined.png Binary files differnew file mode 100644 index 0000000..32c0140 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_format_underlined.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_add.png b/app/src/main/res/drawable-xxhdpi/ic_action_add.png Binary files differnew file mode 100644 index 0000000..2ab780a --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_action_add.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_font_underline.png b/app/src/main/res/drawable-xxhdpi/ic_action_font_underline.png Binary files differnew file mode 100644 index 0000000..1bb40b5 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_action_font_underline.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_list_2.png b/app/src/main/res/drawable-xxhdpi/ic_action_list_2.png Binary files differnew file mode 100644 index 0000000..a71d22c --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_action_list_2.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_code.png b/app/src/main/res/drawable-xxhdpi/ic_code.png Binary files differnew file mode 100644 index 0000000..65972be --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_code.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_format_list_bulleted.png b/app/src/main/res/drawable-xxhdpi/ic_format_list_bulleted.png Binary files differnew file mode 100644 index 0000000..5a7b70e --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_format_list_bulleted.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_format_strikethrough.png b/app/src/main/res/drawable-xxhdpi/ic_format_strikethrough.png Binary files differnew file mode 100644 index 0000000..6b46c34 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_format_strikethrough.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_format_underlined.png b/app/src/main/res/drawable-xxhdpi/ic_format_underlined.png Binary files differnew file mode 100644 index 0000000..8724f59 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_format_underlined.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_add.png b/app/src/main/res/drawable-xxxhdpi/ic_action_add.png Binary files differnew file mode 100644 index 0000000..e6ca376 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_action_add.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_font_underline.png b/app/src/main/res/drawable-xxxhdpi/ic_action_font_underline.png Binary files differnew file mode 100644 index 0000000..f941ab2 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_action_font_underline.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_list_2.png b/app/src/main/res/drawable-xxxhdpi/ic_action_list_2.png Binary files differnew file mode 100644 index 0000000..7746bf2 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_action_list_2.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_code.png b/app/src/main/res/drawable-xxxhdpi/ic_code.png Binary files differnew file mode 100644 index 0000000..fae84b5 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_code.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_format_list_bulleted.png b/app/src/main/res/drawable-xxxhdpi/ic_format_list_bulleted.png Binary files differnew file mode 100644 index 0000000..21bd897 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_format_list_bulleted.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_format_strikethrough.png b/app/src/main/res/drawable-xxxhdpi/ic_format_strikethrough.png Binary files differnew file mode 100644 index 0000000..1e9e4a1 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_format_strikethrough.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_format_underlined.png b/app/src/main/res/drawable-xxxhdpi/ic_format_underlined.png Binary files differnew file mode 100644 index 0000000..afabe85 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_format_underlined.png diff --git a/app/src/main/res/drawable/Thumbs.db b/app/src/main/res/drawable/Thumbs.db Binary files differindex 07c6d5a..7a924fe 100644 --- a/app/src/main/res/drawable/Thumbs.db +++ b/app/src/main/res/drawable/Thumbs.db diff --git a/app/src/main/res/layout/activity_response.xml b/app/src/main/res/layout/activity_response.xml index 15d35eb..2bae1d6 100644 --- a/app/src/main/res/layout/activity_response.xml +++ b/app/src/main/res/layout/activity_response.xml @@ -14,82 +14,144 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/layoutForm"> + + <EditText + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:inputType="textEmailAddress" + android:id="@+id/txtEmail" + android:hint="@string/txt_email" + android:layout_below="@+id/txtPosterName" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:nextFocusDown="@+id/txtThreadSubject"/> + + <Button + style="?android:attr/buttonStyleSmall" + android:layout_width="32dp" + android:layout_height="32dp" + android:id="@+id/buttonBold" + android:background="@drawable/ic_action_font_bold" + android:layout_below="@+id/btnSelectFiles" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" /> + + <Button + style="?android:attr/buttonStyleSmall" + android:layout_width="32dp" + android:layout_height="32dp" + android:background="@drawable/ic_action_font_italic" + android:id="@+id/buttonItalic" + android:layout_above="@+id/txtResponse" + android:layout_toRightOf="@+id/buttonBold" + android:layout_toEndOf="@+id/buttonBold" + android:layout_marginLeft="10dp" /> + + <Button + style="?android:attr/buttonStyleSmall" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="..." + android:id="@+id/btnSelectFiles" + android:layout_below="@+id/txtThreadSubject" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> + <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textPersonName" android:ems="10" android:id="@+id/txtPosterName" + android:hint="@string/txt_postername" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" - android:hint="@string/txt_postername" /> + android:nextFocusDown="@+id/txtEmail"/> <EditText - android:layout_width="fill_parent" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:inputType="textEmailAddress" + android:inputType="textPersonName" android:ems="10" - android:id="@+id/txtEmail" - android:layout_below="@+id/txtPosterName" + android:id="@+id/txtThreadSubject" + android:hint="@string/txt_thread_subject" + android:layout_below="@+id/txtEmail" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" - android:hint="@string/txt_email" /> + android:nextFocusDown="@+id/txtResponse"/> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" - android:inputType="textMultiLine" + android:inputType="textCapSentences|textMultiLine" android:ems="10" android:id="@+id/txtResponse" android:hint="@string/txt_response" - android:layout_below="@+id/buttonBold" + android:clickable="false" + android:capitalize="sentences" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" - android:clickable="false" - android:capitalize="sentences" /> + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:layout_below="@+id/buttonBold" + android:layout_marginTop="10dp" /> + + <EditText + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/txtFilePath" + android:enabled="false" + android:hint="Archivo " + android:layout_gravity="center_horizontal" + android:layout_below="@+id/txtThreadSubject" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" /> <Button style="?android:attr/buttonStyleSmall" android:layout_width="32dp" android:layout_height="32dp" - android:id="@+id/buttonBold" - android:background="@drawable/ic_action_font_bold" - android:layout_below="@+id/txtFilePath" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" /> + android:background="@drawable/ic_format_strikethrough" + android:id="@+id/buttonStrike" + android:layout_alignTop="@+id/buttonItalic" + android:layout_toRightOf="@+id/buttonItalic" + android:layout_toEndOf="@+id/buttonItalic" + android:layout_marginLeft="10dp" /> <Button style="?android:attr/buttonStyleSmall" android:layout_width="32dp" android:layout_height="32dp" - android:background="@drawable/ic_action_font_italic" - android:id="@+id/buttonItalic" - android:layout_alignTop="@+id/buttonBold" - android:layout_toRightOf="@+id/buttonBold" - android:layout_toEndOf="@+id/buttonBold" /> + android:background="@drawable/ic_action_font_underline" + android:id="@+id/buttonUnderline" + android:layout_alignTop="@+id/buttonStrike" + android:layout_toRightOf="@+id/buttonStrike" + android:layout_toEndOf="@+id/buttonStrike" + android:layout_marginLeft="10dp" + android:allowUndo="false" /> - <EditText - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/txtFilePath" - android:layout_below="@+id/txtEmail" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:enabled="false" - android:hint="Archivo " - android:layout_toLeftOf="@+id/btnSelectFiles" - android:layout_toStartOf="@+id/btnSelectFiles" /> + <Button + style="?android:attr/buttonStyleSmall" + android:layout_width="32dp" + android:layout_height="32dp" + android:id="@+id/buttonList" + android:background="@drawable/ic_action_list_2" + android:layout_alignTop="@+id/buttonUnderline" + android:layout_toRightOf="@+id/buttonUnderline" + android:layout_toEndOf="@+id/buttonUnderline" + android:layout_marginLeft="10dp" /> <Button style="?android:attr/buttonStyleSmall" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="..." - android:id="@+id/btnSelectFiles" - android:layout_below="@+id/txtEmail" - android:layout_alignParentRight="true" - android:layout_alignParentEnd="true" /> + android:layout_width="32dp" + android:layout_height="32dp" + android:id="@+id/buttonCode" + android:background="@drawable/ic_code" + android:layout_alignTop="@+id/buttonList" + android:layout_toRightOf="@+id/buttonList" + android:layout_toEndOf="@+id/buttonList" + android:layout_marginLeft="10dp" /> </RelativeLayout> @@ -120,6 +182,7 @@ android:layout_alignRight="@+id/relativeLayout" android:layout_alignEnd="@+id/relativeLayout" android:layout_marginTop="3dp" /> + </LinearLayout> </RelativeLayout> diff --git a/app/src/main/res/layout/thread_item.xml b/app/src/main/res/layout/thread_item.xml index a4396b4..ba2a397 100644 --- a/app/src/main/res/layout/thread_item.xml +++ b/app/src/main/res/layout/thread_item.xml @@ -7,7 +7,6 @@ android:layout_width="5dp" android:layout_height="match_parent" android:id="@+id/ivMargin" - android:scaleType="fitXY" android:src="@color/defaultMarginColor" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7754034..fd34631 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -12,6 +12,7 @@ <string name="txt_email">E-mail</string> <string name="txt_response">Respuesta</string> <string name="btn_send">Responder</string> + <string name="txt_thread_subject">Asunto</string> <string name="menu_reply">Citar</string> <string name="menu_copy">Copiar</string> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 459f65c..7226743 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -17,6 +17,10 @@ android:title="Usar Mona.tff solo en BSS" android:key="setting_mona_bbsonly" android:defaultValue="true"/> + <SwitchPreference + android:title="Redimensionar thumbnails" + android:key="setting_resize_thumbs" + android:defaultValue="true"/> </PreferenceCategory> <PreferenceCategory android:title="Comportamiento"> |