aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Renard 2016-04-07 18:58:48 -0300
committerLibravatar Renard 2016-04-07 18:58:48 -0300
commitb9b2cd586c147ba9b08bbd809e7137ba3b6dacff (patch)
tree27604522330c9d7d88c61c946cf602f4b49ea5aa
parentb80e7f3fd96d76d05734f3ba4221f1d7af97a57f (diff)
downloadBaiApp-b9b2cd586c147ba9b08bbd809e7137ba3b6dacff.tar.gz
BaiApp-b9b2cd586c147ba9b08bbd809e7137ba3b6dacff.tar.xz
BaiApp-b9b2cd586c147ba9b08bbd809e7137ba3b6dacff.zip
test
-rw-r--r--app/build.gradle17
-rw-r--r--app/src/main/AndroidManifest.xml10
-rw-r--r--app/src/main/java/org/bienvenidoainternet/baiparser/MainActivity.java49
-rw-r--r--app/src/main/java/org/bienvenidoainternet/baiparser/ResponseActivity.java38
-rw-r--r--app/src/main/java/org/bienvenidoainternet/baiparser/UpdaterActivity.java127
-rw-r--r--app/src/main/java/org/bienvenidoainternet/baiparser/ViewerActivity.java22
-rw-r--r--app/src/main/res/drawable-hdpi/ic_action_send.pngbin0 -> 324 bytes
-rw-r--r--app/src/main/res/drawable-mdpi/ic_action_send.pngbin0 -> 235 bytes
-rw-r--r--app/src/main/res/drawable-xhdpi/ic_action_send.pngbin0 -> 388 bytes
-rw-r--r--app/src/main/res/drawable-xxhdpi/ic_action_send.pngbin0 -> 582 bytes
-rw-r--r--app/src/main/res/drawable-xxxhdpi/ic_action_send.pngbin0 -> 1921 bytes
-rw-r--r--app/src/main/res/layout/activity_response.xml14
-rw-r--r--app/src/main/res/layout/activity_updater.xml64
-rw-r--r--app/src/main/res/menu/main.xml4
-rw-r--r--app/src/main/res/menu/menu_replyform.xml8
15 files changed, 48 insertions, 305 deletions
diff --git a/app/build.gradle b/app/build.gradle
index f0c0327..3eaec0f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -3,24 +3,13 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
- packagingOptions {
- exclude 'META-INF/DEPENDENCIES.txt'
- exclude 'META-INF/LICENSE.txt'
- exclude 'META-INF/NOTICE.txt'
- exclude 'META-INF/NOTICE'
- exclude 'META-INF/LICENSE'
- exclude 'META-INF/DEPENDENCIES'
- exclude 'META-INF/notice.txt'
- exclude 'META-INF/license.txt'
- exclude 'META-INF/dependencies.txt'
- exclude 'META-INF/LGPL2.1'
- }
+
defaultConfig {
applicationId "org.bienvenidoainternet.baiparser"
minSdkVersion 15
targetSdkVersion 23
- versionCode 1
- versionName "1.1"
+ versionCode 5
+ versionName "1.5"
}
buildTypes {
release {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 31f37e2..59d5328 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -22,14 +22,16 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- <activity android:name=".ResponseActivity" />
+ <activity android:name=".ResponseActivity"
+ android:theme="@style/AppTheme" />
<activity
android:name=".SettingsActivity"
- android:label="@string/title_activity_settings" />
+ android:label="@string/title_activity_settings"
+ android:theme="@style/AppTheme" />
<activity
android:name=".ViewerActivity"
- android:theme="@style/TransparentCompat"></activity>
- <activity android:name=".UpdaterActivity"></activity>
+ android:theme="@style/TransparentCompat" />
+ <activity android:name=".LicensesActivity"></activity>
</application>
</manifest>
diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/MainActivity.java b/app/src/main/java/org/bienvenidoainternet/baiparser/MainActivity.java
index bfe9db7..0a7d057 100644
--- a/app/src/main/java/org/bienvenidoainternet/baiparser/MainActivity.java
+++ b/app/src/main/java/org/bienvenidoainternet/baiparser/MainActivity.java
@@ -217,10 +217,8 @@ public class MainActivity extends AppCompatActivity
refreshNavigator();
}
- // TODO: Aplicar tema al navigator
-// navigationView.setBackgroundColor(themeManager.getPrimaryDarkColor());
- // TODO: Arreglar el servidor
-// checkForUpdates();
+ //TODO: Aplicar tema al navigator
+ //navigationView.setBackgroundColor(themeManager.getPrimaryDarkColor());
}
@Override
@@ -293,10 +291,9 @@ public class MainActivity extends AppCompatActivity
childFragment.scrollToTop();
}
break;
- case R.id.action_update:
- Toast.makeText(getApplicationContext(), "nope", Toast.LENGTH_SHORT).show();
-// Intent updater = new Intent(getApplicationContext(), UpdaterActivity.class);
-// startActivity(updater);
+ case R.id.action_about:
+ startActivity(new Intent(getApplicationContext(), LicensesActivity.class));
+ break;
}
return super.onOptionsItemSelected(item);
}
@@ -441,40 +438,4 @@ public class MainActivity extends AppCompatActivity
}
return rnd;
}
-
- public void checkForUpdates(){
- Ion.with(getApplicationContext())
- .load("http://ahri.xyz/bai/version.php")
- .asString()
- .setCallback(new FutureCallback<String>() {
- @Override
- public void onCompleted(Exception e, String result) {
- if (e != null){
- e.printStackTrace();
- }else{
- try {
- JSONObject version = new JSONObject(result);
- float lastVersion = (float) version.getDouble("version");
- if (CURRENT_VERSION == lastVersion){
- Log.v("Updater", "Up to date");
- }else{
- Log.v("Updater", "New version available : " + lastVersion);
- Snackbar.make(getCurrentFocus(), "Nueva versión disponible", Snackbar.LENGTH_LONG)
- .setAction("Actualizar", new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent updater = new Intent(getApplicationContext(), UpdaterActivity.class);
- startActivity(updater);
- }
- })
- .setActionTextColor(Color.rgb(255,127,0))
- .show();
- }
- } catch (JSONException e1) {
- e1.printStackTrace();
- }
- }
- }
- });
- }
}
diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/ResponseActivity.java b/app/src/main/java/org/bienvenidoainternet/baiparser/ResponseActivity.java
index b319426..e96868a 100644
--- a/app/src/main/java/org/bienvenidoainternet/baiparser/ResponseActivity.java
+++ b/app/src/main/java/org/bienvenidoainternet/baiparser/ResponseActivity.java
@@ -2,11 +2,15 @@ package org.bienvenidoainternet.baiparser;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
@@ -27,12 +31,6 @@ import java.io.File;
import utils.ContentProviderUtils;
-//import org.apache.http.HttpEntity;
-//import org.apache.http.entity.ContentType;
-//import org.apache.http.entity.mime.HttpMultipartMode;
-//import org.apache.http.entity.mime.MultipartEntityBuilder;
-//import org.apache.http.entity.mime.content.FileBody;
-//import org.apache.http.entity.mime.content.StringBody;
public class ResponseActivity extends AppCompatActivity {
@@ -67,17 +65,6 @@ public class ResponseActivity extends AppCompatActivity {
LinearLayout layoutProcess = (LinearLayout)findViewById(R.id.layoutPostProcess);
layoutProcess.setVisibility(View.GONE);
filePath = (EditText) findViewById(R.id.txtFilePath);
- Button send = (Button)findViewById(R.id.btnSend);
- send.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- 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());
-
- }
- });
Button bBold = (Button) findViewById(R.id.buttonBold);
bBold.setOnClickListener(new View.OnClickListener() {
@@ -127,6 +114,23 @@ public class ResponseActivity extends AppCompatActivity {
}
@Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.menu_replyform, menu);
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.action_form_reply){
+ 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());
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE && resultCode == RESULT_OK && null != data) {
diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/UpdaterActivity.java b/app/src/main/java/org/bienvenidoainternet/baiparser/UpdaterActivity.java
deleted file mode 100644
index e98f303..0000000
--- a/app/src/main/java/org/bienvenidoainternet/baiparser/UpdaterActivity.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package org.bienvenidoainternet.baiparser;
-
-import android.content.Context;
-import android.content.ContextWrapper;
-import android.content.Intent;
-import android.net.Uri;
-import android.support.v7.app.AppCompatActivity;
-import android.os.Bundle;
-import android.text.Html;
-import android.util.Log;
-import android.view.View;
-import android.widget.Button;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.koushikdutta.async.future.FutureCallback;
-import com.koushikdutta.ion.Ion;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-
-public class UpdaterActivity extends AppCompatActivity {
- private float lastVersion = 1.0F;
- Button btnUpdate;
- ProgressBar barUpdate;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_updater);
- setTheme(R.style.AppTheme_Black_Activity);
- btnUpdate = (Button) findViewById(R.id.btnDownloadLastVersion);
- barUpdate = (ProgressBar) findViewById(R.id.barUpdateProgress);
- TextView txtCurrentVersion = (TextView) findViewById(R.id.txtCurrentVersion);
- btnUpdate.setEnabled(false);
- txtCurrentVersion.setText("Versión actual: " + MainActivity.CURRENT_VERSION);
- getVersionData();
- btnUpdate.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- downloadApk();
- }
- });
- }
-
- private void getVersionData(){
- Ion.with(getApplicationContext())
- .load("http://ahri.xyz/bai/version.php")
- .asString()
- .setCallback(new FutureCallback<String>() {
- @Override
- public void onCompleted(Exception e, String result) {
- if (e != null) {
- e.printStackTrace();
- } else {
- JSONObject version = null;
- try {
- version = new JSONObject(result);
- lastVersion = (float) version.getDouble("version");
- TextView txtLastVersion = (TextView) findViewById(R.id.txtLastVersion);
- txtLastVersion.setText("Última versión: " + lastVersion);
-
- if (lastVersion > MainActivity.CURRENT_VERSION) {
- getChangelog();
- btnUpdate.setEnabled(true);
- }
- } catch (JSONException e1) {
- e1.printStackTrace();
- }
- }
- }
- });
- }
-
- private void getChangelog(){
- Ion.with(getApplicationContext())
- .load("http://ahri.xyz/bai/lastChangelog.txt")
- .asString()
- .setCallback(new FutureCallback<String>() {
- @Override
- public void onCompleted(Exception e, String result) {
- if (e != null){
- e.printStackTrace();
- }else{
- TextView txtChangelog = (TextView) findViewById(R.id.txtChangelog);
- txtChangelog.setText(Html.fromHtml(result));
- }
- }
- });
- }
-
- private void downloadApk(){
- ContextWrapper cw = new ContextWrapper(getApplicationContext());
- File directory = cw.getDir("src", Context.MODE_PRIVATE);
- if (!directory.exists()) {
- directory.mkdir();
- }
- final File filePath = new File(directory, "last.apk");
- if (filePath.exists()) {
- filePath.delete();
- }
- Ion.with(getApplicationContext())
- .load("http://ahri.xyz/bai/" + lastVersion + "/last.apk")
- .setLogging("Updater", Log.VERBOSE)
- .progressBar(barUpdate)
- .write(filePath)
- .setCallback(new FutureCallback<File>() {
- @Override
- public void onCompleted(Exception e, File result) {
- if (e != null) {
- Toast.makeText(getApplicationContext(), "Error: " + e.getMessage(), Toast.LENGTH_LONG).show();
- } else {
- Intent promptInstall = new Intent(Intent.ACTION_VIEW)
- .setDataAndType(Uri.fromFile(filePath),
- "application/vnd.android.package-archive");
- startActivity(promptInstall);
- }
- }
- });
- }
-}
-
-
diff --git a/app/src/main/java/org/bienvenidoainternet/baiparser/ViewerActivity.java b/app/src/main/java/org/bienvenidoainternet/baiparser/ViewerActivity.java
index b113c2a..4501c0f 100644
--- a/app/src/main/java/org/bienvenidoainternet/baiparser/ViewerActivity.java
+++ b/app/src/main/java/org/bienvenidoainternet/baiparser/ViewerActivity.java
@@ -40,26 +40,6 @@ public class ViewerActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
-// SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
-// int themeId = Integer.valueOf(settings.getString("setting_theme", "1")), currentThemeId = R.style.AppTheme;
-// switch (themeId) {
-// case 1:
-// currentThemeId = R.style.AppTheme_NoActionBar;
-// break;
-// case 2:
-// currentThemeId = R.style.AppTheme_Dark;
-// break;
-// case 3:
-// currentThemeId = R.style.AppTheme_HeadLine;
-// break;
-// case 4:
-// currentThemeId = R.style.AppTheme_Black;
-// break;
-// }
-// setTheme(currentThemeId);
-
-
if (savedInstanceState != null){
bi = savedInstanceState.getParcelable("boardItem");
}
@@ -70,8 +50,6 @@ public class ViewerActivity extends AppCompatActivity {
imageView = (SubsamplingScaleImageView)findViewById(R.id.imageView);
gifView = (GifImageView) findViewById(R.id.gifView);
setTitle(bi.getFile());
-// imageView.setOnClickListener(new View.OnClickListener() {
-// new TaskDownloadFile().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
downloadFile();
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
diff --git a/app/src/main/res/drawable-hdpi/ic_action_send.png b/app/src/main/res/drawable-hdpi/ic_action_send.png
new file mode 100644
index 0000000..100cd85
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_action_send.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_action_send.png b/app/src/main/res/drawable-mdpi/ic_action_send.png
new file mode 100644
index 0000000..eea6617
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_action_send.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_action_send.png b/app/src/main/res/drawable-xhdpi/ic_action_send.png
new file mode 100644
index 0000000..b098e07
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_action_send.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_send.png b/app/src/main/res/drawable-xxhdpi/ic_action_send.png
new file mode 100644
index 0000000..f1f07a9
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_action_send.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_send.png b/app/src/main/res/drawable-xxxhdpi/ic_action_send.png
new file mode 100644
index 0000000..2dcc7a2
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/ic_action_send.png
Binary files differ
diff --git a/app/src/main/res/layout/activity_response.xml b/app/src/main/res/layout/activity_response.xml
index 19194d4..bfd143e 100644
--- a/app/src/main/res/layout/activity_response.xml
+++ b/app/src/main/res/layout/activity_response.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
@@ -9,6 +10,7 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="org.bienvenidoainternet.baiparser.ResponseActivity"
android:textAlignment="textEnd">
+
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -36,7 +38,7 @@
android:hint="@string/txt_email" />
<EditText
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:ems="10"
@@ -49,16 +51,6 @@
android:capitalize="sentences" />
<Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/btn_send"
- android:id="@+id/btnSend"
- android:layout_alignWithParentIfMissing="false"
- android:layout_below="@+id/txtResponse"
- android:layout_alignParentRight="true"
- android:layout_alignParentEnd="true" />
-
- <Button
style="?android:attr/buttonStyleSmall"
android:layout_width="32dp"
android:layout_height="32dp"
diff --git a/app/src/main/res/layout/activity_updater.xml b/app/src/main/res/layout/activity_updater.xml
deleted file mode 100644
index b287293..0000000
--- a/app/src/main/res/layout/activity_updater.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout 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"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- tools:context="org.bienvenidoainternet.baiparser.UpdaterActivity">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="Versión actual:"
- android:id="@+id/txtCurrentVersion"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true" />
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="Última versión:"
- android:id="@+id/txtLastVersion"
- android:layout_below="@+id/txtCurrentVersion"
- android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Descargar última versión"
- android:id="@+id/btnDownloadLastVersion"
- android:layout_alignParentBottom="true"
- android:layout_centerHorizontal="true" />
-
- <ProgressBar
- style="?android:attr/progressBarStyleHorizontal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/barUpdateProgress"
- android:layout_above="@+id/btnDownloadLastVersion"
- android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true" />
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:text=""
- android:id="@+id/txtChangelog"
- android:layout_below="@+id/txtLastVersion"
- android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true"
- android:layout_alignParentRight="true"
- android:layout_alignParentEnd="true"
- android:layout_marginTop="5dp"
- android:typeface="monospace"
- android:layout_above="@+id/barUpdateProgress"
- android:layout_marginBottom="5dp" />
-</RelativeLayout>
diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml
index 280b121..7735ffb 100644
--- a/app/src/main/res/menu/main.xml
+++ b/app/src/main/res/menu/main.xml
@@ -23,8 +23,8 @@
android:title="@string/action_settings"
app:showAsAction="never" />
<item
- android:title="Buscar actualizaciones"
- android:id="@+id/action_update"
+ android:title="Acerca de ..."
+ android:id="@+id/action_about"
android:orderInCategory="500"
app:showAsAction="never"/>
<item
diff --git a/app/src/main/res/menu/menu_replyform.xml b/app/src/main/res/menu/menu_replyform.xml
new file mode 100644
index 0000000..395bca3
--- /dev/null
+++ b/app/src/main/res/menu/menu_replyform.xml
@@ -0,0 +1,8 @@
+<?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/action_form_reply"
+ android:icon="@drawable/ic_action_send"
+ android:title="Responder"
+ app:showAsAction="always"/>
+</menu> \ No newline at end of file