Merged in reply_to_a_toot (pull request #47)

Reply to a toot
This commit is contained in:
tom79 2017-08-08 16:50:23 +00:00
commit 0814dcf538
15 changed files with 58 additions and 107 deletions

View File

@ -134,8 +134,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
private Button toot_it;
private AutoCompleteTextView toot_content;
private EditText toot_cw_content;
private TextView toot_reply_content;
private RelativeLayout toot_reply_content_container;
private LinearLayout toot_reply_content_container;
private BroadcastReceiver search_validate;
private Status tootReply = null;
private String sharedContent, sharedSubject;
@ -209,8 +208,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
toot_picture_container = (LinearLayout) findViewById(R.id.toot_picture_container);
toot_content = (AutoCompleteTextView) findViewById(R.id.toot_content);
toot_cw_content = (EditText) findViewById(R.id.toot_cw_content);
toot_reply_content = (TextView) findViewById(R.id.toot_reply_content);
toot_reply_content_container = (RelativeLayout) findViewById(R.id.toot_reply_content_container);
toot_reply_content_container = (LinearLayout) findViewById(R.id.toot_reply_content_container);
picture_scrollview = (HorizontalScrollView) findViewById(R.id.picture_scrollview);
toot_sensitive = (CheckBox) findViewById(R.id.toot_sensitive);
//search_small_container = (LinearLayout) findViewById(R.id.search_small_container);
@ -316,21 +314,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
boolean isAccountPrivate = account.isLocked();
FloatingActionButton ic_close = (FloatingActionButton) findViewById(R.id.toot_close_reply);
/*toot_close_accounts.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
manageShowUsers(searchAction.CLOSE, true);
}
});
*/
ic_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
toot_reply_content_container.setVisibility(View.GONE);
}
});
if(isAccountPrivate){
visibility = "private";
@ -1078,20 +1061,38 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
else
setTitle(R.string.toot_title_reply);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
boolean show_reply = sharedpreferences.getBoolean(Helper.SET_SHOW_REPLY, false);
if( show_reply ){
toot_reply_content_container.setVisibility(View.VISIBLE);
}else {
toot_reply_content_container.setVisibility(View.GONE);
}
String content = tootReply.getContent();
if(tootReply.getReblog() != null)
content = tootReply.getReblog().getContent();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
toot_reply_content.setText(Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY));
else
//noinspection deprecation
toot_reply_content.setText(Html.fromHtml(content));
FloatingActionButton ic_show = (FloatingActionButton) findViewById(R.id.toot_show_reply);
ic_show.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder alert = new AlertDialog.Builder(TootActivity.this);
alert.setTitle(R.string.toot_reply_content_title);
final TextView input = new TextView(TootActivity.this);
//Set the padding
input.setPadding(30, 30, 30, 30);
alert.setView(input);
String content = tootReply.getContent();
if(tootReply.getReblog() != null)
content = tootReply.getReblog().getContent();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
input.setText(Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY));
else
//noinspection deprecation
input.setText(Html.fromHtml(content));
alert.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
});
alert.show();
}
});
toot_reply_content_container.setVisibility(View.VISIBLE);
switch (tootReply.getVisibility()){
case "public":
visibility = "public";

View File

@ -45,7 +45,6 @@ import android.widget.TextView;
import android.widget.Toast;
import fr.gouv.etalab.mastodon.activities.MainActivity;
import fr.gouv.etalab.mastodon.activities.TootActivity;
import fr.gouv.etalab.mastodon.client.Entities.Account;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
@ -56,8 +55,6 @@ import static android.app.Activity.RESULT_OK;
import static fr.gouv.etalab.mastodon.helper.Helper.CHANGE_THEME_INTENT;
import static fr.gouv.etalab.mastodon.helper.Helper.INTENT_ACTION;
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
import static fr.gouv.etalab.mastodon.helper.Helper.loadPPInActionBar;
import static fr.gouv.etalab.mastodon.helper.Helper.updateHeaderAccountInfo;
/**
@ -79,21 +76,9 @@ public class SettingsFragment extends Fragment {
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean show_reply = sharedpreferences.getBoolean(Helper.SET_SHOW_REPLY, false);
boolean auto_store = sharedpreferences.getBoolean(Helper.SET_AUTO_STORE, true);
final CheckBox set_show_reply = (CheckBox) rootView.findViewById(R.id.set_show_reply);
set_show_reply.setChecked(show_reply);
set_show_reply.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_SHOW_REPLY, set_show_reply.isChecked());
editor.apply();
}
});
final CheckBox set_auto_store = (CheckBox) rootView.findViewById(R.id.set_auto_store);
set_auto_store.setChecked(auto_store);
set_auto_store.setOnClickListener(new View.OnClickListener() {

View File

@ -199,7 +199,6 @@ public class Helper {
public static final String SET_WIFI_ONLY = "set_wifi_only";
public static final String SET_NOTIF_HOMETIMELINE = "set_notif_hometimeline";
public static final String SET_NOTIF_SILENT = "set_notif_silent";
public static final String SET_SHOW_REPLY = "set_show_reply";
public static final String SET_SHOW_ERROR_MESSAGES = "set_show_error_messages";
public static final String SET_EMBEDDED_BROWSER = "set_embedded_browser";
public static final String SET_JAVASCRIPT = "set_javascript";

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -40,41 +40,29 @@
android:hint="@string/toot_cw_placeholder"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
<LinearLayout
android:id="@+id/toot_reply_content_container"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="@+id/toot_reply_content_title"
android:text="@string/toot_reply_content_title"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_below="@+id/toot_reply_content_title"
android:id="@+id/toot_reply_content"
android:layout_marginTop="10dp"
android:gravity="top|start"
android:textStyle="italic"
android:autoLink="web"
android:textSize="12sp"
android:layout_marginEnd="40dp"
android:layout_marginRight="40dp"
android:layout_width="match_parent"
android:text="@string/show_reply"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/toot_close_reply"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:id="@+id/toot_show_reply"
android:layout_marginStart="30dp"
android:layout_marginLeft="30dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_gravity="center_vertical|end"
app:fabSize="mini"
android:layout_margin="5dp"
app:srcCompat="@drawable/ic_close" />
</RelativeLayout>
app:srcCompat="@drawable/ic_action_eye_open" />
</LinearLayout>
<AutoCompleteTextView
android:layout_marginTop="10dp"
android:id="@+id/toot_content"

View File

@ -46,12 +46,6 @@
android:text="@string/set_show_error_messages"
android:layout_height="wrap_content" />
<CheckBox
android:layout_marginTop="10dp"
android:id="@+id/set_show_reply"
android:layout_width="wrap_content"
android:text="@string/set_display_reply"
android:layout_height="wrap_content" />
<CheckBox
android:layout_marginTop="10dp"

View File

@ -40,41 +40,29 @@
android:hint="@string/toot_cw_placeholder"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
<LinearLayout
android:id="@+id/toot_reply_content_container"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="@+id/toot_reply_content_title"
android:text="@string/toot_reply_content_title"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_below="@+id/toot_reply_content_title"
android:id="@+id/toot_reply_content"
android:layout_marginTop="10dp"
android:gravity="top|start"
android:textStyle="italic"
android:autoLink="web"
android:textSize="12sp"
android:layout_marginEnd="40dp"
android:layout_marginRight="40dp"
android:layout_width="match_parent"
android:text="@string/show_reply"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/toot_close_reply"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:id="@+id/toot_show_reply"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_gravity="center_vertical|end"
app:fabSize="mini"
android:layout_margin="5dp"
app:srcCompat="@drawable/ic_close" />
</RelativeLayout>
app:srcCompat="@drawable/ic_action_eye_open" />
</LinearLayout>
<AutoCompleteTextView
android:layout_marginTop="10dp"
android:id="@+id/toot_content"

View File

@ -46,12 +46,6 @@
android:text="@string/set_show_error_messages"
android:layout_height="wrap_content" />
<CheckBox
android:layout_marginTop="10dp"
android:id="@+id/set_show_reply"
android:layout_width="wrap_content"
android:text="@string/set_display_reply"
android:layout_height="wrap_content" />
<CheckBox
android:layout_marginTop="10dp"

View File

@ -170,6 +170,7 @@
<string name="no_draft">Aucun brouillon !</string>
<string name="choose_toot">Choisissez un pouet</string>
<string name="remove_draft">Supprimer le brouillon ?</string>
<string name="show_reply">Cliquer sur le boutton pour afficher le pouet d\'origine</string>
<!-- Instance -->
<string name="instance_no_description">Aucune description !</string>

View File

@ -174,6 +174,7 @@
<string name="no_draft">No draft!</string>
<string name="choose_toot">Choose a toot</string>
<string name="remove_draft">Remove draft?</string>
<string name="show_reply">Click on the button to display the original toot</string>
<!-- Instance -->
<string name="instance_no_description">No description available!</string>