layout fix

added more error notification
This commit is contained in:
NudeDude 2019-01-06 17:59:15 +01:00
parent b0a5288427
commit b34ea0a745
8 changed files with 150 additions and 114 deletions

View File

@ -99,6 +99,15 @@ public class MessageUpload extends AsyncTask<String, Void, Void> {
case 420: case 420:
Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_SHORT).show(); Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_SHORT).show();
break; break;
case 150:
Toast.makeText(ui.get(), R.string.cant_send_dm, Toast.LENGTH_SHORT).show();
break;
case 50:
Toast.makeText(ui.get(), R.string.user_not_found, Toast.LENGTH_SHORT).show();
break;
default: default:
Toast.makeText(ui.get(), errorMsg, Toast.LENGTH_LONG).show(); Toast.makeText(ui.get(), errorMsg, Toast.LENGTH_LONG).show();
} }

View File

@ -304,13 +304,15 @@ public class ProfileLoader extends AsyncTask<Long, Long, Long> {
} else if (MODE == FAILURE) { } else if (MODE == FAILURE) {
switch (returnCode) { switch (returnCode) {
case 420:
case 420: //
case 429: // Rate limit exceeded!
Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_SHORT).show(); Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_SHORT).show();
break; break;
case 50: case 50: // USER not found
case 63: case 63: // USER suspended
case 136: case 136: // Blocked!
Toast.makeText(ui.get(), R.string.user_not_found, Toast.LENGTH_SHORT).show(); Toast.makeText(ui.get(), R.string.user_not_found, Toast.LENGTH_SHORT).show();
ui.get().finish(); ui.get().finish();
break; break;

View File

@ -120,7 +120,7 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
} catch (TwitterException err) { } catch (TwitterException err) {
returnCode = err.getErrorCode(); returnCode = err.getErrorCode();
if (returnCode == 144 || returnCode == 34) if (returnCode == 144 || returnCode == 34 || returnCode == 63)
database.removeStatus(TWEETID); database.removeStatus(TWEETID);
else else
errMsg += err.getMessage(); errMsg += err.getMessage();
@ -236,6 +236,7 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
switch (returnCode) { switch (returnCode) {
case 420: case 420:
case 429:
Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_SHORT).show(); Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_SHORT).show();
break; break;
@ -253,6 +254,10 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
ui.get().finish(); ui.get().finish();
break; break;
case -1:
Toast.makeText(ui.get(), R.string.error_not_specified, Toast.LENGTH_SHORT).show();
break;
default: default:
Toast.makeText(ui.get(), errMsg, Toast.LENGTH_LONG).show(); Toast.makeText(ui.get(), errMsg, Toast.LENGTH_LONG).show();
} }

View File

@ -1,11 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/dm_popup" style="@style/PopupCardView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center">
<LinearLayout
android:id="@+id/dm_popup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/tweetwindow"
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/layout_margin"> android:padding="@dimen/layout_margin">
@ -23,8 +30,8 @@
android:layout_weight="1" android:layout_weight="1"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:hint="@string/username" android:hint="@string/username"
android:inputType="text"
android:importantForAutofill="no" android:importantForAutofill="no"
android:inputType="text"
android:singleLine="true" android:singleLine="true"
tools:targetApi="o" /> tools:targetApi="o" />
@ -58,5 +65,6 @@
android:importantForAutofill="no" android:importantForAutofill="no"
android:inputType="textMultiLine" android:inputType="textMultiLine"
tools:targetApi="o" /> tools:targetApi="o" />
</LinearLayout>
</LinearLayout> </android.support.v7.widget.CardView>

View File

@ -1,21 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tweet_popup" style="@style/PopupCardView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center">
<LinearLayout
android:id="@+id/tweet_popup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/tweetwindow" android:background="@color/tweetwindow"
android:orientation="vertical"> android:orientation="vertical"
android:padding="@dimen/layout_margin">
<EditText <EditText
android:id="@+id/tweet_input" android:id="@+id/tweet_input"
android:layout_width="@dimen/text_input_width" android:layout_width="@dimen/text_input_width"
android:layout_height="@dimen/text_input_height" android:layout_height="@dimen/text_input_height"
android:layout_marginLeft="@dimen/layout_margin"
android:layout_marginTop="@dimen/layout_margin"
android:layout_marginRight="@dimen/layout_margin"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="top" android:gravity="top"
android:hint="@string/tweet" android:hint="@string/tweet"
@ -76,4 +80,6 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView>

View File

@ -95,4 +95,5 @@
<string name="close_dm">Direktnachricht schließen</string> <string name="close_dm">Direktnachricht schließen</string>
<string name="user_not_found">Nutzer nicht gefunden!</string> <string name="user_not_found">Nutzer nicht gefunden!</string>
<string name="profile_tweets">Profile tweets</string> <string name="profile_tweets">Profile tweets</string>
<string name="cant_send_dm">Nachricht kann nicht an den User gesendet werden!</string>
</resources> </resources>

View File

@ -103,4 +103,5 @@
<string name="close_dm">close direct message</string> <string name="close_dm">close direct message</string>
<string name="user_not_found">user not found!</string> <string name="user_not_found">user not found!</string>
<string name="profile_tweets">Profile tweets</string> <string name="profile_tweets">Profile tweets</string>
<string name="cant_send_dm">cannot send dm to user!</string>
</resources> </resources>

View File

@ -39,6 +39,10 @@
<item name="cardCornerRadius">5dp</item> <item name="cardCornerRadius">5dp</item>
</style> </style>
<style name="PopupCardView" parent="CardView">
<item name="cardCornerRadius">10dp</item>
</style>
<style name="CustomButton" parent="Widget.AppCompat.Button"> <style name="CustomButton" parent="Widget.AppCompat.Button">
<item name="android:textAllCaps">false</item> <item name="android:textAllCaps">false</item>
<item name="android:fontFamily">RobotoTextView</item> <item name="android:fontFamily">RobotoTextView</item>