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,62 +1,70 @@
<?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">
android:orientation="vertical"
android:padding="@dimen/layout_margin">
<LinearLayout <LinearLayout
android:id="@+id/dm_popup"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginBottom="@dimen/layout_margin" android:background="@color/tweetwindow"
android:gravity="end|center_vertical" android:orientation="vertical"
android:orientation="horizontal"> android:padding="@dimen/layout_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/layout_margin"
android:gravity="end|center_vertical"
android:orientation="horizontal">
<EditText
android:id="@+id/dm_receiver"
android:layout_width="0dp"
android:layout_height="@dimen/dm_button_size"
android:layout_weight="1"
android:background="@android:color/transparent"
android:hint="@string/username"
android:importantForAutofill="no"
android:inputType="text"
android:singleLine="true"
tools:targetApi="o" />
<ImageView
android:id="@+id/dm_media"
android:layout_width="@dimen/dm_button_size"
android:layout_height="@dimen/dm_button_size"
android:layout_marginStart="@dimen/dm_icon_margin"
android:layout_marginLeft="@dimen/dm_icon_margin"
android:contentDescription="@string/add_image"
app:srcCompat="@drawable/image" />
<ImageView
android:id="@+id/dm_send"
android:layout_width="@dimen/dm_button_size"
android:layout_height="@dimen/dm_button_size"
android:layout_marginStart="@dimen/button_margin"
android:layout_marginLeft="@dimen/button_margin"
android:contentDescription="@string/close_dm"
app:srcCompat="@drawable/right" />
</LinearLayout>
<EditText <EditText
android:id="@+id/dm_receiver" android:id="@+id/dm_text"
android:layout_width="0dp" android:layout_width="@dimen/text_input_width"
android:layout_height="@dimen/dm_button_size" android:layout_height="@dimen/text_input_height"
android:layout_weight="1"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:hint="@string/username" android:gravity="start"
android:inputType="text" android:hint="@string/dmessage"
android:importantForAutofill="no" android:importantForAutofill="no"
android:singleLine="true" android:inputType="textMultiLine"
tools:targetApi="o" /> tools:targetApi="o" />
<ImageView
android:id="@+id/dm_media"
android:layout_width="@dimen/dm_button_size"
android:layout_height="@dimen/dm_button_size"
android:layout_marginStart="@dimen/dm_icon_margin"
android:layout_marginLeft="@dimen/dm_icon_margin"
android:contentDescription="@string/add_image"
app:srcCompat="@drawable/image" />
<ImageView
android:id="@+id/dm_send"
android:layout_width="@dimen/dm_button_size"
android:layout_height="@dimen/dm_button_size"
android:layout_marginStart="@dimen/button_margin"
android:layout_marginLeft="@dimen/button_margin"
android:contentDescription="@string/close_dm"
app:srcCompat="@drawable/right" />
</LinearLayout> </LinearLayout>
<EditText </android.support.v7.widget.CardView>
android:id="@+id/dm_text"
android:layout_width="@dimen/text_input_width"
android:layout_height="@dimen/text_input_height"
android:background="@android:color/transparent"
android:gravity="start"
android:hint="@string/dmessage"
android:importantForAutofill="no"
android:inputType="textMultiLine"
tools:targetApi="o" />
</LinearLayout>

View File

@ -1,79 +1,85 @@
<?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">
android:background="@color/tweetwindow"
android:orientation="vertical">
<EditText
android:id="@+id/tweet_input"
android:layout_width="@dimen/text_input_width"
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:gravity="top"
android:hint="@string/tweet"
android:importantForAutofill="no"
android:inputType="textMultiLine"
tools:targetApi="o" />
<LinearLayout <LinearLayout
android:id="@+id/tweet_popup"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="@dimen/layout_margin" android:background="@color/tweetwindow"
android:gravity="end|center_vertical" android:orientation="vertical"
android:orientation="horizontal"> android:padding="@dimen/layout_margin">
<TextView <EditText
android:id="@+id/imgcount" android:id="@+id/tweet_input"
android:layout_width="wrap_content" android:layout_width="@dimen/text_input_width"
android:layout_height="wrap_content" android:layout_height="@dimen/text_input_height"
android:textColor="@android:color/holo_red_dark" android:background="@android:color/transparent"
android:textSize="18sp" /> android:gravity="top"
android:hint="@string/tweet"
android:importantForAutofill="no"
android:inputType="textMultiLine"
tools:targetApi="o" />
<ImageView <LinearLayout
android:id="@+id/img_preview" android:layout_width="match_parent"
android:layout_width="@dimen/tweet_button_size" android:layout_height="match_parent"
android:layout_height="@dimen/tweet_button_size" android:layout_margin="@dimen/layout_margin"
android:layout_marginStart="@dimen/tweet_icon_margin" android:gravity="end|center_vertical"
android:layout_marginLeft="@dimen/tweet_icon_margin" android:orientation="horizontal">
android:contentDescription="@string/image_preview"
android:visibility="invisible"
app:srcCompat="@drawable/preview" />
<ImageView <TextView
android:id="@+id/image" android:id="@+id/imgcount"
android:layout_width="@dimen/tweet_button_size" android:layout_width="wrap_content"
android:layout_height="@dimen/tweet_button_size" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/tweet_icon_margin" android:textColor="@android:color/holo_red_dark"
android:layout_marginLeft="@dimen/tweet_icon_margin" android:textSize="18sp" />
android:contentDescription="@string/add_image"
app:srcCompat="@drawable/image" />
<ImageView <ImageView
android:id="@+id/sendTweet" android:id="@+id/img_preview"
android:layout_width="@dimen/tweet_button_size" android:layout_width="@dimen/tweet_button_size"
android:layout_height="@dimen/tweet_button_size" android:layout_height="@dimen/tweet_button_size"
android:layout_marginStart="@dimen/tweet_icon_margin" android:layout_marginStart="@dimen/tweet_icon_margin"
android:layout_marginLeft="@dimen/tweet_icon_margin" android:layout_marginLeft="@dimen/tweet_icon_margin"
android:contentDescription="@string/send_tweet" android:contentDescription="@string/image_preview"
app:srcCompat="@drawable/tweet" /> android:visibility="invisible"
app:srcCompat="@drawable/preview" />
<ImageView <ImageView
android:id="@+id/close" android:id="@+id/image"
android:layout_width="@dimen/tweet_button_size" android:layout_width="@dimen/tweet_button_size"
android:layout_height="@dimen/tweet_button_size" android:layout_height="@dimen/tweet_button_size"
android:layout_marginStart="@dimen/tweet_icon_margin" android:layout_marginStart="@dimen/tweet_icon_margin"
android:layout_marginLeft="@dimen/tweet_icon_margin" android:layout_marginLeft="@dimen/tweet_icon_margin"
android:contentDescription="@string/tweet_close" android:contentDescription="@string/add_image"
app:srcCompat="@drawable/cross" /> app:srcCompat="@drawable/image" />
<ImageView
android:id="@+id/sendTweet"
android:layout_width="@dimen/tweet_button_size"
android:layout_height="@dimen/tweet_button_size"
android:layout_marginStart="@dimen/tweet_icon_margin"
android:layout_marginLeft="@dimen/tweet_icon_margin"
android:contentDescription="@string/send_tweet"
app:srcCompat="@drawable/tweet" />
<ImageView
android:id="@+id/close"
android:layout_width="@dimen/tweet_button_size"
android:layout_height="@dimen/tweet_button_size"
android:layout_marginStart="@dimen/tweet_icon_margin"
android:layout_marginLeft="@dimen/tweet_icon_margin"
android:contentDescription="@string/tweet_close"
app:srcCompat="@drawable/cross" />
</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>