mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 09:58:08 +00:00
Rename MaterialActivity to MainActivity
Summary: Its more descriptive Reviewers: #kde_connect, mtijink Reviewed By: #kde_connect, mtijink Subscribers: mtijink, #kde_connect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D10951
This commit is contained in:
parent
889251ed94
commit
e72e0f61dd
@ -63,7 +63,7 @@
|
|||||||
</service>
|
</service>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.UserInterface.MaterialActivity"
|
android:name="org.kde.kdeconnect.UserInterface.MainActivity"
|
||||||
android:label="KDE Connect"
|
android:label="KDE Connect"
|
||||||
android:theme="@style/KdeConnectTheme.NoActionBar">
|
android:theme="@style/KdeConnectTheme.NoActionBar">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@ -75,26 +75,26 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.UserInterface.SettingsActivity"
|
android:name="org.kde.kdeconnect.UserInterface.SettingsActivity"
|
||||||
android:label="@string/device_menu_plugins"
|
android:label="@string/device_menu_plugins"
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.MaterialActivity">
|
android:parentActivityName="org.kde.kdeconnect.UserInterface.MainActivity">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.kde.kdeconnect.UserInterface.MaterialActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.MainActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.UserInterface.CustomDevicesActivity"
|
android:name="org.kde.kdeconnect.UserInterface.CustomDevicesActivity"
|
||||||
android:label="@string/custom_devices_settings"
|
android:label="@string/custom_devices_settings"
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.MaterialActivity">
|
android:parentActivityName="org.kde.kdeconnect.UserInterface.MainActivity">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.kde.kdeconnect.UserInterface.MaterialActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.MainActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.Plugins.SharePlugin.SendFileActivity"
|
android:name="org.kde.kdeconnect.Plugins.SharePlugin.SendFileActivity"
|
||||||
android:label="KDE Connect"
|
android:label="KDE Connect"
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.MaterialActivity">
|
android:parentActivityName="org.kde.kdeconnect.UserInterface.MainActivity">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.kde.kdeconnect.UserInterface.MaterialActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.MainActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.UserInterface.PluginSettingsActivity"
|
android:name="org.kde.kdeconnect.UserInterface.PluginSettingsActivity"
|
||||||
@ -146,10 +146,10 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.Plugins.MprisPlugin.MprisActivity"
|
android:name="org.kde.kdeconnect.Plugins.MprisPlugin.MprisActivity"
|
||||||
android:label="@string/remote_control"
|
android:label="@string/remote_control"
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.MaterialActivity">
|
android:parentActivityName="org.kde.kdeconnect.UserInterface.MainActivity">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.kde.kdeconnect.UserInterface.MaterialActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.MainActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<receiver android:name="org.kde.kdeconnect.Plugins.MprisPlugin.MprisMediaNotificationReceiver">
|
<receiver android:name="org.kde.kdeconnect.Plugins.MprisPlugin.MprisMediaNotificationReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@ -160,20 +160,20 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.Plugins.RunCommandPlugin.RunCommandActivity"
|
android:name="org.kde.kdeconnect.Plugins.RunCommandPlugin.RunCommandActivity"
|
||||||
android:label="@string/remote_control"
|
android:label="@string/remote_control"
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.MaterialActivity">
|
android:parentActivityName="org.kde.kdeconnect.UserInterface.MainActivity">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.kde.kdeconnect.UserInterface.MaterialActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.MainActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.Plugins.MousePadPlugin.MousePadActivity"
|
android:name="org.kde.kdeconnect.Plugins.MousePadPlugin.MousePadActivity"
|
||||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||||
android:label="@string/remote_control"
|
android:label="@string/remote_control"
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.MaterialActivity"
|
android:parentActivityName="org.kde.kdeconnect.UserInterface.MainActivity"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize">
|
android:windowSoftInputMode="stateHidden|adjustResize">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.kde.kdeconnect.UserInterface.MaterialActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.MainActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.Plugins.SharePlugin.ShareActivity"
|
android:name="org.kde.kdeconnect.Plugins.SharePlugin.ShareActivity"
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="16dip"
|
android:paddingLeft="16dip"
|
||||||
android:paddingRight="16dip"
|
android:paddingRight="16dip"
|
||||||
tools:context="org.kde.kdeconnect.UserInterface.MaterialActivity"></ListView>
|
tools:context="org.kde.kdeconnect.UserInterface.MainActivity"></ListView>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
tools:context="org.kde.kdeconnect.UserInterface.MaterialActivity"> <!-- fitSystemWindows to make the drawer slide below the Lollipop transparent status bar -->
|
tools:context="org.kde.kdeconnect.UserInterface.MainActivity"> <!-- fitSystemWindows to make the drawer slide below the Lollipop transparent status bar -->
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -42,7 +42,7 @@ import org.kde.kdeconnect.Helpers.NotificationHelper;
|
|||||||
import org.kde.kdeconnect.Helpers.SecurityHelpers.SslHelper;
|
import org.kde.kdeconnect.Helpers.SecurityHelpers.SslHelper;
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
import org.kde.kdeconnect.Plugins.Plugin;
|
||||||
import org.kde.kdeconnect.Plugins.PluginFactory;
|
import org.kde.kdeconnect.Plugins.PluginFactory;
|
||||||
import org.kde.kdeconnect.UserInterface.MaterialActivity;
|
import org.kde.kdeconnect.UserInterface.MainActivity;
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
import java.security.KeyFactory;
|
import java.security.KeyFactory;
|
||||||
@ -374,23 +374,23 @@ public class Device implements BaseLink.PackageReceiver {
|
|||||||
|
|
||||||
notificationId = (int) System.currentTimeMillis();
|
notificationId = (int) System.currentTimeMillis();
|
||||||
|
|
||||||
Intent intent = new Intent(getContext(), MaterialActivity.class);
|
Intent intent = new Intent(getContext(), MainActivity.class);
|
||||||
intent.putExtra("deviceId", getDeviceId());
|
intent.putExtra("deviceId", getDeviceId());
|
||||||
intent.putExtra("notificationId", notificationId);
|
intent.putExtra("notificationId", notificationId);
|
||||||
PendingIntent pendingIntent = PendingIntent.getActivity(getContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent pendingIntent = PendingIntent.getActivity(getContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
|
|
||||||
Intent acceptIntent = new Intent(getContext(), MaterialActivity.class);
|
Intent acceptIntent = new Intent(getContext(), MainActivity.class);
|
||||||
Intent rejectIntent = new Intent(getContext(), MaterialActivity.class);
|
Intent rejectIntent = new Intent(getContext(), MainActivity.class);
|
||||||
|
|
||||||
acceptIntent.putExtra("deviceId", getDeviceId());
|
acceptIntent.putExtra("deviceId", getDeviceId());
|
||||||
acceptIntent.putExtra("notificationId", notificationId);
|
acceptIntent.putExtra("notificationId", notificationId);
|
||||||
acceptIntent.setAction("action " + System.currentTimeMillis());
|
acceptIntent.setAction("action " + System.currentTimeMillis());
|
||||||
acceptIntent.putExtra(MaterialActivity.PAIR_REQUEST_STATUS, MaterialActivity.PAIRING_ACCEPTED);
|
acceptIntent.putExtra(MainActivity.PAIR_REQUEST_STATUS, MainActivity.PAIRING_ACCEPTED);
|
||||||
|
|
||||||
rejectIntent.putExtra("deviceId", getDeviceId());
|
rejectIntent.putExtra("deviceId", getDeviceId());
|
||||||
rejectIntent.putExtra("notificationId", notificationId);
|
rejectIntent.putExtra("notificationId", notificationId);
|
||||||
rejectIntent.setAction("action " + System.currentTimeMillis());
|
rejectIntent.setAction("action " + System.currentTimeMillis());
|
||||||
rejectIntent.putExtra(MaterialActivity.PAIR_REQUEST_STATUS, MaterialActivity.PAIRING_REJECTED);
|
rejectIntent.putExtra(MainActivity.PAIR_REQUEST_STATUS, MainActivity.PAIRING_REJECTED);
|
||||||
|
|
||||||
PendingIntent acceptedPendingIntent = PendingIntent.getActivity(getContext(), 2, acceptIntent, PendingIntent.FLAG_ONE_SHOT);
|
PendingIntent acceptedPendingIntent = PendingIntent.getActivity(getContext(), 2, acceptIntent, PendingIntent.FLAG_ONE_SHOT);
|
||||||
PendingIntent rejectedPendingIntent = PendingIntent.getActivity(getContext(), 4, rejectIntent, PendingIntent.FLAG_ONE_SHOT);
|
PendingIntent rejectedPendingIntent = PendingIntent.getActivity(getContext(), 4, rejectIntent, PendingIntent.FLAG_ONE_SHOT);
|
||||||
|
@ -45,7 +45,7 @@ import android.util.Log;
|
|||||||
import org.kde.kdeconnect.Helpers.AppsHelper;
|
import org.kde.kdeconnect.Helpers.AppsHelper;
|
||||||
import org.kde.kdeconnect.NetworkPackage;
|
import org.kde.kdeconnect.NetworkPackage;
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
import org.kde.kdeconnect.Plugins.Plugin;
|
||||||
import org.kde.kdeconnect.UserInterface.MaterialActivity;
|
import org.kde.kdeconnect.UserInterface.MainActivity;
|
||||||
import org.kde.kdeconnect.UserInterface.SettingsActivity;
|
import org.kde.kdeconnect.UserInterface.SettingsActivity;
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
@ -497,7 +497,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
||||||
deviceActivity.startActivityForResult(intent, MaterialActivity.RESULT_NEEDS_RELOAD);
|
deviceActivity.startActivityForResult(intent, MainActivity.RESULT_NEEDS_RELOAD);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
|
@ -33,7 +33,7 @@ import android.util.Log;
|
|||||||
import org.kde.kdeconnect.Helpers.NotificationHelper;
|
import org.kde.kdeconnect.Helpers.NotificationHelper;
|
||||||
import org.kde.kdeconnect.NetworkPackage;
|
import org.kde.kdeconnect.NetworkPackage;
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
import org.kde.kdeconnect.Plugins.Plugin;
|
||||||
import org.kde.kdeconnect.UserInterface.MaterialActivity;
|
import org.kde.kdeconnect.UserInterface.MainActivity;
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
|
|
||||||
@ -62,8 +62,8 @@ public class PingPlugin extends Plugin {
|
|||||||
//Log.e("PingPackageReceiver", "was a ping!");
|
//Log.e("PingPackageReceiver", "was a ping!");
|
||||||
|
|
||||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
|
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
|
||||||
stackBuilder.addParentStack(MaterialActivity.class);
|
stackBuilder.addParentStack(MainActivity.class);
|
||||||
stackBuilder.addNextIntent(new Intent(context, MaterialActivity.class));
|
stackBuilder.addNextIntent(new Intent(context, MainActivity.class));
|
||||||
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(
|
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(
|
||||||
0,
|
0,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT
|
PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
|
@ -35,7 +35,7 @@ import android.util.Log;
|
|||||||
import org.kde.kdeconnect.Helpers.NotificationHelper;
|
import org.kde.kdeconnect.Helpers.NotificationHelper;
|
||||||
import org.kde.kdeconnect.NetworkPackage;
|
import org.kde.kdeconnect.NetworkPackage;
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
import org.kde.kdeconnect.Plugins.Plugin;
|
||||||
import org.kde.kdeconnect.UserInterface.MaterialActivity;
|
import org.kde.kdeconnect.UserInterface.MainActivity;
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -76,8 +76,8 @@ public class ReceiveNotificationsPlugin extends Plugin {
|
|||||||
Log.e("NotificationsPlugin", "Received notification package lacks properties");
|
Log.e("NotificationsPlugin", "Received notification package lacks properties");
|
||||||
} else {
|
} else {
|
||||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
|
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
|
||||||
stackBuilder.addParentStack(MaterialActivity.class);
|
stackBuilder.addParentStack(MainActivity.class);
|
||||||
stackBuilder.addNextIntent(new Intent(context, MaterialActivity.class));
|
stackBuilder.addNextIntent(new Intent(context, MainActivity.class));
|
||||||
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(
|
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(
|
||||||
0,
|
0,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT
|
PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
|
@ -33,7 +33,7 @@ import android.view.inputmethod.EditorInfo;
|
|||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.kde.kdeconnect.UserInterface.MaterialActivity;
|
import org.kde.kdeconnect.UserInterface.MainActivity;
|
||||||
import org.kde.kdeconnect.UserInterface.PluginSettingsActivity;
|
import org.kde.kdeconnect.UserInterface.PluginSettingsActivity;
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ public class RemoteKeyboardService
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
} else { // != 1 instance of plugin -> show main activity view
|
} else { // != 1 instance of plugin -> show main activity view
|
||||||
Intent intent = new Intent(this, MaterialActivity.class);
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
intent.putExtra("forceOverview", true);
|
intent.putExtra("forceOverview", true);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
@ -68,7 +68,7 @@ public class DeviceFragment extends Fragment {
|
|||||||
static String mDeviceId; //Static because if we get here by using the back button in the action bar, the extra deviceId will not be set.
|
static String mDeviceId; //Static because if we get here by using the back button in the action bar, the extra deviceId will not be set.
|
||||||
Device device;
|
Device device;
|
||||||
|
|
||||||
MaterialActivity mActivity;
|
MainActivity mActivity;
|
||||||
|
|
||||||
ArrayList<ListAdapter.Item> pluginListItems;
|
ArrayList<ListAdapter.Item> pluginListItems;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ public class DeviceFragment extends Fragment {
|
|||||||
this.setArguments(args);
|
this.setArguments(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceFragment(String deviceId, MaterialActivity activity) {
|
public DeviceFragment(String deviceId, MainActivity activity) {
|
||||||
this.mActivity = activity;
|
this.mActivity = activity;
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString(ARG_DEVICE_ID, deviceId);
|
args.putString(ARG_DEVICE_ID, deviceId);
|
||||||
@ -92,7 +92,7 @@ public class DeviceFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
mActivity = ((MaterialActivity) getActivity());
|
mActivity = ((MainActivity) getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -436,7 +436,7 @@ public class DeviceFragment extends Fragment {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void acceptPairing(final String devId, final MaterialActivity activity) {
|
public static void acceptPairing(final String devId, final MainActivity activity) {
|
||||||
final DeviceFragment frag = new DeviceFragment(devId, activity);
|
final DeviceFragment frag = new DeviceFragment(devId, activity);
|
||||||
BackgroundService.RunCommand(activity, new BackgroundService.InstanceCallback() {
|
BackgroundService.RunCommand(activity, new BackgroundService.InstanceCallback() {
|
||||||
public void onServiceStart(BackgroundService service) {
|
public void onServiceStart(BackgroundService service) {
|
||||||
@ -459,7 +459,7 @@ public class DeviceFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void rejectPairing(final String devId, final MaterialActivity activity) {
|
public static void rejectPairing(final String devId, final MainActivity activity) {
|
||||||
final DeviceFragment frag = new DeviceFragment(devId, activity);
|
final DeviceFragment frag = new DeviceFragment(devId, activity);
|
||||||
BackgroundService.RunCommand(activity, new BackgroundService.InstanceCallback() {
|
BackgroundService.RunCommand(activity, new BackgroundService.InstanceCallback() {
|
||||||
public void onServiceStart(BackgroundService service) {
|
public void onServiceStart(BackgroundService service) {
|
||||||
|
@ -33,7 +33,7 @@ import org.kde.kdeconnect_tp.R;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class MaterialActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private static final String STATE_SELECTED_DEVICE = "selected_device";
|
private static final String STATE_SELECTED_DEVICE = "selected_device";
|
||||||
|
|
||||||
@ -109,24 +109,24 @@ public class MaterialActivity extends AppCompatActivity {
|
|||||||
String savedDevice;
|
String savedDevice;
|
||||||
String pairStatus = "";
|
String pairStatus = "";
|
||||||
if (getIntent().hasExtra("forceOverview")) {
|
if (getIntent().hasExtra("forceOverview")) {
|
||||||
Log.i("MaterialActivity", "Requested to start main overview");
|
Log.i("MainActivity", "Requested to start main overview");
|
||||||
savedDevice = null;
|
savedDevice = null;
|
||||||
} else if (getIntent().hasExtra("deviceId")) {
|
} else if (getIntent().hasExtra("deviceId")) {
|
||||||
Log.i("MaterialActivity", "Loading selected device from parameter");
|
Log.i("MainActivity", "Loading selected device from parameter");
|
||||||
savedDevice = getIntent().getStringExtra("deviceId");
|
savedDevice = getIntent().getStringExtra("deviceId");
|
||||||
if (getIntent().hasExtra(PAIR_REQUEST_STATUS)) {
|
if (getIntent().hasExtra(PAIR_REQUEST_STATUS)) {
|
||||||
pairStatus = getIntent().getStringExtra(PAIR_REQUEST_STATUS);
|
pairStatus = getIntent().getStringExtra(PAIR_REQUEST_STATUS);
|
||||||
}
|
}
|
||||||
} else if (savedInstanceState != null) {
|
} else if (savedInstanceState != null) {
|
||||||
Log.i("MaterialActivity", "Loading selected device from saved activity state");
|
Log.i("MainActivity", "Loading selected device from saved activity state");
|
||||||
savedDevice = savedInstanceState.getString(STATE_SELECTED_DEVICE);
|
savedDevice = savedInstanceState.getString(STATE_SELECTED_DEVICE);
|
||||||
} else {
|
} else {
|
||||||
Log.i("MaterialActivity", "Loading selected device from persistent storage");
|
Log.i("MainActivity", "Loading selected device from persistent storage");
|
||||||
savedDevice = preferences.getString(STATE_SELECTED_DEVICE, null);
|
savedDevice = preferences.getString(STATE_SELECTED_DEVICE, null);
|
||||||
}
|
}
|
||||||
//if pairStatus is not empty, then the decision has been made...
|
//if pairStatus is not empty, then the decision has been made...
|
||||||
if (!pairStatus.equals("")) {
|
if (!pairStatus.equals("")) {
|
||||||
Log.i("MaterialActivity", "pair status is " + pairStatus);
|
Log.i("MainActivity", "pair status is " + pairStatus);
|
||||||
onNewDeviceSelected(savedDevice, pairStatus);
|
onNewDeviceSelected(savedDevice, pairStatus);
|
||||||
}
|
}
|
||||||
onDeviceSelected(savedDevice);
|
onDeviceSelected(savedDevice);
|
||||||
@ -172,9 +172,9 @@ public class MaterialActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void updateComputerList() {
|
private void updateComputerList() {
|
||||||
|
|
||||||
//Log.e("MaterialActivity", "UpdateComputerList");
|
//Log.e("MainActivity", "UpdateComputerList");
|
||||||
|
|
||||||
BackgroundService.RunCommand(MaterialActivity.this, new BackgroundService.InstanceCallback() {
|
BackgroundService.RunCommand(MainActivity.this, new BackgroundService.InstanceCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onServiceStart(final BackgroundService service) {
|
public void onServiceStart(final BackgroundService service) {
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ public class MaterialActivity extends AppCompatActivity {
|
|||||||
BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() {
|
BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onServiceStart(BackgroundService service) {
|
public void onServiceStart(BackgroundService service) {
|
||||||
service.addDeviceListChangedCallback("MaterialActivity", new BackgroundService.DeviceListChangedCallback() {
|
service.addDeviceListChangedCallback("MainActivity", new BackgroundService.DeviceListChangedCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onDeviceListChanged() {
|
public void onDeviceListChanged() {
|
||||||
updateComputerList();
|
updateComputerList();
|
||||||
@ -228,7 +228,7 @@ public class MaterialActivity extends AppCompatActivity {
|
|||||||
BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() {
|
BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onServiceStart(BackgroundService service) {
|
public void onServiceStart(BackgroundService service) {
|
||||||
service.removeDeviceListChangedCallback("MaterialActivity");
|
service.removeDeviceListChangedCallback("MainActivity");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
super.onStop();
|
super.onStop();
|
||||||
@ -313,8 +313,8 @@ public class MaterialActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public void renameDevice() {
|
public void renameDevice() {
|
||||||
final TextView nameView = (TextView) mNavigationView.findViewById(R.id.device_name);
|
final TextView nameView = (TextView) mNavigationView.findViewById(R.id.device_name);
|
||||||
final EditText deviceNameEdit = new EditText(MaterialActivity.this);
|
final EditText deviceNameEdit = new EditText(MainActivity.this);
|
||||||
String deviceName = DeviceHelper.getDeviceName(MaterialActivity.this);
|
String deviceName = DeviceHelper.getDeviceName(MainActivity.this);
|
||||||
deviceNameEdit.setText(deviceName);
|
deviceNameEdit.setText(deviceName);
|
||||||
deviceNameEdit.setPadding(
|
deviceNameEdit.setPadding(
|
||||||
((int) (18 * getResources().getDisplayMetrics().density)),
|
((int) (18 * getResources().getDisplayMetrics().density)),
|
||||||
@ -322,15 +322,15 @@ public class MaterialActivity extends AppCompatActivity {
|
|||||||
((int) (18 * getResources().getDisplayMetrics().density)),
|
((int) (18 * getResources().getDisplayMetrics().density)),
|
||||||
((int) (12 * getResources().getDisplayMetrics().density))
|
((int) (12 * getResources().getDisplayMetrics().density))
|
||||||
);
|
);
|
||||||
new AlertDialog.Builder(MaterialActivity.this)
|
new AlertDialog.Builder(MainActivity.this)
|
||||||
.setView(deviceNameEdit)
|
.setView(deviceNameEdit)
|
||||||
.setPositiveButton(R.string.device_rename_confirm, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.device_rename_confirm, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
String deviceName = deviceNameEdit.getText().toString();
|
String deviceName = deviceNameEdit.getText().toString();
|
||||||
DeviceHelper.setDeviceName(MaterialActivity.this, deviceName);
|
DeviceHelper.setDeviceName(MainActivity.this, deviceName);
|
||||||
nameView.setText(deviceName);
|
nameView.setText(deviceName);
|
||||||
BackgroundService.RunCommand(MaterialActivity.this, new BackgroundService.InstanceCallback() {
|
BackgroundService.RunCommand(MainActivity.this, new BackgroundService.InstanceCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onServiceStart(final BackgroundService service) {
|
public void onServiceStart(final BackgroundService service) {
|
||||||
service.onNetworkChange();
|
service.onNetworkChange();
|
@ -58,7 +58,7 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
|
|||||||
|
|
||||||
private View rootView;
|
private View rootView;
|
||||||
private SwipeRefreshLayout mSwipeRefreshLayout;
|
private SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
private MaterialActivity mActivity;
|
private MainActivity mActivity;
|
||||||
|
|
||||||
boolean listRefreshCalledThisFrame = false;
|
boolean listRefreshCalledThisFrame = false;
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
|
|||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
mActivity = ((MaterialActivity) getActivity());
|
mActivity = ((MainActivity) getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateComputerListAction() {
|
private void updateComputerListAction() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user