bug fix, removed dialog from login page
This commit is contained in:
parent
b3d597c653
commit
2d80392d17
@ -1,7 +1,6 @@
|
||||
package org.nuclearfog.twidda.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@ -12,7 +11,6 @@ import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -36,6 +34,7 @@ import static android.content.Intent.ACTION_VIEW;
|
||||
import static android.os.AsyncTask.Status.FINISHED;
|
||||
import static android.os.AsyncTask.Status.RUNNING;
|
||||
import static android.widget.Toast.LENGTH_LONG;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
|
||||
/**
|
||||
* Login Activity of the App
|
||||
@ -148,13 +147,7 @@ public class LoginActivity extends AppCompatActivity implements OnClickListener
|
||||
try {
|
||||
startActivity(loginIntent);
|
||||
} catch (ActivityNotFoundException err) {
|
||||
// If no browser was found, a popup with the login link appears
|
||||
Dialog dialog = new Dialog(this, R.style.AppInfoDialog);
|
||||
dialog.setContentView(R.layout.dialog_login_info);
|
||||
TextView callbackURL = dialog.findViewById(R.id.login_request_link);
|
||||
callbackURL.setLinkTextColor(settings.getHighlightColor());
|
||||
callbackURL.setText(link);
|
||||
dialog.show();
|
||||
Toast.makeText(this, R.string.error_connection_failed, LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ import static android.content.Intent.ACTION_PICK;
|
||||
import static android.content.pm.PackageManager.PERMISSION_DENIED;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static android.os.AsyncTask.Status.RUNNING;
|
||||
import static android.view.View.INVISIBLE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static android.view.Window.FEATURE_NO_TITLE;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
@ -81,7 +82,7 @@ public class MessagePopup extends AppCompatActivity implements OnClickListener,
|
||||
private MessageUpdater messageAsync;
|
||||
|
||||
private EditText receiver, message;
|
||||
private ImageButton media;
|
||||
private ImageButton media, preview;
|
||||
private Dialog loadingCircle, leaveDialog;
|
||||
|
||||
@Nullable
|
||||
@ -95,6 +96,7 @@ public class MessagePopup extends AppCompatActivity implements OnClickListener,
|
||||
View root = findViewById(R.id.dm_popup);
|
||||
ImageButton send = findViewById(R.id.dm_send);
|
||||
media = findViewById(R.id.dm_media);
|
||||
preview = findViewById(R.id.dm_preview);
|
||||
receiver = findViewById(R.id.dm_receiver);
|
||||
message = findViewById(R.id.dm_text);
|
||||
loadingCircle = new Dialog(this, R.style.LoadingDialog);
|
||||
@ -107,6 +109,7 @@ public class MessagePopup extends AppCompatActivity implements OnClickListener,
|
||||
}
|
||||
send.setImageResource(R.drawable.right);
|
||||
media.setImageResource(R.drawable.image_add);
|
||||
preview.setImageResource(R.drawable.image);
|
||||
leaveDialog = DialogBuilder.create(this, MSG_POPUP_LEAVE, this);
|
||||
loadingCircle.requestWindowFeature(FEATURE_NO_TITLE);
|
||||
loadingCircle.setCanceledOnTouchOutside(false);
|
||||
@ -118,6 +121,7 @@ public class MessagePopup extends AppCompatActivity implements OnClickListener,
|
||||
|
||||
send.setOnClickListener(this);
|
||||
media.setOnClickListener(this);
|
||||
preview.setOnClickListener(this);
|
||||
cancelButton.setOnClickListener(this);
|
||||
loadingCircle.setOnDismissListener(this);
|
||||
}
|
||||
@ -144,17 +148,16 @@ public class MessagePopup extends AppCompatActivity implements OnClickListener,
|
||||
@Override
|
||||
protected void onActivityResult(int reqCode, int returnCode, @Nullable Intent intent) {
|
||||
super.onActivityResult(reqCode, returnCode, intent);
|
||||
if (reqCode == REQ_MEDIA && returnCode == RESULT_OK) {
|
||||
if (intent != null && intent.getData() != null) {
|
||||
Cursor c = getContentResolver().query(intent.getData(), PICK_IMAGE, null, null, null);
|
||||
if (c != null) {
|
||||
if (c.moveToFirst()) {
|
||||
int index = c.getColumnIndex(PICK_IMAGE[0]);
|
||||
mediaPath = c.getString(index);
|
||||
media.setImageResource(R.drawable.image);
|
||||
}
|
||||
c.close();
|
||||
if (reqCode == REQ_MEDIA && returnCode == RESULT_OK && intent != null && intent.getData() != null) {
|
||||
Cursor c = getContentResolver().query(intent.getData(), PICK_IMAGE, null, null, null);
|
||||
if (c != null) {
|
||||
if (c.moveToFirst()) {
|
||||
int index = c.getColumnIndex(PICK_IMAGE[0]);
|
||||
mediaPath = c.getString(index);
|
||||
media.setVisibility(INVISIBLE);
|
||||
preview.setVisibility(VISIBLE);
|
||||
}
|
||||
c.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,16 +186,16 @@ public class MessagePopup extends AppCompatActivity implements OnClickListener,
|
||||
Toast.makeText(this, R.string.error_dm, LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
// open media
|
||||
// get media
|
||||
else if (viewId == R.id.dm_media) {
|
||||
if (mediaPath == null)
|
||||
getMedia();
|
||||
else {
|
||||
Intent image = new Intent(this, MediaViewer.class);
|
||||
image.putExtra(KEY_MEDIA_LINK, new String[]{mediaPath});
|
||||
image.putExtra(KEY_MEDIA_TYPE, MEDIAVIEWER_IMG_S);
|
||||
startActivity(image);
|
||||
}
|
||||
getMedia();
|
||||
}
|
||||
// open media
|
||||
else if (viewId == R.id.dm_preview) {
|
||||
Intent image = new Intent(this, MediaViewer.class);
|
||||
image.putExtra(KEY_MEDIA_LINK, new String[]{mediaPath});
|
||||
image.putExtra(KEY_MEDIA_TYPE, MEDIAVIEWER_IMG_S);
|
||||
startActivity(image);
|
||||
}
|
||||
// stop updating
|
||||
else if (viewId == R.id.kill_button) {
|
||||
@ -200,6 +203,7 @@ public class MessagePopup extends AppCompatActivity implements OnClickListener,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
if (messageAsync != null && messageAsync.getStatus() == RUNNING) {
|
||||
@ -207,6 +211,7 @@ public class MessagePopup extends AppCompatActivity implements OnClickListener,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onConfirm(DialogBuilder.DialogType type) {
|
||||
if (type == MSG_POPUP_LEAVE) {
|
||||
|
@ -426,8 +426,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
|
||||
startActivity(intent);
|
||||
} else {
|
||||
// open link in browser
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(tag));
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(tag));
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException err) {
|
||||
|
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/loginpopup_text_padding">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/info_twitter_login_link"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_request_link"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/loginpopup_text_margin"
|
||||
android:autoLink="web"
|
||||
android:linksClickable="true"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</LinearLayout>
|
@ -30,6 +30,16 @@
|
||||
android:inputType="text"
|
||||
android:singleLine="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/dm_preview"
|
||||
style="@style/RoundButton"
|
||||
android:layout_width="@dimen/dmpopup_button_size"
|
||||
android:layout_height="@dimen/dmpopup_button_size"
|
||||
android:layout_marginStart="@dimen/dmpopup_button_margin"
|
||||
android:layout_marginLeft="@dimen/dmpopup_button_margin"
|
||||
android:contentDescription="@string/tweet_add_image"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/dm_media"
|
||||
style="@style/RoundButton"
|
||||
|
@ -139,7 +139,6 @@
|
||||
<string name="login_info">3 Schritte zum Login</string>
|
||||
<string name="info_fetching_link">öffne Twitter login Seite</string>
|
||||
<string name="info_login_to_twitter">Melde in Twitter an</string>
|
||||
<string name="info_twitter_login_link">Zum Anmelden bitte Link anklicken</string>
|
||||
<string name="userlist_public_sel">öffentlich</string>
|
||||
<string name="userlist_enter_title">Titel eingeben</string>
|
||||
<string name="userlist_enter_descr">Beschreibung der Liste eingeben</string>
|
||||
|
@ -188,8 +188,6 @@
|
||||
<dimen name="infopopup_text_padding">5dp</dimen>
|
||||
|
||||
<!--dimens of dialog_login_info.xml-->
|
||||
<dimen name="loginpopup_text_padding">20dp</dimen>
|
||||
<dimen name="loginpopup_text_margin">5dp</dimen>
|
||||
|
||||
<!--dimens of dialog_userlist.xml-->
|
||||
<dimen name="userlist_descr_height">100dp</dimen>
|
||||
|
@ -113,7 +113,6 @@
|
||||
<string name="info_list_created">Userlist created</string>
|
||||
<string name="info_fetching_link">redirecting to Twitter login</string>
|
||||
<string name="info_login_to_twitter">login to Twitter</string>
|
||||
<string name="info_twitter_login_link">Please click the link below to login</string>
|
||||
<string name="info_phone_tls_support">Phone does not support TLS 1.2. App will probably not work!</string>
|
||||
<string name="error_wrong_connection_settings">Wrong connection settings!</string>
|
||||
<string name="info_cant_add_video">can\'t add video</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user