Initial wallpaper settings screens.

fork-5.53.8
Alex Hart 2021-01-12 14:28:52 -04:00 zatwierdzone przez Greyson Parrelli
rodzic 46492b8238
commit 80651d2425
35 zmienionych plików z 1315 dodań i 1 usunięć

Wyświetl plik

@ -357,6 +357,16 @@
</intent-filter>
</activity>
<activity android:name=".wallpaper.ChatWallpaperActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:windowSoftInputMode="stateAlwaysHidden">
</activity>
<activity android:name=".wallpaper.ChatWallpaperPreviewActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:windowSoftInputMode="stateAlwaysHidden">
</activity>
<activity android:name=".registration.RegistrationNavigationActivity"
android:launchMode="singleTask"
android:theme="@style/TextSecure.LightRegistrationTheme"

Wyświetl plik

@ -0,0 +1,47 @@
package org.thoughtcrime.securesms.components;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Guideline;
import org.thoughtcrime.securesms.R;
public class InsetAwareConstraintLayout extends ConstraintLayout {
public InsetAwareConstraintLayout(@NonNull Context context) {
super(context);
}
public InsetAwareConstraintLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public InsetAwareConstraintLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public InsetAwareConstraintLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
protected boolean fitSystemWindows(Rect insets) {
Guideline statusBarGuideline = findViewById(R.id.status_bar_guideline);
Guideline navigationBarGuideline = findViewById(R.id.navigation_bar_guideline);
if (statusBarGuideline != null) {
statusBarGuideline.setGuidelineBegin(insets.top);
}
if (navigationBarGuideline != null) {
navigationBarGuideline.setGuidelineEnd(insets.bottom);
}
return true;
}
}

Wyświetl plik

@ -9,17 +9,24 @@ import androidx.preference.ListPreference;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.wallpaper.ChatWallpaperActivity;
import java.util.Arrays;
public class AppearancePreferenceFragment extends ListSummaryPreferenceFragment {
private static final String WALLPAPER_PREF = "pref_wallpaper";
@Override
public void onCreate(Bundle paramBundle) {
super.onCreate(paramBundle);
this.findPreference(TextSecurePreferences.THEME_PREF).setOnPreferenceChangeListener(new ListSummaryListener());
this.findPreference(TextSecurePreferences.LANGUAGE_PREF).setOnPreferenceChangeListener(new ListSummaryListener());
this.findPreference(WALLPAPER_PREF).setOnPreferenceClickListener(preference -> {
startActivity(ChatWallpaperActivity.getIntent(requireContext()));
return true;
});
initializeListSummary((ListPreference)findPreference(TextSecurePreferences.THEME_PREF));
initializeListSummary((ListPreference)findPreference(TextSecurePreferences.LANGUAGE_PREF));
}

Wyświetl plik

@ -0,0 +1,29 @@
package org.thoughtcrime.securesms.wallpaper;
import android.os.Parcelable;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import java.util.Arrays;
import java.util.List;
public interface ChatWallpaper extends Parcelable {
List<ChatWallpaper> BUILTINS = Arrays.asList(GradientChatWallpaper.SOLID_1,
GradientChatWallpaper.SOLID_2,
GradientChatWallpaper.SOLID_3,
GradientChatWallpaper.SOLID_4,
GradientChatWallpaper.SOLID_5,
GradientChatWallpaper.SOLID_6,
GradientChatWallpaper.SOLID_7,
GradientChatWallpaper.SOLID_8,
GradientChatWallpaper.SOLID_9,
GradientChatWallpaper.SOLID_10,
GradientChatWallpaper.SOLID_11,
GradientChatWallpaper.SOLID_12,
GradientChatWallpaper.GRADIENT_1,
GradientChatWallpaper.GRADIENT_2);
void loadInto(@NonNull ImageView imageView);
}

Wyświetl plik

@ -0,0 +1,66 @@
package org.thoughtcrime.securesms.wallpaper;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.lifecycle.ViewModelProviders;
import androidx.navigation.NavGraph;
import androidx.navigation.Navigation;
import org.thoughtcrime.securesms.PassphraseRequiredActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.recipients.RecipientId;
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
import org.thoughtcrime.securesms.util.DynamicTheme;
public final class ChatWallpaperActivity extends PassphraseRequiredActivity {
private static final String EXTRA_RECIPIENT_ID = "extra.recipient.id";
private final DynamicTheme dynamicTheme = new DynamicNoActionBarTheme();
public static @NonNull Intent getIntent(@NonNull Context context) {
return getIntent(context, null);
}
public static @NonNull Intent getIntent(@NonNull Context context, @Nullable RecipientId recipientId) {
Intent intent = new Intent(context, ChatWallpaperActivity.class);
intent.putExtra(EXTRA_RECIPIENT_ID, recipientId);
return intent;
}
@Override
protected void onCreate(Bundle savedInstanceState, boolean ready) {
ChatWallpaperViewModel.Factory factory = new ChatWallpaperViewModel.Factory(getIntent(this).getParcelableExtra(EXTRA_RECIPIENT_ID));
ViewModelProviders.of(this, factory).get(ChatWallpaperViewModel.class);
dynamicTheme.onCreate(this);
setContentView(R.layout.chat_wallpaper_activity);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(unused -> {
if (!Navigation.findNavController(this, R.id.nav_host_fragment).popBackStack()) {
finish();
}
});
if (savedInstanceState == null) {
Bundle extras = getIntent().getExtras();
NavGraph graph = Navigation.findNavController(this, R.id.nav_host_fragment).getGraph();
Navigation.findNavController(this, R.id.nav_host_fragment).setGraph(graph, extras != null ? extras : new Bundle());
}
}
@Override
protected void onResume() {
super.onResume();
dynamicTheme.onResume(this);
}
}

Wyświetl plik

@ -0,0 +1,43 @@
package org.thoughtcrime.securesms.wallpaper;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import androidx.navigation.Navigation;
import org.thoughtcrime.securesms.R;
public class ChatWallpaperFragment extends Fragment {
@Override
public @NonNull View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.chat_wallpaper_fragment, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
ChatWallpaperViewModel viewModel = ViewModelProviders.of(requireActivity()).get(ChatWallpaperViewModel.class);
ImageView chatWallpaperPreview = view.findViewById(R.id.chat_wallpaper_preview_background);
View setWallpaper = view.findViewById(R.id.chat_wallpaper_set_wallpaper);
viewModel.setWallpaper(GradientChatWallpaper.GRADIENT_1);
viewModel.getCurrentWallpaper().observe(getViewLifecycleOwner(), wallpaper -> {
if (wallpaper.isPresent()) {
wallpaper.get().loadInto(chatWallpaperPreview);
} else {
chatWallpaperPreview.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.signal_background_primary));
}
});
setWallpaper.setOnClickListener(unused -> Navigation.findNavController(view)
.navigate(R.id.action_chatWallpaperFragment_to_chatWallpaperSelectionFragment));
}
}

Wyświetl plik

@ -0,0 +1,76 @@
package org.thoughtcrime.securesms.wallpaper;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.lifecycle.ViewModelProviders;
import androidx.viewpager2.widget.ViewPager2;
import org.thoughtcrime.securesms.PassphraseRequiredActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.recipients.RecipientId;
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.FullscreenHelper;
import java.util.Collections;
public class ChatWallpaperPreviewActivity extends PassphraseRequiredActivity {
private static final String EXTRA_CHAT_WALLPAPER = "extra.chat.wallpaper";
private static final String EXTRA_RECIPIENT_ID = "extra.recipient.id";
private final DynamicTheme dynamicTheme = new DynamicNoActionBarTheme();
public static @NonNull Intent create(@NonNull Context context, @NonNull ChatWallpaper selection, @Nullable RecipientId recipientId) {
Intent intent = new Intent(context, ChatWallpaperPreviewActivity.class);
intent.putExtra(EXTRA_CHAT_WALLPAPER, selection);
intent.putExtra(EXTRA_RECIPIENT_ID, recipientId);
return intent;
}
@Override
protected void onCreate(Bundle savedInstanceState, boolean ready) {
dynamicTheme.onCreate(this);
setContentView(R.layout.chat_wallpaper_preview_activity);
ViewPager2 viewPager = findViewById(R.id.preview_pager);
ChatWallpaperPreviewAdapter adapter = new ChatWallpaperPreviewAdapter();
View submit = findViewById(R.id.preview_set_wallpaper);
ChatWallpaperViewModel.Factory factory = new ChatWallpaperViewModel.Factory(getIntent().getParcelableExtra(EXTRA_RECIPIENT_ID));
ChatWallpaperViewModel viewModel = ViewModelProviders.of(this, factory).get(ChatWallpaperViewModel.class);
ChatWallpaper selected = getIntent().getParcelableExtra(EXTRA_CHAT_WALLPAPER);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(unused -> finish());
viewPager.setAdapter(adapter);
adapter.submitList(Collections.singletonList(new ChatWallpaperSelectionMappingModel(selected)));
viewModel.getWallpapers().observe(this, adapter::submitList);
submit.setOnClickListener(unused -> {
ChatWallpaperSelectionMappingModel model = (ChatWallpaperSelectionMappingModel) adapter.getCurrentList().get(viewPager.getCurrentItem());
viewModel.saveWallpaperSelection(model.getWallpaper());
setResult(RESULT_OK);
finish();
});
new FullscreenHelper(this).showSystemUI();
}
@Override
protected void onResume() {
super.onResume();
dynamicTheme.onResume(this);
}
}

Wyświetl plik

@ -0,0 +1,10 @@
package org.thoughtcrime.securesms.wallpaper;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.MappingAdapter;
class ChatWallpaperPreviewAdapter extends MappingAdapter {
ChatWallpaperPreviewAdapter() {
registerFactory(ChatWallpaperSelectionMappingModel.class, ChatWallpaperViewHolder.createFactory(R.layout.chat_wallpaper_preview_fragment_adapter_item, null));
}
}

Wyświetl plik

@ -0,0 +1,14 @@
package org.thoughtcrime.securesms.wallpaper;
import androidx.annotation.NonNull;
import androidx.core.util.Consumer;
import java.util.List;
class ChatWallpaperRepository {
void getAllWallpaper(@NonNull Consumer<List<ChatWallpaper>> consumer) {
consumer.accept(ChatWallpaper.BUILTINS);
}
}

Wyświetl plik

@ -0,0 +1,12 @@
package org.thoughtcrime.securesms.wallpaper;
import androidx.annotation.Nullable;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.MappingAdapter;
class ChatWallpaperSelectionAdapter extends MappingAdapter {
ChatWallpaperSelectionAdapter(@Nullable ChatWallpaperViewHolder.EventListener eventListener) {
registerFactory(ChatWallpaperSelectionMappingModel.class, ChatWallpaperViewHolder.createFactory(R.layout.chat_wallpaper_selection_fragment_adapter_item, eventListener));
}
}

Wyświetl plik

@ -0,0 +1,74 @@
package org.thoughtcrime.securesms.wallpaper;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.flexbox.FlexboxLayoutManager;
import com.google.android.flexbox.JustifyContent;
import org.thoughtcrime.securesms.R;
public class ChatWallpaperSelectionFragment extends Fragment {
private static final short CHOOSE_PHOTO = 1;
private static final short PREVIEW = 2;
private ChatWallpaperViewModel viewModel;
@Override
public @Nullable View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.chat_wallpaper_selection_fragment, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
View chooseFromPhotos = view.findViewById(R.id.chat_wallpaper_choose_from_photos);
RecyclerView recyclerView = view.findViewById(R.id.chat_wallpaper_recycler);
FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(requireContext());
chooseFromPhotos.setOnClickListener(unused -> {
// Navigate to photo selection (akin to what we did for profile avatar selection.)
//startActivityForResult(..., CHOOSE_PHOTO);
});
@SuppressWarnings("CodeBlock2Expr")
ChatWallpaperSelectionAdapter adapter = new ChatWallpaperSelectionAdapter(chatWallpaper -> {
startActivityForResult(ChatWallpaperPreviewActivity.create(requireActivity(), chatWallpaper, viewModel.getRecipientId()), PREVIEW);
});
flexboxLayoutManager.setJustifyContent(JustifyContent.SPACE_AROUND);
recyclerView.setLayoutManager(flexboxLayoutManager);
recyclerView.setAdapter(adapter);
viewModel = ViewModelProviders.of(requireActivity()).get(ChatWallpaperViewModel.class);
viewModel.getWallpapers().observe(getViewLifecycleOwner(), adapter::submitList);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (requestCode == CHOOSE_PHOTO && resultCode == Activity.RESULT_OK && data != null) {
Uri uri = data.getData();
if (uri == null || uri == Uri.EMPTY) {
throw new AssertionError("Should never have an empty uri.");
} else {
startActivityForResult(ChatWallpaperPreviewActivity.create(requireActivity(), new UriChatWallpaper(uri), viewModel.getRecipientId()), PREVIEW);
}
} else if (requestCode == PREVIEW && resultCode == Activity.RESULT_OK) {
Navigation.findNavController(requireView()).popBackStack();
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
}

Wyświetl plik

@ -0,0 +1,34 @@
package org.thoughtcrime.securesms.wallpaper;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import org.thoughtcrime.securesms.util.MappingModel;
class ChatWallpaperSelectionMappingModel implements MappingModel<ChatWallpaperSelectionMappingModel> {
private final ChatWallpaper chatWallpaper;
ChatWallpaperSelectionMappingModel(@NonNull ChatWallpaper chatWallpaper) {
this.chatWallpaper = chatWallpaper;
}
ChatWallpaper getWallpaper() {
return chatWallpaper;
}
public void loadInto(@NonNull ImageView imageView) {
chatWallpaper.loadInto(imageView);
}
@Override
public boolean areItemsTheSame(@NonNull ChatWallpaperSelectionMappingModel newItem) {
return areContentsTheSame(newItem);
}
@Override
public boolean areContentsTheSame(@NonNull ChatWallpaperSelectionMappingModel newItem) {
return chatWallpaper.equals(newItem.chatWallpaper);
}
}

Wyświetl plik

@ -0,0 +1,50 @@
package org.thoughtcrime.securesms.wallpaper;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.MappingAdapter;
import org.thoughtcrime.securesms.util.MappingViewHolder;
class ChatWallpaperViewHolder extends MappingViewHolder<ChatWallpaperSelectionMappingModel> {
private final ImageView preview;
private final EventListener eventListener;
public ChatWallpaperViewHolder(@NonNull View itemView, @Nullable EventListener eventListener) {
super(itemView);
this.preview = itemView.findViewById(R.id.chat_wallpaper_preview);
this.eventListener = eventListener;
}
@Override
public void bind(@NonNull ChatWallpaperSelectionMappingModel model) {
model.loadInto(preview);
if (eventListener != null) {
preview.setOnClickListener(unused -> {
if (getAdapterPosition() != RecyclerView.NO_POSITION) {
eventListener.onModelClick(model);
}
});
}
}
public static @NonNull MappingAdapter.Factory<ChatWallpaperSelectionMappingModel> createFactory(@LayoutRes int layout, @Nullable EventListener listener) {
return new MappingAdapter.LayoutFactory<>(view -> new ChatWallpaperViewHolder(view, listener), layout);
}
public interface EventListener {
default void onModelClick(@NonNull ChatWallpaperSelectionMappingModel model) {
onClick(model.getWallpaper());
}
void onClick(@NonNull ChatWallpaper chatWallpaper);
}
}

Wyświetl plik

@ -0,0 +1,67 @@
package org.thoughtcrime.securesms.wallpaper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Transformations;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import com.annimon.stream.Stream;
import org.thoughtcrime.securesms.recipients.RecipientId;
import org.thoughtcrime.securesms.util.MappingModel;
import org.whispersystems.libsignal.util.guava.Optional;
import java.util.List;
import java.util.Objects;
public class ChatWallpaperViewModel extends ViewModel {
private final ChatWallpaperRepository repository = new ChatWallpaperRepository();
private final MutableLiveData<Optional<ChatWallpaper>> wallpaper = new MutableLiveData<>();
private final MutableLiveData<List<ChatWallpaper>> builtins = new MutableLiveData<>();
private final RecipientId recipientId;
private ChatWallpaperViewModel(@Nullable RecipientId recipientId) {
this.recipientId = recipientId;
repository.getAllWallpaper(builtins::postValue);
}
void setWallpaper(@Nullable ChatWallpaper chatWallpaper) {
wallpaper.setValue(Optional.fromNullable(chatWallpaper));
}
void saveWallpaperSelection(@NonNull ChatWallpaper selected) {
// TODO
}
public @Nullable RecipientId getRecipientId() {
return recipientId;
}
LiveData<Optional<ChatWallpaper>> getCurrentWallpaper() {
return wallpaper;
}
LiveData<List<MappingModel<?>>> getWallpapers() {
return Transformations.map(Transformations.distinctUntilChanged(builtins),
wallpapers -> Stream.of(wallpapers).<MappingModel<?>>map(ChatWallpaperSelectionMappingModel::new).toList());
}
public static class Factory implements ViewModelProvider.Factory {
private final RecipientId recipientId;
public Factory(@Nullable RecipientId recipientId) {
this.recipientId = recipientId;
}
@Override
public @NonNull <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
return Objects.requireNonNull(modelClass.cast(new ChatWallpaperViewModel(recipientId)));
}
}
}

Wyświetl plik

@ -0,0 +1,205 @@
package org.thoughtcrime.securesms.wallpaper;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.Arrays;
import java.util.Objects;
final class GradientChatWallpaper implements ChatWallpaper, Parcelable {
public static final GradientChatWallpaper SOLID_1 = new GradientChatWallpaper(0xFFE26983);
public static final GradientChatWallpaper SOLID_2 = new GradientChatWallpaper(0xFFDF9171);
public static final GradientChatWallpaper SOLID_3 = new GradientChatWallpaper(0xFF9E9887);
public static final GradientChatWallpaper SOLID_4 = new GradientChatWallpaper(0xFF89AE8F);
public static final GradientChatWallpaper SOLID_5 = new GradientChatWallpaper(0xFF32C7E2);
public static final GradientChatWallpaper SOLID_6 = new GradientChatWallpaper(0xFF7C99B6);
public static final GradientChatWallpaper SOLID_7 = new GradientChatWallpaper(0xFFC988E7);
public static final GradientChatWallpaper SOLID_8 = new GradientChatWallpaper(0xFFE297C3);
public static final GradientChatWallpaper SOLID_9 = new GradientChatWallpaper(0xFFA2A2AA);
public static final GradientChatWallpaper SOLID_10 = new GradientChatWallpaper(0xFF146148);
public static final GradientChatWallpaper SOLID_11 = new GradientChatWallpaper(0xFF403B91);
public static final GradientChatWallpaper SOLID_12 = new GradientChatWallpaper(0xFF624249);
public static final GradientChatWallpaper GRADIENT_1 = new GradientChatWallpaper(167.96f,
new int[] { 0xFFF3DC47, 0xFFF3DA47, 0xFFF2D546, 0xFFF2CC46, 0xFFF1C146, 0xFFEFB445, 0xFFEEA544, 0xFFEC9644, 0xFFEB8743, 0xFFE97743, 0xFFE86942, 0xFFE65C41, 0xFFE55041, 0xFFE54841, 0xFFE44240, 0xFFE44040 },
new float[] { 0.0f, 0.0807f, 0.1554f, 0.225f, 0.2904f, 0.3526f, 0.4125f, 0.471f, 0.529f, 0.5875f, 0.6474f, 0.7096f, 0.775f, 0.8446f, 0.9193f, 1f });
public static final GradientChatWallpaper GRADIENT_2 = new GradientChatWallpaper(180f,
new int[] { 0xFF16161D, 0xFF17171E, 0xFF1A1A22, 0xFF1F1F28, 0xFF26262F, 0xFF2D2D38, 0xFF353542, 0xFF3E3E4C, 0xFF474757, 0xFF4F4F61, 0xFF57576B, 0xFF5F5F74, 0xFF65657C, 0xFF6A6A82, 0xFF6D6D85, 0xFF6E6E87 },
new float[] { 0.0000f, 0.0807f, 0.1554f, 0.2250f, 0.2904f, 0.3526f, 0.4125f, 0.4710f, 0.5290f, 0.5875f, 0.6474f, 0.7096f, 0.7750f, 0.8446f, 0.9193f, 1.0000f });
private final float degrees;
private final int[] colors;
private final float[] positions;
GradientChatWallpaper(int color) {
this(0f, new int[]{color, color}, null);
}
GradientChatWallpaper(float degrees, int[] colors, float[] positions) {
this.degrees = degrees;
this.colors = colors;
this.positions = positions;
}
private GradientChatWallpaper(Parcel in) {
degrees = in.readFloat();
colors = in.createIntArray();
positions = in.createFloatArray();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeFloat(degrees);
dest.writeIntArray(colors);
dest.writeFloatArray(positions);
}
@Override
public int describeContents() {
return 0;
}
private @NonNull Drawable buildDrawable() {
return new RotatableGradientDrawable(degrees, colors, positions);
}
@Override
public void loadInto(@NonNull ImageView imageView) {
imageView.setImageDrawable(buildDrawable());
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GradientChatWallpaper that = (GradientChatWallpaper) o;
return Float.compare(that.degrees, degrees) == 0 &&
Arrays.equals(colors, that.colors) &&
Arrays.equals(positions, that.positions);
}
@Override
public int hashCode() {
int result = Objects.hash(degrees);
result = 31 * result + Arrays.hashCode(colors);
result = 31 * result + Arrays.hashCode(positions);
return result;
}
public static final Creator<GradientChatWallpaper> CREATOR = new Creator<GradientChatWallpaper>() {
@Override
public GradientChatWallpaper createFromParcel(Parcel in) {
return new GradientChatWallpaper(in);
}
@Override
public GradientChatWallpaper[] newArray(int size) {
return new GradientChatWallpaper[size];
}
};
private static final class RotatableGradientDrawable extends Drawable {
private final float degrees;
private final int[] colors;
private final float[] positions;
private final Rect fillRect = new Rect();
private final Paint fillPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private RotatableGradientDrawable(float degrees, int[] colors, @Nullable float[] positions) {
this.degrees = degrees + 225f;
this.colors = colors;
this.positions = positions;
}
@Override
public void setBounds(int left, int top, int right, int bottom) {
super.setBounds(left, top, right, bottom);
Point topLeft = new Point(left, top);
Point topRight = new Point(right, top);
Point bottomLeft = new Point(left, bottom);
Point bottomRight = new Point(right, bottom);
Point origin = new Point(getBounds().width() / 2, getBounds().height() / 2);
Point rotationTopLeft = cornerPrime(origin, topLeft, degrees);
Point rotationTopRight = cornerPrime(origin, topRight, degrees);
Point rotationBottomLeft = cornerPrime(origin, bottomLeft, degrees);
Point rotationBottomRight = cornerPrime(origin, bottomRight, degrees);
fillRect.left = Integer.MAX_VALUE;
fillRect.top = Integer.MAX_VALUE;
fillRect.right = Integer.MIN_VALUE;
fillRect.bottom = Integer.MIN_VALUE;
for (Point point : Arrays.asList(topLeft, topRight, bottomLeft, bottomRight, rotationTopLeft, rotationTopRight, rotationBottomLeft, rotationBottomRight)) {
if (point.x < fillRect.left) {
fillRect.left = point.x;
}
if (point.x > fillRect.right) {
fillRect.right = point.x;
}
if (point.y < fillRect.top) {
fillRect.top = point.y;
}
if (point.y > fillRect.bottom) {
fillRect.bottom = point.y;
}
}
fillPaint.setShader(new LinearGradient(fillRect.left, fillRect.top, fillRect.right, fillRect.bottom, colors, positions, Shader.TileMode.CLAMP));
}
private static Point cornerPrime(@NonNull Point origin, @NonNull Point corner, float degrees) {
return new Point(xPrime(origin, corner, Math.toRadians(degrees)), yPrime(origin, corner, Math.toRadians(degrees)));
}
private static int xPrime(@NonNull Point origin, @NonNull Point corner, double theta) {
return (int) Math.ceil(((corner.x - origin.x) * Math.cos(theta)) - ((corner.y - origin.y) * Math.sin(theta)) + origin.x);
}
private static int yPrime(@NonNull Point origin, @NonNull Point corner, double theta) {
return (int) Math.ceil(((corner.x - origin.x) * Math.sin(theta)) + ((corner.y - origin.y) * Math.cos(theta)) + origin.y);
}
@Override
public void draw(Canvas canvas) {
int save = canvas.save();
canvas.rotate(degrees, getBounds().width() / 2f, getBounds().height() / 2f);
canvas.drawRect(fillRect, fillPaint);
canvas.restoreToCount(save);
}
@Override
public void setAlpha(int alpha) {
// Not supported
}
@Override
public void setColorFilter(@Nullable ColorFilter colorFilter) {
// Not supported
}
@Override
public int getOpacity() {
return PixelFormat.OPAQUE;
}
}
}

Wyświetl plik

@ -0,0 +1,52 @@
package org.thoughtcrime.securesms.wallpaper;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import org.thoughtcrime.securesms.mms.GlideApp;
final class UriChatWallpaper implements ChatWallpaper, Parcelable {
private final Uri uri;
UriChatWallpaper(@NonNull Uri uri) {
this.uri = uri;
}
protected UriChatWallpaper(Parcel in) {
uri = in.readParcelable(Uri.class.getClassLoader());
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(uri, flags);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<UriChatWallpaper> CREATOR = new Creator<UriChatWallpaper>() {
@Override
public UriChatWallpaper createFromParcel(Parcel in) {
return new UriChatWallpaper(in);
}
@Override
public UriChatWallpaper[] newArray(int size) {
return new UriChatWallpaper[size];
}
};
@Override
public void loadInto(@NonNull ImageView imageView) {
GlideApp.with(imageView)
.load(uri)
.into(imageView);
}
}

Wyświetl plik

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/signal_background_primary" />
<corners android:bottomLeftRadius="8dp" android:bottomRightRadius="8dp" />
</shape>

Wyświetl plik

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/core_white" />
<corners android:radius="8dp" />
</shape>

Wyświetl plik

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/signal_background_secondary" />
<corners android:radius="18dp" />
</shape>

Wyświetl plik

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/signal_accent_primary" />
<corners android:radius="18dp" />
</shape>

Wyświetl plik

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/signal_transparent_40" />
<corners android:radius="8dp" />
</shape>

Wyświetl plik

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:color="@color/signal_inverse_transparent_20" android:width="0.33dp" />
<corners android:radius="8dp" />
</shape>

Wyświetl plik

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/signal_accent_primary" />
<corners android:topLeftRadius="8dp" android:topRightRadius="8dp" />
</shape>

Wyświetl plik

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:type="linear"
android:angle="135"
android:startColor="@color/signal_accent_primary"
android:endColor="@color/signal_accent_green" />
</shape>

Wyświetl plik

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".wallpaper.ChatWallpaperActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/signal_background_primary"
app:title="@string/ChatWallpaperActivity__chat_wallpaper"
app:navigationIcon="@drawable/ic_arrow_left_24" />
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/chat_wallpaper" />
</LinearLayout>

Wyświetl plik

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:id="@+id/chat_wallpaper_preview_lightbox"
android:layout_width="0dp"
android:layout_height="320dp"
android:background="@color/signal_background_tertiary"
app:layout_constraintBottom_toBottomOf="@id/chat_wallpaper_preview_bottom_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/chat_wallpaper_preview_top_bar"
android:layout_width="156dp"
android:layout_height="30dp"
android:background="@drawable/chat_wallpaper_preview_top_bar"
app:layout_constraintBottom_toTopOf="@id/chat_wallpaper_preview_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<ImageView
android:id="@+id/chat_wallpaper_preview_background"
android:layout_width="156dp"
android:layout_height="228dp"
android:importantForAccessibility="no"
android:scaleType="fitXY"
android:src="@drawable/test_gradient"
app:layout_constraintBottom_toTopOf="@id/chat_wallpaper_preview_bottom_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chat_wallpaper_preview_top_bar"
tools:background="@color/signal_background_primary" />
<View
android:id="@+id/chat_wallpaper_preview_bottom_bar"
android:layout_width="156dp"
android:layout_height="30dp"
android:background="@drawable/chat_wallpaper_preview_bottom_bar"
app:layout_constraintBottom_toBottomOf="@id/chat_wallpaper_preview_lightbox"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chat_wallpaper_preview_background" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/chat_wallpaper_preview_bubble_1"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_marginStart="8dp"
android:layout_marginTop="30dp"
app:layout_constraintStart_toStartOf="@id/chat_wallpaper_preview_background"
app:layout_constraintTop_toTopOf="@id/chat_wallpaper_preview_background"
app:srcCompat="@drawable/chat_wallpaper_preview_bubble"
app:tint="@color/signal_accent_primary" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/chat_wallpaper_preview_bubble_2"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_marginTop="66dp"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="@id/chat_wallpaper_preview_background"
app:layout_constraintTop_toTopOf="@id/chat_wallpaper_preview_background"
app:srcCompat="@drawable/chat_wallpaper_preview_bubble"
app:tint="@color/signal_background_tertiary" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/chat_wallpaper_preview_outline"
app:layout_constraintBottom_toBottomOf="@id/chat_wallpaper_preview_bottom_bar"
app:layout_constraintEnd_toEndOf="@id/chat_wallpaper_preview_background"
app:layout_constraintStart_toStartOf="@id/chat_wallpaper_preview_background"
app:layout_constraintTop_toTopOf="@id/chat_wallpaper_preview_top_bar" />
<TextView
android:id="@+id/chat_wallpaper_set_wallpaper"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/ChatWallpaperFragment__set_wallpaper"
android:textAppearance="@style/Signal.Text.Body"
android:textColor="@color/signal_text_primary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chat_wallpaper_preview_lightbox" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/chat_wallpaper_dark_theme_dims_wallpaper"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/ChatWallpaperFragment__dark_theme_dims_wallpaper"
android:textAppearance="@style/Signal.Text.Body"
android:textColor="@color/signal_text_primary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chat_wallpaper_set_wallpaper" />
<View
android:id="@+id/chat_wallpaper_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="16dp"
android:background="@color/signal_inverse_transparent_15"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chat_wallpaper_dark_theme_dims_wallpaper" />
<TextView
android:id="@+id/chat_wallpaper_clear_wallpaper"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/ChatWallpaperFragment__clear_wallpaper"
android:textAppearance="@style/Signal.Text.Body"
android:textColor="@color/signal_text_primary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chat_wallpaper_divider" />
<TextView
android:id="@+id/chat_wallpaper_reset_all_wallpapers"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/ChatWallpaperFragment__reset_all_wallpapers"
android:textAppearance="@style/Signal.Text.Body"
android:textColor="@color/signal_text_primary"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chat_wallpaper_clear_wallpaper"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

Wyświetl plik

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.components.InsetAwareConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/status_bar_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:layout_constraintGuide_begin="48dp" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/navigation_bar_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:layout_constraintGuide_end="48dp" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/preview_pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="@drawable/test_gradient" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/signal_background_primary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/status_bar_guideline"
app:navigationIcon="@drawable/ic_arrow_left_24"
app:title="@string/ChatWallpaperPreviewActivity__preview" />
<TextView
android:id="@+id/preview_today"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/chat_wallpaper_preview_date_background"
android:paddingStart="10dp"
android:paddingTop="4dp"
android:paddingEnd="10dp"
android:paddingBottom="4dp"
android:text="@string/DateUtils_today"
android:textAppearance="@style/TextAppearance.Signal.Subtitle"
android:textColor="@color/signal_text_secondary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar" />
<LinearLayout
android:id="@+id/preview_bubble_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="20dp"
android:background="@drawable/chat_wallpaper_preview_bubble_background_accent"
android:orientation="vertical"
android:paddingStart="12dp"
android:paddingTop="7dp"
android:paddingEnd="12dp"
android:paddingBottom="7dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/preview_today">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ChatWallpaperPreviewActivity__this_wallpaper_will_be_set_for_all_chats"
android:textAppearance="@style/Signal.Text.Body"
android:textColor="@color/core_white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ChatWallpaperPreviewActivity__10_49_am"
android:textAppearance="@style/Signal.Text.Caption"
android:textColor="@color/transparent_white_80" />
</LinearLayout>
<LinearLayout
android:id="@+id/preview_bubble_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginEnd="16dp"
android:background="@drawable/chat_wallpaper_preview_bubble_background"
android:orientation="vertical"
android:paddingStart="12dp"
android:paddingTop="7dp"
android:paddingEnd="12dp"
android:paddingBottom="7dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/preview_bubble_1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ChatWallpaperPreviewActivity__besides_those_you_manually_override"
android:textAppearance="@style/Signal.Text.Body"
android:textColor="@color/signal_text_primary" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:drawablePadding="4dp"
android:text="@string/ChatWallpaperPreviewActivity__10_49_am"
android:textAppearance="@style/Signal.Text.Caption"
android:textColor="@color/signal_text_secondary"
app:drawableEndCompat="@drawable/ic_delivery_status_read"
app:drawableTint="@color/signal_text_secondary" />
</LinearLayout>
<View
android:id="@+id/preview_guideline"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/signal_background_primary"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="@id/navigation_bar_guideline" />
<com.google.android.material.button.MaterialButton
android:id="@+id/preview_set_wallpaper"
style="@style/Signal.Widget.Button.Small.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ChatWallpaperPreviewActivity__set_wallpaper"
app:layout_constraintBottom_toBottomOf="@id/navigation_bar_guideline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/preview_guideline" />
</org.thoughtcrime.securesms.components.InsetAwareConstraintLayout>

Wyświetl plik

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/chat_wallpaper_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:src="@drawable/test_gradient" />

Wyświetl plik

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/chat_wallpaper_choose_from_photos"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/ChatWallpaperSelectionFragment__choose_from_photos"
android:textAppearance="@style/Signal.Text.Body"
android:textColor="@color/signal_text_primary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/chat_wallpaper_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="16dp"
android:background="@color/signal_inverse_transparent_15"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chat_wallpaper_choose_from_photos" />
<TextView
android:id="@+id/chat_wallpaper_presets"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="16dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/ChatWallpaperSelectionFragment__presets"
android:textAppearance="@style/TextAppearance.Signal.Body2"
android:textColor="@color/signal_text_secondary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chat_wallpaper_divider" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/chat_wallpaper_recycler"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:paddingStart="14dp"
android:paddingEnd="14dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chat_wallpaper_presets"
tools:layoutManager="com.google.android.flexbox.FlexboxLayoutManager"
tools:listitem="@layout/chat_wallpaper_selection_fragment_adapter_item" />
</androidx.constraintlayout.widget.ConstraintLayout>

Wyświetl plik

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/chat_wallpaper_preview"
android:layout_width="117dp"
android:layout_height="206dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_marginBottom="4dp"
android:scaleType="fitXY"
tools:src="@drawable/test_gradient" />

Wyświetl plik

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/chat_wallpaper"
app:startDestination="@id/chatWallpaperFragment">
<fragment
android:id="@+id/chatWallpaperFragment"
android:name="org.thoughtcrime.securesms.wallpaper.ChatWallpaperFragment"
android:label="chat_wallpaper_fragment"
tools:layout="@layout/chat_wallpaper_fragment">
<action
android:id="@+id/action_chatWallpaperFragment_to_chatWallpaperSelectionFragment"
app:destination="@id/chatWallpaperSelectionFragment" />
</fragment>
<fragment
android:id="@+id/chatWallpaperSelectionFragment"
android:name="org.thoughtcrime.securesms.wallpaper.ChatWallpaperSelectionFragment"
android:label="chat_wallpaper_selection_fragment"
tools:layout="@layout/chat_wallpaper_selection_fragment">
</fragment>
</navigation>

Wyświetl plik

@ -14,4 +14,7 @@
<item name="reminder_action_gv1_initiation_not_now" type="id" />
<item name="reminder_action_gv1_initiation_update_group" type="id" />
<item name="status_bar_guideline" type="id" />
<item name="navigation_bar_guideline" type="id" />
</resources>

Wyświetl plik

@ -2207,6 +2207,7 @@
<string name="preferences__dark_theme">Dark</string>
<string name="preferences__appearance">Appearance</string>
<string name="preferences__theme">Theme</string>
<string name="preferences__chat_wallpaper">Chat wallpaper</string>
<string name="preferences__disable_pin">Disable PIN</string>
<string name="preferences__enable_pin">Enable PIN</string>
<string name="preferences__if_you_disable_the_pin_you_will_lose_all_data">If you disable the PIN, you will lose all data when you re-register Signal unless you manually back up and restore. You can not turn on Registration Lock while the PIN is disabled.</string>
@ -2819,6 +2820,26 @@
<!-- ShareInterstitialActivity -->
<string name="ShareInterstitialActivity__forward_message">Forward message</string>
<!-- ChatWallpaperActivity -->
<string name="ChatWallpaperActivity__chat_wallpaper">Chat wallpaper</string>
<!-- ChatWallpaperFragment -->
<string name="ChatWallpaperFragment__set_wallpaper">Set wallpaper</string>
<string name="ChatWallpaperFragment__dark_theme_dims_wallpaper">Dark theme dims wallpaper</string>
<string name="ChatWallpaperFragment__clear_wallpaper">Clear wallpaper</string>
<string name="ChatWallpaperFragment__reset_all_wallpapers">Reset all wallpapers</string>
<!-- ChatWallpaperSelectionFragment -->
<string name="ChatWallpaperSelectionFragment__choose_from_photos">Choose from photos</string>
<string name="ChatWallpaperSelectionFragment__presets">Presets</string>
<!-- ChatWallpaperPreviewActivity -->
<string name="ChatWallpaperPreviewActivity__preview">Preview</string>
<string name="ChatWallpaperPreviewActivity__set_wallpaper">Set wallpaper</string>
<string name="ChatWallpaperPreviewActivity__10_49_am">10:49 am</string>
<string name="ChatWallpaperPreviewActivity__this_wallpaper_will_be_set_for_all_chats">This wallpaper will be set for all chats</string>
<string name="ChatWallpaperPreviewActivity__besides_those_you_manually_override">Besides those you manually override</string>
<!-- EOF -->
</resources>

Wyświetl plik

@ -9,6 +9,9 @@
android:defaultValue="system">
</org.thoughtcrime.securesms.preferences.widgets.SignalListPreference>
<Preference android:title="@string/preferences__chat_wallpaper"
android:key="pref_wallpaper" />
<org.thoughtcrime.securesms.preferences.widgets.SignalListPreference
android:key="pref_language"
android:title="@string/preferences__language"

Wyświetl plik

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<org.thoughtcrime.securesms.preferences.widgets.SignalListPreference
android:key="pref_theme"
android:title="@string/preferences__theme"
@ -9,6 +10,9 @@
android:defaultValue="light">
</org.thoughtcrime.securesms.preferences.widgets.SignalListPreference>
<Preference android:title="@string/preferences__chat_wallpaper"
android:key="pref_wallpaper" />
<org.thoughtcrime.securesms.preferences.widgets.SignalListPreference
android:key="pref_language"
android:title="@string/preferences__language"