From b9b2cd586c147ba9b08bbd809e7137ba3b6dacff Mon Sep 17 00:00:00 2001 From: Renard Date: Thu, 7 Apr 2016 18:58:48 -0300 Subject: test --- app/src/main/AndroidManifest.xml | 10 +- .../baiparser/MainActivity.java | 49 +------- .../baiparser/ResponseActivity.java | 38 +++--- .../baiparser/UpdaterActivity.java | 127 --------------------- .../baiparser/ViewerActivity.java | 22 ---- app/src/main/res/drawable-hdpi/ic_action_send.png | Bin 0 -> 324 bytes app/src/main/res/drawable-mdpi/ic_action_send.png | Bin 0 -> 235 bytes app/src/main/res/drawable-xhdpi/ic_action_send.png | Bin 0 -> 388 bytes .../main/res/drawable-xxhdpi/ic_action_send.png | Bin 0 -> 582 bytes .../main/res/drawable-xxxhdpi/ic_action_send.png | Bin 0 -> 1921 bytes app/src/main/res/layout/activity_response.xml | 14 +-- app/src/main/res/layout/activity_updater.xml | 64 ----------- app/src/main/res/menu/main.xml | 4 +- app/src/main/res/menu/menu_replyform.xml | 8 ++ 14 files changed, 45 insertions(+), 291 deletions(-) delete mode 100644 app/src/main/java/org/bienvenidoainternet/baiparser/UpdaterActivity.java create mode 100644 app/src/main/res/drawable-hdpi/ic_action_send.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_send.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_send.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_send.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_action_send.png delete mode 100644 app/src/main/res/layout/activity_updater.xml create mode 100644 app/src/main/res/menu/menu_replyform.xml (limited to 'app/src') 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 @@ - + + android:label="@string/title_activity_settings" + android:theme="@style/AppTheme" /> - + android:theme="@style/TransparentCompat" /> + 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() { - @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() { @@ -126,6 +113,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); 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() { - @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() { - @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() { - @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 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_action_send.png 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 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_action_send.png 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 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_action_send.png 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 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_action_send.png 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 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_action_send.png 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 @@ + -