Skip to content

Commit

Permalink
Merge pull request #91 from prey/improve-content-report
Browse files Browse the repository at this point in the history
Improve content report
  • Loading branch information
oaliaga committed May 4, 2015
2 parents a36114e + a7f8693 commit 6c144e6
Show file tree
Hide file tree
Showing 13 changed files with 137 additions and 8 deletions.
14 changes: 13 additions & 1 deletion res/layout-large-port/password.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:layout_below="@+id/device_ready_h1_text"
android:text="@string/login_setting_h2_text"
Expand Down Expand Up @@ -100,6 +100,18 @@
android:layout_marginBottom="80dp"
android:gravity="center"
android:text="@string/log_in" />

<TextView
android:id="@+id/link_forgot_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"

android:layout_alignParentBottom="true"
android:layout_marginBottom="30dp"
android:gravity="center"
android:text="@string/password_dialog_forgot_text1"
android:textColor="@color/dark_paragraph"
android:textSize="25sp" />



Expand Down
16 changes: 13 additions & 3 deletions res/layout-port/password.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,19 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="40dp"
android:layout_marginBottom="60dp"
android:text="@string/log_in" />



<TextView
android:id="@+id/link_forgot_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"

android:layout_alignParentBottom="true"
android:layout_marginBottom="30dp"
android:gravity="center"
android:text="@string/password_dialog_forgot_text1"
android:textColor="@color/dark_paragraph"
android:textSize="15sp" />

</RelativeLayout>
4 changes: 2 additions & 2 deletions res/layout-port/permission_information.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:layout_marginTop="70dp"
android:src="@drawable/icon_prey_reverse" />

<ImageView
Expand Down Expand Up @@ -64,7 +64,7 @@
android:id="@+id/congrats_btn_ok"
style="@style/PreyButton2"
android:layout_alignParentBottom="true"
android:layout_marginBottom="40dp"
android:layout_marginBottom="20dp"
android:text="@string/go_to_congratulations" />

</RelativeLayout>
14 changes: 13 additions & 1 deletion res/layout-small-port/password.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,21 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:layout_marginBottom="35dp"
android:text="@string/log_in" />


<TextView
android:id="@+id/link_forgot_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"

android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:gravity="center"
android:text="@string/password_dialog_forgot_text1"
android:textColor="@color/dark_paragraph"
android:textSize="15sp" />


</RelativeLayout>
12 changes: 12 additions & 0 deletions res/layout-xlarge-port/password.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,16 @@ Full license at "/LICENSE"
android:layout_marginBottom="100dp"
android:text="@string/log_in" />

<TextView
android:id="@+id/link_forgot_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"

android:layout_alignParentBottom="true"
android:layout_marginBottom="50dp"
android:gravity="center"
android:text="@string/password_dialog_forgot_text1"
android:textColor="@color/dark_paragraph"
android:textSize="30sp" />

</RelativeLayout>
1 change: 1 addition & 0 deletions res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
<string name="error_registered_password_has_changed">La contraseña actual ingresada no es válida.</string>
<string name="error_cant_report_forgotten_password">La contraseña no se pudo reportar como olvidada. Por favor inténtalo nuevamente.</string>
<string name="error_all_fields_are_required">Todos los campos son requeridos</string>
<string name="error_already_register">¿Ya está registrado?</string>
<string name="sms_not_sent">Hubo un problema enviando el mensaje. ¿Estás seguro que tu equipo puede enviar SMS?</string>
<string name="error_mail_out_of_range">El largo de la dirección de correo debe ser entre %1$s y %2$s caracteres.</string>
<string name="error_password_out_of_range">El largo de la contraseña debe ser entre %1$s y %2$s caracteres.</string>
Expand Down
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
<string name="sms_not_sent">There was an error sending the message. Does your device have SMS support?</string>
<string name="error_mail_out_of_range">Email length must be between %1$s and %2$s characters.</string>
<string name="error_password_out_of_range">Password length must be between %1$s and %2$s characters.</string>
<string name="error_already_register">Did you already register?</string>
<!-- Permission Information -->
<string name="permission_title_h1">EXTRA PROTECTION</string>
<string name="permission_body_text">Prey was granted special permissions in order to lock your device and to prevent thieves from uninstalling it. If you ever need to remove Prey, you first have to revoke these permissions from within the app.</string>
Expand Down
53 changes: 53 additions & 0 deletions src/com/prey/activities/CheckPasswordActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@
******************************************************************************/
package com.prey.activities;

import java.util.Locale;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.prey.PreyConfig;
import com.prey.PreyLogger;
import com.prey.R;
import com.prey.backwardcompatibility.FroyoSupport;
Expand All @@ -23,6 +30,8 @@ public class CheckPasswordActivity extends PasswordActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.password);


setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
updateLoginScreen();
bindPasswordControls();
Expand All @@ -42,6 +51,7 @@ public void onVisibilityChanged(boolean keyboardVisible) {
ImageView logoImgTextPrey = (ImageView) findViewById(R.id.logo_img_reversed);
ImageView logoImgExtra = (ImageView) findViewById(R.id.logo_img_extra);
TextView textReady = (TextView) findViewById(R.id.device_ready_h1_text);
TextView textForgotPassword= (TextView) findViewById(R.id.link_forgot_password);
if (keyboardVisible) {
PreyLogger.d("key on");
if (logoImgTextPrey != null)
Expand All @@ -50,6 +60,8 @@ public void onVisibilityChanged(boolean keyboardVisible) {
logoImgExtra.setVisibility(View.GONE);
if (textReady != null)
textReady.setVisibility(View.GONE);
if (textForgotPassword != null)
textForgotPassword.setVisibility(View.GONE);
} else {
PreyLogger.d("key off");
if (logoImgTextPrey != null)
Expand All @@ -58,9 +70,50 @@ public void onVisibilityChanged(boolean keyboardVisible) {
logoImgExtra.setVisibility(View.VISIBLE);
if (textReady != null)
textReady.setVisibility(View.VISIBLE);
if (textForgotPassword != null)
textForgotPassword.setVisibility(View.VISIBLE);
}
}
});


try {
TextView textForgotPassword= (TextView) findViewById(R.id.link_forgot_password);
textForgotPassword.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {
try {
String url = PreyConfig.getPreyConfig(getApplicationContext()).getPreyPanelUrl();
Intent browserIntent = new Intent("android.intent.action.VIEW", Uri.parse(url));
startActivity(browserIntent);
} catch (Exception e) {
}

}
});
} catch (Exception e) {
}
try {

ImageView iconBack = (ImageView) findViewById(R.id.logo_img_reversed);
if ("es".equals(Locale.getDefault().getLanguage())) {
iconBack.setImageResource(R.drawable.icon_back_es);
}
RelativeLayout back=(RelativeLayout) findViewById(R.id.linear_back);
back.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {
Intent intent = null;
intent = new Intent(getApplicationContext(), LoginActivity.class);
startActivity(intent);
finish();

}
});

} catch (Exception e) {
}

}

}
1 change: 1 addition & 0 deletions src/com/prey/activities/CreateAccountActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ protected void onPreExecute() {
@Override
protected Void doInBackground(String... data) {
try {
error=null;
PreyAccountData accountData = PreyWebServices.getInstance().registerNewAccount(CreateAccountActivity.this, data[0], data[1], data[2], getDeviceType());
PreyLogger.d("Response creating account: " + accountData.toString());
getPreyConfig().saveAccount(accountData);
Expand Down
5 changes: 5 additions & 0 deletions src/com/prey/activities/DisableButtonActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ protected void onCreate(Bundle savedInstanceState) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

@Override
public void onBackPressed() {

}

@Override
protected void onResume() {
super.onResume();
Expand Down
12 changes: 12 additions & 0 deletions src/com/prey/activities/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ protected void onStart() {
startup();
}

@Override
protected void onResume() {
super.onResume();
startup();
}

@Override
protected void onRestart() {
super.onRestart();
startup();
}

private void startup() {
if (!isThisDeviceAlreadyRegisteredWithPrey()) {
Intent intent = null;
Expand Down
5 changes: 5 additions & 0 deletions src/com/prey/activities/PermissionInformationActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ protected void onCreate(Bundle savedInstanceState) {

}

@Override
public void onBackPressed() {

}

@Override
protected void onResume() {
super.onResume();
Expand Down
7 changes: 6 additions & 1 deletion src/com/prey/net/PreyWebServices.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;


Expand Down Expand Up @@ -101,7 +102,7 @@ public PreyAccountData registerNewAccount(Context ctx, String name, String email


PreyHttpResponse response=null;
String xml;
String xml="";
try {
String apiv2=FileConfigReader.getInstance(ctx).getApiV2();
String url=PreyConfig.getPreyConfig(ctx).getPreyUrl().concat(apiv2).concat("signup.json");
Expand All @@ -121,7 +122,11 @@ public PreyAccountData registerNewAccount(Context ctx, String name, String email

}
} else{

if (response!=null&&response.getStatusLine()!=null&&response.getStatusLine().getStatusCode()>299){
if(response.getStatusLine().getStatusCode()==422&&xml.indexOf("already")>0){
throw new PreyException(ctx.getString(R.string.error_already_register,""));
}
throw new PreyException(ctx.getString(R.string.error_cant_add_this_device,"["+response.getStatusLine().getStatusCode()+"]"));
}else{
throw new PreyException(ctx.getString(R.string.error_cant_add_this_device,""));
Expand Down

0 comments on commit 6c144e6

Please sign in to comment.