use dynamic titles for activities when they are supplied
This commit is contained in:
parent
e14cdd7c2a
commit
7b1e500659
2 changed files with 10 additions and 14 deletions
|
@ -522,7 +522,7 @@ public class ListenerService extends WearableListenerService implements GoogleAp
|
||||||
intent.putExtras(params);
|
intent.putExtras(params);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else {
|
} else {
|
||||||
showConfirmationDialog(message, actionstring);
|
showConfirmationDialog(title, message, actionstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (path.equals(NEW_STATUS_PATH)) {
|
} else if (path.equals(NEW_STATUS_PATH)) {
|
||||||
|
@ -680,10 +680,11 @@ public class ListenerService extends WearableListenerService implements GoogleAp
|
||||||
notificationManager.createNotificationChannel(channel);
|
notificationManager.createNotificationChannel(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showConfirmationDialog(String message, String actionstring) {
|
private void showConfirmationDialog(String title, String message, String actionstring) {
|
||||||
Intent intent = new Intent(this, AcceptActivity.class);
|
Intent intent = new Intent(this, AcceptActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
Bundle params = new Bundle();
|
Bundle params = new Bundle();
|
||||||
|
params.putString("title", title);
|
||||||
params.putString("message", message);
|
params.putString("message", message);
|
||||||
params.putString("actionstring", actionstring);
|
params.putString("actionstring", actionstring);
|
||||||
intent.putExtras(params);
|
intent.putExtras(params);
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class ViewSelectorActivity extends Activity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.grid_layout);
|
setContentView(R.layout.grid_layout);
|
||||||
|
|
||||||
setTitleBasedOnScreenShape(String.valueOf(getTitle()));
|
setTitleBasedOnScreenShape();
|
||||||
|
|
||||||
pager = findViewById(R.id.pager);
|
pager = findViewById(R.id.pager);
|
||||||
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
|
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
|
||||||
|
@ -59,7 +59,12 @@ public class ViewSelectorActivity extends Activity {
|
||||||
pager.setAdapter(adapter);
|
pager.setAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTitleBasedOnScreenShape(String title) {
|
private void setTitleBasedOnScreenShape() {
|
||||||
|
// intents can inject dynamic titles, otherwise we'll use the default
|
||||||
|
String title = String.valueOf(getTitle());
|
||||||
|
if (getIntent().getExtras() != null)
|
||||||
|
title = getIntent().getExtras().getString("title", title);
|
||||||
|
|
||||||
CurvedTextView titleViewCurved = findViewById(R.id.title_curved);
|
CurvedTextView titleViewCurved = findViewById(R.id.title_curved);
|
||||||
TextView titleView = findViewById(R.id.title);
|
TextView titleView = findViewById(R.id.title);
|
||||||
if (this.getResources().getConfiguration().isScreenRound()) {
|
if (this.getResources().getConfiguration().isScreenRound()) {
|
||||||
|
@ -91,18 +96,8 @@ public class ViewSelectorActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLabelToPlusMinusView(View view, String labelText) {
|
void setLabelToPlusMinusView(View view, String labelText) {
|
||||||
SharedPreferences sharedPrefs = PreferenceManager
|
|
||||||
.getDefaultSharedPreferences(this);
|
|
||||||
int design = Integer.parseInt(sharedPrefs.getString("input_design", "1"));
|
|
||||||
|
|
||||||
if (design == 4) {
|
|
||||||
//@LadyViktoria: Here the label can be set differently, if you like.
|
|
||||||
final TextView textView = view.findViewById(R.id.label);
|
final TextView textView = view.findViewById(R.id.label);
|
||||||
textView.setText(labelText);
|
textView.setText(labelText);
|
||||||
} else {
|
|
||||||
final TextView textView = view.findViewById(R.id.label);
|
|
||||||
textView.setText(labelText);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue