some fixes

This commit is contained in:
tom79 2019-11-09 18:07:33 +01:00
parent 3427e10265
commit 1003930a1e
4 changed files with 55 additions and 72 deletions

View File

@ -71,7 +71,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -89,7 +88,6 @@ import app.fedilab.android.client.Entities.RemoteInstance;
import app.fedilab.android.client.Entities.Status;
import app.fedilab.android.client.Entities.UserNote;
import app.fedilab.android.client.HttpsConnection;
import app.fedilab.android.drawers.AccountsInAListAdapter;
import app.fedilab.android.drawers.StatusListAdapter;
import app.fedilab.android.fragments.DisplayAccountsFragment;
import app.fedilab.android.fragments.DisplayStatusFragment;
@ -179,9 +177,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
case Helper.THEME_LIGHT:
setTheme(R.style.AppTheme_NoActionBar_Fedilab);
break;
case Helper.THEME_DARK:
setTheme(R.style.AppThemeDark_NoActionBar);
break;
case Helper.THEME_BLACK:
setTheme(R.style.AppThemeBlack_NoActionBar);
break;
@ -200,7 +195,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
account_pp = findViewById(R.id.account_pp);
account_dn = findViewById(R.id.account_dn);
account_un = findViewById(R.id.account_un);
TextView account_type = findViewById(R.id.account_type);
account_bot = findViewById(R.id.account_bot);
addToList = null;
account_pp.setBackgroundResource(R.drawable.account_pp_border);
@ -245,10 +239,10 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
}
});
final ImageButton account_menu = findViewById(R.id.account_menu);
ImageButton action_more = findViewById(R.id.action_more);
ImageButton reload_tabs = findViewById(R.id.reload_tabs);
ImageButton action_back = findViewById(R.id.action_back);
final ImageView account_menu = findViewById(R.id.account_menu);
ImageView action_more = findViewById(R.id.action_more);
ImageView reload_tabs = findViewById(R.id.reload_tabs);
ImageView action_back = findViewById(R.id.action_back);
account_menu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View File

@ -294,9 +294,6 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
case Helper.THEME_LIGHT:
setTheme(R.style.AppTheme_Fedilab);
break;
case Helper.THEME_DARK:
setTheme(R.style.AppThemeDark);
break;
case Helper.THEME_BLACK:
setTheme(R.style.AppThemeBlack);
break;
@ -315,8 +312,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
autocomplete = false;
if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
@ -718,7 +714,6 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
String defaultVisibility = account.isLocked() ? "private" : "public";
visibility = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), defaultVisibility);
}
assert visibility != null;
switch (visibility) {
case "public":
toot_visibility.setImageResource(R.drawable.ic_public_toot);
@ -812,14 +807,12 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (ContextCompat.checkSelfPermission(TootActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(TootActivity.this,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
return;
}
if (ContextCompat.checkSelfPermission(TootActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(TootActivity.this,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
return;
}
Intent intent;
intent = new Intent(Intent.ACTION_GET_CONTENT);
@ -832,9 +825,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
startActivityForResult(intent, PICK_IMAGE);
} else {
intent.setType("image/* video/* audio/mpeg audio/opus audio/flac audio/wav audio/ogg");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
}
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
Intent pickIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_image));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
@ -1698,7 +1689,6 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
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) {
@ -2457,11 +2447,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
@Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
media_picture.setImageBitmap(resource);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
media_picture.setImageAlpha(60);
} else {
media_picture.setAlpha(60);
}
media_picture.setImageAlpha(60);
}
});
@ -3523,23 +3509,21 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
initialTootVisibility = 1;
break;
}
if (settingsVisibility != null) {
switch (settingsVisibility) {
case "public":
ownerTootVisibility = 4;
break;
case "unlisted":
ownerTootVisibility = 3;
break;
case "private":
visibility = "private";
ownerTootVisibility = 2;
break;
case "direct":
visibility = "direct";
ownerTootVisibility = 1;
break;
}
switch (settingsVisibility) {
case "public":
ownerTootVisibility = 4;
break;
case "unlisted":
ownerTootVisibility = 3;
break;
case "private":
visibility = "private";
ownerTootVisibility = 2;
break;
case "direct":
visibility = "direct";
ownerTootVisibility = 1;
break;
}
int tootVisibility;
if (ownerTootVisibility >= initialTootVisibility) {

View File

@ -81,7 +81,8 @@
android:scaleType="fitCenter"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/account_pp"
app:layout_constraintTop_toBottomOf="@id/banner_pp" />
app:layout_constraintTop_toBottomOf="@id/banner_pp"
android:contentDescription="@string/make_an_action" />
<ImageButton
android:id="@+id/header_edit_profile"
@ -94,7 +95,8 @@
android:scaleType="fitCenter"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/account_pp"
app:layout_constraintTop_toBottomOf="@id/banner_pp" />
app:layout_constraintTop_toBottomOf="@id/banner_pp"
android:contentDescription="@string/edit_profile" />
<ImageButton
android:id="@+id/account_personal_note"
android:layout_width="45dp"
@ -106,7 +108,8 @@
android:scaleType="fitCenter"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/account_follow"
app:layout_constraintTop_toBottomOf="@id/banner_pp" />
app:layout_constraintTop_toBottomOf="@id/banner_pp"
android:contentDescription="@string/action_add_notes" />
<View
android:id="@+id/fake_actionbar"
android:layout_width="match_parent"
@ -115,29 +118,30 @@
android:background="@color/black"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
<ImageView
android:id="@+id/action_back"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="5dp"
android:layout_alignParentStart="true"
android:layout_marginTop="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/go_back"
android:src="@drawable/ic_back"
android:tint="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
<ImageView
android:id="@+id/account_menu"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/open_menu"
android:src="@drawable/ic_more_vert"
android:tint="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -195,7 +199,8 @@
android:text="Peertube"
android:id="@+id/account_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
tools:ignore="HardcodedText" />
<TextView
android:layout_marginTop="5dp"
@ -297,7 +302,8 @@
android:layout_marginEnd="5dp"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
tools:ignore="HardcodedText" />
<TextView
android:gravity="center"
@ -501,11 +507,9 @@
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:contentDescription="@string/profile_picture" />
<TextView
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_gravity="center_vertical"
android:id="@+id/show_account_title"
@ -516,26 +520,25 @@
android:textSize="14sp"
/>
<ImageButton
android:background="?attr/selectableItemBackgroundBorderless"
<ImageView
android:id="@+id/reload_tabs"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/ic_refresh"
android:tint="?attr/iconColor"
android:layout_marginEnd="10dp"
android:gravity="center"
android:contentDescription="@string/refresh" />
<ImageButton
android:background="?attr/selectableItemBackgroundBorderless"
<ImageView
android:id="@+id/action_more"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/ic_more_vert"
android:tint="?attr/iconColor"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:contentDescription="@string/display_toot_truncate" />
</LinearLayout>

View File

@ -1263,4 +1263,6 @@
<string name="background_color">Change the background color for timelines</string>
<string name="pin_tag">Pin this tag</string>
<string name="logo_of_the_instance">Logo of the instance</string>
<string name="edit_profile">Edite profile</string>
<string name="make_an_action">Make an action</string>
</resources>